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

/* Palette: Calm Dark (slate) — matches the hako.to splash. week keeps its own
   sky accent (#8ec0d6). 2026-06-04. */
:root {
  color-scheme: dark;
  --bg: #151a1f;
  --bg-2: #1c2128;
  --card: #1f252d;
  --border: #262d36;
  --fg: #e8e5dd;
  --muted: #8a8e94;
  --p100: #262d36;
  --p200: #323a45;
  --p300: #6b7780;
  --p400: #8ec0d6;
  --accent: #8ec0d6;
  --accent-soft: rgba(142,192,214,0.16);
  --good: #7eb087;
  --bad: #d0876f;
  --pos: #7eb087;
  --neg: #d0876f;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
}

/* Background lives on the html canvas so it always paints the full scroll
   area (and overscroll) — no dark strip can show through at the bottom.
   Fixed attachment keeps the gradients put while scrolling. */
html {
  background:
    radial-gradient(at 12% 8%,  rgba(158,193,184,0.06) 0px, transparent 50%),
    radial-gradient(at 88% 18%, rgba(232,160,168,0.05) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(142,192,214,0.07) 0px, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  background-color: var(--bg);
}
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: transparent;
  min-height: 100vh;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1;
}

[hidden] { display: none !important; }

/* Header */
.bar {
  display: flex; align-items: center;
  max-width: 900px; margin: 0 auto; padding: 24px 24px 8px;
}
.wordmark {
  font-weight: 900; letter-spacing: -0.02em; font-size: 20px;
  color: var(--fg);
}
.wordmark .dot {
  color: var(--p400);
  text-decoration: none;
  cursor: pointer;
}
.wordmark .dot:hover { opacity: 0.7; }

main { max-width: 900px; margin: 0 auto; padding: 14px 24px 80px; }

/* Today panel */
.today {
  display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 24px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 18px;
}
@media (max-width: 640px) { .today { grid-template-columns: 1fr; gap: 18px; } }

.today-week { border-right: 1.5px solid var(--border); padding-right: 24px; }
@media (max-width: 640px) {
  .today-week { border-right: none; border-bottom: 1.5px solid var(--border); padding: 0 0 18px; }
}

.today-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 520px) { .today-stats { grid-template-columns: 1fr 1fr; } }

.kicker {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 8px;
}

.big {
  font-size: 56px; font-weight: 900; letter-spacing: -0.03em;
  line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums;
}

.num {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; color: var(--accent);
}

.muted { color: var(--muted); }
.muted.small { font-size: 12px; margin-top: 4px; }

.bar-bg {
  height: 4px; background: var(--p100); border-radius: 999px;
  margin: 8px 0 4px; overflow: hidden;
}
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--p300), var(--p400));
  transition: width .4s ease;
}

/* Ad slot */
.ad-slot {
  width: 100%; min-height: 90px; margin: 0 0 18px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

/* Grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 680px) { .grid { grid-template-columns: 1fr; } }

/* Cards */
.card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 16px;
}
.card h2 {
  margin: 0 0 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}

.row {
  display: grid; grid-template-columns: 80px 1fr;
  align-items: center; gap: 10px; margin-bottom: 8px;
}
.row > span { font-size: 13px; color: var(--muted); }

input[type="date"], input[type="number"], input[type="text"] {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  background: var(--bg-2); color: var(--fg);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-variant-numeric: tabular-nums; outline: none;
  -webkit-appearance: none;
}
input[type="date"] { font-family: var(--mono); font-size: 13px; }
input:focus { border-color: var(--p300); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Segmented control */
.seg {
  display: inline-flex; margin: 6px 0 4px;
  border: 1.5px solid var(--border); border-radius: 8px; padding: 2px;
}
.seg button {
  background: transparent; border: 0; color: var(--muted);
  padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 6px;
}
.seg button.on { background: var(--p100); color: var(--p400); }

/* Result output */
.result {
  display: block; margin-top: 12px; padding: 12px 14px;
  background: var(--bg-2); border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; font-variant-numeric: tabular-nums;
  cursor: copy; user-select: none; position: relative; transition: border-color .15s;
}
.result:hover, .result:focus { border-color: var(--p300); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.result .primary { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; color: var(--p400); }
.result .secondary { color: var(--muted); font-size: 13px; margin-top: 2px; }
.result .pos { color: var(--pos); }
.result .neg { color: var(--neg); }
.result.copied::after {
  content: "copied"; position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); font-size: 10px; color: var(--p400);
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* Footer */
.foot { margin-top: 40px; }

.legal {
  font-size: 11px; color: var(--muted); opacity: 0.75;
  text-align: center; letter-spacing: 0.01em; line-height: 1.8;
}

.kofi-inline {
  color: inherit; text-decoration: none;
  transition: color .15s;
}
.kofi-inline:hover { color: var(--p400); }
.linklike {
  background: none; border: 0; padding: 0; font: inherit;
  color: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border);
}
.linklike:hover { color: var(--p400); }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(10,14,20,0.6);
  display: flex; justify-content: center; align-items: center;
  z-index: 50; padding: 4vh 4vw; backdrop-filter: blur(6px);
}
.modal-box {
  position: relative; width: min(520px, 100%); height: min(720px, 90vh);
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  overflow: hidden;
}
.modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: var(--p100); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 20px; line-height: 1; color: var(--p400);
}
.modal-close:hover { background: var(--p200); }
.modal iframe { width: 100%; height: 100%; border: 0; }
.modal-text { height: auto; max-height: 90vh; }
.modal-scroll {
  padding: 32px 28px 28px; overflow-y: auto;
  max-height: 90vh; font-size: 14px; line-height: 1.6;
}
.modal-scroll h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--fg); }
.modal-scroll h3 {
  margin: 22px 0 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.modal-scroll p { margin: 0 0 10px; color: var(--muted); }
.modal-scroll .updated { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.modal-scroll a { color: var(--p400); text-decoration: none; }
.modal-scroll a:hover { text-decoration: underline; }
