:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 14px;
  background: var(--bg-primary);
  border-bottom: 1px solid #22222e;
  flex-shrink: 0;
}
.title-block { flex: 1; min-width: 0; }
.topbar h1 {
  font-size: 26px; font-weight: 700; letter-spacing: -0.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub { font-size: 14px; color: var(--text-secondary); margin-top: 3px; }

.pulse {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.pulse.live { background: var(--accent-secondary); box-shadow: 0 0 12px var(--accent-secondary); animation: blip 2.4s ease-in-out infinite; }
.pulse.stale { background: #ffd23f; }
.pulse.err { background: var(--danger); }
@keyframes blip { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- Stats ---- */
.stats { display: flex; gap: 10px; padding: 14px 20px; flex-shrink: 0; }
.stat {
  flex: 1; background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 12px 8px; text-align: center; border: 1px solid #20202c;
}
.stat-num { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-lbl { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ---- Nav row ---- */
.navrow { display: flex; gap: 10px; padding: 0 20px 12px; flex-shrink: 0; }
.navbtn {
  flex: 1; min-height: 52px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 17px; font-weight: 600; font-family: inherit;
}
.navbtn:active { transform: scale(0.98); }

/* ---- Coin list ---- */
.list { flex: 1; overflow-y: auto; padding: 4px 16px 20px; }
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 3px; }

.coin {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
}
.sym-badge {
  width: 54px; height: 54px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; letter-spacing: -0.5px;
}
.sym-badge.long { font-size: 13px; }
.coin-info { flex: 1; min-width: 0; }
.coin-name { font-size: 18px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-rank { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.coin-right { text-align: right; flex-shrink: 0; }
.coin-price { font-size: 18px; font-weight: 700; line-height: 1.1; }
.coin-chg { font-size: 14px; font-weight: 600; margin-top: 4px; }

.up { color: var(--accent-secondary); }
.down { color: var(--danger); }
.flat { color: var(--text-secondary); }

.empty { text-align: center; color: var(--text-secondary); padding: 50px 20px; font-size: 16px; line-height: 1.5; }

/* ---- Detail ---- */
.backbtn {
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 16px; font-weight: 600; font-family: inherit;
}
.sym-tag {
  margin-left: auto; font-size: 18px; font-weight: 800;
  padding: 7px 16px; border-radius: 10px; letter-spacing: -0.3px;
  background: var(--bg-tertiary); color: var(--accent);
}
.detail-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 3px; }

.d-hero { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.d-price { font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.d-chg { font-size: 22px; font-weight: 700; }
.d-name { font-size: 18px; color: var(--text-secondary); font-weight: 600; margin-bottom: 22px; }

.lh-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.lh-bar { height: 12px; border-radius: 6px; position: relative;
  background: linear-gradient(90deg, var(--danger), #ffd23f 50%, var(--accent-secondary)); }
.lh-marker { position: absolute; top: -5px; width: 4px; height: 22px; background: #fff; border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 6px rgba(0,0,0,0.6); }
.lh-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); margin: 8px 0 22px; }

.d-rows { display: flex; flex-direction: column; gap: 2px; }
.d-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 13px 4px; border-bottom: 1px solid #1d1d28; }
.d-row:last-child { border-bottom: none; }
.d-key { font-size: 14px; color: var(--text-secondary); flex-shrink: 0; }
.d-val { font-size: 16px; font-weight: 600; text-align: right; }

/* ---- About ---- */
.about-body { flex: 1; overflow-y: auto; padding: 20px; }
.about-lead { font-size: 18px; line-height: 1.5; margin-bottom: 20px; }
.about-lead strong { color: var(--accent); }
.info-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 20px; }
.leg-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; }
.leg-row .dot { width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0; }
.up-dot { background: var(--accent-secondary); }
.down-dot { background: var(--danger); }
.about-note { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
