/* DeepSeek Budget — Minimal design system
   Tokens: primary=#4D6BFE (DeepSeek), peak=#F59E0B, text=#0C0C09, surface=#F4F4F1
   Spacing scale: 4/8/12/16/24/32 */
:root {
  --primary: #4D6BFE;
  --primary-soft: #EEF1FF;
  --peak: #D97706;
  --peak-soft: #FEF3E2;
  --success: #16A34A;
  --success-soft: #EAF7EF;
  --text: #0C0C09;
  --text-2: #5B5B54;
  --text-3: #8A8A80;
  --line: #E5E5DF;
  --surface: #FFFFFF;
  --bg: #F4F4F1;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(12,12,9,.04), 0 4px 16px rgba(12,12,9,.05);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: var(--space-4) var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 22px; height: 22px; color: var(--primary); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }

.seg {
  display: inline-flex; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; gap: 2px;
}
.seg-btn {
  border: none; background: transparent; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-2); padding: 5px 14px; border-radius: 999px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(12,12,9,.08); }
.seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Layout */
.container { max-width: 920px; margin: 0 auto; padding: var(--space-8) var(--space-6) var(--space-8); display: flex; flex-direction: column; gap: var(--space-6); }

/* Status card */
.status-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-8) var(--space-6);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6);
  flex-wrap: wrap;
  border-top: 3px solid var(--offpeak-color, var(--success));
  transition: border-color .3s ease;
}
.status-card[data-state="peak"] { --offpeak-color: var(--peak); }
.status-card[data-state="offpeak"] { --offpeak-color: var(--success); }
.status-card[data-state="unknown"] { --offpeak-color: var(--text-3); }

.status-left { display: flex; align-items: center; gap: var(--space-4); }
.status-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-3);
  transition: background .3s ease, box-shadow .3s ease;
}
.status-card[data-state="peak"] .status-dot { background: var(--peak); box-shadow: 0 0 0 6px var(--peak-soft); }
.status-card[data-state="offpeak"] .status-dot { background: var(--success); box-shadow: 0 0 0 6px var(--success-soft); }

.status-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.status-state { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px; }
.status-card[data-state="peak"] .status-state { color: var(--peak); }
.status-card[data-state="offpeak"] .status-state { color: var(--success); }

.status-right { text-align: right; }
.countdown { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.next-detail { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-6);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-4); }
.card-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-meta { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Today's segments */
.segments { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.segment { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; }
.segment-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 118px; color: var(--text); }
.segment-bar { flex: 1; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg); position: relative; }
.segment-bar-fill { height: 100%; border-radius: 999px; }
.segment-bar-fill.peak { background: var(--peak); }
.segment-bar-fill.offpeak { background: var(--success); }
.segment-state { font-size: 12px; font-weight: 600; min-width: 66px; text-align: right; }
.segment-state.peak { color: var(--peak); }
.segment-state.offpeak { color: var(--success); }
.segment.current .segment-state::after { content: " ·"; }

.legend { display: flex; gap: var(--space-4); margin-top: var(--space-4); font-size: 12px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-swatch.peak { background: var(--peak); }
.legend-swatch.offpeak { background: var(--success); }

/* Rules */
.rules { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.rule { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: 14px; }
.rule-window { font-variant-numeric: tabular-nums; font-weight: 700; }
.rule-days { color: var(--text-2); font-size: 13px; }
.note { margin-top: var(--space-4); font-size: 12.5px; color: var(--text-3); line-height: 1.55; }

/* Price table */
.table-wrap { overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.price-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line);
}
.price-table th.num, .price-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.price-table td { padding: var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.price-table tbody tr:last-child td { border-bottom: none; }
.price-table tbody tr:hover { background: var(--bg); }
.model-name { font-weight: 600; }
.model-version { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }
.price-off { color: var(--success); font-weight: 600; }
.price-peak { color: var(--peak); font-weight: 600; }

/* Footer */
.footer { text-align: center; font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-4); }

/* Responsive */
@media (max-width: 720px) {
  .container { padding: var(--space-6) var(--space-4); gap: var(--space-4); }
  .topbar-inner { padding: var(--space-3) var(--space-4); }
  .grid-2 { grid-template-columns: 1fr; }
  .status-card { flex-direction: column; align-items: flex-start; padding: var(--space-6) var(--space-5); }
  .status-right { text-align: left; }
  .status-state { font-size: 28px; }
  .countdown { font-size: 26px; }
  .segment-time { min-width: 100px; font-size: 13px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
