/* Price Voice web - mobile first. Same palette as the Android app. */
:root {
  --bg: #0e1116; --surface: #151a21; --surface-2: #1b212a; --surface-3: #222935;
  --text: #e6e8eb; --muted: #9aa3ae; --outline: #2a313c; --outline-2: #3a434f;
  --primary: #2ee6a6; --on-primary: #00281a; --primary-soft: #0f3a2c; --on-primary-soft: #b6f7dd;
  --up: #22c38e; --down: #ff5c6c; --warn: #ffb547; --danger: #ff5c6c;
  --radius: 16px; --gutter: 16px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --surface-3: #e7eaee;
  --text: #14181d; --muted: #55606c; --outline: #dde2e8; --outline-2: #c3cad3;
  --primary: #00805a; --on-primary: #ffffff; --primary-soft: #c8f5e2; --on-primary-soft: #00281a;
  --up: #0b8f63; --down: #d7263d; --warn: #b86e00; --danger: #d7263d;
  --shadow: 0 8px 24px rgba(20, 24, 29, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.shell { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  min-height: 56px; padding: env(safe-area-inset-top) calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline);
}
.topbar h1 { font-size: 20px; font-weight: 650; margin: 0 4px 0 8px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:focus-visible, .btn:focus-visible, .row-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon { width: 24px; height: 24px; display: inline-block; flex: none; }
.icon svg { width: 100%; height: 100%; fill: currentColor; display: block; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--outline-2); }
.dot.ok { background: var(--up); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--down); }

/* ---- main ---- */
.view { flex: 1; padding: 12px calc(var(--gutter) + env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left)); }
.stack { display: flex; flex-direction: column; gap: 10px; }

.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); }
.token-card { padding: 14px; display: block; width: 100%; text-align: left; border: 1px solid var(--outline); background: var(--surface); border-radius: var(--radius); }
.token-card:active { background: var(--surface-2); }
.tc-row { display: flex; align-items: center; gap: 12px; }
.tc-info { flex: 1; min-width: 0; }
.tc-name { font-weight: 650; font-size: 17px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.tc-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-src { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-src.bad { color: var(--down); }
.tc-value { text-align: right; flex: none; }
.tc-main { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; transition: color .4s; }
.tc-main.up { color: var(--up); } .tc-main.down { color: var(--down); }
.tc-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; gap: 8px; justify-content: flex-end; }
.chg { font-variant-numeric: tabular-nums; font-weight: 600; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); } .chg.none { color: var(--muted); }
.speak-btn { color: var(--muted); } .speak-btn.on { color: var(--primary); }
.alert-flag { width: 15px; height: 15px; color: var(--warn); }
.spark { display: block; width: 100%; margin-top: 8px; }
.spark path.line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark.up path.line { stroke: var(--up); } .spark.down path.line { stroke: var(--down); }
.spark.up path.area { fill: color-mix(in srgb, var(--up) 18%, transparent); } .spark.down path.area { fill: color-mix(in srgb, var(--down) 18%, transparent); }

.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--primary-soft); color: var(--on-primary-soft); display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }

.banner { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--primary-soft); color: var(--on-primary-soft); }
.banner .label { font-size: 11px; opacity: .85; }

.empty { text-align: center; padding: 48px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .big-icon { width: 56px; height: 56px; color: var(--primary); }
.empty h2 { font-size: 26px; margin: 4px 0; }
.empty p { color: var(--muted); margin: 0 0 12px; max-width: 360px; }
.hint { color: var(--muted); font-size: 13px; padding: 6px 4px; }

/* ---- buttons ---- */
.btn {
  min-height: 52px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; background: var(--primary); color: var(--on-primary); white-space: nowrap;
}
.btn.tonal { background: var(--primary-soft); color: var(--on-primary-soft); }
.btn.outline { background: transparent; color: var(--text); border-color: var(--outline-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.text { background: transparent; color: var(--primary); min-height: 44px; padding: 0 12px; }
a.btn { text-decoration: none; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.grow { flex: 1; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--outline);
  padding: 12px calc(var(--gutter) + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}
.bottombar .inner { max-width: 608px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--surface-3); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ---- forms / settings ---- */
.section { margin: 14px 0; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); margin: 0 4px 6px; }
.list { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--outline); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.row-btn { width: 100%; border: 0; background: transparent; text-align: left; }
.row-btn:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 16px; }
.row .sub { font-size: 13px; color: var(--muted); }
.row .value { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.row.disabled { opacity: .5; }
.row.wrap { flex-wrap: wrap; gap: 4px 8px; }
.radio .grow { flex: 1; min-width: 0; }

.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--outline-2); position: relative; flex: none; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .5; }

input[type="range"] { width: 100%; accent-color: var(--primary); height: 32px; }
select, input[type="text"], input[type="search"], textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--outline-2); background: var(--surface-2); font-size: 16px;
}
select { padding-right: 32px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.select-row select { width: auto; max-width: 55%; min-height: 40px; color: var(--primary); font-weight: 600; background: var(--surface-2); }

.radio { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; cursor: pointer; }
.radio input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--outline-2); margin: 0; flex: none; display: grid; place-items: center; }
.radio input:checked { border-color: var(--primary); }
.radio input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

.segmented { display: flex; border: 1px solid var(--outline-2); border-radius: 999px; overflow: hidden; }
.segmented label { flex: 1; text-align: center; padding: 10px 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 44px; display: grid; place-items: center; }
.segmented label + label { border-left: 1px solid var(--outline-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--primary-soft); color: var(--on-primary-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--outline-2); background: transparent; border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* ---- search ---- */
.search-box { position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 8px 0; display: flex; gap: 8px; }
.result { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border: 0; background: transparent; width: 100%; text-align: left; border-bottom: 1px solid var(--outline); }
.result:active { background: var(--surface-2); }
.result .r-info { flex: 1; min-width: 0; }
.result .r-sym { font-weight: 650; display: flex; align-items: center; gap: 4px; }
.result .r-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .r-val { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.verified { width: 16px; height: 16px; color: var(--primary); }
.progress { height: 3px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 50% 100%; animation: slide 1s linear infinite; border-radius: 2px; }
@keyframes slide { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---- token screen ---- */
.hero { display: flex; gap: 14px; align-items: center; padding: 6px 0 12px; }
.hero .big { font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.changes { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 0 8px; }
.changes .label { font-size: 11px; color: var(--muted); }
.chart-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 2px 0 6px; font-variant-numeric: tabular-nums; }
.alert-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; }
.mint { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; color: var(--muted); padding: 12px 16px 4px; }
.say-preview { font-size: 18px; font-weight: 600; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.notice.warn { border-left: 3px solid var(--warn); }

@media (min-width: 700px) {
  .view { padding-top: 20px; }
  .token-card:hover { border-color: var(--outline-2); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* "Add to Home Screen" offer (iPhone Safari) */
.install-card { position: relative; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--outline); border-left: 3px solid var(--primary); margin-bottom: 12px; }
.install-head { display: flex; gap: 12px; align-items: center; }
.install-head .title { font-weight: 650; }
.install-head .sub { color: var(--muted); font-size: 13px; }
.install-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install-close { flex: none; align-self: flex-start; margin: -6px -6px 0 0; }
.install-steps { margin: 12px 0 2px; padding-left: 22px; display: grid; gap: 8px; font-size: 14px; }
.install-steps .sub { color: var(--muted); }
.install-steps b { white-space: nowrap; }
.icon.inline { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: var(--primary); }
.icon.inline svg { width: 100%; height: 100%; fill: currentColor; }
.install-actions { display: flex; gap: 8px; margin-top: 12px; }
