/* Card */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.card-pad { padding: 12px 16px; }

/* Skeleton loader */
.skeleton {
  background: var(--panel2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Coin logo */
.coin-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel2);
}
.coin-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.coin-logo-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

/* Coin row */
.coin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}
.coin-row:active { background: var(--panel2); }
.coin-row:last-child { border-bottom: none; }
.coin-info { flex: 1; min-width: 0; }
.coin-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.coin-price { text-align: right; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coin-change { text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 56px; white-space: nowrap; }

/* Price flash */
/* Follows the chosen rise/fall colours (Korean red/blue or global green/red) through --up / --down. */
@keyframes flash-up { from { background: color-mix(in srgb, var(--up) 32%, transparent); } to { background: transparent; } }
@keyframes flash-down { from { background: color-mix(in srgb, var(--down) 32%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation-duration: 0.01s; } }
.flash-up { animation: flash-up 1.4s ease-out; }
.flash-down { animation: flash-down 1.4s ease-out; }

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.75; }
.btn-primary {
  background: var(--amber);
  color: var(--on-amber);
  border-color: var(--amber);
}

/* Chip */
.chip {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  background: none;
}
.chip.active {
  background: var(--amber);
  color: var(--on-amber);
  border-color: var(--amber);
  font-weight: 700;
}

/* Section header */
.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 20px 0 8px;
}

/* Settings row */
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-height: 46px;
}
.setting-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.setting-label { flex: 1; font-size: 15px; }
.setting-value { font-size: 14px; color: var(--muted); }
.setting-chevron { font-size: 12px; color: var(--muted); opacity: 0.7; }

/* Gradient bar (Fear & Greed) */
.gradient-bar {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--fng-fear), var(--fng-neutral), var(--fng-greed));
  position: relative;
}
.spark-svg { display: block; }
.gradient-bar-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--panel);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Range bar (24h low-high) */
.range-bar {
  height: 3px;
  border-radius: 1.5px;
  background: var(--line);
  position: relative;
}
.range-bar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 30px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Horizontal divider */
.divider { height: 1px; background: var(--line); }

/* Bottom sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 301;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  padding-top: 24px;
  padding-bottom: calc(8px + var(--safe-b));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet.open { transform: translateY(0); }
.sheet.open.dragging { transform: translateY(var(--drag, 0px)); transition: none; }
.sheet:focus { outline: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.sheet-grabber { flex-shrink: 0; touch-action: none; }
.sheet-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px;
  padding-bottom: 8px; background: var(--panel);
  touch-action: none;
}
.sheet-head input { touch-action: manipulation; }
.sheet-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 800; }
.sheet-search { flex-basis: 100%; }
.sheet-search input {
  width: 100%; min-height: 44px; padding: 9px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); outline: none;
}
.sheet-note { font-size: 12px; color: var(--amber-ink); line-height: 1.5; }
.sheet-note:not(:empty) { padding: 4px 2px 8px; }
.sheet-text { margin: 4px 0 16px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.sheet-text b { color: var(--text); }
.sheet-action { width: 100%; }
/* Page scroll lock (sheet open, coin overlay open): on <html> only — overflow:hidden on <body> would make it
   the scroll container for the sticky top/tab bars. body has overflow-x:hidden, which stops propagating to the
   viewport once <html> is not `visible` and would turn <body> into a scroll container, so it is released. */
html.sheet-open, html.scroll-locked { overflow: hidden; }
html.sheet-open body, html.scroll-locked body { overflow: visible; }

/* Icon button: 44px target */
.icon-btn {
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; cursor: pointer;
}
.icon-btn.danger { color: var(--down); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.btn-active { border-color: var(--amber); color: var(--amber-ink); }

/* Add-coin results */
.add-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 6px 4px;
  border: none; border-bottom: 1px solid var(--line); background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.add-row.added { opacity: 0.45; cursor: default; }
.add-rank { width: 34px; flex-shrink: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.add-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-sym { color: var(--muted); }
.add-pill { flex-shrink: 0; padding: 5px 10px; border-radius: 6px; background: var(--up); color: var(--on-up); font-size: 12px; font-weight: 700; }
.add-tag { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.add-empty { padding: 10px 4px; font-size: 12px; color: var(--muted); }

/* Watchlist */
.watch-toolbar { display: flex; gap: 6px; padding: 12px 0 10px; }
.watch-more { width: 100%; margin-top: 8px; }
.bg-up { background: var(--up); } .bg-down { background: var(--down); } .bg-flat { background: var(--muted); }
.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: 2.5px;
  background: var(--line);
  margin: 0 auto 16px;
}

/* Settings: checkable exchange rows */
.setting-check {
  width: 100%;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.setting-check:disabled { cursor: not-allowed; opacity: 0.5; }
.setting-checkmark { color: var(--amber-ink); font-weight: 800; min-width: 16px; text-align: right; }
.setting-note { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.setting-subhead { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 16px 2px; }
.setting-footer { font-size: 11px; color: var(--muted); line-height: 1.5; padding: 6px 4px 0; }

/* ── Coin page (views/coin.js) ─────────────────────────────── */
.coin-bar {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding-bottom: 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.coin-back {
  width: 36px; height: 36px; margin-left: -8px; flex-shrink: 0;
  border: none; background: none; color: var(--text); font-size: 30px; line-height: 1; cursor: pointer;
}
.coin-titles { flex: 1; min-width: 0; }
.coin-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.coin-titles .coin-title { flex: none; }
.coin-sub-title { font-size: 11px; color: var(--muted); }
.coin-star {
  width: 34px; height: 34px; flex-shrink: 0; border: none; background: none;
  font-size: 20px; color: var(--muted); cursor: pointer;
}
.coin-star.on { color: var(--amber-ink); }
.coin-bar-msg { flex-basis: 100%; font-size: 11px; color: var(--amber-ink); text-align: right; }
.coin-trade { position: relative; flex-shrink: 0; }
.coin-trade-btn {
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--teal);
  background: none; color: var(--teal); font-size: 12px; font-weight: 700; cursor: pointer;
}
.coin-trade-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 190px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.coin-trade-link {
  display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.coin-trade-link .text-muted { font-size: 10.5px; font-weight: 500; }
.coin-trade-link:active { background: var(--panel2); }
.coin-trade-foot { font-size: 10px; color: var(--muted); padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }

.coin-price-block { padding: 12px 0 10px; }
.coin-price-big { font-size: 24px; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.coin-price-sub { font-size: 12px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

.coin-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.coin-ranges, .coin-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.coin-ranges .chip { padding: 5px 9px; }
.coin-tool {
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line);
  background: none; color: var(--muted); font-size: 12px; cursor: pointer;
}
.coin-tool.accent { border-color: var(--amber); color: var(--amber-ink); }
.coin-style { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.coin-style-btn { width: 32px; border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.coin-style-btn.on { background: var(--amber); color: var(--on-amber); }

.coin-chart { position: relative; }
.coin-chart-canvas { position: absolute; inset: 0; }
.coin-chart-msg {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  padding: 0 16px; text-align: center; white-space: pre-line; font-size: 12px; color: var(--muted); background: var(--bg);
  border-radius: 10px;
}
.coin-chart-msg[hidden] { display: none; }
.coin-chart-meta { margin-top: 6px; }
.coin-ma-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; }
.coin-ma-legend i { display: inline-block; width: 10px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 4px; }
.coin-ma-legend b { font-variant-numeric: tabular-nums; }
.coin-src-note { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.coin-body { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.coin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.coin-stat { padding: 12px 10px; }
.coin-stat-label { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-stat-value { font-size: 15px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-stat-ends { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 9.5px; color: var(--text); opacity: 0.8; font-variant-numeric: tabular-nums; min-height: 11px; }
.coin-stat-ends span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-stat-foot { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-faint { font-weight: 400; opacity: 0.8; }
.coin-fg-row { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.coin-fg-value { font-size: 18px; font-weight: 800; }
.coin-fg-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.coin-sig-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.coin-sig-names { display: flex; flex-direction: column; font-size: 12px; min-width: 52px; }
.coin-sig-names span { font-size: 9.5px; }
.coin-sig-mid { flex: 1; min-width: 0; }
.coin-sig-counts { font-size: 9.5px; margin-top: 3px; min-height: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-sig-rating { font-size: 12px; font-weight: 800; min-width: 58px; text-align: right; white-space: nowrap; }
.coin-ex { padding: 12px 0 6px; }
.coin-ex-title { padding: 0 14px 6px; }
.coin-ex-row { display: grid; grid-template-columns: 1fr auto 64px; gap: 10px; padding: 7px 14px; font-size: 13px; border-top: 1px solid var(--line); }
.coin-ex-row span:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.coin-ex-head { font-size: 11px; color: var(--muted); font-weight: 600; border-top: none; }
.coin-ex-wait { padding: 6px 14px; font-size: 11px; }
.coin-premium-title { font-size: 13px; font-weight: 700; }
.coin-premium-now { font-size: 11px; margin-top: 2px; }
.coin-premium-disc { font-size: 9.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.coin-disclaimer { font-size: 10px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.text-flat { color: var(--muted); }

/* Home / list helpers (layout in layout.css) */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-head .section-title { margin: 0; }
.section-link { background: none; border: none; color: var(--teal); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 4px; }
.market-search { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 12px 0; }
.market-search input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: 14px; outline: none; }
.list-note { font-size: 11px; padding: 0 4px 8px; }
.pager { display: flex; justify-content: center; gap: 12px; padding: 16px; }
.movers-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.movers-foot { font-size: 12px; text-align: center; padding: 8px; }
.summary-title { font-size: 12px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-value { font-size: 16px; font-weight: 700; white-space: nowrap; }
.summary-chg { font-size: 12px; font-weight: 600; }
.summary-sub { font-size: 12px; }
.watch-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.watch-head > span { font-size: 17px; font-weight: 800; }

/* ── Dialog sheets (dialogs.js) ─────────────────────────────── */
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions > .btn { flex: 1; }
.sheet-form { display: flex; flex-direction: column; gap: 12px; }
.sheet-input, .tf-input {
  width: 100%; min-height: 44px; padding: 9px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); outline: none;
}
.sheet-input:focus, .tf-input:focus { border-color: var(--amber); }
.sheet-text { white-space: pre-line; }
.btn-danger { background: var(--down); border-color: var(--down); color: var(--on-down); }
.btn-buy { background: var(--up); border-color: var(--up); color: var(--on-up); }
.btn-sell { background: var(--down); border-color: var(--down); color: var(--on-down); }
.option-list { display: flex; flex-direction: column; }
.option-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1; min-width: 0;
  min-height: 48px; padding: 8px 4px; border: none; border-bottom: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.option-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-row.danger { color: var(--down); }
.option-check { color: var(--amber-ink); font-weight: 800; }

/* ── Portfolio (views/portfolio.js) ─────────────────────────── */
.pf-modes { display: flex; gap: 4px; padding: 3px; margin: 12px 0; border-radius: 10px; background: var(--panel2); }
.pf-mode { flex: 1; min-width: 0; min-height: 44px; padding: 4px; word-break: keep-all; line-height: 1.25; border: none; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.pf-mode.on { background: var(--panel); color: var(--text); }
.pf-intro { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 0 2px 10px; }
.pf-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pf-toolbar .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 24px; }
.pf-trade-btns { display: flex; gap: 8px; margin-bottom: 16px; }
.pf-trade-btns .btn { flex: 1; font-size: 15px; font-weight: 800; }
.pf-total { margin: 4px 2px 14px; }
.pf-total-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.pf-total-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-section-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.pf-section-tab {
  flex: 1; min-height: 44px; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
.pf-section-tab.on { color: var(--text); border-bottom-color: var(--amber); }
.pf-col { min-width: 0; }
.pf-pills { display: flex; gap: 6px; margin-bottom: 12px; }
.pf-pill { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.pf-pill.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.pf-assets-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pf-sort { min-height: 44px; padding: 0 6px; border: none; background: none; font-size: 12px; cursor: pointer; color: var(--text); }
.pf-sort-value { color: var(--amber-ink); }
.coin-table .td.est { font-style: italic; color: var(--muted); }
.pf-saved { font-size: 11px; color: var(--muted); margin: 12px 2px; }
.pf-soon { padding-top: 48px; }

.pf-alloc-card { padding: 16px 12px 8px; }
.pf-donut-wrap { position: relative; width: min(220px, 62%); aspect-ratio: 1; margin: 0 auto 12px; }
.pf-donut { width: 100%; height: 100%; display: block; }
.pf-slice { cursor: pointer; transition: opacity 0.25s; }
.pf-slice.dim { opacity: 0.25; }
.pf-donut-center { position: absolute; inset: 22%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.pf-dc-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.pf-dc-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-dc-sub { font-size: 11px; color: var(--muted); }
.pf-legend {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 4px;
  border: none; border-top: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.pf-legend.dim { opacity: 0.45; }
.pf-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pf-other-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--panel2); color: var(--muted); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pf-legend-names { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.pf-legend-names > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-legend-names .text-muted { font-size: 9px; }
.pf-legend-vals { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.pf-legend-vals b { font-size: 14px; }
.pf-legend-vals span { font-size: 11px; white-space: nowrap; }
.pf-legend-vals .est { font-style: italic; }
.pf-alloc-missing { font-size: 11px; color: var(--muted); padding: 8px 4px 4px; border-top: 1px solid var(--line); }

.pf-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pf-coin-cards { display: flex; gap: 8px; margin-bottom: 14px; }
.pf-coin-card { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--panel2); display: flex; flex-direction: column; }
.pf-cc-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.pf-cc-value { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-cc-sym { font-size: 11px; color: var(--muted); }
.pf-cc-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.pf-date { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 2px 6px; }
.pf-date:first-child { margin-top: 0; }
.pf-tx {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 12px;
  border: none; border-top: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.pf-tx:first-child { border-top: none; }
.pf-tx-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-tx-mid > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-tx-mid b { font-size: 13px; }
.pf-tx-mid span { font-size: 11px; }
.pf-tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; max-width: 50%; }
.pf-tx-right > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pf-tx-right b { font-size: 13px; }
.pf-tx-right span { font-size: 11px; }

.pf-pick-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.pf-pick-row .option-row { border-bottom: none; }
.pf-add { justify-content: center; color: var(--amber-ink); font-weight: 700; }
.pf-ex-head { font-size: 12px; font-weight: 700; margin: 4px 2px 8px; }
.pf-ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 16px; }
.pf-ex-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-width: 0; min-height: 54px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.pf-ex-tile b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-ex-tile span { font-size: 10px; }
.pf-ex-tile.on { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--panel2)); }
.pf-ex-tile:disabled { opacity: 0.5; cursor: not-allowed; }
.pf-ex-note { color: var(--muted); line-height: 1.3; }

.pf-wallet { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.pf-wallet .section-title { margin: 8px 0 0; }
.pf-w-intro p, .pf-w-pro p { font-size: 11px; line-height: 1.6; margin-top: 6px; }
.pf-w-total-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-w-row { display: flex; flex-direction: column; gap: 8px; }
.pf-w-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pf-w-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-w-chain { padding: 2px 7px; border-radius: 999px; background: var(--amber); color: var(--on-amber); font-size: 10px; font-weight: 800; }
.pf-w-bal { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; font-variant-numeric: tabular-nums; }
.pf-w-bal b { font-size: 17px; }
.pf-w-foot { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.pf-w-foot > span { flex: 1; min-width: 0; }
.pf-w-btn { min-height: 44px; font-size: 11px; }
.pf-w-addr { font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-w-form { display: flex; flex-direction: column; gap: 8px; }
.pf-w-safety { font-size: 10px; color: var(--muted); line-height: 1.6; }

/* ── Trade sheet (views/trade-sheet.js) ─────────────────────── */
.tf-field { display: flex; flex-direction: column; min-width: 0; margin-bottom: 12px; }
.tf-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 2px 5px; }
.tf-req { color: var(--amber-ink); font-weight: 700; }
.tf-opt { font-weight: 500; }
.tf-row { display: flex; gap: 6px; }
.tf-row > .tf-input, .tf-input-wrap { flex: 1; min-width: 0; }
.tf-input-wrap { position: relative; }
.tf-input-wrap .tf-input { padding-right: 64px; }
.tf-unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--muted); pointer-events: none; }
.tf-swap { min-width: 44px; font-size: 18px; color: var(--amber-ink); }
.tf-hint { min-height: 16px; margin: 4px 2px 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Price and date sit side by side and wrap onto two lines when the sheet is narrow (no breakpoint needed). */
.tf-pair { display: flex; flex-wrap: wrap; column-gap: 8px; }
.tf-pair > .tf-field { flex: 1 1 140px; }
.tf-pair > .tf-date { flex: 1 1 150px; }
.tf-error { font-size: 12px; color: var(--down); }
.tf-error:not(:empty) { margin-bottom: 8px; }
/* The submit button stays in view at the bottom of the sheet (also above the on-screen keyboard). */
.tf-submit { position: sticky; bottom: 0; width: 100%; font-size: 15px; font-weight: 800; box-shadow: 0 -8px 12px var(--panel); }

/* ── Shared bits for the paper / strategy / wallet screens (views/ui-kit.js) ─── */
.chip-row { display: flex; gap: 6px; align-items: center; }
.chip-wrap { flex-wrap: wrap; }
.tf-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tf-label-row .tf-label { margin-bottom: 0; }
.link-btn { min-height: 44px; padding: 0 2px; border: none; background: none; color: var(--teal); font-size: 12px; font-weight: 600; cursor: pointer; }
.tf-hint-err { color: var(--down); font-weight: 600; }
.line-chart { display: block; width: 100%; overflow: visible; }
.lc-grid { stroke: var(--line); stroke-width: 1; fill: none; opacity: 0.6; }
.lc-base { stroke: var(--muted); stroke-width: 1; fill: none; opacity: 0.5; }
.lc-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lc-line.lc-dash { stroke-width: 1.7; stroke-dasharray: 4 3; }
.lc-amber { stroke: var(--amber); background: var(--amber); }
.lc-teal { stroke: var(--teal); background: var(--teal); }
.lc-line.text-up { stroke: var(--up); }
.lc-line.text-down { stroke: var(--down); }
.lc-line.text-flat { stroke: var(--muted); }
.lc-dot { fill: none; stroke-width: 6; stroke-linecap: round; }
.lc-dot.lc-up { stroke: var(--up); }
.lc-dot.lc-down { stroke: var(--down); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; }

/* Wallet gate (views/wallet-connect.js) */
.locked-notice {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; min-height: 44px; margin: 0 0 14px; padding: 12px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  color: var(--text); font: inherit; font-size: 12px; line-height: 1.55; text-align: left; cursor: pointer;
}
.locked-icon { color: var(--amber-ink); font-size: 13px; }
.labs-locked { opacity: 0.4; }
.wc-seg { display: flex; gap: 4px; padding: 3px; margin-bottom: 16px; border-radius: 10px; background: var(--panel2); }
.wc-seg-btn { flex: 1; min-height: 44px; border: none; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.wc-seg-btn.on { background: var(--panel); color: var(--text); }
.wc-confirm { width: 100%; min-height: 48px; font-size: 16px; }
.wc-done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0; }
.wc-check { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--up); color: var(--on-up); font-size: 26px; font-weight: 800; }
.wc-done-text { font-size: 16px; font-weight: 700; }
.wc-disconnect { width: 100%; min-height: 48px; border-color: var(--down); color: var(--down); font-size: 14px; }
.setting-nav { width: 100%; border: none; background: none; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.setting-nav .setting-label { flex: 1; min-width: 0; }
.setting-nav .setting-icon { width: auto; height: auto; margin: 0; border-radius: 0; background: none; font-size: 16px; }

/* Signal marks (iOS: a notification) */
.tab-btn { position: relative; }
.tab-badge {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--up); color: var(--on-up); font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.tab-badge[hidden] { display: none; }
.pf-mode-dot { display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--up); vertical-align: middle; }

/* ── Paper trading (views/paper-view.js) ─────────────────────── */
.paper-h { font-size: 15px; font-weight: 700; margin: 0 4px 8px; }
.paper-small { font-size: 12px; line-height: 1.5; margin: 6px 4px 0; }
.paper-disclaimer { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 16px 2px 0; }
.paper-intro { display: flex; flex-direction: column; gap: 10px; }
.paper-intro-icon { font-size: 30px; }
.paper-intro-title { font-size: 19px; font-weight: 800; margin: 0; }
.paper-intro-body { font-size: 13px; line-height: 1.6; margin: 0; }
.paper-start { min-height: 48px; margin-top: 4px; font-size: 15px; font-weight: 800; }
.paper-whatif { width: 100%; min-height: 44px; margin-top: 12px; }
.paper-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.paper-pick { min-width: 0; min-height: 44px; gap: 6px; border: none; background: none; padding-left: 4px; font-size: 14px; }
.paper-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-pick .text-muted { font-weight: 500; white-space: nowrap; }
.paper-caret { font-size: 10px; }
.paper-menu { font-size: 22px; }
.paper-total { margin-bottom: 12px; }
.paper-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.paper-total-value { font-size: 26px; font-weight: 800; margin: 4px 0; overflow-wrap: anywhere; }
.paper-pnl { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 13px; }
.paper-pnl .text-muted { font-size: 12px; }
.paper-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.paper-stat { min-width: 0; font-size: 11px; }
.paper-stat .mono { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.paper-funding { font-size: 11px; margin-top: 8px; overflow-wrap: anywhere; }
.paper-equity, .paper-goal, .paper-goal-btn { margin-top: 12px; }
.paper-goal-btn { width: 100%; min-height: 44px; }
.paper-chart { height: 130px; margin: 10px 0 4px; }
.paper-goal-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.paper-goal-top .text-muted { font-size: 12px; }
.paper-bar { height: 8px; margin: 10px 0 4px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.paper-bar-fill { height: 100%; border-radius: 4px; background: var(--amber); }
.paper-bar-fill.done { background: var(--up); }
.paper-sec { margin-top: 16px; }
.paper-col > .paper-sec:first-child { margin-top: 0; }
.paper-empty { padding: 20px 12px; font-size: 12px; }
.paper-list { display: flex; flex-direction: column; }
.paper-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 9px 12px;
  border: none; border-top: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left;
}
.paper-list > :first-child { border-top: none; }
button.paper-row { cursor: pointer; }
.paper-row-mid { flex: 1; min-width: 0; }
.paper-row-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-row-sub { font-size: 10.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-row-end { text-align: right; font-size: 12px; flex-shrink: 0; }
.paper-row-end .mono:first-child { font-weight: 600; }
.paper-side { width: 34px; flex-shrink: 0; font-size: 11px; font-weight: 800; }
.paper-cancel { min-height: 44px; padding: 6px 12px; flex-shrink: 0; }
.paper-trade { padding: 9px 12px; border-top: 1px solid var(--line); }
.paper-trade-top { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.paper-trade-top .paper-row-name { font-size: 12px; min-width: 0; }
.paper-trade-price { margin-left: auto; font-size: 11px; white-space: nowrap; }
.paper-trade-sub { display: flex; gap: 6px; margin-top: 4px; font-size: 10.5px; min-width: 0; }
.paper-note { color: var(--text); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.paper-badge { flex-shrink: 0; padding: 1px 6px; border: 1px solid var(--teal); border-radius: 999px; color: var(--teal); font-size: 9px; font-weight: 800; }
.new-badge { margin-left: 6px; border-color: var(--up); color: var(--up); vertical-align: 1px; }
.paper-medal { width: 26px; flex-shrink: 0; text-align: center; font-size: 14px; }
.paper-hall-pct { font-size: 13px; font-weight: 800; flex-shrink: 0; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.paper-actions > .btn { flex: 1 1 150px; min-height: 44px; margin: 0; }

/* Paper sheets (views/paper-sheets.js) and the shared coin picker (views/coin-picker.js) */
.pt-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pt-summary { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; padding: 10px; border-radius: 8px; background: var(--panel2); font-size: 12px; }
.pt-sum-row { display: flex; justify-content: space-between; gap: 8px; }
.pt-sum-row .mono { text-align: right; overflow-wrap: anywhere; }
.pt-amount-field .chip-row { margin-top: 6px; }
.pn-seed { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pn-check { min-width: 64px; min-height: 44px; }
.pn-safety { font-size: 11px; color: var(--muted); line-height: 1.5; }
.cp-picked { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--panel2); }
.cp-picked .cp-name { font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-picked .text-muted { font-size: 13px; }
.cp-change { margin-left: auto; min-height: 44px; padding: 0 10px; border: none; background: none; color: var(--teal); font-size: 13px; font-weight: 600; cursor: pointer; }
.cp-list { display: flex; flex-direction: column; margin-top: 4px; }
.cp-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border: none; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.cp-row .cp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-row .text-muted { font-size: 12px; }
.cp-row:active { background: var(--panel2); }
.wi-result-box:not(:empty) { margin-bottom: 12px; }
.wi-result { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; background: var(--panel2); }
.wi-small { font-size: 11px; }
.wi-worth { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.wi-pct { font-size: 14px; font-weight: 700; }
.wi-spark { height: 44px; }
.wi-skeleton { height: 90px; border-radius: 10px; }
.ps-card {
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin: 0 auto 14px; padding: 20px;
  border-radius: 20px; background: linear-gradient(135deg, var(--share-a), var(--share-b)); color: var(--share-ink);
}
.ps-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ps-app { font-size: 15px; font-weight: 800; }
.ps-tag { padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--share-ink) 18%, transparent); font-size: 11px; font-weight: 700; }
.ps-sub { font-size: 13px; opacity: 0.85; overflow-wrap: anywhere; }
.ps-pct { font-size: 44px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.ps-line { font-size: 13px; font-weight: 600; opacity: 0.9; overflow-wrap: anywhere; }
.ps-foot { font-size: 10px; opacity: 0.7; }
.coin-trade-paper { width: 100%; border: none; background: none; font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.coin-trade-sep { height: 1px; margin: 2px 0; background: var(--line); }

/* ── Strategy lab (views/strategy-view.js) ─────────────────── */
.strategy-disclaimer {
  margin: 0 0 14px; padding: 10px; border-radius: 10px; font-size: 11px; line-height: 1.55;
  background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber-ink);
}
.strategy-sec { margin-bottom: 16px; }
.strategy-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.strategy-kind {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
}
.strategy-kind.on { background: var(--amber); border-color: var(--amber); color: var(--on-amber); }
.strategy-kind-icon { color: var(--teal); flex-shrink: 0; }
.strategy-kind.on .strategy-kind-icon { color: var(--on-amber); }
.strategy-kind-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.strategy-detail { font-size: 12px; line-height: 1.6; margin: 10px 2px; }
.strategy-params { display: flex; flex-direction: column; }
.stepper { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.strategy-params > :first-child { border-top: none; }
.stepper-label { flex: 1; min-width: 0; }
.stepper-value { font-weight: 600; white-space: nowrap; }
.stepper-ctl { display: flex; gap: 2px; flex-shrink: 0; }
.stepper-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper-btn:disabled { opacity: 0.35; cursor: default; }
.strategy-result { margin-bottom: 12px; }
.strategy-result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.strategy-result-head .paper-h { margin-bottom: 0; }
.signal-badge { padding: 3px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 800; }
.strategy-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.strategy-metrics-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.strategy-metric { min-width: 0; padding: 10px; border-radius: 8px; background: var(--panel2); font-size: 11px; }
.strategy-metric .text-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strategy-metric-value { margin-top: 3px; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.strategy-chart { height: 150px; margin: 12px 0 8px; }
.strategy-skeleton { height: 180px; margin-top: 10px; border-radius: 10px; }
.strategy-recent { margin-top: 10px; font-size: 11px; }
.strategy-recent-title { font-weight: 600; margin-bottom: 4px; }
.strategy-recent-row { display: flex; gap: 8px; align-items: center; min-height: 22px; }
.strategy-recent-row .mono { margin-left: auto; }
.strategy-interval { font-size: 10px; margin: 8px 0 0; }
.strategy-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.strategy-actions .btn { min-height: 46px; font-size: 14px; }
.strategy-watch.is-new { background: color-mix(in srgb, var(--up) 8%, transparent); }
.strategy-auto { color: var(--teal); }
.strategy-bell { font-size: 15px; flex-shrink: 0; }

/* ── Phase 07: app feel, stacked dialogs, native fallbacks ─────────────────── */
/* Pressed state on every touch control (the tap highlight is off). :where() keeps it weaker than any
   control's own :active rule. */
:where(button, a[href], [role="button"], [role="option"], [role="tab"], .chip, .option-row, .setting-row):active:not(:disabled) { opacity: 0.65; }
:where(.coin-table .tr:not(.th), .coin-row):active { background: var(--panel2); }

/* A dialog opened over a sheet (sheet.js `stack`) sits above it with its own backdrop. */
.sheet-backdrop--stacked { z-index: 302; }
.sheet--stacked { z-index: 303; }

/* In-page notification (native.js notify fallback). */
.native-banner {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 8px); z-index: 400;
  display: flex; flex-direction: column; gap: 2px; width: min(420px, calc(100% - 32px)); padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -150%); opacity: 0; transition: transform 0.25s, opacity 0.25s; pointer-events: none;
}
.native-banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.native-banner span { color: var(--muted); font-size: 12px; }

/* Text to copy by hand (native.js copyText last fallback). */
.copy-box { width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 13px; }

/* Outdated engine notice (compat.js). Plain properties only: it must render on old engines too. */
.compat-notice {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b, 0px) + 76px); z-index: 450;
  max-width: 520px; margin: 0 auto; padding: 14px 16px;
  border: 1px solid var(--amber); border-radius: 12px; background: var(--panel); color: var(--text);
  font-size: 13px; line-height: 1.55; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.compat-notice p { margin: 6px 0 10px; color: var(--muted); }
.compat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.compat-actions .btn { flex: 1 1 140px; min-height: 44px; }

/* ── Phase 08: settings sections, backup, alerts, info ─────────────────────── */
.settings-section { margin-top: 20px; }
.setting-divider { margin-left: 16px; }
.setting-row .setting-icon { width: 28px; height: auto; margin: 0; border-radius: 0; background: none; font-size: 16px; flex-shrink: 0; }
.setting-value.is-bad { color: var(--down); font-weight: 700; }
.settings-disclaimer { font-size: 11px; color: var(--muted); line-height: 1.6; padding: 16px 0; text-align: center; }
.coin-stat-bar { margin-top: 9px; }
.coin-fg-bar { margin-top: 10px; }
.home-fg-bar { margin-top: 6px; }

/* Backup sheet (views/backup-sheet.js). The code box scrolls inside itself. */
.bk-desc { margin-bottom: 12px; }
.bk-code {
  display: block; width: 100%; height: 132px; min-height: 96px; resize: none; overflow-y: auto; overscroll-behavior: contain;
  font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace; word-break: break-all;
}
.bk-code[readonly] { color: var(--muted); }
.bk-hint { min-height: 18px; margin: 6px 2px 10px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.bk-hint.is-error { color: var(--down); font-weight: 600; }
.bk-actions { display: flex; flex-direction: column; gap: 8px; }
.bk-actions .btn { min-height: 46px; font-size: 14px; }
.bk-file { display: none; }

/* Alert sheets (views/alert-sheet.js) */
.al-block { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.al-now { margin: 0 2px; }
.al-hint { min-height: 18px; font-size: 12px; font-weight: 600; color: var(--teal); line-height: 1.5; }
.al-note { font-size: 12px; color: var(--amber-ink); line-height: 1.5; }
.al-note:not(:empty) { margin-bottom: 8px; }
.al-small { font-size: 11px; line-height: 1.55; margin: 4px 2px 10px; }
.al-mine { margin-top: 14px; }
.al-rows { background: var(--panel2); }
.al-row.is-off .paper-row-name { color: var(--muted); }
.al-bell { font-size: 15px; flex-shrink: 0; }
.al-bell:not(.on) { filter: grayscale(1); opacity: 0.6; }
.coin-bell { width: 44px; height: 44px; flex-shrink: 0; border: none; background: none; font-size: 18px; cursor: pointer; filter: grayscale(1); opacity: 0.75; }
.coin-bell.on { filter: none; opacity: 1; }
.kimp-alert-btn {
  min-height: 44px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: none; color: var(--teal); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}

/* Info sheets (views/info-sheet.js) */
.info-sections { display: flex; flex-direction: column; gap: 18px; padding: 0 2px 24px; }
.info-h { font-size: 14px; font-weight: 700; margin: 0 0 6px; }
.info-contact-addr { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--amber-ink); overflow-wrap: anywhere; cursor: pointer; }
.info-contact-hint { font-size: 12px; color: var(--muted); }
.info-b { font-size: 13px; line-height: 1.7; color: var(--muted); white-space: pre-line; margin: 0; overflow-wrap: anywhere; }

/* Phase 09: coin rows are buttons (keyboard + screen readers); their parts are spans laid out as blocks. */
.coin-logo { display: block; }
.coin-logo img { display: block; }
button.coin-row { width: 100%; border: none; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; }
.coin-row .coin-name, .coin-row .coin-sub { display: block; }

/* ── Phase 09: top bar, ticker strip, pull-to-refresh, FX panel, focus ─────── */
/* Row 1 of the top bar: name · update status · refresh (iOS HeaderRow). */
.update-status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.update-status.warn { color: var(--amber-ink); font-weight: 600; }
.refresh-btn { flex-shrink: 0; color: var(--muted); margin-right: -10px; }
.refresh-btn svg { width: 16px; height: 16px; }
.refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Row 2: the index strip [USD/KRW │ Fear & Greed │ Market cap] (iOS TickerStrip), hidden on Home. */
.ticker-strip {
  /* Clipped sideways only: the FX item's 44 px touch target reaches 7 px above and below the strip. */
  position: relative; display: flex; align-items: center; height: var(--ticker-h); overflow-x: clip; overflow-y: visible;
  border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l)); padding: 0 var(--pad-r) 0 var(--pad-l);
  font-size: 11px; color: var(--muted); white-space: nowrap;
}
[data-tab="home"] .ticker-strip { display: none; }
.ticker-track { display: flex; align-items: center; min-width: 100%; }
.ticker-group { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1 0 auto; }
.ticker-clone, .tk-seam { display: none; }
.ticker-strip.marquee { -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
.ticker-strip.marquee .ticker-track { width: max-content; min-width: 0; animation: ticker-scroll var(--ticker-dur, 30s) linear infinite; }
.ticker-strip.marquee .ticker-group { justify-content: flex-start; flex: none; }
.ticker-strip.marquee .ticker-clone { display: flex; }
.ticker-strip.marquee .tk-seam { display: block; width: 69px; height: 12px; flex: none; background: linear-gradient(var(--line), var(--line)) center / 1px 100% no-repeat; }
.ticker-strip.paused .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  /* No marquee: the strip can be scrolled by hand instead. */
  .ticker-strip.marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; scrollbar-width: none; overscroll-behavior-x: contain; }
  .ticker-strip.marquee button.ticker-item { min-height: 0; }
  .ticker-strip.marquee .ticker-track { animation: none; }
  .ticker-strip.marquee .ticker-clone, .ticker-strip.marquee .tk-seam:last-child { display: none; }
}
.ticker-item { display: inline-flex; align-items: baseline; gap: 5px; flex: none; }
button.ticker-item { min-height: 44px; align-items: center; padding: 0; border: none; background: none; color: inherit; font: inherit; cursor: pointer; }
.tk-label { color: var(--muted); }
.tk-val { font-size: 12px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; border-radius: 4px; padding: 0 2px; }
.tk-amber { color: var(--amber-ink); }
.tk-chg { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-fng-label { font-weight: 700; }
.tk-div { width: 1px; height: 12px; background: var(--line); flex: none; }
.tk-skel { display: inline-block; width: 64px; height: 11px; }
.fng-xfear, .fng-fear { color: var(--fng-fear-ink); }
.fng-neutral { color: var(--fng-neutral-ink); }
.fng-greed, .fng-xgreed { color: var(--fng-greed-ink); }

/* Pull-to-refresh indicator (gestures.js), a fixed layer below the top bar. */
.pull-indicator {
  position: fixed; left: 50%; top: calc(var(--safe-t) + var(--topbar-h)); z-index: 150;
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, calc(var(--pull, 0px) - 40px)); opacity: 0; pointer-events: none;
}
.pull-indicator.show { opacity: 1; }
.pull-indicator.ready, .pull-indicator.spinning { color: var(--amber-ink); }
.pull-indicator svg { width: 16px; height: 16px; transform: rotate(var(--pull-rot, 0deg)); }
.pull-indicator.spinning svg { animation: spin 0.7s linear infinite; }

/* FX panel (views/fx-panel.js) */
.fx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fx-delta { font-size: 11px; }
.fx-now { font-size: 18px; font-weight: 800; }
.fx-ranges { margin-bottom: 10px; }
.fx-chart { position: relative; height: 190px; border-radius: 10px; }
.fx-msg { font-size: 12px; color: var(--muted); text-align: center; white-space: pre-line; }
.fx-msg:not(:empty) { padding: 12px 0; }
.fx-note { font-size: 11px; color: var(--muted); margin-top: 8px; min-height: 16px; }
.card-button { cursor: pointer; }

/* Keyboard focus is always visible (the tap highlight is off). */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tab-view:focus-visible { outline-offset: -2px; }

/* TradingView attribution under the charts (chart-lib.js chartCredit). */
.chart-credit { display: block; margin-left: auto; font-size: 10px; font-weight: 500; color: var(--muted); }
