:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --bg-deep: #dfe8e4;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #ffffff;
  --ink: #17191d;
  --ink-soft: #5f6670;
  --line: rgba(28, 33, 44, 0.12);
  --line-strong: rgba(28, 33, 44, 0.22);
  --accent: #ff4f68;
  --accent-strong: #bf2439;
  --accent-soft: rgba(255, 79, 104, 0.12);
  --gold: #f2b84b;
  --mint: #14a67b;
  --royal: #355c7d;
  --red: #e84d5b;
  --violet: #7c5cff;
  --shadow: 0 30px 90px rgba(24, 32, 48, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 79, 104, 0.10), transparent 34%),
    linear-gradient(245deg, rgba(20, 166, 123, 0.12), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 48%, var(--bg-deep) 100%);
  font: 15px/1.45 "Inter", "SF Pro Text", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  padding: 18px;
  gap: 18px;
}

body.rail-collapsed .app-shell {
  grid-template-columns: 96px minmax(0, 1fr);
}

.goal-rail,
.main-stage {
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: var(--panel);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.goal-rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px 18px;
  border-radius: 32px;
  overflow: hidden;
}

.rail-brand h2,
.topbar h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.rail-brand h2 {
  font-size: 24px;
  line-height: 1.05;
}

.eyebrow,
.sheet-kicker {
  margin: 0 0 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}

.rail-copy,
.deck-meta {
  margin: 0;
  color: var(--ink-soft);
}

.king-panel {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(23, 25, 29, 0.10);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 249, 235, 0.86)),
    linear-gradient(135deg, rgba(220, 166, 64, 0.16), rgba(51, 92, 103, 0.12));
  overflow: hidden;
}

.rank-orbit {
  position: absolute;
  right: -18px;
  top: -24px;
  width: 118px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(220, 166, 64, 0.22);
  background: conic-gradient(from 120deg, rgba(220, 166, 64, 0.55), rgba(32, 168, 120, 0.35), rgba(51, 92, 103, 0.42), rgba(220, 166, 64, 0.55));
  opacity: 0.72;
}

.rank-orbit span {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.rank-orbit span:nth-child(2) {
  inset: 34px;
}

.rank-orbit span:nth-child(3) {
  inset: 52px;
  background: #fff8ea;
}

.rank-copy {
  position: relative;
  display: grid;
  gap: 2px;
}

.rank-copy span {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 900;
}

.rank-copy strong {
  font-size: 28px;
  line-height: 0.95;
}

.rank-copy small {
  color: var(--ink-soft);
  font-weight: 700;
}

.rank-meter {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.08);
}

.rank-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--mint));
  box-shadow: 0 0 22px rgba(220, 166, 64, 0.44);
}

.rank-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.rank-stats span {
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(23, 25, 29, 0.06);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.rank-stats strong {
  color: var(--ink);
  font-size: 15px;
}

.daily-quest {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(23, 25, 29, 0.06);
}

.daily-quest div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.daily-quest span,
.domain-row span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.daily-quest strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.14;
}

.daily-quest small {
  align-self: start;
  color: var(--mint);
  font-weight: 900;
}

.daily-quest i {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.08);
}

.daily-quest b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--gold));
}

.domain-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-row span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.06);
  letter-spacing: 0.06em;
}

.domain-row b {
  color: var(--ink);
}

.rail-actions,
.top-actions,
.sheet-actions {
  display: flex;
  gap: 10px;
}

.primary-pill,
.primary-button,
.secondary-button,
.sheet-actions button,
.goal-tabs button,
.mobile-goals button,
.goal-examples button,
.activity-item {
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.primary-pill,
.primary-button {
  color: #fffaf7;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7d4d 100%);
  box-shadow: 0 16px 34px rgba(255, 95, 109, 0.22);
}

.primary-pill,
.primary-button,
.secondary-button,
.sheet-actions button {
  min-height: 46px;
  padding: 0 18px;
  font-weight: 700;
}

.secondary-button,
.sheet-actions button[value="cancel"],
.context-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.icon-pill,
.mobile-goals-button {
  min-width: 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  font-weight: 700;
}

.rail-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.goal-tabs,
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.goal-tabs button,
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.52);
  border-color: rgba(255, 255, 255, 0.64);
}

.goal-tabs button:hover,
.activity-item:hover,
.primary-pill:hover,
.primary-button:hover,
.secondary-button:hover,
.sheet-actions button:hover,
.goal-examples button:hover,
.icon-pill:hover,
.mobile-goals-button:hover,
.variant-pill:hover,
.round-action:hover,
.context-button:hover {
  transform: translateY(-1px);
}

.goal-tabs button.active {
  border-color: rgba(255, 95, 109, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 241, 233, 0.9));
  box-shadow: 0 18px 26px rgba(255, 95, 109, 0.12);
}

.goal-title,
.activity-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.goal-subline,
.activity-copy small,
.activity-status {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
}

.goal-count,
.activity-dot,
.mini-pill,
.count-pill {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 95, 109, 0.08);
  color: var(--accent-strong);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.activity-item {
  align-items: flex-start;
}

.activity-dot {
  min-width: 12px;
  width: 12px;
  height: 12px;
  padding: 0;
  margin-top: 4px;
  background: var(--gold);
}

.activity-dot.is-accepted {
  background: var(--mint);
}

.activity-dot.is-dismissed {
  background: var(--red);
}

.activity-dot.is-completed {
  background: var(--accent);
}

.main-stage {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border-radius: 38px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.king-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(244, 247, 245, 0.42) 38%, rgba(222, 235, 230, 0.64) 100%);
}

.topbar,
.rule-strip,
.mobile-goals,
.deck-stage,
.bottom-bar {
  position: relative;
  z-index: 1;
}

.topbar {
  grid-row: 1;
  padding: calc(env(safe-area-inset-top) + 20px) 24px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.54), transparent);
}

.topline,
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider-pill,
.rule-strip span,
.mini-pill,
.variant-meta,
.card-source,
.hero-age,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  font-weight: 700;
}

.topbar h1 {
  font-size: clamp(34px, 5.6vw, 52px);
  line-height: 0.98;
}

.mobile-goals-button {
  display: none;
}

.rule-strip {
  grid-row: 2;
  display: flex;
  gap: 10px;
  overflow: auto;
  padding: 0 24px 16px;
}

.mobile-goals {
  grid-row: 3;
  display: none;
  gap: 10px;
  overflow: auto;
  padding: 0 24px 18px;
}

.mobile-goals button,
.lane-list button {
  white-space: nowrap;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.52);
  border-color: var(--line);
}

.mobile-goals button.active {
  background: var(--accent-soft);
  border-color: rgba(255, 95, 109, 0.28);
  color: var(--accent-strong);
}

.active-lane {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.active-lane small {
  min-width: 26px;
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.deck-stage {
  grid-row: 4;
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 10px 20px 12px;
  perspective: 1300px;
}

.deck {
  position: relative;
  width: min(100%, 430px);
  height: min(100%, 720px);
  min-height: min(520px, 100%);
}

.deck-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 40% auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 251, 249, 0.98) 100%),
    linear-gradient(135deg, rgba(242, 184, 75, 0.10), rgba(53, 92, 125, 0.08));
  box-shadow: 0 28px 70px rgba(24, 32, 48, 0.20);
  transform-origin: 50% 92%;
  transition: transform 240ms ease, box-shadow 240ms ease, opacity 240ms ease;
  will-change: transform;
  touch-action: pan-y;
}

.deck-card.stack-1 {
  z-index: 2;
  transform: translateY(16px) translateZ(-44px) rotateX(2deg) scale(0.965);
  opacity: 0.86;
  pointer-events: none;
}

.deck-card.stack-2 {
  z-index: 1;
  transform: translateY(32px) translateZ(-86px) rotateX(3deg) scale(0.93);
  opacity: 0.68;
  pointer-events: none;
}

.deck-card.stack-0 {
  z-index: 3;
}

.deck-card.no-visual {
  grid-template-rows: minmax(132px, 28%) auto auto auto minmax(86px, 1fr) auto;
}

.deck-card:not(.is-top) .card-footer,
.deck-card:not(.is-top) .card-body,
.deck-card:not(.is-top) .variant-strip {
  visibility: hidden;
  pointer-events: none;
}

.deck-card.dragging {
  transition: none;
  box-shadow: 0 34px 100px rgba(126, 71, 29, 0.28);
}

.deck-card.dismiss-left {
  animation: fly-left 260ms cubic-bezier(.2, .7, .3, 1) forwards;
}

.deck-card.accept-right {
  animation: fly-right 260ms cubic-bezier(.2, .7, .3, 1) forwards;
}

@keyframes fly-left {
  to { transform: translate(-120%, 8%) rotate(-16deg); opacity: 0; }
}

@keyframes fly-right {
  to { transform: translate(120%, 8%) rotate(16deg); opacity: 0; }
}

.hero-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 44%),
    linear-gradient(145deg, #ff4f68 0%, #f2b84b 44%, #355c7d 100%);
}

.hero-panel.has-media {
  background: #111827;
}

.hero-panel.no-media {
  min-height: 132px;
  background:
    linear-gradient(145deg, rgba(255, 79, 104, 0.82), rgba(242, 184, 75, 0.62) 46%, rgba(53, 92, 125, 0.84)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 14px),
    rgba(24, 32, 48, 0.88);
}

.hero-media,
.hero-media img,
.hero-media video {
  width: 100%;
  height: 100%;
}

.hero-media img,
.hero-media video {
  object-fit: cover;
  display: block;
}

.hero-sheen {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 22, 34, 0.06), rgba(16, 22, 34, 0.62)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.34), transparent 34%);
}

.kingdom-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 26%),
    linear-gradient(150deg, #f25555 0%, #dca640 48%, #335c67 100%);
}

.kingdom-visual .sun {
  position: absolute;
  right: 36px;
  top: 34px;
  width: 64px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff5c7;
  box-shadow: 0 0 60px rgba(255, 245, 199, 0.7);
}

.kingdom-visual .castle {
  position: absolute;
  left: 44px;
  right: 44px;
  bottom: 54px;
  height: 118px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  filter: drop-shadow(0 20px 30px rgba(15, 23, 42, 0.22));
}

.kingdom-visual .castle span {
  width: 74px;
  height: 86px;
  border-radius: 18px 18px 4px 4px;
  background: rgba(255, 255, 255, 0.82);
}

.kingdom-visual .castle span:nth-child(2) {
  height: 122px;
  width: 92px;
  border-radius: 22px 22px 4px 4px;
}

.kingdom-visual .castle span::before {
  content: "";
  display: block;
  width: 46px;
  height: 24px;
  margin: -20px auto 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: rgba(255, 255, 255, 0.82);
}

.kingdom-visual .road {
  position: absolute;
  left: 50%;
  bottom: -54px;
  width: 160px;
  height: 190px;
  transform: translateX(-50%) perspective(160px) rotateX(54deg);
  border-radius: 50% 50% 0 0;
  background: rgba(255, 255, 255, 0.28);
}

.kingdom-visual .spark {
  position: absolute;
  width: 12px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  animation: floatSpark 4s ease-in-out infinite;
}

.spark-a {
  left: 16%;
  top: 24%;
}

.spark-b {
  right: 20%;
  bottom: 34%;
  animation-delay: 1.3s;
}

@keyframes floatSpark {
  0%,
  100% { transform: translateY(0) scale(1); opacity: 0.55; }
  50% { transform: translateY(-18px) scale(1.3); opacity: 1; }
}

.hero-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 18px 22px;
  color: #fffdf9;
}

.hero-meta,
.hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.card-source,
.hero-age,
.status-pill {
  color: inherit;
  background: rgba(18, 12, 9, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.card-source {
  padding-left: 7px;
}

.source-favicon,
.source-initials {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  color: #17191d;
  object-fit: cover;
  font-size: 10px;
  font-weight: 900;
}

.source-orb {
  background:
    radial-gradient(circle at 34% 34%, #fff 0 20%, transparent 22%),
    linear-gradient(135deg, var(--gold), var(--royal));
}

.hero-title {
  margin: 0;
  max-width: 100%;
  font-size: clamp(30px, 5.2vw, 44px);
  line-height: 1.04;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-why {
  margin: 10px 0 0;
  max-width: 34ch;
  font-size: 15px;
  color: rgba(255, 249, 245, 0.9);
}

.swipe-badge {
  position: absolute;
  top: 26px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  background: rgba(255, 255, 255, 0.76);
}

.swipe-badge.like {
  right: 20px;
  color: var(--mint);
}

.swipe-badge.nope {
  left: 20px;
  color: var(--red);
}

.deck-card.show-like .swipe-badge.like,
.deck-card.show-nope .swipe-badge.nope {
  opacity: 1;
}

.card-summary,
.quest-meter,
.variant-strip,
.card-body,
.card-footer {
  padding-left: 18px;
  padding-right: 18px;
}

.quest-meter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.quest-meter i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.08);
}

.quest-meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--mint));
}

.card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-top: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.summary-copy strong {
  display: block;
  font-size: 18px;
}

.summary-copy p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
}

.variant-strip {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-top: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.variant-pill {
  padding: 10px 14px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 700;
}

.variant-pill.active {
  background: var(--accent-soft);
  border-color: rgba(255, 95, 109, 0.28);
  color: var(--accent-strong);
}

.card-body {
  min-height: 0;
  overflow: auto;
  padding-top: 6px;
  padding-bottom: 14px;
}

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

.insight-panel,
.detail-panel,
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.insight-panel {
  padding: 14px;
}

.insight-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.insight-value {
  font-size: 17px;
  line-height: 1.34;
}

.prepared-list,
.detail-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prepared-list li,
.detail-panel li {
  position: relative;
  padding-left: 18px;
  margin-top: 8px;
  color: var(--ink-soft);
}

.prepared-list li::before,
.detail-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.detail-panel {
  overflow: hidden;
}

.detail-panel + .detail-panel {
  margin-top: 12px;
}

.detail-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.detail-panel summary::-webkit-details-marker {
  display: none;
}

.detail-panel .detail-copy {
  padding: 0 16px 16px;
  color: var(--ink-soft);
}

.detail-copy a,
.activity-copy a,
.insight-value a {
  color: var(--accent-strong);
}

.card-footer {
  display: grid;
  gap: 10px;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 16px;
  border-top: 1px solid var(--line);
}

.action-button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr));
  gap: 8px;
}

.choice-button {
  min-height: 40px;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #fffaf7;
  background: linear-gradient(135deg, var(--accent) 0%, #df8b39 100%);
  font-weight: 700;
  font-size: 13px;
  overflow-wrap: anywhere;
  line-height: 1.1;
}

.choice-button.ghost {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.choice-button.active {
  box-shadow: 0 12px 30px rgba(242, 85, 85, 0.20);
}

.utility-row {
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.utility-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 900;
  font-size: 24px;
}

.skip-mini {
  color: var(--red);
}

.comment-mini {
  color: var(--royal);
}

.inline-comment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.inline-comment textarea {
  min-height: 48px;
  max-height: 120px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
}

.inline-comment.sending {
  opacity: 0.62;
}

.choice-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.mobile-goals-button:disabled,
.round-action:disabled,
.context-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.swipe-legend {
  position: absolute;
  top: 50%;
  z-index: 0;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  backdrop-filter: blur(14px);
}

.swipe-legend-left {
  left: max(10px, calc(50% - 310px));
}

.swipe-legend-right {
  right: max(10px, calc(50% - 310px));
}

.bottom-bar {
  grid-row: 5;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  gap: 14px;
  align-items: center;
  padding: 10px 24px calc(env(safe-area-inset-bottom) + 18px);
}

.action-cluster {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.round-action {
  position: relative;
  min-width: 76px;
  width: 76px;
  height: 76px;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 20px 40px rgba(36, 42, 55, 0.14);
}

.round-action::before,
.round-action::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}

.round-skip {
  background: linear-gradient(180deg, #fffdfb, #ffe7e0);
}

.round-skip::before,
.round-skip::after {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--red);
}

.round-skip::before {
  transform: rotate(45deg);
}

.round-skip::after {
  transform: rotate(-45deg);
}

.round-start {
  background: linear-gradient(135deg, #ff6d67, #ffb45c);
}

.round-start::before {
  width: 30px;
  height: 30px;
  clip-path: path("M15 27 C6 20,0 14,0 7 C0 3,3 0,7 0 C10 0,13 2,15 5 C17 2,20 0,23 0 C27 0,30 3,30 7 C30 14,24 20,15 27 Z");
  background: #fffaf7;
}

.context-button {
  min-height: 58px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
}

.empty {
  width: min(100%, 430px);
  padding: 28px;
  box-shadow: 0 24px 50px rgba(126, 71, 29, 0.1);
}

.empty strong {
  display: block;
  font-size: 34px;
  line-height: 0.96;
}

.empty p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.sheet {
  position: fixed;
  inset: auto;
  width: min(520px, calc(100vw - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

.sheet::backdrop {
  background: rgba(28, 18, 11, 0.34);
  backdrop-filter: blur(8px);
}

.sheet-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.sheet-card label {
  font-size: 18px;
  font-weight: 700;
}

.sheet-note {
  margin: 0;
  color: var(--ink-soft);
}

.confirm-summary {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(23, 25, 29, 0.04);
}

.confirm-summary strong {
  font-size: 16px;
}

.confirm-summary span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.confirm-summary p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.sheet textarea,
.sheet input {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  resize: none;
}

.goal-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lane-list {
  display: grid;
  gap: 10px;
  max-height: min(520px, 60vh);
  overflow: auto;
}

.lane-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  text-align: left;
}

.goal-examples button {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.76);
  border-color: var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 26px);
  transform: translateX(-50%) translateY(16px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(24, 18, 14, 0.86);
  color: #fff9f5;
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.rail-collapsed .goal-rail {
  padding-left: 12px;
  padding-right: 12px;
}

body.rail-collapsed .rail-brand,
body.rail-collapsed .king-panel,
body.rail-collapsed .rail-section,
body.rail-collapsed #newGoalButton {
  display: none;
}

body.rail-collapsed .rail-actions {
  justify-content: center;
}

body.rail-collapsed .icon-pill {
  margin: 0 auto;
}

@media (max-height: 720px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .goal-rail {
    gap: 12px;
    padding: 16px 14px 14px;
  }

  .rail-brand h2 {
    font-size: 22px;
  }

  .rail-copy,
  .rule-strip {
    display: none;
  }

  .king-panel {
    gap: 8px;
    padding: 12px;
  }

  .rank-copy strong {
    font-size: 23px;
  }

  .daily-quest,
  .domain-row {
    display: none;
  }

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

  .topbar h1 {
    font-size: 34px;
  }

  .deck-stage {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .deck-card {
    grid-template-rows: 34% auto auto auto minmax(72px, 1fr) auto;
  }

  .deck-card.no-visual {
    grid-template-rows: 27% auto auto auto minmax(86px, 1fr) auto;
  }

  .hero-title {
    font-size: 24px;
    -webkit-line-clamp: 4;
  }

  .hero-why {
    display: none;
  }

  .summary-copy p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
  }

  .variant-strip {
    display: flex;
    padding-top: 7px;
    padding-bottom: 6px;
  }

  .variant-pill {
    padding: 7px 10px;
    font-size: 11px;
  }

  .card-body {
    display: block;
    max-height: 84px;
    padding-top: 4px;
    padding-bottom: 8px;
  }

  .insight-panel {
    padding: 9px 10px;
  }

  .insight-label,
  .detail-panel,
  .count-pill {
    display: none;
  }

  .insight-value {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
  }

  .utility-row {
    grid-template-columns: 38px 38px minmax(0, 1fr);
    gap: 7px;
    font-size: 11px;
  }

  .utility-button {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .card-summary {
    padding-top: 10px;
    padding-bottom: 9px;
  }

  .bottom-bar {
    grid-template-columns: 62px minmax(0, 1fr) 62px;
    gap: 10px;
    padding-top: 6px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
  }

  .round-action {
    min-width: 58px;
    width: 58px;
    height: 58px;
  }

  .choice-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .goal-rail {
    display: none;
  }

  .mobile-goals {
    display: flex;
  }

  .mobile-goals-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .deck {
    min-height: 480px;
    height: min(100%, 680px);
  }

  .swipe-legend {
    display: none;
  }
}

@media (max-width: 720px) {
  .main-stage {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    border-radius: 28px;
  }

  .topbar {
    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: 14px;
  }

  .topbar h1 {
    font-size: 38px;
  }

  .provider-pill,
  .rule-strip {
    display: none;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .rule-strip,
  .mobile-goals,
  .bottom-bar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .deck-stage {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
    min-height: 430px;
  }

  .deck {
    width: 100%;
    height: 100%;
    min-height: 430px;
    max-height: 620px;
  }

  .deck-card {
    grid-template-rows: 32% auto auto auto minmax(74px, 1fr) auto;
  }

  .deck-card.no-visual {
    grid-template-rows: 24% auto auto auto minmax(92px, 1fr) auto;
  }

  .hero-title {
    max-width: 100%;
    font-size: 30px;
    -webkit-line-clamp: 4;
  }

  .hero-why {
    display: none;
  }

  .hero-copy {
    padding: 14px 14px 18px;
  }

  .card-summary {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .summary-copy p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
  }

  .summary-copy strong {
    font-size: 15px;
    line-height: 1.12;
  }

  .count-pill {
    padding: 5px 8px;
  }

  .card-body {
    max-height: 142px;
    overflow: auto;
    padding-top: 2px;
    padding-bottom: 10px;
  }

  .insight-grid {
    gap: 8px;
  }

  .detail-panel {
    display: none;
  }

  .utility-row {
    grid-template-columns: 42px 42px minmax(0, 1fr);
  }

  .utility-row span {
    display: none;
  }

  .action-button-row {
    display: flex;
    overflow-x: auto;
  }

  .choice-button {
    flex: 0 0 auto;
  }

  .bottom-bar {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    gap: 10px;
    padding-top: 6px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
  }

  .round-action {
    min-width: 68px;
    width: 68px;
    height: 68px;
  }
}

@media (max-width: 720px) and (max-height: 740px) {
  .topbar {
    padding-top: calc(env(safe-area-inset-top) + 10px);
    padding-bottom: 8px;
  }

  .topbar h1 {
    font-size: 30px;
  }

  .deck-meta {
    font-size: 14px;
  }

  .top-actions .primary-button,
  .top-actions .secondary-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .mobile-goals {
    display: none;
  }

  .deck-stage {
    min-height: 390px;
  }

  .deck {
    min-height: 390px;
    max-height: 470px;
  }

  .deck-card {
    grid-template-rows: 31% auto auto auto auto;
  }

  .deck-card.no-visual {
    grid-template-rows: 23% auto auto auto auto;
  }

  .hero-title {
    font-size: 23px;
    -webkit-line-clamp: 3;
  }

  .hero-why {
    display: none;
  }

  .bottom-bar {
    padding-top: 4px;
  }

  .card-body {
    display: none;
  }
}

@media (max-width: 720px) and (max-height: 640px) {
  .app-shell {
    padding: 8px;
  }

  .main-stage {
    border-radius: 24px;
  }

  .topbar {
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 8px;
  }

  .eyebrow {
    margin-bottom: 6px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .deck-meta {
    font-size: 13px;
  }

  .top-actions {
    gap: 8px;
  }

  .top-actions .primary-button,
  .top-actions .secondary-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
  }

  .mobile-goals {
    display: none;
  }

  .deck-stage {
    min-height: 260px;
  }

  .deck {
    min-height: 260px;
    max-height: 300px;
  }

  .deck-card {
    grid-template-rows: 34% auto auto auto auto;
  }

  .deck-card.no-visual {
    grid-template-rows: 24% auto auto auto auto;
  }

  .hero-copy {
    padding: 12px;
  }

  .hero-title {
    font-size: 24px;
    -webkit-line-clamp: 3;
  }

  .card-summary {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .summary-copy strong {
    font-size: 16px;
  }

  .variant-meta {
    display: none;
  }

  .summary-copy p {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-body {
    display: block;
    max-height: 74px;
  }

  .insight-panel {
    padding: 10px;
  }

  .insight-label {
    display: none;
  }

  .insight-value {
    font-size: 13px;
    line-height: 1.25;
  }

  .variant-strip {
    padding-top: 8px;
    padding-bottom: 6px;
  }

  .variant-pill {
    padding: 8px 12px;
    font-size: 12px;
  }

  .card-footer {
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .choice-button {
    min-height: 38px;
    padding: 0 14px;
  }

  .bottom-bar {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 6px);
  }

  .round-action {
    min-width: 58px;
    width: 58px;
    height: 58px;
  }

  .round-skip::before,
  .round-skip::after {
    width: 24px;
  }

  .context-button {
    min-height: 48px;
  }
}
