/* Today, mobile first, in the Block Lab language.
 *
 * The phone is the base case and the desktop is the exception — this is opened
 * from a bot, in a hand, usually standing up. Everything here is sized for a
 * thumb at arm's length first, and widened later.
 *
 * The palette is borrowed from Block Lab rather than reinvented: two lab
 * surfaces that look unrelated read as two products, and this is one workshop. */

:root {
  --font-sans: "Avenir Next", "Avenir", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Andale Mono", Menlo, Consolas, monospace;

  --bg: #07111a;
  --fg: #f5efe5;
  --fg-strong: #ffffff;
  --fg-dim: #8b96a5;
  --fg-faint: #5b6572;
  --border: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.05);
  --grid-line: rgba(255, 255, 255, 0.025);

  --a-sky: #8ed4ff;
  --a-mint: #9be6d2;
  --a-gold: #f2b768;
  --a-genesis: #5b8cff;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms;

  --gutter: 16px;
  --r-md: 14px;
  --r-pill: 999px;
  /* A thumb needs this much no matter how small the label is. */
  --tap: 44px;
  --dock-h: 62px;
}

/* Nothing is painted until the door has answered. The board used to flash for a
   moment and then be replaced by «Team only», which reads as a page that let you
   in and then threw you out. */
html.booting body > *, html.booting .dock, html.booting .sheet { visibility: hidden; }
html.booting body::after {
  content: "";
  position: fixed; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px;
  border: 2px solid rgba(255,255,255,.15); border-top-color: #8ed4ff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  padding:
    20px
    max(var(--gutter), env(safe-area-inset-right))
    calc(var(--dock-h) + env(safe-area-inset-bottom) + 24px)
    max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Two glows over a gradient, plus a faint grid. Depth comes from light, never
   from added objects. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -3;
  background:
    repeating-linear-gradient(0deg, transparent 0 107px, var(--grid-line) 107px 108px),
    repeating-linear-gradient(90deg, transparent 0 107px, var(--grid-line) 107px 108px),
    radial-gradient(120% 90% at 12% 6%, rgba(142, 212, 255, 0.13), transparent 52%),
    radial-gradient(95% 85% at 88% 104%, rgba(91, 140, 255, 0.12), transparent 58%),
    radial-gradient(150% 130% at 50% 42%, #0c1826 0%, #08131d 55%, #050a11 100%);
}

.eyebrow, h2, .micro, .who, .players, .pill {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.eyebrow { margin: 0 0 .4rem; font-size: .64rem; color: var(--fg-faint); }
h1 {
  margin: 0 0 .7rem;
  font-size: 1.6rem;
  line-height: 1.15;
  font-weight: 400;
  color: var(--fg-strong);
}
h2 { margin: 0 0 .6rem; font-size: .64rem; color: var(--fg-dim); }
.micro { font-size: .66rem; color: var(--fg-dim); }
.hint { margin: .3rem 0; color: var(--fg-faint); font-size: .95rem; }

.who-row { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; margin: 0 0 1.4rem; }
.me { font-weight: 600; color: var(--a-mint); }
.players { font-size: .66rem; color: var(--fg-faint); }
.here { color: var(--a-mint); }
.away { color: var(--fg-faint); }

.block { margin-bottom: 1.6rem; }

/* Epics scroll sideways instead of stacking: on a phone they are a strip, and a
   wrapped strip pushes the table below the fold before anything is played. */
.epics {
  display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.epics::-webkit-scrollbar { display: none; }
.epic { flex: 0 0 auto; }
.epic.on {
  color: var(--bg); background: var(--a-gold); border-color: var(--a-gold);
  box-shadow: 0 0 20px color-mix(in srgb, var(--a-gold) 40%, transparent);
}

.row { display: flex; gap: .5rem; align-items: center; margin-top: .7rem; }
.row input { flex: 1; }

input[type=text], select {
  font: inherit; font-size: 16px; /* under 16 and iOS zooms the page on focus */
  color: var(--fg); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft); border-radius: var(--r-pill);
  padding: 0 1rem; height: var(--tap); min-width: 0; width: 100%;
  transition: border-color var(--fast) var(--ease);
}
input:focus, select:focus { outline: none; border-color: var(--a-sky); }
input::placeholder { color: var(--fg-faint); }

button {
  font-family: var(--font-mono); font-size: .66rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  min-height: var(--tap); padding: 0 1.1rem;
  border-radius: var(--r-pill); cursor: pointer; white-space: nowrap;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.ghost { color: var(--fg); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-soft); }
.ghost:hover, .ghost:focus-visible { border-color: var(--border); color: var(--fg-strong); }
.primary {
  color: var(--bg); background: var(--a-sky); border: 1px solid var(--a-sky); font-weight: 700;
}
button:focus-visible { outline: 2px solid var(--a-sky); outline-offset: 2px; }
button[aria-expanded="true"] { border-color: var(--a-sky); color: var(--a-sky); }

.cards { display: grid; grid-template-columns: 1fr; gap: .6rem; }
.card {
  display: flex; flex-direction: column; gap: .7rem;
  padding: .9rem 1rem;
  border: 1px solid var(--border-soft); border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
}
.card.mine {
  border-color: color-mix(in srgb, var(--a-genesis) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--a-genesis) 8%, rgba(255, 255, 255, 0.02));
}
.card-text { margin: 0; font-size: 1.02rem; line-height: 1.4; }
.card footer { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.who { font-size: .6rem; color: var(--fg-faint); }
.card button { min-height: 36px; padding: 0 .8rem; font-size: .58rem; }

.card-text[data-edit] { cursor: text; border-radius: 6px; }
.card-text[data-edit]:focus { outline: 2px solid var(--a-sky); outline-offset: 4px; }

/* The dock: the card being written, and a burger. Nothing else — the table is
   what the screen is for. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: .6rem max(var(--gutter), env(safe-area-inset-right))
    calc(.6rem + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: rgba(7, 17, 26, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
}
.dock-write { display: flex; gap: .5rem; align-items: center; }

.burger {
  position: relative; flex: 0 0 auto;
  width: var(--tap); height: var(--tap); padding: 0;
  display: grid; place-items: center;
  color: var(--fg); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
}
.burger svg { width: 22px; height: 22px; }
/* State on the button itself: opening a panel to learn whether the tape is
   running is one tap too many, and the answer is two dots wide. */
.dots { position: absolute; right: 5px; bottom: 5px; display: flex; gap: 2px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.dot.on { background: var(--a-mint); box-shadow: 0 0 6px var(--a-mint); }
.dot.rec { background: var(--a-gold); box-shadow: 0 0 6px var(--a-gold); }
.badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 3px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .55rem;
  color: var(--bg); background: var(--a-mint); border-radius: var(--r-pill);
}

.sheet {
  position: fixed; left: 0; right: 0; z-index: 11;
  bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
  display: grid; gap: .6rem;
  padding: .8rem max(var(--gutter), env(safe-area-inset-right)) .9rem
    max(var(--gutter), env(safe-area-inset-left));
  background: rgba(7, 17, 26, 0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
}
/* A class beats the browser's own [hidden] rule, so display: grid above kept
   the panel open forever. Anything that ships with the attribute has to say so. */
.sheet[hidden], .badge[hidden] { display: none; }
.sheet-line { display: flex; gap: 1.2rem; margin: 0; }
.sheet-line b { color: var(--a-sky); }
/* Two across: six full-width rows was the shelf this replaced. */
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.sheet-grid .span-2 { grid-column: span 2; }

/* Wider screens get the two columns back, and the dock stops being a shelf. */
@media (min-width: 900px) {
  :root { --gutter: 26px; --dock-h: 68px; }
  body { padding-top: 30px; font-size: 18px; }
  h1 { font-size: 2.4rem; margin-bottom: 1rem; }
  .layout { display: grid; grid-template-columns: 3fr 2fr; gap: 2rem; align-items: start; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  .dock-write { max-width: 40rem; margin: 0 auto; }
  .sheet { left: auto; right: var(--gutter); width: 22rem; border-radius: var(--r-md); }
}

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