/* Boost CCG — Build Tracker.
 *
 * Post-it notes on a dark whiteboard. Palette lifted from the Flutter app's
 * theme.dart so the two products look like the same thing.
 *
 * The match screen deliberately does not scroll: the notes ARE dials, and a
 * competing vertical scroll would steal the drag. Everything is sized to fit,
 * with the board taking the slack in the middle so there is drag room above
 * and below it.
 */
:root {
  --board: #0B0B0C;
  --surface: #141416;
  --outline: #232326;
  --accent: #FF9F00;        /* the Boost orange: the one primary action only */
  --secondary: #4DD0E1;     /* secondary actions and toggles */
  --ok: #2CCA5F;            /* requirement satisfied */
  --recessed: #2E2E30;
  --recessed-outline: #1F1F21;
  --ink-on-note: rgba(0,0,0,.87);
  --ink-on-recessed: rgba(255,255,255,.60);
  --font: "Mona Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--board);
  color: #fff;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;                    /* the match screen must not scroll */
  /* Faint honeycomb, drawn in CSS so it costs no request. */
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 26px 45px;
}
button { font: inherit; cursor: pointer; }
a { color: var(--secondary); }

#app { height: 100%; display: flex; flex-direction: column; }

/* Portrait only, on phones.
 *
 * A web page cannot actually lock orientation: screen.orientation.lock() is
 * only honoured in fullscreen, and iOS Safari does not implement it at all. So
 * rather than pretend, a phone held sideways is asked to turn back. Scoped by
 * pointer:coarse and a short viewport so it never fires on a desktop window or
 * a tablet, both of which are landscape by nature and have room to spare. */
#rotate { display: none; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  #app { display: none; }
  #rotate {
    display: flex; position: fixed; inset: 0; z-index: 60;
    align-items: center; justify-content: center; padding: 24px; text-align: center;
  }
  .rotate-inner { max-width: 340px; color: var(--secondary); }
  .rotate-inner svg { animation: tip 2.4s ease-in-out infinite; }
  .rotate-inner b { display: block; margin-top: 14px; font-size: 19px; color: #fff; }
  .rotate-inner p { margin-top: 8px; color: rgba(255,255,255,.6); font-size: 14px; line-height: 1.5; }
}
@keyframes tip { 0%, 60%, 100% { transform: rotate(0); } 30% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate-inner svg { animation: none; } }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- setup */
#setup { overflow-y: auto; }           /* setup may scroll; the match may not */
.setup-inner {
  width: 100%; max-width: 560px; margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px 28px;
}
.wordmark { display: flex; align-items: center; gap: 14px; }
.wordmark .mark { height: 58px; width: auto; border-radius: 6px; box-shadow: 0 6px 14px -6px #000; }
.wm-text strong { display: block; font-size: 26px; font-weight: 900; letter-spacing: .09em; line-height: 1; }
.wm-text span { display: block; margin-top: 5px; font-size: 11px; letter-spacing: .12em; color: rgba(255,255,255,.54); }

/* Sized by height, not width: height is what decides whether this screen
   scrolls, and a wide character would push everything below it off a phone. */
.character { margin: 10px 0 2px; text-align: center; }
.character img { width: auto; max-width: 100%; max-height: 104px; height: auto; opacity: .96; }
.blurb { color: rgba(255,255,255,.62); font-size: 13.5px; line-height: 1.5; margin: 4px 0 0; }

.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255,255,255,.60); margin: 16px 0 8px;
}
.hint { color: rgba(255,255,255,.38); font-size: 12px; margin-top: 6px; line-height: 1.45; }

.stepper {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 4px; padding: 6px 8px;
}
.stepper .step {
  width: 44px; height: 44px; font-size: 24px; line-height: 1;
  background: none; border: 0; color: #fff; border-radius: 4px;
}
.stepper .step:disabled { color: rgba(255,255,255,.22); cursor: default; }
.stepper .step:not(:disabled):hover { background: rgba(255,255,255,.06); }
.stepper output { flex: 1; text-align: center; font-size: 30px; font-weight: 700; }

.feature-select {
  width: 100%; background: var(--surface); color: #fff;
  border: 1px solid var(--outline); border-radius: 4px;
  padding: 14px 12px; font-size: 15.5px; font-family: var(--font);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.5) 50%),
                    linear-gradient(135deg, rgba(255,255,255,.5) 50%, transparent 50%);
  background-position: right 18px center, right 12px center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.feature-select:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

.modes { display: flex; gap: 8px; }
.mode {
  flex: 1; padding: 13px 8px; border-radius: 4px; font-weight: 700; font-size: 14px;
  background: var(--surface); color: rgba(255,255,255,.6);
  border: 1px solid rgba(77,208,225,.45);
}
.mode[aria-checked="true"] { background: var(--secondary); color: #000; }

.primary {
  width: 100%; margin-top: 18px; padding: 16px 12px; border: 0; border-radius: 4px;
  background: var(--accent); color: #000; font-weight: 700; font-size: 16px; letter-spacing: .1em;
}
.primary:disabled { background: var(--surface); color: rgba(255,255,255,.24); cursor: default; }
.primary.ok { background: var(--ok); }
.foot { margin-top: 16px; text-align: center; font-size: 12.5px; color: rgba(255,255,255,.4); }
.foot a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- match */
/* Normally this does not scroll, which is the point: the notes are dials and a
   competing scroll would steal the drag. On a screen too short to fit the board
   at a usable size (a landscape phone) it scrolls rather than squashing the
   notes to a few pixels. Safe, because each note sets touch-action:none and
   captures its own pointer, so dragging a dial never scrolls the page. */
#match { padding: max(10px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom)); gap: 10px; overflow-y: auto; }
.bar { display: flex; align-items: center; gap: 11px; }
.bar .mark.small { height: 36px; width: auto; border-radius: 4px; }
.progress { flex: 1; min-width: 0; }
.progress strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { display: flex; gap: 4px; margin-top: 5px; }
.pips i { width: 14px; height: 5px; border-radius: 2px; background: var(--outline); }
.pips i.on { background: var(--ok); }
.chip {
  flex: none; padding: 9px 12px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  border: 1.5px solid var(--secondary); background: var(--secondary); color: #000;
}
.chip[aria-pressed="false"] { background: transparent; color: var(--secondary); }

/* The board takes the slack: leftover space above and below is the drag room. */
.board {
  /* Never smaller than this: below it the notes stop being draggable targets. */
  flex: 1; min-height: 190px;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 8px; align-content: center;
}
.note {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 6px 7px; border-radius: 2px;
  background: var(--recessed); border: 1px solid var(--recessed-outline);
  color: var(--ink-on-recessed);
  touch-action: none;               /* the note owns the vertical gesture */
  user-select: none; -webkit-user-select: none;
  transition: background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
  cursor: ns-resize;
  overflow: hidden;
}
.note.prominent {
  background: var(--note-colour);
  border-color: rgba(0,0,0,.18);
  color: var(--ink-on-note);
  box-shadow: 0 3px 6px rgba(0,0,0,.4);
}
.note.glow { border: 2.5px solid var(--ok); box-shadow: 0 0 16px 1px rgba(44,202,95,.55); }
.note:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }
.note .n-label { font-size: 11px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note .n-value { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3px; font-size: clamp(20px, 6.2vw, 34px); font-weight: 700; line-height: 1; }
.note .n-value .arrows { font-size: .5em; opacity: .65; }
.note .n-goal { height: 18px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 900; letter-spacing: .02em; }
/* Inherits the note's ink, so it is dark on a pale post-it rather than the
   emoji's own washed-out tan. */
.note .n-goal .thumb { flex: none; opacity: .92; }

/* type requirements */
.type-reqs { min-height: 58px; }
.type-reqs .tr-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: rgba(255,255,255,.6); }
.type-reqs.muted .tr-label { color: rgba(255,255,255,.24); }
.type-reqs .tr-casual { color: rgba(255,255,255,.38); font-size: 12px; margin-top: 5px; }
/* Between Features there is no goal, so the board recedes and the dropdown is
   the only thing worth touching. */
.board.awaiting { opacity: .55; }
#match-feature.awaiting { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,159,0,.25); }
.tr-boxes { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.tr-box {
  display: inline-flex; align-items: center; gap: 9px; padding: 4px 0;
  background: none; border: 0; color: rgba(255,255,255,.6); font-weight: 700; font-size: 14px;
}
.tr-box svg { flex: none; }
.tr-box[aria-checked="true"] { color: #fff; }
.tr-box[aria-checked="true"] .tr-text { text-decoration: line-through; text-decoration-color: var(--ok); text-decoration-thickness: 2px; }

/* QA stamp */
.stamp-slot { height: 60px; display: flex; align-items: center; justify-content: center; }
.qa-stamp {
  display: flex; flex-direction: column; align-items: center;
  padding: 5px 14px; border: 3px solid var(--ok); border-radius: 4px; color: var(--ok);
  transform: rotate(-7deg); animation: slam .26s cubic-bezier(.2,1.6,.4,1);
}
.qa-stamp.auto { background: rgba(44,202,95,.18); }
.qa-stamp .s-top { font-size: 10px; font-weight: 700; letter-spacing: .34em; line-height: 1.1; }
.qa-stamp .s-qa { font-size: 26px; font-weight: 900; letter-spacing: .2em; line-height: 1.1; }
@keyframes slam { from { transform: rotate(-7deg) scale(1.6); opacity: 0; } to { transform: rotate(-7deg) scale(1); opacity: 1; } }

#complete { margin-top: 0; padding: 20px 12px; }

.actions { display: flex; gap: 10px; }
.action {
  flex: 1; padding: 12px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: .09em;
  background: rgba(77,208,225,.10); border: 1px solid rgba(77,208,225,.55); color: var(--secondary);
}
.action:disabled { background: var(--surface); border-color: var(--outline); color: rgba(255,255,255,.24); cursor: default; }

/* floating readout: the thumb covers the note, so the value rides above it */
.readout {
  position: fixed; z-index: 40; pointer-events: none;
  min-width: 120px; padding: 8px 16px; border-radius: 6px; text-align: center;
  background: var(--recessed); color: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.26);
  box-shadow: 0 4px 14px rgba(0,0,0,.67);
}
.readout.prominent { background: var(--note-colour); color: var(--ink-on-note); }
.readout.glow { border: 2.5px solid var(--ok); }
.readout .r-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em; opacity: .7; }
.readout .r-value { display: block; font-size: 34px; font-weight: 900; line-height: 1.1; }
.readout .r-goal { display: block; font-size: 14px; font-weight: 900; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.62); padding: 20px; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.win-card, .confirm-card {
  position: relative; background: var(--surface); border-radius: 6px; padding: 24px 18px 16px;
  width: 100%; max-width: 340px; text-align: center; box-shadow: 0 22px 30px rgba(0,0,0,.67);
}
.win-card { border: 2px solid var(--ok); }
.confirm-card { border: 1px solid var(--outline); text-align: left; }
.win-card .rocket { font-size: 40px; line-height: 1; }
.win-card b { display: block; margin-top: 12px; color: var(--ok); font-size: 30px; font-weight: 900; letter-spacing: .13em; }
.win-card p { margin-top: 8px; color: rgba(255,255,255,.7); }
.confirm-card b { font-size: 18px; }
.confirm-card p { margin-top: 8px; color: rgba(255,255,255,.6); font-size: 14px; }
.confirm-actions { display: flex; gap: 10px; margin-top: 20px; }
.confirm-actions .primary { margin-top: 0; }

.shipped-card { text-align: center; color: var(--ok); transform: rotate(-7deg); animation: slam .3s cubic-bezier(.2,1.6,.4,1); }
.shipped-card b { display: block; font-size: 68px; font-weight: 900; line-height: 1; }
.shipped-card span { display: block; margin-top: 6px; font-size: 15px; font-weight: 900; letter-spacing: .3em; }

/* Wider screens: cap the board so notes stay post-it shaped rather than slabs. */
@media (min-width: 720px) {
  #match { padding-left: 22px; padding-right: 22px; }
  .board { max-width: 760px; width: 100%; margin: 0 auto; }
  #complete, .actions, .type-reqs, .stamp-slot, #match > .feature-select, .bar { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
}
/* Short screens: the character is decoration, so it yields first. */
@media (max-height: 700px) {
  .character img { max-height: 74px; }
  .blurb { display: none; }
}
/* Short screens (landscape phones): give the board what little room there is. */
@media (max-height: 620px) {
  .character { display: none; }
  .stamp-slot { height: 44px; }
  .qa-stamp .s-qa { font-size: 20px; }
  #complete { padding: 14px 12px; }
  .type-reqs { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .qa-stamp, .shipped-card { animation: none; }
  .note { transition: none; }
}
