:root {
  --bg: #edf7fb;
  --card: #ffffff;
  --ink: #17323d;
  --subtle: #5f7a84;
  --brand: #3a8ea5;
  --brand-soft: #d8eef5;
  --accent: #6bbf9b;
  --danger: #b31e2d;
  --border: #cfe3e9;
}

* {
  box-sizing: border-box;
}

body {
  -webkit-text-size-adjust: 100%;
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "SF Pro Display", "Hiragino Sans GB", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, #d9f0fb 0, transparent 35%),
    radial-gradient(circle at 100% 20%, #ddf4ea 0, transparent 30%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 12px;
}

.phone-shell {
  width: min(430px, 100%);
  height: min(932px, 100dvh);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(18, 33, 26, 0.12);
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: 0 20px 40px rgba(18, 33, 26, 0.12);
}

.phone-shell.splash-mode {
  grid-template-rows: 1fr;
}

.phone-shell.splash-mode .topbar,
.phone-shell.splash-mode .tabbar {
  display: none;
}

.phone-shell.splash-mode main {
  padding: 0;
  overflow: hidden;
  height: 100%;
}

.phone-shell.splash-mode #app-content {
  height: 100%;
}

.topbar {
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  color: var(--subtle);
}

h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.icon-btn {
  border: 0;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  background: #e4f2f7;
  cursor: pointer;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d6edf5;
}

.landing-card {
  background: linear-gradient(135deg, #e4f4fb, #e2f4eb);
  border: 1px solid #cde6ee;
  border-radius: 18px;
  padding: 18px 14px;
}

.landing-card h2 {
  margin: 8px 0 6px;
  font-size: 30px;
}

.landing-slogan {
  margin: 0 0 14px;
  color: #3f6772;
}

main {
  padding: 14px 14px calc(102px + env(safe-area-inset-bottom));
  overflow: auto;
  min-height: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.splash-screen {
  position: relative;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #dff1eb 0%, #dcecf8 100%);
}

.view[data-view="splash"].active {
  display: block;
  height: 100%;
}

.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.splash-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, rgba(219, 241, 233, 0.18) 0%, rgba(208, 231, 246, 0.35) 100%),
    linear-gradient(180deg, rgba(9, 28, 31, 0.08) 0%, rgba(9, 28, 31, 0.32) 100%);
}

.splash-skip {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 2;
  min-width: 78px;
  height: 38px;
  border: 1.5px solid rgba(239, 252, 248, 0.92);
  border-radius: 999px;
  background: rgba(28, 54, 60, 0.22);
  color: #f4fffb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.splash-content {
  position: absolute;
  left: 50%;
  top: calc(20% + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 2;
  width: min(84%, 320px);
  text-align: center;
  color: #f3fffa;
  text-shadow: 0 3px 12px rgba(15, 37, 42, 0.28);
  background: rgba(27, 64, 74, 0.2);
  border: 1px solid rgba(230, 248, 244, 0.48);
  border-radius: 18px;
  padding: 14px 16px;
  backdrop-filter: blur(4px);
}

.splash-content h2 {
  margin: 0 0 8px;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 3px;
  line-height: 1.1;
}

.splash-content p {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.6px;
  color: rgba(241, 255, 250, 0.96);
}

@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

.view.view-enter-right {
  animation: slideInFromRight 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view.view-enter-left {
  animation: slideInFromLeft 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ask-card,
.block,
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(36, 82, 96, 0.06);
}

.ask-card input,
.search-wrap input,
textarea,
#title,
#diseaseSelect {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px;
  font-size: 14px;
  margin-top: 8px;
  background: #fcfdfc;
}

h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--subtle);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chips span {
  font-size: 12px;
  background: #eef2ef;
  border-radius: 999px;
  padding: 6px 10px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.quick-grid button,
.filters button,
.tab,
.primary,
#logoutBtn,
#exportBtn,
#deleteBtn,
.feed-actions button {
  border: 0;
  border-radius: 12px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
}

.quick-grid button {
  background: #e9f5fb;
  color: #245260;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.quick-grid button img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.quick-grid button span {
  font-weight: 600;
}

.quick-grid button:nth-child(1) {
  background: #dff0fb;
}

.quick-grid button:nth-child(2) {
  background: #def5ea;
}

.quick-grid button:nth-child(3) {
  background: #e8f8f2;
}

.quick-grid button:nth-child(4) {
  background: #e4f4f8;
}

.admin-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #eff4f1;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.feed-item {
  padding: 10px 0;
  border-bottom: 1px dashed #d9e1dc;
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.feed-actions button {
  font-size: 12px;
  background: #eef3f0;
  padding: 7px 10px;
}

.comment-list {
  max-height: 240px;
  overflow: auto;
  margin: 10px 0;
  border: 1px solid #e3ebe6;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fafcfb;
}

.comment-item {
  padding: 8px 0;
  border-bottom: 1px dashed #d8e2dc;
}

.comment-item:last-child {
  border-bottom: 0;
}

.comment-meta {
  margin: 0 0 6px;
  font-size: 12px;
  color: #607168;
}

.comment-body {
  margin: 0 0 6px;
  font-size: 13px;
}

.comment-actions {
  display: flex;
  gap: 8px;
}

.comment-actions button {
  border: 0;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  background: #eaf1ed;
  cursor: pointer;
}

.post .meta,
.post .stat {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--subtle);
}

.post p {
  margin: 8px 0;
}

.search-wrap {
  margin-bottom: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters button {
  background: #eff4f1;
}

.filters button.active {
  background: var(--brand-soft);
  color: var(--brand);
}

#composeTags button.active {
  background: #12211a;
  color: #fff;
}

label {
  display: block;
  font-size: 13px;
  margin-top: 10px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 14px;
}

.row label,
.settings label {
  font-size: 13px;
  color: #324038;
}

.primary {
  background: linear-gradient(135deg, var(--brand), #63b59a);
  color: #fff;
  width: 100%;
}

#logoutBtn {
  width: 100%;
  margin-top: 10px;
  background: #eff4f1;
}

#exportBtn,
#deleteBtn {
  width: 100%;
  margin-top: 10px;
  background: #eff4f1;
}

#deleteBtn {
  background: #fde9ec;
  color: #a82a38;
}

.warning {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #ffe4e7;
  border: 1px solid #ffc9d0;
  color: var(--danger);
  font-size: 13px;
}

.hidden {
  display: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.settings {
  display: grid;
  gap: 10px;
}

.credit-card {
  border: 1px solid #d5e8ed;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(135deg, #e7f5fb, #e7f5ee);
}

.credit-level {
  margin: 0;
  font-weight: 700;
  color: #1d4f5e;
}

.credit-score {
  margin: 6px 0 0;
  color: #2f6472;
  font-size: 13px;
}

.notice-item {
  padding: 10px 0;
  border-bottom: 1px solid #edf2ef;
}

.notice-item:last-child {
  border-bottom: 0;
}

.ai-result {
  margin-top: 12px;
  background: #f4f8f6;
  border: 1px dashed #bfd2c8;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
  margin: 0 10px;
  border-top: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  position: sticky;
  bottom: 8px;
  z-index: 20;
}

.tab {
  background: #f0f3f1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  padding: 7px 4px;
  min-height: 44px;
  color: #5a6e75;
}

.tab-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.tab-label {
  font-size: 11px;
  line-height: 1;
}

.tab-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
}

.tab.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.tab.center {
  background: linear-gradient(135deg, #69b9cf, #63b59a);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(58, 142, 165, 0.28);
}

.tab.center .tab-icon {
  width: 20px;
  height: 20px;
}

.tab.center .tab-svg {
  width: 20px;
  height: 20px;
}

dialog {
  width: min(92vw, 360px);
  max-height: 78dvh;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  overflow: auto;
}

dialog::backdrop {
  background: rgba(12, 22, 18, 0.35);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.modal-actions button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
  background: #fff;
}

.disease-cards {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.disease-cards button {
  border: 1px solid #d6e1db;
  border-radius: 12px;
  background: #f4f8f6;
  text-align: left;
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
}

.disease-cards button.active {
  border-color: #8eb9ab;
  background: #ddf0e8;
}

@media (max-width: 430px) {
  body {
    padding: 0;
    place-items: stretch;
  }

  .phone-shell {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }

  .splash-screen {
    border-radius: 0;
  }

  .splash-skip {
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
  }

  .splash-content h2 {
    font-size: 36px;
  }

  .splash-content p {
    font-size: 16px;
  }

  .splash-content {
    top: calc(18% + env(safe-area-inset-top));
    width: min(90%, 330px);
    padding: 12px 14px;
  }

  .topbar {
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }

  h1 {
    font-size: 20px;
  }

  main {
    padding: 10px 10px calc(100px + env(safe-area-inset-bottom));
  }

  .ask-card,
  .block,
  .profile-card,
  .landing-card {
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .quick-grid {
    gap: 8px;
  }

  .quick-grid button {
    min-height: 56px;
    padding: 8px;
    gap: 8px;
  }

  .quick-grid button img {
    width: 26px;
    height: 26px;
  }

  .row {
    flex-wrap: wrap;
    margin: 8px 0 12px;
  }

  .tabbar {
    gap: 6px;
    padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
    margin: 0 8px;
    border-radius: 12px;
    bottom: 8px;
  }

  .tab {
    min-height: 42px;
  }

  .tab-icon {
    width: 16px;
    height: 16px;
  }

  .tab-label {
    font-size: 10px;
  }

  .tab-svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.9;
  }

}

@media (max-width: 360px) {
  .chips span {
    font-size: 11px;
    padding: 5px 8px;
  }

  .tab {
    font-size: 11px;
  }
}
