/* Mbao — hand-written CSS, mobile first at 360px. Tokens first; never hard-code colours below.
   The Frizzy G look (same as frizzy-g.com, Earshot and Stretcher): mid-grey ground, lime, heavy
   black outlines with hard black offset shadows. One theme. Black is the only text colour that
   reads on the grey, so lime is a fill (with black text) or sits on black, never text on grey. */

:root {
  --ground: #808080;
  --field: #9c9c9c;
  --field-2: #8e8e8e;
  --ink: #000000;
  --lime: #55ff00;
  --no-on-black: #ff6b6b;

  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 48px;
  --gutter: 16px;

  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ground); }
body {
  margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.5 var(--font);
  min-height: 100dvh; display: flex; flex-direction: column;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 2px; }
b { font-weight: 800; }
abbr { text-decoration: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

/* the logo's lettering: lime, fat black outline, hard shadow */
.brand, h1 {
  font-family: var(--font-display); font-style: italic; font-weight: 900; letter-spacing: -0.01em;
  color: var(--lime); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink);
}
h1 { font-size: 1.75rem; line-height: 1.2; padding: 4px 0; -webkit-text-stroke-width: 4.5px; text-shadow: 2px 2px 0 var(--ink); letter-spacing: 0.005em; }
.intro { display: flex; flex-direction: column; gap: 6px; }

.me-pill {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--field); font-weight: 800; text-decoration: none; box-shadow: 2px 2px 0 var(--ink);
}
.link-btn {
  appearance: none; background: none; border: 0; padding: 8px 4px; min-height: 36px; margin-left: auto; cursor: pointer;
  font: 700 0.85rem var(--font); color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
}
h2 { font-size: 1.15rem; font-weight: 850; font-style: italic; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--lime); border: var(--line); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- layout ---------- */

.top, main, .foot { width: 100%; max-width: 560px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--gutter); }
.brand { font-size: 1.9rem; text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 4px; }
main { flex: 1; padding: 4px var(--gutter) 120px; display: flex; flex-direction: column; gap: 18px; }
.foot { padding: 16px var(--gutter) 24px; font-size: 0.85rem; }
.foot a { min-height: var(--tap); display: inline-flex; align-items: center; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; }
.small { font-size: 0.875rem; }
.plainlist { list-style: none; margin: 0; padding: 0; }

.card { background: var(--field); border: var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.round-on { background: var(--lime); }
.verdict { font: italic 900 1.3rem/1.2 var(--font-display); }

.flash { border: var(--line); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow-sm); font-weight: 700; }
.flash-ok { background: var(--lime); }

/* ---------- buttons ---------- */

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: var(--line); background: var(--field);
  color: var(--ink); font: 800 1rem var(--font); text-decoration: none; cursor: pointer; touch-action: manipulation;
  box-shadow: var(--shadow-sm); transition: transform 60ms, box-shadow 60ms;
}
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn-primary { background: var(--lime); }
.btn-block { width: 100%; }
.btn-big { min-height: 72px; font: italic 900 1.5rem var(--font-display); box-shadow: var(--shadow); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }

.btn-mini {
  appearance: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--field); color: var(--ink); font: 700 0.85rem var(--font); cursor: pointer; touch-action: manipulation;
}

/* bottom-anchored primary action: thumb reach */
.actionbar {
  z-index: 20; /* above the slider thumbs */
  position: fixed; inset: auto 0 0 0; padding: 12px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ground) 70%, transparent); display: flex; justify-content: center; pointer-events: none;
}
.actionbar > * { pointer-events: auto; width: 100%; max-width: 528px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 800; white-space: nowrap; }
.pill-yes { background: var(--ink); color: var(--lime); }
.pill-yes::before { content: "✓"; }

.pill-lock { background: var(--ink); color: var(--lime); }
.ico { width: 1em; height: 1em; vertical-align: -0.12em; flex: none; }
.lock-tag { display: flex; align-items: center; gap: 6px; }

/* a proposal: who's in, and the I'm in / Undo button */
.in-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.in-row form { margin: 0; }
.ins { display: flex; gap: 12px; font-size: 0.95rem; }
.ins .is-in { font-weight: 900; }
.ins .not-in { font-weight: 400; }
.btn-mini-wide { min-height: 44px; padding: 0 16px; }

.slot { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 2px solid var(--ink); }
.slot:first-child { border-top: 0; padding-top: 2px; }
.slot-when { font-weight: 800; }

/* ---------- the day picker ---------- */

fieldset { margin: 0; min-width: 0; }
.day { border: var(--line); border-radius: var(--radius); padding: 12px; background: var(--field); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.day legend { float: left; width: 100%; display: flex; align-items: center; gap: 8px; padding: 0; margin: 0; }
.day legend + * { clear: both; }
.day-name { font: italic 900 1.15rem var(--font-display); }
.day-weekend .day-name { background: var(--ink); color: var(--lime); padding: 0 10px; border-radius: 8px; }
.said { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; }
.tag { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 999px; border: 2px solid var(--ink); line-height: 1.3; }
.tag-free { background: var(--ground); }
.tag-cant { background: var(--ink); color: var(--no-on-black); }
.tag-unsaid { border-style: dashed; }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label {
  margin: 0; min-height: var(--tap); display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--ground); font-weight: 800; font-size: 0.9rem;
  line-height: 1.1; cursor: pointer; touch-action: manipulation; user-select: none; padding: 2px;
}
.choices input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 2px; }
.choices .c-free:checked + label { background: var(--lime); box-shadow: var(--shadow-sm); }
.choices .c-free:checked + label::before { content: "✓ "; white-space: pre; }
.choices .c-no:checked + label { background: var(--ink); color: var(--no-on-black); }
.choices .c-no:checked + label::before { content: "✕ "; white-space: pre; }

/* the slider shows once you've said you're free (everywhere without :has, so it still works) */
.range { display: none; padding: 2px 4px 0; }
.day:has(.c-free:checked) .range { display: block; }
@supports not selector(:has(*)) { .range { display: block; } }
.range-label { display: block; font: italic 900 1.2rem var(--font-display); margin-bottom: 6px; }

.range-track { position: relative; height: 36px; }
.range-track::before, .range-fill { content: ""; position: absolute; top: 12px; height: 12px; border-radius: 6px; }
.range-track::before { left: 0; right: 0; background: var(--ink); }
.range-fill { left: 0; right: 0; background: var(--lime); border: 2px solid var(--ink); }
.range-track input {
  position: absolute; inset: 0; width: 100%; height: 36px; margin: 0; background: transparent;
  appearance: none; -webkit-appearance: none; pointer-events: none; z-index: 2;
}
.range-track input:focus-visible { outline: none; }
.range-track input::-webkit-slider-runnable-track { background: transparent; border: 0; height: 36px; }
.range-track input::-moz-range-track { background: transparent; border: 0; }
.range-track input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: grab;
  width: 30px; height: 30px; margin-top: 3px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); box-shadow: var(--shadow-sm);
}
.range-track input::-moz-range-thumb {
  pointer-events: auto; cursor: grab; width: 24px; height: 24px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); box-shadow: var(--shadow-sm);
}
.range-track input:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--ink); outline-offset: 3px; }
.range-track input:focus-visible::-moz-range-thumb { outline: 3px solid var(--ink); outline-offset: 3px; }

/* scale: 8am..2am is 1080 minutes; each label sits where its time is */
.range-scale { position: relative; height: 1.4em; font-size: 0.72rem; font-weight: 700; margin: 0 15px; }
.range-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.range-scale .at-480 { left: 0; }
.range-scale .at-720 { left: 22.222%; }
.range-scale .at-960 { left: 44.444%; }
.range-scale .at-1200 { left: 66.667%; }
.range-scale .at-1440 { left: 88.889%; }
.range-scale .at-1560 { left: 100%; }

/* ---------- results: locked-in card and proposals ---------- */

/* locked in: the one black card on the page, lime lettering */
.lock {
  background: var(--ink); color: var(--lime); border: var(--line); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--lime), 8px 8px 0 var(--ink); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 2px;
}
.lock-tag { font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.lock-day { font: italic 900 2.1rem/1.05 var(--font-display); margin-top: 4px; }
.lock-time { font: italic 800 1.35rem/1.2 var(--font-display); }
.lock .in-row { margin-top: 12px; }
.lock .chip { border-color: var(--lime); color: var(--lime); }
.lock .chip-in { background: var(--lime); color: var(--ink); }

.prop { background: var(--lime); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.prop-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.prop-day { font: italic 900 1.45rem/1.1 var(--font-display); }
.prop-time { font: italic 800 1.15rem/1.1 var(--font-display); }

.in-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.in-row form { margin: 0; }
.chips { display: flex; gap: 6px; }
.chip {
  width: 36px; height: 36px; border-radius: 50%; border: 2.5px dashed var(--ink); display: inline-grid; place-items: center;
  font-weight: 900; font-size: 0.95rem;
}
.chip-in { background: var(--ink); color: var(--lime); border-style: solid; }

.btn-ink { background: var(--ink); color: var(--lime); box-shadow: 3px 3px 0 var(--ink); min-width: 104px; }
.btn-ghost-ink { background: transparent; box-shadow: none; min-width: 104px; }
.btn-ghost { background: transparent; color: var(--lime); border-color: var(--lime); box-shadow: none; }

/* ---------- results: the 14-day timeline ---------- */

.tl { list-style: none; margin: 0; padding: 0; }
.tl-head, .tl-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) 64px; gap: 8px; align-items: center; }
.tl-head { font-size: 0.68rem; font-weight: 800; }
.tl-head > span:last-child { text-align: center; }
.tl-scale { position: relative; height: 1.3em; margin-left: 17px; }
.tl-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-scale .at-480 { left: 0; transform: none; }
.tl-scale .at-720 { left: 22.222%; }
.tl-scale .at-960 { left: 44.444%; }
.tl-scale .at-1200 { left: 66.667%; }
.tl-scale .at-1440 { left: 88.889%; }

.tl-row { padding: 7px 4px; border-top: 2px solid var(--ink); margin: 0 -4px; }
.tl-weekend { background: var(--field-2); }
.tl-day { font-size: 0.78rem; line-height: 1.15; }
.tl-day b { display: block; font-size: 0.9rem; font-weight: 900; }
.tl-lanes { position: relative; display: flex; flex-direction: column; gap: 3px; }
.tl-band { position: absolute; top: -7px; bottom: -7px; left: 17px; width: calc(100% - 17px); height: calc(100% + 14px); z-index: 0; }
.tl-band line { stroke: var(--ink); stroke-opacity: 0.25; stroke-width: 1; vector-effect: non-scaling-stroke; }
.tl-band .tl-on { fill: var(--lime); }
.tl-lane { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; height: 11px; }
.tl-name { width: 12px; font-size: 0.66rem; font-weight: 900; line-height: 1; }
.tl-track { flex: 1 1 0; width: 0; height: 11px; min-width: 0; display: block; }
svg.tl-track rect { fill: var(--ink); }
.tl-unsaid .tl-track { height: 0; border-top: 2px dashed var(--ink); opacity: 0.45; }
.tl-cant .tl-track { font-size: 0.62rem; font-weight: 900; line-height: 11px; letter-spacing: 0.02em; }
.tl-all { text-align: center; font-size: 0.72rem; font-weight: 800; line-height: 1.15; }
.tl-all-on { background: var(--lime); border: 2px solid var(--ink); border-radius: 8px; padding: 3px 2px; box-shadow: 2px 2px 0 var(--ink); }

.tl-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tl-key span { display: inline-block; width: 18px; height: 8px; }
.key-bar { background: var(--ink); }
.key-dash { height: 0 !important; border-top: 2px dashed var(--ink); margin-left: 6px; }
.key-on { background: var(--lime); border: 2px solid var(--ink); margin-left: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (min-width: 600px) {
  h1 { font-size: 2.2rem; }
  table.grid { font-size: 0.85rem; }
}
