/* Counter site. Tokens from DESIGN.md (Uber analysis on getdesign.md). */
:root {
  --ink: #000; --on-ink: #fff; --body: #5e5e5e; --mute: #6b6b6b;
  --canvas: #fff; --soft: #efefef; --softer: #f6f6f6; --pressed: #e2e2e2; --hairline: #e2e2e2;
  --signal: #04844a;   /* 4.77:1 with white text (AA) */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pill: 999px; --card: 16px; --input: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #fff; --on-ink: #000; --body: #b8b8b8; --mute: #8a8a8a;
    --canvas: #000; --soft: #1c1c1c; --softer: #141414; --pressed: #282828; --hairline: #2e2e2e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #fff; --on-ink: #000; --body: #b8b8b8; --mute: #8a8a8a;
  --canvas: #000; --soft: #1c1c1c; --softer: #141414; --pressed: #282828; --hairline: #2e2e2e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 16px/1.5 var(--font); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* header / footer */
.top { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 21px; letter-spacing: -0.03em; text-decoration: none; margin-right: auto; }
.brand b { font-weight: 400; }
.brand img { display: block; border-radius: 7px; }
:root[data-theme="dark"] .brand img { box-shadow: 0 0 0 1px #3a3a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { box-shadow: 0 0 0 1px #3a3a3a; } }
.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.top nav a { text-decoration: none; font-weight: 500; font-size: 15px; padding: 8px 12px; border-radius: var(--pill); white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { background: var(--soft); }
@media (max-width: 720px) { .top nav { display: none; } }
.foot { border-top: 1px solid var(--hairline); margin-top: 56px; padding: 32px 0 48px; color: var(--body); font-size: 14px; }
.foot ul { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { text-decoration: none; } .foot a:hover { text-decoration: underline; }

/* headings and prose */
h1 { font-size: clamp(30px, 6vw, 40px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; margin: 12px 0 6px; }
.lede { color: var(--body); font-size: 18px; margin: 0 0 20px; max-width: 640px; }
.prose { max-width: 680px; }
.prose h2 { font-size: 24px; letter-spacing: -0.02em; margin: 40px 0 8px; }
.prose p, .prose li { color: var(--body); }
.prose kbd, .hint { font: 600 13px/1 var(--font); background: var(--soft); border-radius: 6px; padding: 3px 7px; color: var(--ink); }
.faq details { border-top: 1px solid var(--hairline); padding: 14px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; }

/* pills */
.pill { border: 0; border-radius: var(--pill); background: var(--soft); padding: 12px 18px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
.pill:hover { background: var(--pressed); }
.pill-ink { background: var(--ink); color: var(--on-ink); }
.pill-ink:hover { background: var(--ink); opacity: .86; }
.pill-inv { background: var(--on-ink); color: var(--ink); min-height: 36px; padding: 6px 14px; }
.pill.round { width: 64px; height: 64px; padding: 0; font-size: 30px; font-weight: 500; }
.pill[aria-pressed="false"] { color: var(--mute); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.pill:focus-visible, .tap:focus-visible, .tile-tap:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pill:disabled { opacity: .4; cursor: default; }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: var(--pill); cursor: pointer; color: var(--mute); }
.icon-btn:hover { background: var(--pressed); color: var(--ink); }

/* the tool */
.tool { position: relative; user-select: none; -webkit-user-select: none; }
.stage { background: var(--soft); border-radius: var(--card); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.stage-head { display: flex; align-items: center; gap: 8px; }
.name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 600; font-size: 17px; padding: 8px; border-radius: var(--input); }
.name:focus { background: var(--canvas); outline: none; }
.name::placeholder { color: var(--mute); }
.target-info { font-size: 14px; font-weight: 600; color: var(--body); background: var(--canvas); border-radius: var(--pill); padding: 6px 12px; white-space: nowrap; }
.target-info.is-done { background: var(--signal); color: #fff; }

.tap { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: clamp(260px, 52vh, 520px);
  border: 0; border-radius: 12px; background: var(--canvas); cursor: pointer; padding: 16px; transition: transform .06s; }
.tap:active { transform: scale(.985); background: var(--softer); }
.value { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.045em; line-height: .95; font-size: clamp(110px, 30vw, 280px); }
.value[data-len="m"] { font-size: clamp(80px, 20vw, 200px); }
.value[data-len="l"] { font-size: clamp(56px, 14vw, 150px); }
.value[data-len="xl"] { font-size: clamp(40px, 10vw, 110px); }
.tap-hint { color: var(--mute); font-size: 14px; margin-top: 14px; }
.tally { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; max-width: 760px; margin-top: 18px; max-height: 30vh; overflow: hidden; }
.tg { width: 38px; height: 34px; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.tmore { color: var(--mute); font-size: 14px; align-self: center; }

.controls { display: grid; grid-template-columns: 64px 1fr 1fr 64px; gap: 8px; align-items: center; }
.controls .pill { width: 100%; }
.controls .pill:not(.pill-ink) { background: var(--canvas); }
.controls .pill:not(.pill-ink):hover { background: var(--pressed); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggles .pill { min-height: 40px; padding: 8px 14px; font-size: 14px; background: var(--canvas); }
.toggles .pill:hover { background: var(--pressed); }
.toggles .pill-ink, .toggles .pill-ink:hover { background: var(--ink); color: var(--on-ink); }

.is-hit { animation: hit .9s ease-out; }
@keyframes hit { 0% { box-shadow: 0 0 0 0 var(--signal); background: var(--signal); color: #fff; } 100% { box-shadow: 0 0 0 18px transparent; } }

/* settings */
.settings { margin-top: 12px; background: var(--softer); border-radius: var(--card); }
.settings summary { cursor: pointer; font-weight: 600; padding: 16px; list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::after { content: "+"; float: right; font-weight: 500; }
.settings[open] summary::after { content: "\2212"; }
.settings form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; padding: 0 16px 16px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--body); }
.settings input[type="number"] { border: 0; background: var(--canvas); border-radius: var(--input); padding: 12px; font-size: 17px; color: var(--ink); width: 100%; }
.settings label.check { flex-direction: row; align-items: center; gap: 10px; }
.settings input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); }
.settings .row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--on-ink);
  border-radius: var(--pill); padding: 8px 8px 8px 20px; display: flex; align-items: center; gap: 14px; min-height: 52px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast:not(:has(button)) { padding-right: 20px; }

/* multi */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.total { margin-right: auto; font-weight: 600; padding: 0 8px; }
.total b { font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; margin-left: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { min-width: 0; background: var(--canvas); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tile-top { display: flex; align-items: center; gap: 6px; }
.tile-name { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; font-weight: 600; padding: 6px; border-radius: var(--input); }
.tile-name:focus { background: var(--soft); outline: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-left: 4px; }
.c0 { background: #276ef1; } .c1 { background: #e11900; } .c2 { background: #05a357; } .c3 { background: #ffc043; }
.c4 { background: #7356bf; } .c5 { background: #ff6937; } .c6 { background: #00a3b4; } .c7 { background: #99644c; }
.tile-tap { border: 0; background: var(--softer); border-radius: 10px; min-height: 130px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tile-tap:active { background: var(--pressed); }
.tile-val { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; font-size: 72px; line-height: 1; }
.tile-val[data-len="m"] { font-size: 52px; } .tile-val[data-len="l"] { font-size: 38px; } .tile-val[data-len="xl"] { font-size: 28px; }
.tile-btns { display: flex; align-items: center; justify-content: space-between; }
.tile-btns .pill.round { width: 56px; height: 56px; }

/* focus mode (fullscreen, and the fallback for iPhone Safari) */
body.is-focus { overflow: hidden; }
body.is-focus .stage { position: fixed; inset: 0; z-index: 40; border-radius: 0; margin: 0; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overflow: auto; }
body.is-focus .tap { flex: 1; min-height: 0; }
body.is-focus .toggles .pill:not([data-full]) { display: none; }
.stage:fullscreen { border-radius: 0; }

@media (max-width: 520px) {
  .stage { padding: 8px; margin: 0 -8px; }
  .controls { grid-template-columns: 64px 1fr 1fr 64px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile-val { font-size: 56px; }
  .tile-btns .pill.round { width: 48px; height: 48px; font-size: 26px; }
  .tile-btns .hint { display: none; }
  .tile-tap { min-height: 110px; }
}
@media (prefers-reduced-motion: reduce) { .is-hit { animation: none; outline: 4px solid var(--signal); } .tap { transition: none; } }

/* footer groups, hub, related */
.fgroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 24px; margin-bottom: 16px; }
.fgroup h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin: 0 0 8px; }
.fgroup ul { display: block; }
.fgroup li { margin: 0 0 6px; }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.hub .fgroup { background: var(--soft); border-radius: var(--card); padding: 20px; }
.hub h2 { font-size: 20px; margin: 0 0 10px; }
.hub ul { list-style: none; padding: 0; margin: 0; }
.hub li { margin: 0 0 8px; } .hub a { font-weight: 500; }
.related { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-block; background: var(--soft); border-radius: var(--pill); padding: 8px 14px; text-decoration: none; font-weight: 500; color: var(--ink); }
.related a:hover { background: var(--pressed); }

/* shared tool parts for the other kinds */
.seg { display: inline-flex; background: var(--canvas); border-radius: var(--pill); padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: var(--pill); padding: 8px 14px; font-weight: 500; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--body); }
.field input, .field select, .inp { border: 0; background: var(--canvas); border-radius: var(--input); padding: 12px; font-size: 16px; color: var(--ink); width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.muted { color: var(--mute); }
.big { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; line-height: 1; }
.card { background: var(--canvas); border-radius: 12px; padding: 12px; }
table.t { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--hairline); }
table.t th { font-size: 13px; color: var(--body); font-weight: 600; }
table.t td:first-child, table.t th:first-child { text-align: left; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hub .fgroup p { color: var(--body); margin: 0 0 12px; font-size: 15px; }
.hub li span { display: block; color: var(--body); font-size: 14px; margin-top: 2px; }
.hub li { margin: 0 0 14px; }
.finfo { margin: 0 0 12px; }
.info h2 { font-size: 22px; }

/* charts (CT.bars / CT.line) */
.ct-chart { width: 100%; height: auto; display: block; font: 12px var(--font); }
.ct-chart text { fill: var(--body); }
.ct-chart .grid { stroke: var(--hairline); stroke-width: 1; }
.ct-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--body); margin: 6px 0 0; }
.ct-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.ct-panel { background: var(--softer); border-radius: var(--card); margin-top: 12px; }
.ct-panel > summary { cursor: pointer; font-weight: 600; padding: 16px; list-style: none; }
.ct-panel > summary::-webkit-details-marker { display: none; }
.ct-panel > summary::after { content: "+"; float: right; font-weight: 500; }
.ct-panel[open] > summary::after { content: "\2212"; }
.ct-panel > div { padding: 0 16px 16px; }

/* embed code box */
.embed-box textarea { width: 100%; min-height: 96px; border: 0; border-radius: var(--input); background: var(--canvas); color: var(--ink); padding: 12px; font: 13px/1.4 ui-monospace, Menlo, monospace; resize: vertical; }

/* printing a sheet: only #ct-print shows */
#ct-print { display: none; }
@media print {
  body.printing > *:not(#ct-print) { display: none !important; }
  body.printing #ct-print { display: block; color: #000; background: #fff; font: 12pt/1.4 var(--font); }
  #ct-print table { border-collapse: collapse; width: 100%; }
  #ct-print th, #ct-print td { border: 1px solid #000; padding: 6px 4px; text-align: center; min-width: 22px; height: 26px; }
  #ct-print th:first-child, #ct-print td:first-child { text-align: left; }
  .ct-print-title { font-size: 20pt; margin: 0 0 10px; }
  .ct-print-foot { font-size: 9pt; color: #555; margin-top: 16px; }
  body:not(.printing) .top, body:not(.printing) .foot, body:not(.printing) .toggles, body:not(.printing) .settings, body:not(.printing) .toast { display: none !important; }
}

/* embed version (inside an iframe on another site) */
body.embed { background: var(--canvas); }
body.embed main.wrap { padding: 8px; max-width: none; }
body.embed .stage { margin: 0; }
.embed-credit { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--body); padding: 8px 4px 0; }
.embed-credit a { color: var(--ink); font-weight: 600; text-decoration: none; }
.embed-credit a:hover { text-decoration: underline; }
body.embed [data-install] { display: none !important; }

/* cookie choice */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 560px; margin: 0 auto; background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--card); padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.consent p { margin: 0 0 12px; font-size: 14px; color: var(--body); }
.consent p b { color: var(--ink); }
.consent-btns { display: flex; gap: 8px; justify-content: flex-end; }
body.is-focus .consent { display: none; }
