/* Thursday Crew web app. Direction A, "Bold poster". Tokens match DESIGN.md / Theme.swift. */

@font-face {
  font-family: "Anton";
  src: url("/app/fonts/Anton-Regular.ttf") format("truetype");
  font-display: block;
}

:root {
  --ink: #101422;
  --slate: #272B3B;
  --ice: #A8DCE7;
  --accent: #FF6A1A;
  --accent-deep: #C2410C;
  --go: #2ECC71;
  --go-light: #7EE2A8;
  --stop: #DC2626;
  --text: #fff;
  --text-2: rgba(255, 255, 255, .62);
  --text-3: rgba(255, 255, 255, .4);
  --hairline: rgba(255, 255, 255, .08);
  --hairline-4: rgba(255, 255, 255, .32);

  --xs: 4px; --s: 8px; --m: 12px; --l: 16px; --xl: 24px; --xxl: 32px;
  --gutter: 20px;
  --r-s: 10px; --r-m: 18px; --r-l: 28px;

  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; }
img { display: block; }
svg.i { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

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

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + var(--s)) var(--gutter) calc(var(--safe-bottom) + 110px);
  display: flex;
  flex-direction: column;
  gap: var(--xl);
}
.screen.no-tabs { padding-bottom: calc(var(--safe-bottom) + 120px); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-xs { gap: var(--xs); } .gap-s { gap: var(--s); } .gap-m { gap: var(--m); }
.gap-l { gap: var(--l); } .gap-xl { gap: var(--xl); }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.hscroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.hscroll::-webkit-scrollbar { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--m); }
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s); }

/* ---------- type ---------- */

.poster {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.02;
  margin: 0;
  overflow-wrap: normal;
  letter-spacing: 0;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ice);
}
.caption { font-size: 13px; font-weight: 500; }
.strong { font-weight: 600; }
.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }
.ice { color: var(--ice); }
.micro { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); }
.clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- components ---------- */

.card {
  background: var(--slate);
  border-radius: var(--r-m);
  padding: var(--l);
  width: 100%;
  text-align: left;
}
.card.m { padding: var(--m); }
.card.xl { padding: var(--xl); }

.tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 7px;
  background: var(--ice);
  color: var(--ink);
  line-height: 1.2;
}
.tag.outline { background: transparent; color: var(--ice); box-shadow: inset 0 0 0 1px var(--ice); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--slate);
  color: var(--text);
  flex: none;
}
.chip.on { background: var(--ice); color: var(--ink); }

.btn-primary {
  width: 100%;
  font-family: var(--display);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 0;
  border-radius: 999px;
  background: var(--ice);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s, opacity .12s;
}
.btn-primary:active:not(:disabled) { transform: scale(.98); opacity: .8; }
.btn-primary:disabled { background: var(--slate); color: var(--text-3); }
.btn-primary svg { font-size: 18px; }

.btn-secondary {
  width: 100%;
  font-weight: 600;
  padding: 14px 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--hairline-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-secondary:active { opacity: .6; }

.round {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--slate);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex: none;
}
.round.sm { width: 36px; height: 36px; font-size: 14px; }
.round.ink { background: var(--ink); color: var(--text-2); }

.pill-btn {
  font-family: var(--display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .8px;
  height: 44px;
  padding: 0 var(--l);
  border-radius: 999px;
  background: var(--slate);
}
.pill-btn:disabled { color: var(--text-3); }

.num-badge {
  position: absolute;
  top: -6px; left: -6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ice);
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-s);
  background: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
}
.tile > .art { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.tile > svg { width: 50%; height: 50%; color: var(--ice); }

.gear-pill {
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--ice);
}
.flow { display: flex; flex-wrap: wrap; gap: 6px; }

.avatar {
  border-radius: 50%;
  background: var(--ink);
  color: var(--ice);
  font-family: var(--display);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px var(--hairline-4);
  flex: none;
  line-height: 1;
}
.avatar.hl { box-shadow: inset 0 0 0 2px var(--ice); }

/* ---------- bottom bar ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 10px);
  width: min(calc(100% - 64px), 420px);
  display: flex;
  gap: var(--xs);
  padding: 6px;
  background: var(--slate);
  border-radius: 999px;
  box-shadow: 0 8px 36px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--hairline);
  z-index: 10;
}
.tabbar button {
  height: 50px;
  width: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 18px;
  transition: flex-grow .3s, background-color .2s;
}
.tabbar button.on { flex: 1; background: var(--ice); color: var(--ink); }
.tabbar button span { font-family: var(--display); font-size: 16px; letter-spacing: .8px; text-transform: uppercase; }

/* ---------- sticky start bar ---------- */

.startbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: var(--m) var(--gutter) calc(var(--safe-bottom) + var(--m));
  background: linear-gradient(to bottom, rgba(16, 20, 34, 0), var(--ink) 50%);
  z-index: 10;
}
.startbar > * { max-width: 520px; margin: 0 auto; }

/* ---------- train ---------- */

.featured {
  background: var(--ice);
  color: var(--ink);
  border-radius: var(--r-l);
  padding: var(--xl);
  display: flex;
  flex-direction: column;
  gap: var(--m);
  text-align: left;
  width: 100%;
}
.featured .round { background: var(--ink); color: var(--ice); width: 34px; height: 34px; font-size: 15px; }
.featured .plus4 { width: 44px; height: 44px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(16, 20, 34, .3); font-family: var(--display); font-size: 18px; display: grid; place-items: center; }
.featured .meta { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }

.build-tile .round { background: var(--ink); color: var(--ice); width: 36px; height: 36px; }

.workout-card { display: flex; align-items: center; gap: var(--m); }
.workout-card .chev { color: var(--text-3); font-size: 14px; }

/* ---------- detail ---------- */

.station-btn { display: flex; align-items: center; gap: var(--m); width: 100%; text-align: left; }
.kit-line { font-size: 12px; font-weight: 600; color: var(--ice); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* ---------- builder ---------- */

.name-input {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--display);
  font-size: 48px;
  line-height: 1.1;
  text-transform: uppercase;
  padding: 0;
}
.balance { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s); }
.balance > div { background: var(--slate); border-radius: var(--r-s); padding: var(--s) var(--m); }
.balance > div.met { box-shadow: inset 0 0 0 1px rgba(168, 220, 231, .5); }
.balance .n { font-family: var(--display); font-size: 28px; line-height: 1.1; }
.balance .lbl { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--text-2); }
.empty-slot {
  display: flex; align-items: center; gap: var(--m);
  width: 100%;
  padding: var(--m);
  border-radius: var(--r-m);
  border: 1px dashed var(--text-3);
  text-align: left;
}
.empty-slot .tile { width: 56px; background: var(--slate); }
.empty-slot .tile > svg { width: 18px; height: 18px; }
.search {
  display: flex; align-items: center; gap: var(--s);
  height: 44px;
  padding: 0 var(--l);
  border-radius: 999px;
  background: var(--slate);
  color: var(--text-3);
}
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); min-width: 0; }
.pick-row { display: flex; align-items: center; gap: var(--m); padding: var(--s); background: var(--slate); border-radius: var(--r-s); }
.pick-row > button:first-child { display: flex; align-items: center; gap: var(--m); flex: 1; min-width: 0; text-align: left; }
.pick-row.dim > button:first-child { opacity: .5; }
.check-list { background: var(--slate); border-radius: var(--r-m); padding: 0 var(--l); }
.check-list button { display: flex; align-items: center; width: 100%; padding: var(--m) 0; font-weight: 600; text-align: left; }
.check-list button + button { border-top: 1px solid var(--hairline); }
.check-list .tick { margin-left: auto; font-size: 22px; color: var(--text-3); }
.check-list .tick.on { color: var(--ice); }

/* ---------- crew ---------- */

.segmented { display: flex; padding: 4px; border-radius: 999px; background: var(--slate); }
.segmented button {
  flex: 1;
  height: 40px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-2);
}
.segmented button.on { background: var(--ice); color: var(--ink); }
.podium { display: flex; align-items: flex-end; gap: var(--s); }
.podium > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s); }
.podium .col {
  width: 100%;
  border-radius: var(--r-m) var(--r-m) 0 0;
  background: var(--slate);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--m) 0;
}
.podium .col.first { background: var(--accent); color: var(--ink); }
.podium .unit { font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--text-3); }
.podium .first .unit { color: rgba(16, 20, 34, .7); }
.rank-row { display: flex; align-items: center; gap: var(--m); padding: var(--m) var(--l); border-radius: var(--r-m); background: var(--slate); }
.rank-row.me { background: var(--ice); color: var(--ink); }
.rank-row .rk { width: 28px; font-family: var(--display); font-size: 22px; color: var(--text-2); }
.rank-row.me .rk { color: var(--ink); }

/* ---------- you ---------- */

.history-row { display: flex; align-items: center; gap: var(--m); }
.history-row .check { width: 32px; height: 32px; border-radius: 50%; background: var(--ice); color: var(--ink); display: grid; place-items: center; font-size: 14px; flex: none; }

/* ---------- onboarding ---------- */

.onboard {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + var(--l)) var(--gutter) calc(var(--safe-bottom) + var(--l));
}
.onboard .page { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--l); animation: fadeIn .3s; }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: var(--l); }
.dots span { height: 8px; width: 8px; border-radius: 999px; background: var(--slate); transition: width .25s; }
.dots span.on { width: 24px; background: var(--ice); }
.big-input {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--display);
  font-size: 34px;
  padding: var(--s) 0;
  border-bottom: 2px solid var(--hairline-4);
}
.big-input:focus { border-color: var(--ice); }
.big-input::placeholder { color: var(--text-3); }
.install-hint { display: flex; gap: var(--m); align-items: flex-start; }

/* ---------- sheets ---------- */

.layer { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); animation: fadeIn .2s; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: calc(var(--safe-top) + 24px);
  background: var(--ink);
  border-radius: 14px 14px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: slideUp .28s cubic-bezier(.2, .9, .3, 1);
  box-shadow: 0 -1px 0 var(--hairline);
}
.sheet .screen { padding-top: var(--l); padding-bottom: calc(var(--safe-bottom) + var(--xl)); }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--text-3); margin: 6px auto 0; }
.full { position: fixed; inset: 0; z-index: 20; background: var(--ink); overflow-y: auto; animation: slideUp .3s cubic-bezier(.2, .9, .3, 1); }

.dialog-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center; padding: var(--gutter); padding-bottom: calc(var(--safe-bottom) + var(--gutter)); }
.dialog-wrap .sheet-backdrop { z-index: -1; }
.dialog {
  width: 100%; max-width: 420px;
  background: var(--slate);
  border-radius: var(--r-m);
  padding: var(--xl);
  display: flex; flex-direction: column; gap: var(--m);
  animation: slideUp .25s cubic-bezier(.2, .9, .3, 1);
}
.dialog .danger { background: var(--stop); color: #fff; }
.dialog input { width: 100%; padding: 12px 14px; border-radius: var(--r-s); border: 0; background: var(--ink); outline: none; }

.menu { position: absolute; right: var(--gutter); top: calc(var(--safe-top) + 60px); background: var(--slate); border-radius: var(--r-s); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); overflow: hidden; min-width: 180px; animation: fadeIn .15s; }
.menu button { display: flex; width: 100%; padding: 13px 16px; gap: 10px; align-items: center; font-weight: 600; }
.menu button + button { border-top: 1px solid var(--hairline); }
.menu .del { color: #ff6b6b; }

/* ---------- player ---------- */

.player {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  gap: var(--l);
  padding: calc(var(--safe-top) + var(--s)) var(--gutter) calc(var(--safe-bottom) + var(--s));
  transition: background-color .8s, color .35s;
  overflow: hidden;
  user-select: none;
}
.player > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.player.getReady { background: var(--slate); color: #fff; --sec: var(--text-2); }
.player.work { background: var(--go); color: var(--ink); --sec: rgba(16, 20, 34, .65); }
.player.work.late { background: var(--go-light); }
.player.rest, .player.roundRest { background: var(--stop); color: #fff; --sec: rgba(255, 255, 255, .75); }
.player .sec { color: var(--sec); }
.player .x { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: color-mix(in srgb, var(--sec) 18%, transparent); }
.player .counter { text-align: right; }
.player .counter b { display: block; font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.player .counter small { font-size: 10px; font-weight: 900; letter-spacing: 1px; color: var(--sec); }
.player .phase { font-size: clamp(64px, 24vw, 96px); }
.player .ex-name { font-size: 72px; }
.player:not(.work) .ex-name { font-size: 36px; }
.player .art-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; }
.player .art-wrap .tile { height: 100%; max-height: 300px; width: auto; max-width: 100%; border-radius: var(--r-l); }
.player:not(.work) .art-wrap .tile { opacity: .85; }
.player .clock { font-family: var(--display); font-size: 120px; line-height: 1; font-variant-numeric: tabular-nums; }
.player .next { text-align: right; max-width: 45%; }
.player .next b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.05; text-transform: uppercase; }
.player .bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--sec) 25%, transparent); overflow: hidden; }
.player .bar i { display: block; height: 100%; background: currentColor; border-radius: 4px; }
.player .controls { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--l); }
.player .controls .side { width: 56px; height: 56px; display: grid; place-items: center; font-size: 24px; }
.player .controls .main { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: currentColor; }
.player .controls .main svg { color: var(--bg); }
.player.getReady { --bg: var(--slate); }
.player.work { --bg: var(--go); }
.player.work.late { --bg: var(--go-light); }
.player.rest, .player.roundRest { --bg: var(--stop); }
.player.paused .clock { opacity: .55; }

.done { position: fixed; inset: 0; z-index: 30; background: var(--ice); color: var(--ink); display: flex; flex-direction: column; gap: var(--l); padding: calc(var(--safe-top) + var(--s)) var(--gutter) calc(var(--safe-bottom) + var(--s)); animation: fadeIn .3s; }
.done > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.done .stat { background: var(--ink); border-radius: var(--r-m); padding: var(--m); }
.done .btn-ink { width: 100%; font-family: var(--display); font-size: 22px; text-transform: uppercase; padding: 16px 0; border-radius: 999px; background: var(--ink); color: var(--ice); }

/* ---------- launch ---------- */

.launch { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: grid; place-items: center; transition: opacity .35s, transform .35s; }
.launch.leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.launch .lockup { display: flex; flex-direction: column; align-items: center; gap: var(--xl); }
.launch svg { width: 136px; height: 136px; }
.launch .seg, .launch .letter { opacity: 0; transform-box: fill-box; transform-origin: center; }
.launch .seg { transform: scale(.82); transition: opacity .18s ease-out, transform .18s ease-out; }
.launch .seg.lit { transform: scale(1.3); transition: opacity .3s, transform .35s cubic-bezier(.3, 1.8, .5, 1); }
.launch .letter { transform: scale(.6); transition: opacity .3s, transform .4s cubic-bezier(.3, 1.5, .5, 1); }
.launch .on { opacity: 1; transform: none; }
.launch .words { text-align: center; opacity: 0; transform: translateY(10px); transition: opacity .35s ease-out, transform .35s ease-out; }
.launch .words.on { opacity: 1; transform: none; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 90px); transform: translateX(-50%); background: var(--slate); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); animation: fadeIn .2s; white-space: nowrap; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

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