/* ---------- Inter (self-hosted variable font) ----------
 * One file spans weights 400-800, so no per-weight requests and no
 * dependency on fonts.googleapis.com on a flaky connection. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3f1ec;          /* warm paper */
  --bg-alt: #ece9e2;
  --surface: #ece9e2;     /* pills and icon buttons */
  --fg: #1f1d1a;          /* warm near-black */
  --muted: #68635b;       /* warm grey */
  --line: #e0dcd3;

  --p1-bg: #b3261e; --p1-fg: #ffffff;
  --p2-bg: #ea580c; --p2-fg: #ffffff;
  --p3-bg: #facc15; --p3-fg: #111111;
  --p4-bg: #1d4ed8; --p4-fg: #ffffff;
  --p0-bg: #e4e7ec; --p0-fg: #3f3f3f;
  --gold: #b07d2b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;          /* warm dark, same family */
    --bg-alt: #221f1c;
    --surface: #221f1c;
    --fg: #f2efe9;
    --muted: #a39d93;
    --line: #322e2a;

    --p3-bg: #eab308;
    --p0-bg: #2e2e33; --p0-fg: #c9c9cf;
    --gold: #e0a33a;
  }
}

* { box-sizing: border-box; }

/* Several elements here are toggled via the `hidden` property while their class
   sets an explicit `display`, which would otherwise win. Belt and braces. */
[hidden] { display: none !important; }

:root {
  /* Stock Inter. No cv11/ss01/ss03 — cv11 in particular swaps the double-storey
     'a' for a single-storey one, which stops it reading as Inter at all. */
  --font: "Inter", "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form controls don't inherit font by default in every engine. */
button, input, select, textarea { font-family: var(--font); }

button { font: inherit; color: inherit; }

.app {
  max-width: 1160px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 32px clamp(16px, 4vw, 24px) 40px;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3.5vh, 40px);
}

/* ---------- chrome ----------
 * Date left, score and refresh right. Quiet, glanced at now and then. */

.chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.date {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.chrome-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scorepill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.score-n {
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.iconbtn {
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.iconbtn:hover { color: var(--fg); filter: brightness(0.97); }
.iconbtn[aria-busy="true"] svg { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero issue ---------- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  justify-content: center;
}

.hero-meta { display: flex; align-items: center; gap: 10px; min-height: 26px; }

.slot {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tag {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag--1 { background: var(--p1-bg); color: var(--p1-fg); }
.tag--2 { background: var(--p2-bg); color: var(--p2-fg); }
.tag--3 { background: var(--p3-bg); color: var(--p3-fg); }
.tag--4 { background: var(--p4-bg); color: var(--p4-fg); }
.tag--0 { background: var(--p0-bg); color: var(--p0-fg); }

.title {
  margin: 0;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.cta:hover { border-color: var(--fg); }

/* In execution this is the whole point of the screen — it should read as the
   one thing to do, not as one control among several. */
.cta--primary {
  align-self: stretch;
  justify-content: center;
  gap: 14px;
  min-height: 92px;
  padding: 0 24px;
  border: 0;
  border-radius: 20px;
  background: var(--fg);
  color: var(--bg);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.cta--primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.cta--primary:active { transform: translateY(1px); }
.cta--primary svg { width: 24px; height: 24px; stroke-width: 2.6; }

/* the secondary links shouldn't compete with it */
.cta--primary ~ .link { opacity: 0.7; }
.cta:not([href]) { opacity: 0.45; pointer-events: none; }

.hero-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.link {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--fg);
  cursor: pointer;
  font-weight: 500;
}
.link:hover { color: var(--p1-bg); }
.link:disabled { opacity: 0.4; cursor: default; }

/* ---------- priority blocks ---------- */

.triage { display: flex; flex-direction: column; gap: 10px; }

.blocks { display: flex; flex-direction: column; gap: 10px; }

.block {
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 20px;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  cursor: pointer;
  transition: outline-offset 0.12s ease, transform 0.12s ease;
  outline: 4px solid transparent;
  outline-offset: 0;
}

.block:active { transform: scale(0.985); }

.block--1 { background: var(--p1-bg); color: var(--p1-fg); }
.block--2 { background: var(--p2-bg); color: var(--p2-fg); }
.block--3 { background: var(--p3-bg); color: var(--p3-fg); }
.block--4 { background: var(--p4-bg); color: var(--p4-fg); }

.block--current {
  outline-color: var(--fg);
  outline-offset: 4px;
}

.block:disabled { opacity: 0.4; cursor: default; }

.hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
  min-height: 21px;
}
.hint strong { color: var(--fg); font-weight: 700; }

/* ---------- distribution nudge ---------- */

.dist {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.dist[hidden] { display: none; }

.dist-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.dist-note--warn { color: var(--p1-bg); font-weight: 600; }
.dist-note--ok { color: var(--done, #15803d); font-weight: 600; }

/* running tier count on each priority block */
.block { position: relative; }

.block-count {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.block--full { opacity: 0.72; }
.block--full .block-count { opacity: 1; text-decoration: underline; }
.block--current { opacity: 1; }

/* ---------- execution slot nav ---------- */

.navrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.navrow[hidden] { display: none; }

.navbtn {
  min-width: 56px;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--fg);
  cursor: pointer;
}
.navbtn:hover:not(:disabled) { border-color: var(--fg); }
.navbtn:disabled { opacity: 0.35; cursor: default; }

.navpos {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 10;
}

/* ---------- desktop ----------
 * Phone keeps the stacked full-width blocks; from here the blocks go into a
 * row, since four full-width bars across 900px would be absurd. */

@media (min-width: 760px) {
  .app {
    max-width: 900px;
    padding: 40px 48px 48px;
    gap: 28px;
  }

  .meta { font-size: 13px; }

  .hero { gap: 20px; }
  .title { font-size: clamp(40px, 4.4vw, 56px); }
  .slot, .tag { font-size: 13px; }
  .cta { min-height: 48px; font-size: 17px; }

  /* four across, with room for the selected outline between them */
  .blocks {
    flex-direction: row;
    gap: 20px;
  }
  .block {
    flex: 1;
    min-height: 132px;
    border-radius: 24px;
    font-size: clamp(20px, 2vw, 26px);
  }

  .hint { font-size: 15px; }

  .cta--primary { min-height: 108px; font-size: 32px; border-radius: 24px; }
  .cta--primary svg { width: 28px; height: 28px; }

  .dist { padding-top: 20px; }
    .dist-note { font-size: 14px; }
  .block-count { top: 10px; right: 14px; font-size: 12px; }

  .navrow { padding-top: 20px; }
  .navbtn { min-width: 72px; min-height: 44px; }
}

/* Short, wide windows: stop the blocks eating the whole viewport. */
@media (min-width: 760px) and (max-height: 760px) {
  .app { padding-top: 28px; padding-bottom: 28px; gap: 20px; }
  .block { min-height: 96px; }
  .cta--primary { min-height: 84px; font-size: 26px; }
  .title { font-size: clamp(32px, 3.4vw, 44px); }
}

:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
