/* ============================================================
   Drivepast — mobile-rework app stylesheet.
   Pairs with /static/ds/styles.css (tokens + dp-* components).
   Translates the mobile-rework UI kit direction into production
   classes. App-specific classes are unprefixed or
   `app-`/screen-scoped; DS atoms (dp-chip, dp-tag, dp-eyebrow,
   dp-prose, dp-sr-only) are reused as-is.
   ============================================================ */

:root { --tray-h: 84px; --mini-h: 0px; }

/* ---------------------------------------------------------- frame ---- */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink-50);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
* { -webkit-tap-highlight-color: transparent; }

.app {
  position: relative;
  width: 100%;
  max-width: var(--container-phone);     /* 430px */
  height: 100dvh;
  margin: 0 auto;
  background: var(--surface-page);
  overflow: hidden;
  isolation: isolate;
}
@media (min-width: 480px) {
  body { display: grid; place-items: center; }
  .app {
    height: min(100dvh, 880px);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(14, 18, 22, 0.30), 0 0 0 1px var(--ink-200);
  }
}

/* Each screen fills the app box; only one is shown at a time. */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--surface-page); }
.screen.is-active { display: flex; }
.screen__scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen__scroll::-webkit-scrollbar { width: 0; height: 0; }

.hidden { display: none !important; }
.muted { color: var(--text-secondary); }
.tnum { font-variant-numeric: tabular-nums lining-nums; }

/* Generic icon (inline <svg><use> from the sprite). Lucide-style strokes. */
.ic { display: block; flex-shrink: 0; width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic--12 { width: 12px; height: 12px; } .ic--14 { width: 14px; height: 14px; }
.ic--16 { width: 16px; height: 16px; } .ic--18 { width: 18px; height: 18px; }
.ic--22 { width: 22px; height: 22px; } .ic--24 { width: 24px; height: 24px; }
.ic--28 { width: 28px; height: 28px; } .ic--30 { width: 30px; height: 30px; }

/* Visible focus everywhere (a11y) */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ----------------------------------------------------- bottom tray ---- */
.tray {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--z-bar);
  display: flex; padding: 6px 10px calc(14px + var(--safe-bottom));
  background: var(--white);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -2px 12px rgba(14, 18, 22, 0.05);
}
.tray__item {
  flex: 1; appearance: none; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0;
  min-height: var(--tap-min); color: var(--ink-500); font-weight: var(--weight-semibold);
}
.tray__item .ic { color: var(--ink-500); }
.tray__label { font-size: 11px; }
.tray__item.is-on { color: var(--clay-600); }
.tray__item.is-on .ic { color: var(--clay-600); stroke-width: 2.3; }
.tray__item.is-on .tray__label { font-weight: var(--weight-bold); }
.tray__badge {
  position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--clay-600); border: 1.5px solid var(--white);
}
.tray__ico { position: relative; display: inline-flex; }

/* ----------------------------------------------------- mini player ---- */
.mini {
  position: absolute; left: 8px; right: 8px;
  bottom: calc(var(--tray-h) + 6px + var(--safe-bottom)); z-index: var(--z-sheet);
}
.mini__inner {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px;
  background: var(--ink-900); border-radius: 14px; box-shadow: var(--shadow-lg); cursor: pointer;
}
.mini__art {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--clay-600), var(--ink-700));
}
.mini__meta { flex: 1; min-width: 0; }
.mini__title { display: block; font-size: 13.5px; font-weight: var(--weight-bold); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini__sub { display: block; font-size: 11.5px; color: rgba(255,255,255,0.6); }
.mini__btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; border: none; cursor: pointer;
  background: var(--clay-600); display: inline-flex; align-items: center; justify-content: center;
}

/* ----------------------------------------------------- menu overlay --- */
.menu {
  position: absolute; inset: 0; z-index: var(--z-modal);
  background: var(--ink-950); color: #fff;
  display: none; flex-direction: column; padding: calc(52px + var(--safe-top)) 22px calc(28px + var(--safe-bottom));
}
.menu.is-open { display: flex; animation: menuin .24s var(--ease-standard); }
@keyframes menuin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .menu.is-open { animation: none; } }
.menu__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.menu__brand { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: var(--weight-semibold); }
.menu__brand b { color: var(--clay-600); }
.menu__x, .icon-btn--dark {
  width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.08);
  border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.menu__profile {
  appearance: none; cursor: pointer; text-align: left; width: 100%; display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.06); border: none; border-radius: 16px; padding: 16px; margin-bottom: 24px;
}
.menu__avatar, .acct__avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--clay-600); color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-weight: var(--weight-bold); font-size: 17px;
}
.menu__name { display: block; font-size: 17px; font-weight: var(--weight-bold); }
.menu__email { display: block; font-size: 12.5px; color: rgba(255,255,255,0.55); font-family: var(--font-mono); }
.menu__nav { display: flex; flex-direction: column; }
.menu__row {
  appearance: none; cursor: pointer; text-align: left; width: 100%; display: flex; align-items: center; gap: 14px;
  background: transparent; border: none; border-top: 1px solid rgba(255,255,255,0.08); padding: 18px 4px; color: #fff;
}
.menu__row-title { display: block; font-size: 17px; font-weight: var(--weight-semibold); }
.menu__row-sub { display: block; font-size: 12.5px; color: rgba(255,255,255,0.5); }
.menu__spacer { flex: 1; }
.menu__signout {
  appearance: none; cursor: pointer; height: 50px; border-radius: 12px; background: transparent;
  border: 1px solid rgba(255,255,255,0.18); color: #fff; font-family: var(--font-sans);
  font-size: 15px; font-weight: var(--weight-semibold);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}

/* --------------------------------------------------------- modal ------ */
.scrim {
  position: absolute; inset: 0; z-index: var(--z-modal); background: var(--surface-scrim);
  display: none; align-items: flex-end; justify-content: center; padding: 16px;
}
.scrim.is-open { display: flex; }
.modal {
  width: 100%; background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 20px 18px calc(18px + var(--safe-bottom)); animation: menuin .2s var(--ease-standard);
}
.modal h3 { font-size: var(--text-xl); margin-bottom: 6px; }
.modal__rows { margin: 14px 0; border-top: 1px solid var(--border-subtle); }
.modal__row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.modal__row span:first-child { color: var(--text-tertiary); }
.modal__row span:last-child { font-family: var(--font-mono); color: var(--text-primary); }
.modal__cost { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--cost-normal); }
.modal__cost.is-over { color: var(--cost-over); }
.modal__actions { display: flex; gap: 10px; margin-top: 8px; }

/* ====================================================== buttons ======= */
.btn {
  appearance: none; border: none; cursor: pointer; border-radius: 12px;
  font-family: var(--font-sans); font-weight: var(--weight-bold); letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap-min);
}
.btn--block { width: 100%; }
.btn--primary { height: 52px; background: var(--action-primary); color: #fff; font-size: 16px;
  box-shadow: 0 1px 2px rgba(143, 57, 20, 0.4); }
.btn--primary:hover { background: var(--action-primary-hover); }
.btn--primary:active { background: var(--action-primary-active); transform: translateY(1px); }
.btn--ghost { height: 48px; padding: 0 16px; background: var(--white); color: var(--ink-900);
  border: 1px solid var(--border-default); font-size: 15px; font-weight: var(--weight-semibold); }
.btn--ghost:hover { background: var(--action-neutral-hover); }
.btn--ghost.is-active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.btn--sm { height: 42px; font-size: 14px; }
.btn--danger { color: var(--red-700); }
.btn[disabled] { opacity: 0.55; cursor: default; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; background: var(--white);
  border: 1px solid var(--border-default); box-shadow: var(--shadow-xs); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hamburger { display: flex; flex-direction: column; gap: 3.5px; }
.hamburger span { width: 17px; height: 2px; border-radius: 2px; background: var(--ink-800); }

/* ====================================================== MAP =========== */
#map { position: absolute; inset: 0; z-index: var(--z-map); background: var(--map-base); }
/* Cool-neutral Leaflet skin to match the design's abstract map */
.leaflet-container { background: var(--map-land); font-family: var(--font-sans); }
.leaflet-tile { filter: grayscale(0.55) brightness(1.03) contrast(0.92); }
.leaflet-control-zoom { display: none; }

.mapbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: var(--z-bar);
  display: flex; gap: 8px; align-items: center;
  padding: calc(12px + var(--safe-top)) 14px 10px;
  background: linear-gradient(180deg, rgba(250,251,252,0.92), rgba(250,251,252,0));
  pointer-events: none;
}
.mapbar > * { pointer-events: auto; }
.mapbar__pill {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  flex: 0 0 auto; max-width: 138px; min-width: 0;
  height: 38px; padding: 0 12px 0 7px; background: var(--white); border: 1px solid var(--border-default);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-sm);
  font-size: 13.5px; font-weight: var(--weight-semibold); color: var(--ink-900);
}
#loc-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapbar__jk {
  width: 24px; height: 24px; border-radius: 50%; background: var(--clay-600); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: var(--weight-bold);
  flex: 0 0 auto;
}
.mapbar__spacer { flex: 1; }
.mapbar__address {
  align-items: center; display: flex; flex: 1 1 auto; min-width: 96px;
  height: 38px; padding: 0 12px; background: var(--white);
  border: 1px solid var(--border-default); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.mapbar__address:focus-within { border-color: var(--border-focus); box-shadow: var(--shadow-focus); }
.mapbar__address input {
  appearance: none; border: none; outline: none; background: transparent;
  min-width: 0; width: 100%; font-family: var(--font-sans);
  font-size: 13.5px; font-weight: var(--weight-semibold); color: var(--ink-900);
}
.mapbar__address input::-webkit-search-cancel-button { cursor: pointer; }
.mapbar__address input::placeholder { color: var(--text-disabled); }
.mapbar__gps {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-pill); box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: var(--weight-semibold); color: var(--ink-700);
  flex: 0 0 auto;
}
.mapbar__gps-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--clay-600); border: 2px solid #fff; box-shadow: var(--shadow-pin); }

@media (max-width: 360px) {
  .mapbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .mapbar__pill { max-width: 112px; padding-right: 8px; }
  .mapbar__address { min-width: 72px; padding: 0 10px; }
  .mapbar__address input { font-size: 12.5px; }
  .mapbar__gps { padding: 0 9px; }
}

.recenter { position: absolute; right: 14px; top: calc(96px + var(--safe-top)); z-index: var(--z-overlay); }
.recenter .icon-btn { box-shadow: var(--shadow-md); }

/* Leaflet div-icon markers (teardrop pins + score chip) */
.dp-marker { background: transparent; border: none; }
.dp-marker > span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50% 50% 50% 2px; transform: rotate(45deg);
  background: var(--map-pin); color: #fff; box-shadow: var(--shadow-pin); border: 2px solid #fff;
  font-family: var(--font-display); font-size: 11px; font-weight: var(--weight-bold);
}
.dp-marker > span > * { transform: rotate(-45deg); }
.dp-marker.best > span { background: var(--map-pin-best); width: 34px; height: 34px; }
.dp-marker.active > span { background: var(--map-pin-active); width: 34px; height: 34px; }
.dp-marker.drop > span { background: var(--map-pin-active); }
.dp-marker.route > span { background: var(--map-stop); border-radius: 50%; }
.dp-marker.here > span { background: var(--map-current); border-radius: 50%; transform: none; width: 18px; height: 18px; font-size: 0; }

/* --------------------------------------------------------- sheet ------ */
.sheet { position: absolute; left: 0; right: 0; bottom: var(--tray-h); z-index: var(--z-sheet); pointer-events: none; }
.sheet__panel {
  background: var(--white); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-sheet);
  padding: 14px 18px calc(20px + var(--safe-bottom)); max-height: 72vh; overflow-y: auto;
  pointer-events: auto; overscroll-behavior: contain;
  transition: max-height var(--dur-sheet) ease, padding var(--dur-sheet) ease;
}
.sheet.sheet--collapsed .sheet__panel {
  max-height: 86px; padding-bottom: calc(12px + var(--safe-bottom)); overflow: hidden;
}
.sheet.sheet--dragging .sheet__panel { transition: none; }
.sheet__grip {
  appearance: none; border: 0; cursor: grab; display: block;
  width: 38px; height: 5px; border-radius: var(--radius-pill); background: var(--ink-200);
  margin: 0 auto 14px; padding: 0;
}
.sheet__grip:active { cursor: grabbing; }
.sheet__grip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 5px; }
.sheet.sheet--collapsed .sheet__grip { margin-bottom: 10px; }
.sheet.sheet--collapsed .sheet__body { display: none; }
.sheet.sheet--collapsed .sheet__summary { margin-bottom: 0; }
.sheet.sheet--collapsed .sheet__summary-title,
.sheet.sheet--collapsed .sheet__summary-score { display: inline-flex; }
.sheet.sheet--collapsed .sheet__summary-caret { transform: rotate(180deg); }
.sheet:not(.sheet--collapsed) .sheet__summary-title,
.sheet:not(.sheet--collapsed) .sheet__summary-score { display: none; }
.sheet__summary {
  appearance: none; border: 0; cursor: pointer; width: 100%; padding: 0; margin: 0 0 12px;
  background: transparent; color: inherit; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-sans); text-align: left;
}
.sheet__summary .dp-chip { flex: 0 0 auto; }
.sheet.sheet--collapsed .sheet__summary .dp-chip {
  max-width: 42%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet__summary-title {
  flex: 1; min-width: 0; color: var(--ink-900); font-size: 14px; font-weight: var(--weight-semibold);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet__summary-score {
  color: var(--ink-700); font-family: var(--font-display); font-size: 20px; font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.sheet__summary-caret { color: var(--text-tertiary); flex: 0 0 auto; transition: transform var(--dur-sheet) ease; }
.sheet__summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 5px; border-radius: 8px; }
.sheet__body {
  display: flex; flex-direction: column; gap: 12px;
}
@media (max-width: 360px) {
  .sheet.sheet--collapsed .sheet__summary .dp-chip { max-width: 38%; }
}

.modes { display: flex; gap: 4px; padding: 4px; background: var(--surface-sunken); border-radius: 12px; }
.modes__btn {
  appearance: none; border: none; cursor: pointer; flex: 1; height: 42px; border-radius: 9px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-sans); font-size: 12.5px; font-weight: var(--weight-semibold); color: var(--ink-500);
}
.modes__btn .ic { color: var(--ink-400); }
.modes__btn.is-on { background: var(--white); box-shadow: var(--shadow-sm); color: var(--ink-900); }
.modes__btn.is-on .ic { color: var(--clay-600); }
.mode-help { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-secondary); }

.radius { }
.radius__row { display: flex; gap: 6px; }
.radius__btn {
  appearance: none; cursor: pointer; flex: 1; height: 38px; border-radius: 9px;
  border: 1px solid var(--border-default); background: var(--white); color: var(--ink-700);
  font-family: var(--font-mono); font-size: 12.5px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums;
}
.radius__btn.is-on { border-color: var(--ink-900); background: var(--ink-900); color: #fff; }
.radius__btn sub { font-size: 10px; opacity: 0.7; vertical-align: baseline; }

.field { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border-default); background: var(--white); }
.field input { flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); }
.field-hint { display: flex; gap: 6px; align-items: flex-start; margin: 7px 2px 0; font-size: 11.5px;
  color: var(--text-tertiary); line-height: 1.35; }

.sheet__stack { display: flex; flex-direction: column; gap: 14px; }
.sheet__results { display: flex; flex-direction: column; gap: 12px; }

/* ====================================================== STORY CARDS === */
.dp-eyebrow, .eyebrow { font-size: 11px; font-weight: var(--weight-bold); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-tertiary); }

.story-rich {
  background: var(--white); border-radius: 14px; padding: 16px; position: relative;
  border: 1px solid var(--border-default); box-shadow: var(--shadow-sm);
}
.story-rich.is-best { border: 1.5px solid var(--clay-600); box-shadow: 0 4px 16px rgba(143,57,20,0.10); }
.story-rich__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.story-rich__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.story-rich__title { font-family: var(--font-display); font-size: 21px; font-weight: var(--weight-bold);
  letter-spacing: -0.015em; color: var(--ink-900); line-height: 1.15; }
.story-rich__score { font-family: var(--font-display); font-size: 30px; font-weight: var(--weight-bold);
  line-height: 1; color: var(--ink-700); font-variant-numeric: tabular-nums; }
.story-rich.is-best .story-rich__score { color: var(--clay-600); }
.story-rich__why { margin: 8px 0 12px; font-size: 14px; line-height: 1.45; color: var(--text-secondary); }
.story-rich__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.story-rich__meta .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); }
.story-rich__more {
  appearance: none; border: none; background: transparent; cursor: pointer; width: 100%; margin-top: 8px; padding: 4px;
  font-size: 13px; font-weight: var(--weight-semibold); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}

.story-compact {
  appearance: none; cursor: pointer; text-align: left; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; background: var(--white);
  border: 1px solid var(--border-subtle); border-radius: 12px;
}
.story-compact__ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-sunken); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.story-compact__body { flex: 1; min-width: 0; }
.story-compact__title { display: block; font-size: 14.5px; font-weight: var(--weight-semibold); color: var(--ink-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-compact__meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-tertiary); }
.story-compact__meta .mono { font-family: var(--font-mono); }
.story-compact__score { font-family: var(--font-display); font-size: 20px; font-weight: var(--weight-bold);
  color: var(--ink-700); font-variant-numeric: tabular-nums; }

/* "Play instantly" / "Generate" inline tag is a DS chip variant; reuse dp-chip--ready / dp-chip--network */

/* ====================================================== STORY DETAIL == */
.topchrome {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex;
  justify-content: space-between; align-items: center; padding: calc(14px + var(--safe-top)) 14px 0;
}
.detail__scroll { padding: calc(92px + var(--safe-top)) 18px 120px; }
.detail__title { font-family: var(--font-display); font-size: 30px; font-weight: var(--weight-bold);
  letter-spacing: -0.02em; color: var(--ink-900); line-height: 1.08; margin-top: 12px; }
.detail__facts { display: flex; align-items: center; gap: 16px; margin: 12px 0 16px; font-size: 13px;
  color: var(--text-secondary); font-family: var(--font-mono); }
.detail__salience { display: inline-flex; align-items: center; gap: 5px; }
.detail__salience b { font-family: var(--font-display); font-size: 22px; font-weight: var(--weight-bold); color: var(--clay-600); }
.detail__salience .lbl { font-family: var(--font-sans); font-size: 11px; font-weight: var(--weight-bold); letter-spacing: 0.06em; color: var(--text-tertiary); }
.detail__banner { display: flex; gap: 9px; align-items: flex-start; padding: 13px; border-radius: 12px; margin-bottom: 18px; }
.detail__banner.is-instant { background: var(--status-success-bg); border: 1px solid var(--green-100); color: var(--green-800); }
.detail__banner.is-generate { background: var(--status-warning-bg); border: 1px solid var(--gold-100); color: var(--gold-800); }
.detail__why { margin: 0 0 22px; font-family: var(--font-serif); font-size: 17px; line-height: 1.6; color: var(--ink-800); }
.srclist { background: var(--white); border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; }
.srclist__row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); }
.srclist__row:last-child { border-bottom: none; }
.srclist__d { flex: 1; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail__action {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; padding: 14px 18px calc(24px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--surface-page) 24%);
}
.detail__action-note { text-align: center; font-size: 12px; color: var(--text-tertiary); margin: 8px 0 0; }

/* ====================================================== PLAYER ======== */
.player__scroll { display: flex; flex-direction: column; justify-content: center;
  padding: calc(96px + var(--safe-top)) 26px calc(150px + var(--safe-bottom)); gap: 22px; }
.player__eyebrow { position: absolute; top: calc(54px + var(--safe-top)); left: 0; right: 0; text-align: center;
  font-size: 12px; font-weight: var(--weight-bold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.player__cover { aspect-ratio: 1 / 1; border-radius: 22px; background: linear-gradient(150deg, var(--clay-600), var(--ink-800));
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; padding: 22px; color: #fff; }
.player__cover-top { display: flex; justify-content: space-between; align-items: center; }
.player__cover-tag { font-size: 11px; font-weight: var(--weight-bold); letter-spacing: 0.1em; color: rgba(255,255,255,0.85); }
.player__cover-src { font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,0.7); }
.player__title { font-family: var(--font-display); font-size: 24px; font-weight: var(--weight-bold);
  letter-spacing: -0.015em; color: var(--ink-900); line-height: 1.15; }
.player__sub { margin-top: 5px; font-size: 13.5px; color: var(--text-secondary); }
.scrub__track { height: 6px; border-radius: var(--radius-pill); background: var(--ink-200); position: relative; cursor: pointer; }
.scrub__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: var(--radius-pill); background: var(--clay-600); }
.scrub__knob { position: absolute; left: 0; top: 50%; width: 15px; height: 15px; border-radius: 50%; background: #fff;
  border: 2px solid var(--clay-600); transform: translate(-50%, -50%); box-shadow: var(--shadow-sm); }
.scrub__times { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--font-mono);
  font-size: 11.5px; color: var(--text-tertiary); }
.transport { display: flex; align-items: center; justify-content: center; gap: 30px; }
.transport__seek { background: none; border: none; cursor: pointer; position: relative; color: var(--ink-700); }
.transport__seek span { position: absolute; inset: 0; top: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-weight: var(--weight-bold); color: var(--ink-700); }
.transport__play { width: 72px; height: 72px; border-radius: 50%; background: var(--clay-600); border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(143,57,20,0.4); }
.player__utility { position: absolute; left: 0; right: 0; bottom: var(--tray-h); z-index: 5; display: flex; justify-content: space-around;
  padding: 12px 18px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--border-subtle); background: var(--white); }
.player__util-btn { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 4px; color: var(--text-secondary); font-size: 11px; font-weight: var(--weight-semibold); min-height: var(--tap-min); }
.player__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 40px; text-align: center; height: 100%; }
.player__empty-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--surface-sunken);
  display: inline-flex; align-items: center; justify-content: center; }
.player__details { padding: 0 18px; }
.player__details details { margin-top: 10px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--white); }
.player__details summary { padding: 12px 14px; cursor: pointer; font-weight: var(--weight-semibold); font-size: 13.5px; }
.player__details pre { margin: 0; padding: 0 14px 14px; white-space: pre-wrap; font-family: var(--font-mono);
  font-size: 11.5px; color: var(--text-secondary); }
audio { width: 100%; }

/* ====================================================== QUEUE ========= */
.scr-head { padding: calc(54px + var(--safe-top)) 18px 12px; border-bottom: 1px solid var(--border-subtle); }
.scr-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.scr-head__title { font-family: var(--font-display); font-size: 27px; font-weight: var(--weight-bold);
  letter-spacing: -0.02em; color: var(--ink-900); line-height: 1.1; margin-top: 3px; }
.qswitch { display: flex; gap: 4px; padding: 4px; background: var(--surface-sunken); border-radius: 12px; margin-top: 14px; }
.qswitch__btn { appearance: none; border: none; cursor: pointer; flex: 1; height: 40px; border-radius: 9px; background: transparent;
  font-family: var(--font-sans); font-size: 14px; font-weight: var(--weight-semibold); color: var(--ink-500);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.qswitch__btn.is-on { background: var(--white); box-shadow: var(--shadow-sm); color: var(--ink-900); }
.qswitch__n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-400); }
.qswitch__btn.is-on .qswitch__n { color: var(--clay-600); }
.qlist { padding: 14px 18px calc(150px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; }

.job {
  cursor: pointer; text-align: left; width: 100%; background: var(--white);
  border: 1px solid var(--border-subtle); border-radius: 14px; padding: 15px; display: flex; flex-direction: column; gap: 11px;
}
.job.is-playing { border-color: var(--clay-600); }
.job__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job__title { font-size: 16px; font-weight: var(--weight-bold); color: var(--ink-900); line-height: 1.2; }
.job__step { font-size: 12.5px; color: var(--text-secondary); }
.job__bar { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; }
.job__bar span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--clay-600); }
.job__bar.is-queued span { background: var(--ink-300); }
.job__meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }
.job__actions { display: flex; }
.job__actions .btn { flex: 1; }

.hist { background: var(--white); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 15px;
  display: flex; flex-direction: column; gap: 11px; }
.hist__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hist__title { font-size: 15.5px; font-weight: var(--weight-bold); color: var(--ink-900); line-height: 1.25; }
.hist__meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }
.hist__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hist__actions .btn { flex: 1 1 130px; min-width: 0; }
.qnote { text-align: center; font-size: 12.5px; color: var(--text-tertiary); margin: 6px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 6px; }
.qempty { text-align: center; color: var(--text-tertiary); padding: 40px 20px; font-size: 14px; }

/* ====================================================== ACCOUNT ======= */
.acct__scroll { padding: 14px 18px calc(150px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.acct__profile { display: flex; align-items: center; gap: 13px; padding: 15px; background: var(--white);
  border: 1px solid var(--border-subtle); border-radius: 14px; }
.acct__name { display: block; font-size: 15.5px; font-weight: var(--weight-bold); color: var(--ink-900); }
.acct__email { display: block; font-size: 12.5px; color: var(--text-tertiary); font-family: var(--font-mono); }
.group__label { padding: 0 4px 8px; }
.group__box { background: var(--white); border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; }
.setrow { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--border-subtle);
  min-height: var(--tap-min); }
.setrow:last-child { border-bottom: none; }
.setrow--button { appearance: none; width: 100%; background: transparent; color: inherit; text-align: left; cursor: pointer; font-family: var(--font-sans); }
.setrow--button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -3px; }
.setrow__ico { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-sunken); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.setrow__body { flex: 1; min-width: 0; }
.setrow__label { display: block; font-size: 14.5px; font-weight: var(--weight-semibold); color: var(--ink-900); }
.setrow__sub { display: block; font-size: 12px; color: var(--text-tertiary); }
.setrow__val { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-secondary); }
.setrow__val.mono { font-family: var(--font-mono); }
.toggle { width: 44px; height: 26px; border-radius: var(--radius-pill); background: var(--ink-200); position: relative;
  flex-shrink: 0; border: none; cursor: pointer; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: left var(--dur-base, 180ms) var(--ease-standard); }
.toggle.is-on { background: var(--clay-600); }
.toggle.is-on::after { left: 21px; }
@media (prefers-reduced-motion: reduce) { .toggle::after { transition: none; } }
.acct__signout { appearance: none; cursor: pointer; height: 50px; border-radius: 12px; background: var(--white);
  border: 1px solid var(--border-default); color: var(--red-700); font-family: var(--font-sans);
  font-size: 15px; font-weight: var(--weight-semibold); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

/* ================================================= TASTE PROFILE ===== */
.taste { position: absolute; inset: 0; z-index: calc(var(--z-modal) + 1); background: var(--surface-page); display: flex; justify-content: center; overflow-y: auto; }
.taste.hidden { display: none; }
.taste__panel { width: 100%; max-width: 560px; min-height: 100%; padding: calc(22px + var(--safe-top)) 20px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; background: var(--surface-page); }
.taste__welcome, .taste__summary { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 13px; }
.taste h1 { max-width: 19ch; color: var(--ink-950); font-family: var(--font-display); font-size: 30px; line-height: 1.08; letter-spacing: 0; }
.taste p { color: var(--text-secondary); line-height: 1.5; }
.taste__mark, .taste__genre-icon { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.taste__mark { background: var(--clay-600); }
.taste__genre-icon { background: var(--clay-100); }
.taste__actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.taste__text-btn { appearance: none; border: 0; background: transparent; color: var(--ink-600); min-height: var(--tap-min); padding: 8px 10px; font: 600 14px var(--font-sans); cursor: pointer; }
.taste__head { display: grid; grid-template-columns: 44px 1fr 64px; align-items: center; gap: 8px; min-height: 44px; }
.taste__head > :nth-child(2) { text-align: center; }
.taste__progress-label { color: var(--text-secondary); font-size: 13px; font-weight: var(--weight-semibold); }
.taste__progress { height: 4px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.taste__progress span { display: block; height: 100%; border-radius: inherit; background: var(--clay-600); }
.taste__card { flex: 1; min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px 6px; }
.taste__hook { max-width: 32ch; font-size: 16px; }
.taste__fact { width: 100%; max-width: 38ch; padding: 13px 15px 12px; border: 1px solid var(--clay-200); border-left: 3px solid var(--clay-500); border-radius: 0 12px 12px 0; background: linear-gradient(135deg, var(--clay-50), var(--surface-sunken)); text-align: left; }
.taste__fact-label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--clay-700); font-size: 10px; font-weight: var(--weight-bold); letter-spacing: .1em; line-height: 1; text-transform: uppercase; }
.taste__fact p { color: var(--ink-800); font-family: var(--font-display); font-size: 14px; line-height: 1.45; }
.taste__fact a { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--blue-700); font-size: 11px; }
.taste__choices { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.taste__choices legend { grid-column: 1 / -1; width: 100%; margin-bottom: 7px; text-align: center; color: var(--text-tertiary); font-size: 12px; }
.taste__choice { appearance: none; min-height: 52px; padding: 8px 5px; border: 1px solid var(--border-default); border-radius: 10px; background: var(--white); color: var(--ink-700); font: 600 12.5px var(--font-sans); cursor: pointer; }
.taste__choice.is-on, .taste__setting button.is-on { border-color: var(--clay-600); background: var(--clay-50); color: var(--clay-800); box-shadow: inset 0 0 0 1px var(--clay-600); }
.taste__summary-list { width: 100%; display: flex; flex-direction: column; border-top: 1px solid var(--border-subtle); }
.taste__summary-list span { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border-subtle); color: var(--ink-800); font-size: 14px; text-align: left; }
.taste__summary-list b { color: var(--clay-700); }
.taste__settings { display: flex; flex-direction: column; gap: 14px; }
.taste__settings > p { margin-top: -8px; }
.taste__setting { border: 0; border-bottom: 1px solid var(--border-subtle); margin: 0; padding: 0 0 14px; }
.taste__setting legend { width: 100%; margin-bottom: 9px; }
.taste__setting legend span, .taste__setting legend small { display: block; }
.taste__setting legend span { color: var(--ink-900); font-size: 14px; font-weight: var(--weight-bold); }
.taste__setting legend small { color: var(--text-tertiary); font-size: 11.5px; }
.taste__setting > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.taste__setting button { appearance: none; min-height: 44px; padding: 5px 3px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--white); color: var(--ink-600); font: 600 10.5px var(--font-sans); cursor: pointer; }
.taste__error { border: 1px solid var(--red-100); background: var(--red-50); color: var(--red-800); padding: 11px 12px; border-radius: 8px; font-size: 12.5px; }
.taste__error button { display: block; margin-top: 5px; border: 0; background: transparent; color: inherit; padding: 4px 0; font-weight: var(--weight-bold); text-decoration: underline; cursor: pointer; }
@media (min-width: 700px) {
  .taste { padding: 32px; background: var(--surface-scrim); }
  .taste__panel { min-height: auto; max-height: calc(100vh - 64px); border-radius: 16px; box-shadow: var(--shadow-lg); overflow-y: auto; padding: 28px 32px; }
}

/* ====================================================== banner / toast = */
.toast { position: absolute; left: 12px; right: 12px; top: calc(12px + var(--safe-top)); z-index: var(--z-toast);
  display: none; gap: 9px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; box-shadow: var(--shadow-md);
  font-size: 13px; line-height: 1.4; }
.toast.is-show { display: flex; }
.toast.info { background: var(--status-info-bg); color: var(--status-info-fg); border: 1px solid var(--blue-100); }
.toast.success { background: var(--status-success-bg); color: var(--status-success-fg); border: 1px solid var(--green-100); }
.toast.warning { background: var(--status-warning-bg); color: var(--status-warning-fg); border: 1px solid var(--gold-100); }
.toast.danger { background: var(--status-danger-bg); color: var(--status-danger-fg); border: 1px solid var(--red-100); }
.offline-banner { position: absolute; left: 12px; right: 12px; top: calc(12px + var(--safe-top)); z-index: var(--z-toast);
  display: none; gap: 9px; align-items: center; padding: 11px 13px; border-radius: 12px;
  background: var(--status-neutral-bg); color: var(--ink-800); border: 1px solid var(--ink-200); font-size: 13px; box-shadow: var(--shadow-md); }
body.is-offline .offline-banner { display: flex; }

/* ====================================================== SIGN IN ======= */
.signin { position: absolute; inset: 0; background: var(--ink-950); color: #fff; display: flex; flex-direction: column;
  justify-content: space-between; padding: calc(64px + var(--safe-top)) 28px calc(40px + var(--safe-bottom)); }
.signin__brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: var(--weight-semibold); }
.signin__brand b { color: var(--clay-500); }
.signin__hero { color: rgba(255,255,255,0.94); font-family: var(--font-display); font-size: 34px; font-weight: var(--weight-bold); letter-spacing: 0;
  line-height: 1.08; margin-top: 18px; }
.signin__lede { margin-top: 14px; font-size: 15px; line-height: 1.55; color: rgba(255,255,255,0.7); max-width: 34ch; }
.signin__cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 12px;
  background: #fff; color: var(--ink-900); font-weight: var(--weight-bold); font-size: 16px; text-decoration: none; }
.signin__note { margin-top: 14px; font-size: 12.5px; color: rgba(255,255,255,0.5); text-align: center; }
.signin__error { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: rgba(216,81,63,0.15);
  border: 1px solid rgba(216,81,63,0.4); color: #f7c4aa; font-size: 13px; }

/* ===== Earned rating / feedback (rating/feedback v1) =====
   Appears only after the backend unlocks it (an honest active-listen). One
   canonical vote rendered the same in player (full + reason sheet) and in the
   queue/history cards (compact). */
.vote { display: flex; flex-direction: column; gap: 10px; }
.player__feedback { margin-top: 6px; }
.player__feedback .vote { align-items: center; padding: 14px 14px 16px; background: var(--white);
  border: 1px solid var(--line, #e7ebee); border-radius: 16px; box-shadow: 0 1px 3px rgba(16,22,28,.05); }
.vote__label { font-size: 14px; font-weight: var(--weight-semibold); color: var(--ink-900); text-align: center; }
.vote__btns { display: flex; gap: 12px; }
.vote__btn { width: 54px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--white); border: 1.5px solid var(--line, #d9e0e4);
  color: var(--ink-600, #54616b); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.vote__btn:hover { background: var(--action-neutral-hover, #f1f4f5); }
.vote__btn:focus-visible { outline: 2px solid var(--clay-600); outline-offset: 2px; }
.vote__btn--up.is-active { background: #1e8449; border-color: #1e8449; color: #fff; }
.vote__btn--down.is-active { background: var(--clay-600); border-color: var(--clay-600); color: #fff; }
.vote--compact { flex-direction: row; align-items: center; margin-top: 8px; }
.vote--compact .vote__btn { width: 42px; height: 34px; border-radius: 10px; }
.vote--compact .vote__btn .ic { width: 15px; height: 15px; }
.vote__sheet { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.vote__sheet-q { margin: 2px 0 0; font-size: 13.5px; font-weight: var(--weight-semibold); color: var(--ink-900); }
.vote__sheet-q .muted { font-weight: 400; }
.vote__reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.vote__reason { font-size: 12.5px; padding: 6px 11px; border-radius: 999px; background: var(--white);
  border: 1.5px solid var(--line, #d9e0e4); color: var(--ink-600, #54616b); cursor: pointer; }
.vote__reason.is-active { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.vote__comment { width: 100%; resize: vertical; border: 1.5px solid var(--line, #d9e0e4); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 13.5px; color: var(--ink-900); background: var(--white); }
.vote__comment:focus { outline: none; border-color: var(--clay-600); }
/* Submit appears only after a reason chip or a note (toggled via the [hidden] attr). */
.vote__submit { align-self: flex-start; margin-top: 2px; font-size: 13px; font-weight: var(--weight-semibold);
  padding: 8px 16px; border-radius: 999px; background: var(--clay-600); color: #fff; border: none; cursor: pointer; }
.vote__submit:hover { filter: brightness(1.04); }
.vote__submit:active { transform: translateY(0.5px); }
.vote__submit[hidden] { display: none; }

/* ===== Get the whole story (post-narrow-finish CTA, wide-expansion v1) ===== */
.player__whole-story { margin-top: 10px; }
.btn--block { width: 100%; }
.whole-story__cta { gap: 9px; }
.whole-story__status { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px;
  background: var(--panel, #fff); border: 1px solid var(--line, #e7ebee); color: var(--ink-700, #54616b);
  font-size: 13.5px; font-weight: var(--weight-semibold); }
.whole-story__status .ic { color: var(--clay-600); flex: none; }
