/* Wunschliste – layout: sticky top bar, content column up to 1180px, bottom tab bar on phones,
   detail as a side sheet (desktop) or bottom sheet (phone). Tokens after docs/ui/konzept.md §8;
   no green/red for numbers (P3). Motion respects prefers-reduced-motion. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --surface-3: #e7e5df;
  --text: #16161a;
  --text-muted: #5c5a53;
  --text-faint: #6e6c64;
  --accent: #2b4fd8;
  --accent-soft: rgb(43 79 216 / 10%);
  --on-accent: #ffffff;
  --assumption: #5b3fb5;
  --projected: #8a5300;
  --danger: #b42318;
  --border: #e2e0d9;
  --border-strong: #8a877e;
  --slot-1: #2f5bea;
  --slot-2: #b87603;
  --slot-3: #0e9f8e;
  --slot-4: #7b4fd6;
  --slot-5: #d6457a;
  --shadow-1: 0 1px 2px rgb(22 22 26 / 6%), 0 1px 1px rgb(22 22 26 / 4%);
  --shadow-2: 0 8px 24px rgb(22 22 26 / 10%), 0 2px 6px rgb(22 22 26 / 6%);
  --scrim: rgb(14 15 18 / 45%);
  --glass: rgb(246 245 241 / 82%);
  --radius: 14px;
  --radius-l: 20px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e0f12;
    --surface: #16181d;
    --surface-2: #1e2128;
    --surface-3: #262a33;
    --text: #ecedef;
    --text-muted: #a3a8b4;
    --text-faint: #8b909c;
    --accent: #8fa2ff;
    --accent-soft: rgb(143 162 255 / 14%);
    --on-accent: #0e0f12;
    --assumption: #b9a6ff;
    --projected: #f0b454;
    --danger: #ff8b80;
    --border: #2c3039;
    --border-strong: #6b7180;
    --slot-1: #4d74f5;
    --slot-2: #b87a12;
    --slot-3: #1a9e8d;
    --slot-4: #8c6ce6;
    --slot-5: #d95a88;
    --shadow-1: none;
    --shadow-2: 0 10px 30px rgb(0 0 0 / 45%);
    --scrim: rgb(0 0 0 / 60%);
    --glass: rgb(14 15 18 / 80%);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e0f12;
  --surface: #16181d;
  --surface-2: #1e2128;
  --surface-3: #262a33;
  --text: #ecedef;
  --text-muted: #a3a8b4;
  --text-faint: #8b909c;
  --accent: #8fa2ff;
  --accent-soft: rgb(143 162 255 / 14%);
  --on-accent: #0e0f12;
  --assumption: #b9a6ff;
  --projected: #f0b454;
  --danger: #ff8b80;
  --border: #2c3039;
  --border-strong: #6b7180;
  --slot-1: #4d74f5;
  --slot-2: #b87a12;
  --slot-3: #1a9e8d;
  --slot-4: #8c6ce6;
  --slot-5: #d95a88;
  --shadow-1: none;
  --shadow-2: 0 10px 30px rgb(0 0 0 / 45%);
  --scrim: rgb(0 0 0 / 60%);
  --glass: rgb(14 15 18 / 80%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings:
    'tnum' 1,
    'cv11' 1;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
}
img {
  max-width: 100%;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
}
h3 {
  font-size: 16px;
}
p {
  margin: 0;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.muted {
  color: var(--text-muted);
}
.faint {
  color: var(--text-faint);
  font-size: 13px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

/* --- Top bar ---------------------------------------------------------------------------------- */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--bg);
}
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--glass);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.top .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-width: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--on-accent);
  flex: none;
}
.brand-mark svg {
  width: 18px;
  height: 18px;
}
.brand h1 {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slot-3);
  flex: none;
}
.pill.busy .dot {
  background: var(--accent);
  animation: pulse 1.2s var(--ease) infinite;
}
.tabs {
  display: flex;
  gap: 2px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  transition:
    background 160ms var(--ease),
    color 160ms var(--ease);
}
.tabs button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.tabs button[aria-current='page'] {
  background: var(--text);
  color: var(--bg);
}
.tabs svg {
  width: 18px;
  height: 18px;
}

/* --- Bottom bar on phones ---------------------------------------------------------------------- */
.bottom-nav {
  display: none;
}
@media (max-width: 767px) {
  .top .tabs,
  .hide-phone {
    display: none !important;
  }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px max(8px, env(safe-area-inset-right, 0px))
      calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--glass);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 0;
    border-radius: 12px;
    cursor: pointer;
    min-height: 0;
  }
  .bottom-nav button[aria-current='page'] {
    color: var(--accent);
  }
  .bottom-nav svg {
    width: 22px;
    height: 22px;
  }
  .bottom-nav .add {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--on-accent);
    margin-top: -4px;
    box-shadow: var(--shadow-2);
  }
  main {
    padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
  }
}

/* --- Buttons and inputs ------------------------------------------------------------------------ */
button {
  font: inherit;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  transition:
    transform 120ms var(--ease),
    background 160ms var(--ease),
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease);
}
button:hover {
  border-color: var(--border-strong);
}
button:active {
  transform: scale(0.97);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover {
  box-shadow: 0 4px 14px rgb(43 79 216 / 30%);
}
button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding: 6px 10px;
}
button.ghost:hover {
  background: var(--accent-soft);
}
button.icon {
  width: 38px;
  padding: 0;
}
button svg {
  width: 17px;
  height: 17px;
  flex: none;
}
button:disabled {
  opacity: 0.6;
  cursor: progress;
}
button.busy svg {
  animation: spin 900ms linear infinite;
}
a.bookmarklet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 600;
  cursor: grab;
}
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 40px;
  width: 100%;
  transition:
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input[type='checkbox'],
input[type='radio'] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}
label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}
.field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.field-grid > *,
.row > * {
  min-width: 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.hint {
  color: var(--text-faint);
  font-size: 13px;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  gap: 2px;
  overflow-x: auto;
  max-width: 100%;
}
.segmented button {
  border: 0;
  background: transparent;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}
.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
fieldset {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin: 0;
  background: var(--surface);
  display: grid;
  gap: 12px;
}
legend {
  padding: 0 6px;
  font-weight: 600;
}
form.stack {
  display: grid;
  gap: 16px;
}

/* --- Sections and panels ----------------------------------------------------------------------- */
main {
  padding-top: 20px;
  display: grid;
  gap: 28px;
}
main > * {
  min-width: 0;
}
.section {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin-right: auto;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
  min-width: 0;
  display: grid;
  gap: 12px;
}
.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--assumption);
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 0 12px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* --- Hero and KPI tiles ------------------------------------------------------------------------ */
.hero {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}
@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
}
.hero-card {
  border-radius: var(--radius-l);
  padding: 20px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  display: grid;
  gap: 14px;
  min-width: 0;
}
.hero-figure {
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}
.kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}
.kpi .label {
  color: var(--text-muted);
  font-size: 12.5px;
}
.kpi .value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.kpi .value.small {
  font-size: 16px;
}
.kpi .sub {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 2px;
}
.classbar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}
.classbar span {
  display: block;
  height: 100%;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 6px;
}

/* --- Wish cards -------------------------------------------------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.toolbar .search {
  flex: 1 1 220px;
  position: relative;
}
.toolbar .search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  translate: 0 -50%;
  width: 17px;
  height: 17px;
  color: var(--text-faint);
}
.toolbar .search input {
  padding-left: 36px;
}
.grid-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.grid-cards > * {
  min-width: 0;
}
.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 290px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.scroller > * {
  scroll-snap-align: start;
}
.wish {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  min-height: 0;
  align-items: stretch;
  justify-content: stretch;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease),
    border-color 220ms var(--ease);
}
.wish:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}
.wish:active {
  transform: translateY(-1px) scale(0.99);
}
.wish-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
  max-width: 100%;
}
.wish-media.compact {
  aspect-ratio: 3 / 1;
}
@media (max-width: 767px) {
  .wish-media {
    aspect-ratio: 16 / 9;
  }
}
.wish-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 500ms var(--ease);
}
.wish:hover .wish-media img {
  transform: scale(1.04);
}
.wish-media .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-faint);
}
.wish-media .placeholder svg {
  width: 40px;
  height: 40px;
}
.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  border: 1px solid var(--border);
}
.badge.ready {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}
.class-tag {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.wish-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}
.wish-title {
  font-weight: 600;
  line-height: 1.3;
}
.wish-sub {
  font-size: 12.5px;
  color: var(--text-faint);
}
.wish-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.price {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.price.big {
  font-size: clamp(28px, 5vw, 36px);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  white-space: nowrap;
}
.chip.strong {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.chip.assumption {
  border-color: var(--assumption);
  color: var(--assumption);
}
.chip.note {
  border-color: var(--projected);
  color: var(--projected);
}
.ring {
  width: 46px;
  height: 46px;
  flex: none;
}
.ring circle {
  fill: none;
  stroke-width: 5;
}
.ring .track {
  stroke: var(--surface-2);
}
.ring .fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 900ms var(--ease);
}
.ring text {
  font-size: 9.5px;
  letter-spacing: -0.02em;
  font-weight: 600;
  fill: var(--text);
}
.spark {
  width: 100%;
  height: 34px;
  display: block;
}
.spark .line {
  fill: none;
  stroke: var(--slot-1);
  stroke-width: 1.8;
}
.spark .area {
  fill: var(--accent-soft);
}
.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-top: 6px;
}
.group-title .count {
  color: var(--text-faint);
  font-weight: 500;
}

/* --- Sheet (detail) ---------------------------------------------------------------------------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 260ms var(--ease);
}
.sheet-scrim.open {
  opacity: 1;
}
.sheet {
  position: fixed;
  z-index: 41;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 100vw);
  background: var(--bg);
  box-shadow: var(--shadow-2);
  display: grid;
  grid-template-rows: auto auto 1fr;
  transform: translateX(104%);
  transition: transform 360ms var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
}
.sheet.open {
  transform: none;
}
.sheet .grabber {
  display: none;
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--border-strong);
  margin: 8px auto 0;
}
@media (max-width: 767px) {
  .sheet {
    top: auto;
    left: 0;
    width: 100vw;
    height: calc(100dvh - 28px - env(safe-area-inset-top, 0px));
    border-radius: 20px 20px 0 0;
    transform: translateY(104%);
    padding-top: 0;
  }
  .sheet .grabber {
    display: block;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px
    max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.sheet-head h2 {
  margin-right: auto;
  font-size: 17px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px max(16px, env(safe-area-inset-right, 0px))
    calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
}
.sheet-body > * {
  min-width: 0;
}
.detail-hero {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
@media (max-width: 520px) {
  .detail-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}
.detail-hero .wish-media {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 0;
}
.facts div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 0;
}
.facts dt {
  color: var(--text-muted);
  font-size: 12px;
}
.facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.facts .faint {
  font-size: 12px;
}
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--slot-1);
  transition: width 900ms var(--ease);
}

/* --- Charts ------------------------------------------------------------------------------------ */
.chart-figure {
  margin: 0;
  display: grid;
  gap: 6px;
}
.chart {
  width: 100%;
  height: 170px;
  display: block;
}
.chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .line {
  fill: none;
  stroke: var(--slot-1);
  stroke-width: 2.2;
  stroke-linejoin: round;
}
.chart .area {
  fill: var(--accent-soft);
}
.chart .target {
  stroke: var(--text);
  stroke-dasharray: 5 5;
  stroke-width: 1.2;
}
.chart .projection {
  fill: none;
  stroke: var(--projected);
  stroke-width: 2;
  stroke-dasharray: 4 5;
}
.chart .band {
  fill: var(--projected);
  opacity: 0.14;
}
.chart .event {
  stroke: var(--slot-4);
  stroke-width: 1.2;
  stroke-dasharray: 2 3;
}
.chart-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 12px;
}
.chart-legend i {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 2px solid var(--slot-1);
  margin-right: 5px;
  vertical-align: middle;
}
.chart-legend i.dash {
  border-top: 2px dashed var(--projected);
}
.chart-legend i.target {
  border-top: 1px dashed var(--text);
}
.draw {
  stroke-dasharray: 3000;
  stroke-dashoffset: 3000;
  animation: draw 1.1s var(--ease) forwards;
}

/* --- Tables ------------------------------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
}
td.num,
th.num {
  text-align: right;
}
td .row {
  flex-wrap: nowrap;
}

/* --- Lists, financing, outlook ----------------------------------------------------------------- */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.timeline li {
  position: relative;
  padding-left: 32px;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.cards-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.cards-2 > * {
  min-width: 0;
}
.fin {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 0;
}
.fin .rate {
  font-size: 22px;
  font-weight: 650;
}
.kv {
  display: grid;
  grid-template-columns: fit-content(45%) minmax(0, 1fr);
  gap: 4px 12px;
  font-size: 13.5px;
  margin: 0;
}
.kv dt {
  color: var(--text-muted);
}
.kv dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.footnote {
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
  white-space: pre;
  max-height: 160px;
  margin: 0;
}
.steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--text-muted);
}

/* --- Dialog, toast, login ---------------------------------------------------------------------- */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--text);
  max-width: min(560px, calc(100vw - 32px));
  width: 100%;
  padding: 18px;
  box-shadow: var(--shadow-2);
}
dialog[open] {
  animation: pop 240ms var(--ease);
}
dialog::backdrop {
  background: var(--scrim);
}
dialog form {
  display: grid;
  gap: 14px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.thumbs button {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 10px;
  min-height: 0;
}
.thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  max-width: calc(100vw - 32px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms var(--ease),
    transform 260ms var(--ease);
  box-shadow: var(--shadow-2);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 767px) {
  #toast {
    bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  }
}
.login {
  max-width: 380px;
  margin: 10vh auto 0;
  display: grid;
  gap: 14px;
}
footer {
  color: var(--text-faint);
  font-size: 12px;
  padding-top: 28px;
  padding-bottom: 40px;
}
@media (max-width: 767px) {
  footer {
    padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom, 0px));
  }
}

/* --- Skeleton and motion ----------------------------------------------------------------------- */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  min-height: 120px;
}
.enter {
  animation: rise 520ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@keyframes pulse {
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .draw {
    stroke-dashoffset: 0;
  }
}

/* Progressive entry and optional patience play share the existing tokens. */
.page-heading {
  align-items: center;
  gap: 16px;
}
.page-heading p {
  margin-top: 6px;
}
.form-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}
.form-details > summary {
  font-weight: 600;
  cursor: pointer;
}
.form-details[open] > summary {
  margin-bottom: 16px;
}
.form-details fieldset {
  margin: 0;
}
.auth-screen .tabs,
.auth-screen .bottom-nav,
.auth-screen #check-now {
  display: none;
}
.auth-screen .top .brand {
  margin-right: auto;
}
.game-intro {
  display: grid;
  gap: 12px;
  max-width: 720px;
}
.challenge-list {
  display: grid;
  gap: 12px;
}
.challenge-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  gap: 12px;
  min-width: 0;
}
.challenge-card h3,
.comparison-title {
  overflow-wrap: anywhere;
}
.challenge-card progress {
  width: 100%;
  accent-color: var(--accent);
  height: 10px;
}
.comparison-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.comparison-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.comparison-table th,
.comparison-table td {
  text-align: left;
  padding: 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 520px) {
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-heading > button {
    width: 100%;
    justify-content: center;
  }
  .top .wrap {
    gap: 8px;
  }
  .brand h1 {
    font-size: 16px;
  }
  #status {
    max-width: 32vw;
  }
}

.purchase-marker {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.section > details + details {
  margin-top: 12px;
}
.auth-screen .bottom-nav {
  display: none !important;
}
@media (max-width: 767px) {
  .bottom-nav button {
    min-height: 44px;
    font-size: 10px;
  }
}

/* Personal accounts share the same quiet mobile-first shell. */
.account-login {
  max-width: 440px;
  margin-top: 7vh;
  gap: 16px;
}
.account-login > button.primary {
  width: 100%;
  justify-content: center;
}
.auth-switch {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  gap: 4px;
  justify-items: start;
}
.auth-error {
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  overflow-wrap: anywhere;
}
.account-email {
  overflow-wrap: anywhere;
  font-weight: 600;
}
.session-pending .tabs,
.session-pending .bottom-nav,
.session-pending #check-now,
#check-now[hidden] {
  display: none !important;
}
@media (max-width: 520px) {
  .account-login {
    margin-top: 32px;
  }
}

[hidden] {
  display: none !important;
}
