:root {
  --font-ui: "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --sunrise-0: #fff7f0;
  --sunrise-1: #ffe8d6;
  --sunrise-2: #ffd4b2;
  --sunrise-3: #ffb88a;
  --sunrise-4: #f79060;
  --bg-a: #fff6ef;
  --bg-b: #ffe9d8;
  --bg-c: #ffe0c3;
  --text: #20160f;
  --text-sub: #6b4f3e;
  --text-soft: #987764;

  --glass-1: rgba(255, 250, 245, 0.72);
  --glass-2: rgba(255, 249, 242, 0.58);
  --glass-3: rgba(255, 251, 247, 0.84);
  --glass-border: rgba(244, 186, 144, 0.46);
  --glass-border-soft: rgba(232, 168, 125, 0.32);

  --shadow-1: 0 18px 40px rgba(181, 95, 45, 0.15);
  --shadow-2: 0 8px 22px rgba(170, 88, 42, 0.12);
  --shadow-3: 0 16px 36px rgba(150, 74, 32, 0.24);
  --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.75);

  --primary: #dd744b;
  --primary-strong: #c85e35;
  --primary-bright: #f2a468;
  --primary-ink: #fff8f4;
  --danger: #bf4f4f;
  --success: #269a6d;

  --state-info: #4d8fdd;
  --state-warning: #d78e3d;
  --state-positive: #269a6d;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --input-bg: rgba(255, 255, 255, 0.78);
  --focus-ring: 0 0 0 3px rgba(65, 199, 178, 0.28);
  --action-dock-height: 92px;
  --post-shell-max: 1180px;
  --section-gap-lg: 24px;
  --section-gap-xl: 36px;
  --post-display-size: clamp(38px, 5vw, 62px);
  --post-title-size: clamp(28px, 3.2vw, 40px);
  --surface-primary: rgba(255, 251, 247, 0.9);
  --surface-secondary: rgba(255, 249, 242, 0.68);
}

:root[data-theme="dark"] {
  --bg-a: #21160f;
  --bg-b: #2a1b12;
  --bg-c: #302018;
  --text: #f9efe5;
  --text-sub: #d9b9a1;
  --text-soft: #bb9680;

  --glass-1: rgba(54, 34, 24, 0.62);
  --glass-2: rgba(47, 30, 21, 0.56);
  --glass-3: rgba(59, 37, 25, 0.78);
  --glass-border: rgba(255, 196, 150, 0.22);
  --glass-border-soft: rgba(210, 150, 108, 0.26);

  --shadow-1: 0 18px 40px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 22px rgba(0, 0, 0, 0.34);
  --shadow-3: 0 16px 36px rgba(0, 0, 0, 0.5);
  --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12);

  --primary: #f09360;
  --primary-strong: #e57d45;
  --primary-bright: #ffb487;
  --primary-ink: #2d170d;

  --input-bg: rgba(70, 45, 33, 0.82);
  --focus-ring: 0 0 0 3px rgba(240, 147, 96, 0.3);
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] body.landing-page,
:root[data-theme="dark"] body.theory-page,
:root[data-theme="dark"] body.train-page {
  background:
    radial-gradient(980px 420px at 52% -8%, rgba(240, 140, 88, 0.22), transparent 68%),
    radial-gradient(760px 320px at 12% 24%, rgba(224, 108, 64, 0.18), transparent 72%),
    radial-gradient(760px 340px at 86% 86%, rgba(168, 96, 58, 0.17), transparent 76%),
    linear-gradient(180deg, #21160f 0%, #2d1b12 42%, #1d140f 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(980px 420px at 50% -6%, rgba(244, 150, 93, 0.2), transparent 68%),
    radial-gradient(720px 280px at 12% 22%, rgba(232, 123, 74, 0.14), transparent 72%),
    radial-gradient(720px 300px at 88% 84%, rgba(255, 191, 129, 0.16), transparent 76%),
    linear-gradient(180deg, #fff8f1 0%, #ffe9d8 45%, #fff1e4 100%);
  position: relative;
}

body.landing-page,
body.theory-page {
  background:
    radial-gradient(980px 420px at 50% -6%, rgba(244, 150, 93, 0.2), transparent 68%),
    radial-gradient(740px 300px at 10% 20%, rgba(232, 123, 74, 0.14), transparent 72%),
    radial-gradient(760px 320px at 88% 86%, rgba(255, 191, 129, 0.16), transparent 76%),
    linear-gradient(180deg, #fff8f1 0%, #ffe9d8 45%, #fff1e4 100%);
}

body.train-page {
  background:
    radial-gradient(980px 420px at 50% -6%, rgba(244, 150, 93, 0.2), transparent 68%),
    radial-gradient(740px 300px at 10% 20%, rgba(232, 123, 74, 0.14), transparent 72%),
    radial-gradient(760px 320px at 88% 86%, rgba(255, 191, 129, 0.16), transparent 76%),
    linear-gradient(180deg, #fff8f1 0%, #ffe9d8 45%, #fff1e4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 280px at 48% 50%, rgba(255, 255, 255, 0.12), transparent 72%),
    radial-gradient(680px 220px at 50% 66%, rgba(255, 255, 255, 0.09), transparent 78%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.2'/%3E%3C/svg%3E");
  opacity: 0.14;
  mix-blend-mode: soft-light;
}

body.train-page::after {
  content: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 22px 16px 100px;
}

.train-shell {
  padding-bottom: 180px;
}

.glass-card {
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-1), var(--inner-highlight);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  border-radius: var(--radius-xl);
}

.glass-soft {
  background: var(--glass-2);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border-radius: var(--radius-lg);
}

.glass-pop {
  background: var(--glass-3);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3), var(--inner-highlight);
  backdrop-filter: blur(32px) saturate(1.42);
  -webkit-backdrop-filter: blur(32px) saturate(1.42);
  border-radius: var(--radius-lg);
}

.glass-card-strong {
  background: var(--glass-3);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3), var(--inner-highlight);
  backdrop-filter: blur(30px) saturate(1.35);
  -webkit-backdrop-filter: blur(30px) saturate(1.35);
  border-radius: var(--radius-xl);
}

/* Shared component primitives */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
}

.glass-panel {
  background: var(--glass-2);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(1.24);
  -webkit-backdrop-filter: blur(20px) saturate(1.24);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.45);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
}

.bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 249, 242, 0.72);
  border-top: 1px solid var(--glass-border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.modal-sheet {
  width: min(560px, 100%);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-3);
  box-shadow: var(--shadow-3), var(--inner-highlight);
}

.toast-message {
  min-height: 40px;
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.44);
  color: var(--text-sub);
  font-size: 14px;
}

.progress-modern {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(230, 158, 112, 0.24);
}

.progress-modern > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f09f6b, #df7b4e);
}

/* Speed training timer */
.speed-timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--glass-1);
  border: 1px solid rgba(255, 120, 90, 0.3);
}

.speed-timer-bar-wrap {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  background: var(--glass-2);
  overflow: hidden;
}

.speed-timer-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
  width: 100%;
  transform-origin: left center;
  transition: width linear;
}

.speed-timer-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-danger, #e05a3a);
  min-width: 22px;
  text-align: center;
}

@keyframes speed-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.speed-timer-wrap.is-urgent .speed-timer-text {
  animation: speed-timer-pulse 0.5s ease-in-out infinite;
}

/* Fatigue & rest prompts */
.fatigue-prompt {
  position: fixed;
  bottom: calc(var(--action-dock-height, 92px) + 16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 32px));
  z-index: 200;
  padding: 16px 18px;
  animation: stage-in 220ms ease;
  text-align: center;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  margin-bottom: 14px;
  animation: stage-in 220ms ease;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(32px, 3.6vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-sub);
  font-size: 18px;
}

.card {
  padding: 16px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.15;
}

.card p,
.card li {
  font-size: 17px;
  line-height: 1.58;
}

.card label,
.card button,
.card input,
.card select,
.card textarea,
.card span {
  font-size: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  height: 56px;
  min-width: 126px;
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease, background 140ms ease;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn:focus-visible,
.speed-option:focus-visible,
.fold-toggle:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

.btn.is-busy {
  opacity: 0.9;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: var(--primary-ink);
  box-shadow: 0 10px 20px rgba(196, 92, 48, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.btn-secondary {
  background: var(--glass-2);
  border-color: var(--glass-border-soft);
  color: var(--text);
}

.btn-danger {
  background: rgba(204, 92, 92, 0.18);
  border-color: rgba(204, 92, 92, 0.42);
  color: var(--danger);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.panel-hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.progress {
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--glass-border-soft);
}

.progress > i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
  transition: width 220ms ease;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 15px;
  color: #6e321a;
  background: rgba(240, 164, 104, 0.22);
  border: 1px solid rgba(232, 130, 73, 0.44);
}

:root[data-theme="dark"] .badge {
  color: #ffd7bf;
}

.badge.orange {
  color: #8a421f;
  border-color: rgba(222, 137, 72, 0.48);
  background: rgba(236, 159, 99, 0.24);
}

.badge.green {
  color: #1f6b4f;
  border-color: rgba(56, 164, 121, 0.44);
  background: rgba(95, 192, 150, 0.22);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 16px;
  color: var(--text-sub);
}

.field input,
.field select,
.field textarea {
  height: 56px;
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 14px;
}

.library-filter,
.library-search {
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 12px;
}

.library-filter {
  min-width: 140px;
}

.library-search {
  min-width: 220px;
  flex: 1 1 220px;
}

.library-toolbar-row {
  align-items: stretch;
}

.library-toolbar-row .btn {
  min-width: 108px;
}

.library-card h3 {
  margin: 0;
  font-size: 24px;
}

.library-card p {
  margin: 6px 0 0;
  color: var(--text-sub);
}

.library-open-btn {
  margin-top: 8px;
}

.field textarea {
  min-height: 108px;
  padding: 12px 14px;
}

.field-compact {
  max-width: 460px;
}

.notice {
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-sub);
}

.feedback-text {
  white-space: pre-line;
}

.kv {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.kv .item {
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-2);
  box-shadow: var(--inner-highlight);
  padding: 12px;
}

.kv .item small {
  color: var(--text-soft);
  display: block;
  font-size: 14px;
}

.kv .item b {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.owner-modern-shell {
  max-width: 1180px;
}

.owner-metric-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.owner-stat {
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  padding: 12px;
}

.owner-stat small {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
}

.owner-stat b {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.owner-reason-list {
  margin-top: 12px;
  gap: 8px;
}

.owner-table-wrap {
  overflow-x: auto;
}

.owner-table-modern {
  width: 100%;
  border-collapse: collapse;
}

.owner-table-modern th,
.owner-table-modern td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border-soft);
}

.owner-table-modern th {
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
}

.owner-table-modern td {
  font-size: 15px;
}

footer.page-footer {
  margin-top: 16px;
  color: var(--text-sub);
  text-align: center;
  font-size: 18px;
}

.auth-card {
  max-width: 640px;
  margin: 0 auto;
}

.auth-tabs {
  margin-bottom: 10px;
}

.auth-tabs-modern .btn {
  flex: 1 1 180px;
}

.auth-form {
  gap: 12px;
}

.auth-actions-row {
  width: 100%;
}

.auth-actions-row .btn {
  flex: 1 1 180px;
}

.auth-error {
  color: var(--danger);
  margin: 0;
  min-height: 24px;
}

.list-compact {
  margin: 0;
  padding-left: 20px;
}

.review-actions {
  margin-top: 12px;
}

.review-item-title {
  margin: 0 0 6px;
  font-size: 24px;
}

.review-item-subtitle,
.review-item-hint {
  margin: 0;
  color: var(--text-sub);
}

.review-item-due {
  margin: 8px 0 0;
}

.review-item-hint {
  margin-top: 6px;
}

/* Train Layout */
.train-stage {
  display: grid;
  gap: 14px;
  animation: stage-in 220ms ease;
}

.task-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.task-source {
  color: var(--text-sub);
  font-size: 17px;
}

.task-card h2 {
  margin: 0;
  font-size: 30px;
}

.task-card p {
  margin: 7px 0 0;
  color: var(--text-sub);
}

.prompt-card {
  padding: 2px 4px;
}

.prompt-card h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.12;
}

.context-strip {
  display: none;
}

.coach-tips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coach-tips li {
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-sub);
  font-size: 16px;
}

.fold-wrap {
  display: grid;
  gap: 8px;
}

.fold-toggle {
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-2);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
  transition: background 140ms ease, transform 120ms ease;
}

.fold-toggle:hover {
  transform: translateY(-1px);
}

.fold-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.fold-panel.is-expanded {
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
}

.content-raw {
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.4);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.content-lines {
  display: grid;
  gap: 6px;
}

.content-line {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.content-desc {
  margin: 0;
  color: var(--text-sub);
  font-size: 18px;
  line-height: 1.5;
}

.media-block {
  display: grid;
  gap: 10px;
}

.image-box {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.36);
  min-height: 240px;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.image-box img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  display: block;
  background: rgba(255, 255, 255, 0.14);
  transition: opacity 140ms ease, filter 140ms ease;
}

.image-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--text-sub);
  font-size: 17px;
  line-height: 1.45;
}

.image-box.is-fallback .image-fallback {
  display: flex;
}

.image-box.is-fallback img {
  display: none;
}

.image-box.is-loading .image-fallback {
  display: flex;
}

.image-box.is-loading img {
  opacity: 0.2;
  filter: blur(1px);
}

.image-box.is-ready {
  border-color: rgba(65, 199, 178, 0.42);
}

.player-row {
  display: none;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-2);
  padding: 10px;
}

.player-primary {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  border: 1px solid rgba(65, 199, 178, 0.45);
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: var(--primary-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(22, 160, 133, 0.28);
  transition: transform 120ms ease;
}

.player-primary:active {
  transform: scale(0.96);
}

.player-primary .glyph {
  font-size: 20px;
  line-height: 1;
}

.player-meta {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.player-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.player-state {
  margin: 0;
  color: var(--text-sub);
  font-size: 16px;
}

.player-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.48);
  color: var(--text);
  cursor: pointer;
}

.speed-segment {
  display: inline-flex;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  padding: 3px;
  background: rgba(255, 255, 255, 0.4);
}

.speed-option {
  height: 38px;
  min-width: 56px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.speed-option.is-active {
  background: rgba(65, 199, 178, 0.26);
  color: var(--text);
}

.question-options {
  display: grid;
  gap: 10px;
}

.option-card {
  width: 100%;
  border: 1px solid var(--glass-border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.option-card:hover {
  transform: translateY(-1px);
}

.option-key {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 15px;
}

.option-card.is-selected {
  border-color: rgba(65, 199, 178, 0.75);
  background: rgba(65, 199, 178, 0.2);
}

.option-card.is-selected .option-key {
  color: #0d5a4d;
  border-color: rgba(65, 199, 178, 0.7);
  background: rgba(255, 255, 255, 0.6);
}

.option-card.is-correct {
  border-color: rgba(63, 172, 111, 0.75);
  background: rgba(63, 172, 111, 0.18);
}

.option-card.is-wrong {
  border-color: rgba(210, 93, 93, 0.72);
  background: rgba(210, 93, 93, 0.16);
}

.inline-msg {
  min-height: 30px;
  margin: 0;
  color: var(--danger);
  font-size: 17px;
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.result-sheet {
  position: fixed;
  left: 50%;
  bottom: 16px;
  width: min(980px, calc(100vw - 22px));
  transform: translate(-50%, 120%);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  z-index: 20;
  display: none;
  padding: 14px;
}

.result-sheet.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.result-sheet h3 {
  margin: 0;
  font-size: 24px;
}

.result-sheet p {
  margin: 8px 0 0;
  color: var(--text-sub);
  font-size: 18px;
}

.result-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* Train P3.3 */
.train-page .train-shell {
  padding-bottom: calc(var(--action-dock-height) + 96px + env(safe-area-inset-bottom));
}

.train-topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  position: relative;
  z-index: 25;
  overflow: visible;
}

.icon-nav {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 21px;
  cursor: pointer;
}

.train-progress-center {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.train-progress-center p {
  margin: 0;
  text-align: center;
  font-size: 16px;
  color: var(--text-sub);
  overflow-wrap: anywhere;
}

.train-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.train-progress-row .progress {
  width: 100%;
  height: 8px;
}

.train-progress-row .progress > i {
  background: linear-gradient(90deg, #4caf50, #69d36f);
}

.train-progress-row span {
  font-size: 14px;
  color: var(--text-soft);
}

.train-menu-wrap {
  position: relative;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: 56px;
  min-width: 156px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-1);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  padding: 6px;
  display: grid;
  gap: 6px;
  z-index: 21;
}

.menu-panel[hidden] {
  display: none !important;
}

.menu-btn {
  border: 1px solid var(--glass-border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--text);
  font-size: 15px;
  min-height: 40px;
  cursor: pointer;
}

.menu-btn.danger {
  color: var(--danger);
}

.train-page .train-stage {
  gap: 16px;
}

.question-hero {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.hero-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.question-source {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  min-width: 0;
}

.train-page .question-hero h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.18;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.question-clue {
  margin: 0;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.4;
}

.question-clue-rich {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.question-clue-compact {
  font-size: 14px;
}

.assistant-inline {
  display: grid;
  gap: 10px;
}

.media-template {
  gap: 12px;
}

.inline-audio-trigger {
  border: 1px solid var(--glass-border-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  padding: 8px 12px;
  text-decoration: none;
}

.mini-player {
  min-height: 48px;
}

.train-page .image-box {
  min-height: 220px;
  max-height: min(56vh, 460px);
  aspect-ratio: 4 / 3;
}

.train-page .image-box--question {
  background: rgba(255, 255, 255, 0.48);
}

.train-page .question-options {
  gap: 10px;
}

.train-page .option-card {
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.53);
  grid-template-columns: 34px 1fr 22px;
  box-shadow: var(--inner-highlight);
}

.train-page .option-key {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 700;
}

.train-page .option-text {
  font-size: 18px;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.option-status {
  justify-self: end;
  color: var(--success);
  font-size: 20px;
  font-weight: 700;
}

.train-page .option-card.is-selected {
  border: 2px solid rgba(65, 199, 178, 0.8);
  background: rgba(65, 199, 178, 0.22);
}

.train-page .option-card.is-selected .option-key {
  background: rgba(65, 199, 178, 0.92);
  color: #fff;
  border-color: rgba(65, 199, 178, 0.9);
}

.train-page .option-card.is-correct {
  border: 2px solid rgba(76, 175, 80, 0.78);
  background: rgba(76, 175, 80, 0.17);
}

.train-page .option-card.is-wrong {
  border: 2px solid rgba(244, 67, 54, 0.75);
  background: rgba(244, 67, 54, 0.14);
}

.train-page .option-card.is-wrong .option-status {
  color: rgba(244, 67, 54, 0.9);
}

.train-page .option-card.is-muted {
  opacity: 0.5;
}

.train-page .fold-toggle {
  font-size: 16px;
  color: var(--text-sub);
  min-height: 48px;
}

.hint-inline {
  margin: 0;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.4;
}

.hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hint-audio-btn {
  border: 1px solid var(--glass-border-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-sub);
  min-height: 38px;
  padding: 0 12px;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.train-page .inline-msg {
  min-height: 24px;
  font-size: 16px;
}

.action-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 24;
  background: rgba(255, 255, 255, 0.64);
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  min-height: var(--action-dock-height);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.action-dock-inner {
  max-width: 1020px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.action-dock .btn {
  height: 52px;
  border-radius: 14px;
}

.action-dock #hintBtn {
  flex: 0 0 35%;
  font-size: 14px;
  min-width: 0;
}

.action-dock #submitBtn {
  flex: 1 1 60%;
  font-size: 18px;
  font-weight: 700;
  min-width: 0;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 22, 32, 0.4);
  display: none;
  place-items: center;
  padding: 16px;
  pointer-events: auto;
}

.preview-modal.is-open {
  display: grid;
}

.preview-modal[hidden] {
  display: none !important;
}

.preview-card {
  width: min(540px, 100%);
  border-radius: 18px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-1);
  box-shadow: var(--shadow-3), var(--inner-highlight);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  padding: 16px;
  display: grid;
  gap: 10px;
  pointer-events: auto;
}

.preview-card h3 {
  margin: 0;
  font-size: 22px;
}

.preview-card p {
  margin: 0;
  font-size: 16px;
  color: var(--text-sub);
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.train-page .result-sheet {
  bottom: calc(94px + env(safe-area-inset-bottom));
}

.result-audio-wrap {
  margin-top: 10px;
}

:root[data-theme="dark"] .train-page .question-source,
:root[data-theme="dark"] .train-page .question-clue {
  color: #a8b3be;
}

:root[data-theme="dark"] .train-page .question-hero h1 {
  color: #f1f6fb;
}

:root[data-theme="dark"] .action-dock {
  background: rgba(18, 25, 34, 0.9);
  border-top-color: rgba(160, 178, 196, 0.26);
}

:root[data-theme="dark"] .method-tab {
  background: rgba(26, 35, 46, 0.58);
  color: #b7c7d4;
}

:root[data-theme="dark"] .method-tab.is-active {
  background: rgba(58, 157, 138, 0.32);
  color: #d7fff6;
  border-color: rgba(105, 217, 198, 0.5);
}

:root[data-theme="dark"] .reference-link {
  color: #7db2ff;
  border-bottom-color: rgba(125, 178, 255, 0.42);
}

:root[data-theme="dark"] .reference-link:hover {
  color: #a8cbff;
}

/* Home */
.home-hero {
  padding: 18px;
  margin-bottom: 14px;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(30px, 3.2vw, 36px);
}

.home-hero p {
  margin: 8px 0 0;
  color: var(--text-sub);
}

.home-shell {
  max-width: 1080px;
}

.home-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.home-head-main {
  display: grid;
  gap: 6px;
}

.home-head-actions {
  justify-content: flex-end;
}

.home-summary {
  margin-bottom: 12px;
}

.home-main-cta {
  display: grid;
  gap: 10px;
}

.home-main-cta .btn-primary {
  width: fit-content;
}

.home-main-grid {
  align-items: stretch;
}

.home-side-actions {
  display: grid;
  gap: 10px;
}

.home-secondary-actions .btn {
  flex: 1 1 180px;
}

.info-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.info-pill {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  padding: 12px;
}

.info-pill small {
  font-size: 14px;
  color: var(--text-soft);
}

.info-pill b {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

/* Landing */
.landing-shell {
  max-width: 1160px;
}

.landing-topbar {
  padding: 18px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.brand-eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.landing-topbar h1 {
  margin: 8px 0 0;
  font-size: clamp(34px, 4.3vw, 48px);
  line-height: 1.03;
  letter-spacing: -0.03em;
}

.landing-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.landing-hero {
  margin-bottom: 12px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.hero-tag {
  margin: 0;
  font-size: 14px !important;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-copy {
  display: grid;
  gap: 12px;
  align-content: center;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(36px, 4.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero-copy > p {
  margin: 0;
  color: var(--text-sub);
  font-size: 20px;
  line-height: 1.55;
}

.hero-showcase {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.hero-showcase h3 {
  margin: 0;
  font-size: 24px;
}

.showcase-list {
  display: grid;
  gap: 10px;
}

.showcase-item {
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.45);
  display: grid;
  gap: 6px;
}

.showcase-item b {
  font-size: 18px;
}

.showcase-item span {
  color: var(--text-sub);
  font-size: 17px;
  line-height: 1.45;
}

.trust-strip {
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.trust-pill {
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.46);
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text-sub);
}

.landing-steps {
  margin-bottom: 12px;
}

.step-card {
  display: grid;
  gap: 8px;
}

.step-card small {
  color: var(--text-soft);
  font-size: 14px;
}

.step-card h3,
.scenario-card h3 {
  margin: 0;
  font-size: 24px;
}

.step-card p,
.scenario-card p {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.55;
}

.landing-scenarios {
  margin-bottom: 12px;
}

.landing-cta {
  padding: 20px;
  text-align: center;
  display: grid;
  gap: 10px;
}

.landing-cta h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 40px);
}

.landing-cta p {
  margin: 0;
  color: var(--text-sub);
}

.landing-cta .btn {
  justify-self: center;
}

.modern-landing,
.modern-home {
  max-width: 1140px;
}

.landing-modern-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-1);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  margin-bottom: 14px;
}

.landing-nav-modern .btn {
  min-width: 118px;
}

.landing-modern-hero {
  padding: 24px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.landing-modern-hero .hero-copy h2 {
  font-size: clamp(34px, 4.1vw, 46px);
}

.landing-modern-hero .hero-copy > p {
  font-size: 18px;
  line-height: 1.65;
}

.sunrise-landing .landing-modern-topbar h1 {
  margin: 6px 0 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sunrise-hero .hero-copy h2 {
  font-size: clamp(34px, 4.2vw, 48px);
  letter-spacing: -0.02em;
}

.sunrise-hero .hero-copy > p {
  color: var(--text-sub);
}

.landing-kpis {
  display: grid;
  gap: 10px;
}

.kpi-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-2), var(--inner-highlight);
  padding: 14px;
}

.kpi-card small {
  color: var(--text-soft);
  font-size: 13px;
}

.kpi-card b {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.landing-capabilities {
  margin-bottom: 12px;
}

.capability-card {
  display: grid;
  gap: 8px;
  min-height: 138px;
}

.capability-card h3 {
  margin: 0;
  font-size: 24px;
}

.capability-card p {
  margin: 0;
}

.landing-flow {
  margin-bottom: 12px;
}

.flow-grid {
  align-items: stretch;
}

.flow-item {
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.48);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.flow-item b {
  font-size: 18px;
}

.flow-item span {
  color: var(--text-sub);
  line-height: 1.48;
}

.landing-cta-modern {
  margin-bottom: 14px;
}

.sunrise-landing .landing-flow h2,
.sunrise-landing .landing-cta h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 38px);
}

.sunrise-landing .landing-flow {
  margin-bottom: 12px;
}

.home-hero-modern {
  padding: 18px 20px;
  margin-bottom: 12px;
}

.home-summary-modern {
  margin-bottom: 12px;
}

.summary-head-row {
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.summary-head-row h2 {
  margin: 0;
}

.home-ops-board {
  margin-bottom: 12px;
}

.ops-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-sub);
}

.home-main-modern-grid {
  margin-bottom: 10px;
}

.home-main-cta-modern,
.home-side-actions-modern {
  min-height: 246px;
}

.home-sunrise-shell {
  max-width: 1220px;
  padding-top: 88px;
}

.with-global-nav {
  padding-top: 88px;
}

.home-global-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: 64px;
  border-bottom: 1px solid rgba(240, 180, 120, 0.25);
  background: rgba(255, 248, 240, 0.8);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 2px 20px rgba(200, 100, 40, 0.08);
}

.home-global-nav-inner {
  max-width: 1220px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Noto Serif SC", var(--font-ui);
  font-weight: 700;
  font-size: 20px;
  color: var(--primary-strong);
  letter-spacing: 0.02em;
  min-width: 0;
}

.home-nav-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2ac8b8;
}

.home-nav-sub {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-soft);
  letter-spacing: 0;
  white-space: nowrap;
}

.home-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.home-nav-actions .btn {
  min-height: 44px;
}

.home-sunrise-hero {
  margin-bottom: 14px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-1), var(--inner-highlight);
  background: var(--glass-3);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.home-sunrise-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 54% 70% at 8% 16%, rgba(243, 171, 121, 0.18), transparent 72%),
    radial-gradient(ellipse 44% 60% at 92% 92%, rgba(215, 130, 86, 0.14), transparent 74%);
}

.home-sunrise-hero-main {
  display: grid;
  gap: 14px;
  align-content: center;
  position: relative;
  z-index: 1;
}

.home-sunrise-hero-main h2 {
  margin: 0;
  font-size: clamp(36px, 4.4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.home-sunrise-hero-main p {
  margin: 0;
  color: var(--text-sub);
  font-size: 19px;
  line-height: 1.6;
}

.home-sunrise-hero-side {
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.5);
  padding: 14px;
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.home-sunrise-hero-side h3 {
  margin: 0;
  font-size: 22px;
}

.home-sunrise-hero-side-strong {
  padding: 16px;
}

.home-sunrise-hero-side-strong .info-pills {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-sunrise-hero-side-strong .info-pill {
  padding: 14px;
  border-radius: 14px;
}

.home-sunrise-hero-side-strong .info-pill b {
  font-size: 22px;
}

.home-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.home-mode-grid-strong {
  gap: 14px;
}

.home-mode-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 20px;
  border-radius: 20px;
}

.home-mode-card h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.1;
}

.home-mode-card p {
  margin: 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1.65;
}

.home-mode-card .row {
  margin-top: auto;
}

.home-mode-filters .library-filter {
  min-width: 138px;
}

.home-mode-card .btn {
  min-height: 48px;
}

.home-entry-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-entry-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  min-height: 180px;
  border: 1px solid var(--glass-border-soft);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.home-entry-card:hover {
  transform: translateY(-2px);
  border-color: rgba(65, 199, 178, 0.5);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(65, 199, 178, 0.18);
}

.home-entry-card h3 {
  margin: 0;
  font-size: 22px;
}

.home-entry-card p {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.55;
  font-size: 15px;
}

.home-entry-card .btn {
  margin-top: auto;
  width: 100%;
  min-height: 46px;
}

.stage-timeline {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.stage-node-card {
  position: relative;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--inner-highlight);
  display: grid;
  gap: 8px;
}

.stage-node-card:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -14px;
  width: 2px;
  height: 14px;
  background: linear-gradient(180deg, rgba(65, 199, 178, 0.75), rgba(65, 199, 178, 0.2));
}

.stage-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-node-index {
  min-width: 36px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(65, 199, 178, 0.48);
  background: rgba(65, 199, 178, 0.2);
  color: #0d5a4d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.stage-node-tag {
  font-size: 13px;
  color: var(--text-soft);
}

.stage-node-card h3 {
  margin: 0;
  font-size: 19px;
}

.stage-node-card p {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.45;
}

.stage-node-goal {
  color: var(--text);
  font-weight: 600;
}

.stage-node-meta {
  color: var(--text-soft);
  font-size: 13px;
}

.stage-start-btn {
  min-height: 44px;
  width: 100%;
}

.library-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 96;
  background: rgba(18, 14, 10, 0.42);
  opacity: 0;
  transition: opacity 160ms ease;
}

.library-detail-overlay[hidden] {
  display: none !important;
}

.library-detail-overlay.is-open {
  opacity: 1;
}

.library-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 97;
  width: min(1040px, calc(100vw - 14px));
  height: 100vh;
  padding: 14px;
  border-left: 1px solid var(--glass-border-soft);
  background: var(--glass-3);
  backdrop-filter: blur(24px) saturate(1.28);
  -webkit-backdrop-filter: blur(24px) saturate(1.28);
  box-shadow: -14px 0 34px rgba(37, 22, 13, 0.24);
  transform: translateX(102%);
  transition: transform 170ms ease;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.library-detail-drawer[hidden] {
  display: none !important;
}

.library-detail-drawer.is-open {
  transform: translateX(0);
}

.library-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.48);
  padding: 12px;
}

.library-drawer-head h2 {
  margin: 0;
  font-size: 24px;
}

.library-subtitle {
  margin: 6px 0 0;
  color: var(--text-sub);
  font-size: 14px;
}

.library-drawer-body {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  display: grid;
  gap: 10px;
}

.library-drawer-body::-webkit-scrollbar {
  width: 8px;
}

.library-drawer-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(164, 109, 72, 0.35);
}

.library-detail-block {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.library-detail-block h3 {
  margin: 0;
  font-size: 20px;
}

.library-image-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-thumb-btn {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 13px;
}

.library-thumb-btn.is-active {
  border-color: rgba(65, 199, 178, 0.7);
  background: rgba(65, 199, 178, 0.23);
  color: var(--text);
}

.library-bridge-actions .btn {
  flex: 1 1 120px;
  min-width: 0;
}

body.library-drawer-open {
  overflow: hidden;
}

:root[data-theme="dark"] .kpi-card,
:root[data-theme="dark"] .flow-item,
:root[data-theme="dark"] .info-pill {
  background: rgba(30, 39, 52, 0.64);
  border-color: rgba(181, 201, 218, 0.26);
}

:root[data-theme="dark"] .ops-list {
  color: #b8c7d4;
}

:root[data-theme="dark"] .home-sunrise-hero-side {
  background: rgba(55, 36, 26, 0.62);
  border-color: rgba(216, 160, 120, 0.24);
}

:root[data-theme="dark"] .home-mode-card {
  background: rgba(52, 34, 24, 0.66);
  border-color: rgba(216, 160, 120, 0.22);
}

:root[data-theme="dark"] .home-global-nav {
  background: rgba(44, 28, 20, 0.78);
  border-bottom-color: rgba(214, 160, 122, 0.22);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .home-entry-card,
:root[data-theme="dark"] .stage-node-card,
:root[data-theme="dark"] .library-drawer-head,
:root[data-theme="dark"] .library-thumb-btn {
  background: rgba(55, 36, 26, 0.62);
  border-color: rgba(216, 160, 120, 0.24);
}

:root[data-theme="dark"] .library-detail-overlay {
  background: rgba(5, 8, 12, 0.62);
}

:root[data-theme="dark"] .library-detail-drawer {
  background: rgba(40, 26, 19, 0.92);
  border-left-color: rgba(216, 160, 120, 0.22);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.46);
}

:root[data-theme="dark"] .stage-node-index {
  color: #dbfff8;
  border-color: rgba(105, 217, 198, 0.52);
  background: rgba(58, 157, 138, 0.28);
}

.merged-theory-host {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.merged-block {
  animation: stage-in 220ms ease;
}

#theory {
  scroll-margin-top: 94px;
}

.theory-methods {
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

.method-tab {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.44);
  color: var(--text-sub);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.method-tab:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.method-tab.is-active {
  color: #0d5a4d;
  border-color: rgba(65, 199, 178, 0.66);
  background: rgba(65, 199, 178, 0.26);
}

.theory-method-note {
  margin: 0;
  color: var(--text-sub);
  font-size: 17px !important;
}

.evidence-card {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.evidence-card.is-highlight {
  border-color: rgba(65, 199, 178, 0.76);
  box-shadow: 0 10px 26px rgba(30, 124, 110, 0.22), var(--inner-highlight);
  transform: translateY(-1px);
}

.evidence-card.is-dim {
  opacity: 0.52;
}

.theory-scenarios {
  margin-top: 0;
  margin-bottom: 0;
}

/* Theory */
.theory-stack {
  display: grid;
  gap: 12px;
}

.theory-shell {
  max-width: 1100px;
}

.theory-hero {
  padding: 20px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.theory-hero-copy {
  display: grid;
  gap: 10px;
}

.theory-hero-copy h1 {
  margin: 0;
  font-size: clamp(36px, 4.3vw, 50px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.theory-hero-copy > p {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.5;
}

.theory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theory-card {
  display: grid;
  gap: 12px;
}

.section-head {
  display: grid;
  gap: 5px;
}

.section-head h2 {
  margin: 0;
}

.section-head p {
  margin: 0;
  color: var(--text-sub);
  font-size: 17px;
}

.evidence-card {
  display: grid;
  gap: 8px;
}

.evidence-card h3 {
  margin: 0;
  font-size: 24px;
}

.evidence-card p {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.45;
  font-size: 17px;
}

.evidence-card p b {
  color: var(--text);
  font-size: 16px;
}

.evidence-ref {
  color: var(--text-soft);
}

.practice-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.42);
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.timeline-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(65, 199, 178, 0.42);
  background: rgba(65, 199, 178, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #0d5a4d;
  font-weight: 700;
}

.timeline-main h3 {
  margin: 0;
  font-size: 20px;
}

.timeline-main p {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 16px;
}

.timeline-time {
  color: var(--text-soft);
  font-size: 14px !important;
}

.expert-grid {
  display: grid;
  gap: 10px;
}

.expert-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
}

.expert-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.56);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-size: 20px !important;
  font-weight: 700;
}

.expert-meta h3 {
  margin: 0;
  font-size: 19px;
}

.expert-meta p {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 16px;
}

.expert-status {
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.5);
  padding: 6px 10px;
  color: var(--text-soft);
  font-size: 13px !important;
}

.theory-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theory-tag {
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.4);
  font-size: 15px;
  color: var(--text-sub);
}

.theory-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.boundary-card {
  border: 1px solid rgba(224, 154, 85, 0.45);
  background: rgba(255, 244, 227, 0.5);
}

:root[data-theme="dark"] .boundary-card {
  background: rgba(86, 67, 42, 0.38);
}

.faq-list {
  display: grid;
  gap: 8px;
}

.faq-item {
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.42);
  padding: 10px 12px;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 18px;
}

.faq-item p {
  margin: 8px 0 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1.5;
}

.reference-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.reference-list li {
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1.5;
}

.reference-list li b {
  color: var(--text);
}

.reference-list li span {
  margin-left: 4px;
  color: var(--text-soft);
}

.reference-list li p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 15px;
}

.reference-actions {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.reference-link {
  color: #2a6ee8;
  font-size: 15px !important;
  text-decoration: none;
  border-bottom: 1px solid rgba(42, 110, 232, 0.34);
}

.reference-link:hover {
  color: #1e58be;
}

.reference-link.is-pending {
  color: var(--text-soft);
  border-bottom-color: rgba(110, 130, 146, 0.4);
}

.reference-verified {
  color: var(--text-soft);
  font-size: 14px !important;
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .grid.two,
  .grid.three,
  .theory-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    grid-template-columns: 1fr;
  }

  .landing-modern-hero {
    grid-template-columns: 1fr;
  }

  .home-sunrise-hero {
    grid-template-columns: 1fr;
  }

  .home-mode-grid {
    grid-template-columns: 1fr;
  }

  .home-entry-card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home-sunrise-hero-side-strong .info-pills {
    grid-template-columns: 1fr 1fr;
  }

  .theory-hero,
  .landing-topbar,
  .home-head {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-modern-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .timeline-item {
    grid-template-columns: auto 1fr;
  }

  .timeline-time {
    grid-column: 2;
    justify-self: start;
  }

  .method-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .method-tab {
    white-space: nowrap;
  }

  .task-card h2 {
    font-size: 28px;
  }

  .prompt-card h2 {
    font-size: 30px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px 12px 26px;
  }

  .page-header {
    padding: 14px;
  }

  .card p,
  .card li {
    font-size: 17px;
  }

  .card label,
  .card button,
  .card input,
  .card select,
  .card textarea,
  .card span {
    font-size: 16px;
  }

  .prompt-card h2 {
    font-size: 27px;
  }

  .landing-topbar h1,
  .hero-copy h2,
  .theory-hero-copy h1 {
    font-size: clamp(30px, 7.8vw, 38px);
  }

  .landing-modern-hero .hero-copy h2 {
    font-size: clamp(30px, 7.4vw, 38px);
  }

  .home-sunrise-hero-main h2 {
    font-size: clamp(30px, 7.2vw, 38px);
  }

  .home-sunrise-topbar {
    padding: 10px 14px;
    gap: 10px;
  }

  .app-page .home-global-nav {
    height: auto;
    min-height: 64px;
  }

  .app-page .home-global-nav-inner {
    max-width: none;
    padding: 8px 12px;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .app-page .home-nav-brand {
    font-size: 18px;
    width: 100%;
  }

  .app-page .home-nav-sub {
    max-width: 146px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-page .home-nav-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .app-page .home-nav-actions .btn {
    min-height: 40px;
    padding: 0 12px;
    min-width: 0;
    width: 100%;
  }

  .app-page .home-sunrise-shell {
    padding-top: 104px;
  }

  .app-page.with-global-nav,
  .app-page .with-global-nav {
    padding-top: 104px;
  }

  .home-sunrise-hero {
    padding: 16px;
  }

  .home-sunrise-hero-side-strong .info-pills {
    grid-template-columns: 1fr;
  }

  .home-entry-card-grid {
    grid-template-columns: 1fr;
  }

  .stage-node-card {
    padding: 10px;
  }

  .stage-node-card h3 {
    font-size: 18px;
  }

  .stage-start-btn {
    min-height: 42px;
  }

  .library-detail-drawer {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(86vh, 680px);
    border-left: 0;
    border-top: 1px solid var(--glass-border-soft);
    border-radius: 18px 18px 0 0;
    transform: translateY(102%);
    box-shadow: 0 -10px 26px rgba(32, 20, 12, 0.28);
  }

  .library-detail-drawer.is-open {
    transform: translateY(0);
  }

  .library-drawer-head h2 {
    font-size: 22px;
  }

  .library-drawer-body {
    padding-right: 2px;
  }

  .summary-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .summary-head-row .badge-pill {
    max-width: 100%;
  }

  .hero-copy > p {
    font-size: 18px;
  }

  .home-head-actions .btn,
  .landing-nav .btn {
    flex: 1 1 auto;
  }

  .landing-nav-modern .btn {
    flex: 1 1 auto;
  }

  .home-head-actions,
  .landing-nav {
    width: 100%;
  }

  .landing-nav-modern {
    width: 100%;
  }

  .home-main-actions .btn,
  .reference-actions {
    width: 100%;
  }

  .reference-actions .reference-link,
  .reference-actions .reference-verified {
    width: 100%;
  }

  .player-row {
    grid-template-columns: 1fr;
  }

  .player-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .speed-segment {
    flex: 1;
    justify-content: space-between;
  }

  .speed-option {
    min-width: 0;
    flex: 1;
  }

  .result-sheet {
    width: calc(100vw - 14px);
    bottom: 8px;
  }

  .train-page .train-shell {
    padding-bottom: calc(var(--action-dock-height) + 116px + env(safe-area-inset-bottom));
  }

  .train-page .image-box {
    aspect-ratio: 1 / 1;
    min-height: 200px;
    max-height: none;
  }

  .hero-top-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .question-source {
    width: 100%;
  }

  .hint-row {
    flex-direction: column;
    align-items: stretch;
  }

  .hint-audio-btn {
    width: 100%;
  }

  .action-dock {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .action-dock-inner {
    gap: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-dock #pauseTrainBtn {
    grid-column: 1 / 2;
    min-width: 0;
  }

  .action-dock #hintBtn {
    grid-column: 2 / 3;
    min-width: 0;
  }

  .action-dock #submitBtn {
    grid-column: 1 / -1;
    min-width: 0;
    font-size: 17px;
    white-space: nowrap;
  }

  .auth-tabs-modern {
    display: grid;
    grid-template-columns: 1fr;
  }

  .auth-tabs-modern .btn,
  .auth-actions-row .btn,
  .library-toolbar-row .library-filter,
  .library-toolbar-row .library-search,
  .library-toolbar-row .btn,
  .library-bridge-actions .btn,
  .preview-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .auth-actions-row,
  .library-toolbar-row,
  .library-bridge-actions,
  .preview-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .train-page .question-hero {
    padding: 14px;
  }

  .train-page .option-card {
    grid-template-columns: 30px 1fr 18px;
    padding: 12px;
  }

  .train-page .option-text {
    font-size: 17px;
  }
}

.home-prescription-hero {
  margin-top: 6px;
}

.home-boundary-note {
  margin-top: 6px;
  max-width: 680px;
}

.home-caregiver-tip {
  padding: 12px;
  border-radius: 14px;
}

.home-caregiver-tip small {
  color: var(--text-soft);
}

.home-caregiver-tip p {
  margin: 8px 0 0;
  color: var(--text-sub);
  line-height: 1.55;
}

.home-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-support-card {
  min-height: 150px;
}

.home-entry-card-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-mode-filters-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-mode-filters-stack .btn {
  grid-column: 1 / -1;
}

.library-card-compact {
  min-height: 180px;
}

#domainBadge {
  background: rgba(65, 199, 178, 0.18);
  color: #0d5a4d;
  border: 1px solid rgba(65, 199, 178, 0.35);
}

@media (max-width: 900px) {
  .home-support-grid,
  .home-entry-card-grid-wide,
  .home-mode-filters-stack {
    grid-template-columns: 1fr;
  }
}
.home-nav-brand-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.home-nav-brand-link:hover {
  opacity: 0.9;
}

.caregiver-shell {
  max-width: 1120px;
}

.caregiver-principle-card,
.caregiver-boundary-card,
.caregiver-train-panel {
  padding: 14px;
}

.caregiver-principle-card p,
.caregiver-boundary-card p,
.caregiver-train-panel p {
  margin: 0;
  line-height: 1.6;
}

.caregiver-grid {
  align-items: stretch;
}

.caregiver-action-stack {
  display: grid;
  gap: 10px;
}

.caregiver-step-card {
  min-height: 190px;
}

.caregiver-list-negative li::marker {
  color: var(--danger);
}

.caregiver-train-panel {
  margin-bottom: 12px;
  border: 1px solid rgba(65, 199, 178, 0.3);
  background: rgba(65, 199, 178, 0.08);
}

.caregiver-train-panel h3 {
  margin: 0;
  font-size: 18px;
}

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 140;
  display: grid;
  gap: 10px;
  width: min(460px, calc(100vw - 28px));
}

.toast-chip {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  border-radius: 16px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(34, 23, 17, 0.92);
  color: #fff9f4;
  padding: 12px 14px;
  box-shadow: var(--shadow-3);
  font-size: 14px;
  line-height: 1.45;
}

.toast-chip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-info {
  background: rgba(32, 54, 86, 0.94);
}

.toast-danger {
  background: rgba(139, 42, 42, 0.94);
}

.toast-success {
  background: rgba(25, 94, 69, 0.94);
}

/* Post-login editorial refresh */
.post-shell {
  max-width: var(--post-shell-max);
  display: grid;
  gap: var(--section-gap-lg);
}

.post-page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 18px;
  padding: 28px;
  align-items: stretch;
}

.post-hero-copy,
.post-hero-panel {
  position: relative;
  z-index: 1;
}

.post-hero-copy {
  display: grid;
  gap: 14px;
  align-content: center;
}

.post-kicker {
  margin: 0;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.post-hero-title {
  margin: 0;
  font-size: var(--post-display-size);
  line-height: 1.06;
  letter-spacing: -0.04em;
  max-width: 12ch;
}

.post-hero-deck {
  margin: 0;
  max-width: 56ch;
  color: var(--text-sub);
  font-size: 18px;
  line-height: 1.75;
}

.post-hero-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}

.post-hero-actions {
  margin-top: 4px;
}

.post-hero-actions .btn {
  min-width: 168px;
}

.post-hero-footnotes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-micro-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.42);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
}

.post-hero-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--glass-border-soft);
  background: var(--surface-secondary);
  box-shadow: var(--shadow-2), var(--inner-highlight);
}

.post-panel-label {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-panel-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.post-section {
  display: grid;
  gap: 16px;
}

.post-section-head {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.post-section-head-tight {
  max-width: none;
}

.post-section-title {
  margin: 0;
  font-size: var(--post-title-size);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.post-section-deck {
  margin: 0;
  color: var(--text-sub);
  font-size: 17px;
  line-height: 1.75;
}

.home-brand-hero {
  background:
    radial-gradient(circle at top left, rgba(255, 191, 129, 0.26), transparent 38%),
    radial-gradient(circle at right center, rgba(232, 123, 74, 0.18), transparent 44%),
    var(--surface-primary);
}

.home-brand-copy .post-hero-title {
  max-width: 10ch;
}

.home-daily-panel h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.info-pills-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-pills-compact .info-pill {
  min-height: 94px;
}

.home-caregiver-tip-quiet {
  padding: 14px;
}

.brand-note-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.brand-note-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-2), var(--inner-highlight);
}

.brand-note-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand-note-card p {
  margin: 0;
  color: var(--text-sub);
}

.entry-editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
}

.entry-feature-card,
.entry-utility-card {
  padding: 18px;
}

.entry-feature-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 270px;
  align-content: end;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.1), transparent 42%),
    radial-gradient(circle at top right, rgba(42, 200, 184, 0.18), transparent 34%),
    radial-gradient(circle at bottom left, rgba(232, 123, 74, 0.18), transparent 40%),
    var(--surface-primary);
}

.entry-feature-card h3,
.entry-utility-card h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.12;
}

.entry-feature-card p,
.entry-utility-card p {
  margin: 0;
  color: var(--text-sub);
}

.entry-feature-illust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.entry-feature-card > :not(.entry-feature-illust) {
  position: relative;
  z-index: 1;
}

.entry-utility-grid {
  display: grid;
  gap: 12px;
}

.entry-utility-card {
  display: grid;
  gap: 10px;
  min-height: 145px;
}

.entry-utility-kicker {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.training-editorial-section .training-wide-card,
.training-controls-card {
  padding: 18px;
}

.brand-control-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.brand-control-grid .btn {
  min-width: 0;
  width: 100%;
}

.library-page-hero {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.08), transparent 38%),
    radial-gradient(circle at top left, rgba(240, 164, 104, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(42, 200, 184, 0.15), transparent 36%),
    var(--surface-primary);
}

.library-hero-panel {
  align-content: start;
}

.library-hero-points {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--text-sub);
}

.command-bar {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.command-bar-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.command-bar-meta {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  text-align: right;
}

.library-featured-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.library-featured-main {
  display: grid;
  gap: 14px;
  align-content: start;
}

.library-featured-rail,
.library-recent-grid,
.library-stream-grid {
  display: grid;
  gap: 12px;
}

.library-recent-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(227, 184, 144, 0.4);
  background: rgba(255, 250, 244, 0.78);
  box-shadow: var(--shadow-1), var(--inner-highlight);
}

.library-recent-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.library-recent-title {
  margin: 4px 0 0;
  font-size: clamp(28px, 2.5vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.library-recent-note {
  margin: 0;
  max-width: 20ch;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
}

.library-recent-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-recent-grid--single {
  grid-template-columns: 1fr;
}

.library-stream-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-card {
  overflow: hidden;
  display: grid;
}

.library-card--lead {
  min-height: 420px;
  grid-template-rows: 220px 1fr;
}

.library-card--compact,
.library-card--stream {
  min-height: 220px;
}

.library-card-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.library-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.library-card-kicker {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-card h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.12;
}

.library-card-subtitle,
.library-card-tip {
  margin: 0;
  color: var(--text-sub);
}

.library-card-tip {
  font-size: 15px;
  line-height: 1.6;
}

.library-card-media {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
}

.library-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-load-more-row {
  display: flex;
  justify-content: center;
}

.result-brand-hero {
  background:
    radial-gradient(circle at top right, rgba(42, 200, 184, 0.16), transparent 34%),
    radial-gradient(circle at bottom left, rgba(240, 164, 104, 0.22), transparent 42%),
    var(--surface-primary);
}

.result-hero-panel {
  align-content: center;
}

.result-score-block {
  display: grid;
  gap: 6px;
}

.result-score-block small {
  color: var(--text-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-score-block b {
  font-size: clamp(52px, 7vw, 84px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.result-score-block p {
  margin: 0;
  color: var(--text-sub);
}

.result-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 14px;
}

.result-story-card,
.result-next-card,
.pathway-action-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.result-domain-wrap {
  display: grid;
  gap: 10px;
}

.result-domain-wrap h3 {
  margin: 0;
  font-size: 22px;
}

.result-suggestion-list {
  display: grid;
  gap: 10px;
}

.result-care-note {
  margin: 0;
}

.result-action-cluster .btn {
  min-width: 0;
}

.pathway-brand-hero,
.review-brand-hero {
  background:
    radial-gradient(circle at top left, rgba(240, 164, 104, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(42, 200, 184, 0.12), transparent 36%),
    var(--surface-primary);
}

.pathway-hero-note {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.65;
}

.review-editorial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-editorial-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
}

.review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-meta-pill {
  white-space: nowrap;
}

.caregiver-hero .post-hero-title {
  max-width: 12ch;
}

.caregiver-hero .post-hero-deck {
  max-width: 48ch;
}

@media (max-width: 980px) {
  .post-page-hero,
  .entry-editorial-grid,
  .library-featured-grid,
  .result-layout-grid {
    grid-template-columns: 1fr;
  }

  .brand-note-grid,
  .review-editorial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-recent-grid,
  .library-stream-grid {
    grid-template-columns: 1fr 1fr;
  }

  .library-recent-head {
    align-items: start;
    flex-direction: column;
  }

  .library-recent-note {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .post-shell {
    gap: 18px;
  }

  .post-page-hero {
    padding: 18px 16px;
    gap: 14px;
  }

  .post-hero-title {
    max-width: none;
    font-size: clamp(34px, 9vw, 44px);
  }

  .post-hero-deck,
  .post-section-deck {
    font-size: 16px;
    line-height: 1.68;
  }

  .post-hero-actions,
  .result-action-cluster {
    width: 100%;
  }

  .post-hero-actions .btn,
  .result-action-cluster .btn {
    width: 100%;
    min-width: 0;
  }

  .brand-note-grid,
  .brand-control-grid,
  .library-recent-grid,
  .library-stream-grid,
  .review-editorial-grid {
    grid-template-columns: 1fr;
  }

  .library-recent-panel {
    padding: 16px;
  }

  .library-recent-title {
    font-size: 28px;
  }

  .entry-utility-grid {
    grid-template-columns: 1fr;
  }

  .library-card--lead {
    min-height: 0;
    grid-template-rows: 180px 1fr;
  }

  .command-bar-head,
  .review-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Bottom navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 900;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  font-size: 20px;
  color: var(--text-sub);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color 0.2s, background 0.2s;
}

.bottom-nav-item span {
  font-size: 11px;
  font-weight: 600;
}

.bottom-nav-item--active {
  color: var(--coral-deep);
}

.bottom-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
