/* GILAD — Neo-Brutalist "Poster" theme (design handoff, direction 1b).
   Grid-paper ground, 3px ink borders, hard offset shadows, lime + cobalt. */

@font-face {
  font-family: 'Archivo Black';
  src: url('../fonts/archivo-black-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/space-grotesk-var.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('../fonts/space-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('../fonts/space-mono-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #111111;
  --paper: #F6F2E8;
  --grid: rgba(17, 17, 17, .12);
  --white: #FFFFFF;
  --lime: #D4FF00;
  --cobalt: #2E5BFF;
  --muted: #555555;

  --display: 'Archivo Black', sans-serif;
  --ui: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;

  --pad-x: 20px;
  --safe-top: max(22px, calc(env(safe-area-inset-top, 0px) + 10px));
  --safe-bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 10px));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

button, input, select { font-family: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; }

body {
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--grid) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--grid) 23px 24px);
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

main {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) var(--pad-x) var(--safe-bottom);
  overflow-y: auto;
  overflow-x: hidden;
  animation: cut .12s linear;
}
@keyframes cut { from { opacity: 0; } to { opacity: 1; } }

/* Content sits above the decorative stickers. */
.screen > *, .ob-step > * { position: relative; z-index: 1; flex-shrink: 0; }

/* ============ DECORATION ============ */

.sticker-circle, .sticker-star, .sticker-lime {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border: 3px solid var(--ink);
}
.sticker-circle { right: -30px; top: 120px; width: 150px; height: 150px; border-radius: 50%; background: var(--cobalt); }
.sticker-star {
  right: 66px; top: 88px; width: 70px; height: 70px; background: var(--lime);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.sticker-lime { display: none; left: -60px; bottom: 140px; width: 260px; height: 260px; border-radius: 50%; background: var(--lime); }

.sticker-label {
  position: absolute;
  left: -10px; top: -18px;
  z-index: 2;
  background: var(--lime);
  border: 3px solid var(--ink);
  padding: 4px 10px;
  font: 700 11px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  transform: rotate(-4deg);
  white-space: nowrap;
}

/* ============ HEADER / TOP BAR ============ */

.nb-header { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.brand { font: 400 14px var(--display); letter-spacing: .04em; }

.level-pill, .topbar-pill {
  font: 700 11px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 3px solid var(--ink);
  border-radius: 99px;
  padding: 4px 12px;
  background: var(--white);
  color: var(--ink);
  white-space: nowrap;
}

.topbar { display: flex; align-items: center; gap: 10px; }
.topbar-time { margin-left: auto; font: 700 14px var(--mono); }
.close-circle {
  width: 36px; height: 36px; flex: none;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  display: grid; place-items: center;
  font: 700 18px/1 var(--ui);
}
.close-circle:active { background: var(--lime); }

/* ============ TITLE BLOCK ============ */

.title-block {
  margin-top: 34px;
  align-self: flex-start;
  max-width: 100%;
  background: var(--lime);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 12px 16px;
  transform: rotate(-2deg);
}
.title-block h1 {
  font: 400 38px/.9 var(--display);
  letter-spacing: -.02em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ============ PILLS ============ */

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rep-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.pill, .rep-chip, .lvl, .btn-pill, .gear-pill, .voice-hint, .action-btn {
  border: 3px solid var(--ink);
  border-radius: 99px;
  background: var(--white);
  color: var(--ink);
  font: 700 14px var(--ui);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

.pill { padding: 9px 16px; }
.pill.on { background: var(--cobalt); color: var(--white); box-shadow: 3px 3px 0 var(--ink); }
.pill.on::before { content: "✓ "; }
.pill.on:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

.rep-chip { padding: 9px 14px; font-size: 13px; }
.rep-chip.num { width: 44px; padding: 9px 0; text-align: center; }
.rep-chip.on { background: var(--ink); color: var(--lime); }

.lvl { flex: 1; padding: 9px 0; text-align: center; font-size: 13px; }
.lvl.on { background: var(--cobalt); color: var(--white); box-shadow: 3px 3px 0 var(--ink); }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }

.btn-pill { padding: 12px 18px; text-align: center; }
.btn-pill:active { background: var(--lime); }
.btn-pill.lime {
  background: var(--lime);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 16px;
  font: 400 18px var(--display);
  text-transform: uppercase;
}
.btn-pill.lime:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--ink); background: var(--lime); }
.btn-pill.dark { background: var(--ink); color: var(--white); box-shadow: 3px 3px 0 var(--cobalt); }
.btn-pill.dark:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--cobalt); background: var(--ink); }

.gear-pill { padding: 14px 18px; font-size: 16px; }
.voice-hint { padding: 10px 16px; font: 700 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; align-self: center; margin-top: 12px; }

/* ============ CARDS / LABELS ============ */

.card {
  width: 100%;
  border: 3px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  padding: 14px 16px;
}
.card-label {
  font: 700 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-body { font: 500 14px/1.6 var(--ui); margin-top: 6px; }
.card-body.lg { font-size: 16px; }
.card + .card { margin-top: 12px; }

.section-label {
  margin-top: 22px;
  font: 700 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.mono-note {
  margin-top: 14px;
  font: 700 11px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.mono-note:empty { display: none; }

/* ============ PRIMARY CTA ============ */

.cta-row {
  margin-top: auto;
  padding-top: 22px;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.btn-primary {
  flex: 1;
  width: 100%;
  text-align: left;
  border: 3px solid var(--ink);
  background: var(--lime);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 18px;
  font: 400 22px/1 var(--display);
  text-transform: uppercase;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.btn-primary:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); }
.btn-meta {
  font: 700 11px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 8px;
}
.btn-primary.btn-disabled {
  background: var(--white);
  color: var(--muted);
  box-shadow: none;
  pointer-events: none;
}

.btn-square {
  width: 70px;
  flex: none;
  border: 3px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  display: grid; place-items: center;
  font: 400 22px var(--display);
}
.btn-square:active { background: var(--lime); }

/* ============ INPUTS ============ */

.input-field {
  width: 100%;
  margin-top: 12px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 14px 16px;
  font: 500 18px var(--ui);
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
}
.input-field::placeholder { color: var(--muted); }
.input-field:focus { box-shadow: 3px 3px 0 var(--ink); }

.select-wrap { position: relative; margin-top: 12px; }
.select-wrap .input-field { margin-top: 0; padding-right: 44px; }
.select-wrap::after {
  content: "▾";
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  font: 700 18px var(--ui);
  pointer-events: none;
}

.check-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; font: 700 16px var(--ui); cursor: pointer; }
.check-row input {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; flex: none;
  border: 3px solid var(--ink);
  background: var(--white);
  display: grid; place-items: center;
  cursor: pointer;
}
.check-row input:checked { background: var(--lime); }
.check-row input:checked::after { content: "✓"; font: 700 16px/1 var(--ui); color: var(--ink); }

/* ============ ONBOARDING ============ */

.ob-step { display: flex; flex-direction: column; flex: 1; position: relative; }

/* ============ HOME ============ */

.levelup { margin-top: 22px; }
.levelup .pill-row { margin-top: 12px; }
.levelup .btn-pill { flex: 1; }

/* ============ MY WEIGHTS ============ */

.weights-phase { margin-top: 22px; }
.weights-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  border: 3px solid var(--ink);
  background: var(--white);
  padding: 12px 14px;
}
.weights-name { flex: 1; min-width: 0; font: 700 16px/1.2 var(--ui); }
.weights-source { font: 700 11px var(--mono); letter-spacing: .08em; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.weights-value { font: 400 28px/1 var(--display); white-space: nowrap; }
.weights-unit { font: 700 11px var(--mono); letter-spacing: .08em; color: var(--muted); margin-left: 4px; }
.weights-steppers { display: flex; gap: 8px; }
.circle-btn {
  width: 44px; height: 44px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  display: grid; place-items: center;
  font: 400 20px/1 var(--display);
}
.circle-btn:active { background: var(--lime); }
.weights-reset { margin-top: 10px; align-self: flex-start; padding: 6px 12px; font-size: 11px; font-family: var(--mono); letter-spacing: .08em; }

/* ============ HISTORY ============ */

.history-card { margin-top: 12px; cursor: pointer; }
.history-title { font: 400 22px/1 var(--display); text-transform: uppercase; margin-top: 6px; }
.history-detail { margin-top: 10px; font: 700 11px/1.7 var(--mono); letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.title-block .sticker-label { left: auto; right: -14px; top: -22px; transform: rotate(4deg); }

/* ============ SETTINGS ============ */

.settings-group { margin-top: 12px; }
.settings-footer {
  margin-top: 22px;
  font: 400 11px/1.6 var(--mono);
  color: var(--muted);
  text-align: center;
}

/* ============ WORKOUT ============ */

.workout-screen { padding-top: max(18px, calc(env(safe-area-inset-top, 0px) + 8px)); }

.seg-progress {
  margin-top: 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
}
.seg { height: 10px; background: var(--white); border: 2px solid var(--ink); }
.seg.done { background: var(--cobalt); }

.workout-player {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.workout-player > * { flex-shrink: 0; }

.headline { margin-top: 30px; position: relative; }
.headline-box {
  background: var(--white);
  border: 3px solid var(--ink);
  padding: 16px 14px 12px;
}
.headline-box h1 {
  font: 400 46px/.92 var(--display);
  letter-spacing: -.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.headline-sub {
  margin-top: 10px;
  font: 700 11px/1.6 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-band {
  margin: 22px calc(-1 * var(--pad-x)) 0;
  background: var(--cobalt);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  color: var(--white);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px var(--pad-x) 14px;
  position: relative;
}
.timer-number {
  font: 400 clamp(120px, 46vw, 180px)/.85 var(--display);
  letter-spacing: -.06em;
}
.timer-unit {
  text-align: right;
  font: 700 11px/1.6 var(--mono);
  letter-spacing: .1em;
  padding-bottom: 8px;
}
.pct-badge {
  position: absolute;
  right: var(--pad-x); top: -26px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid var(--ink);
  color: var(--ink);
  display: grid; place-items: center;
  font: 700 11px var(--mono);
}

.image-frame {
  margin-top: 20px;
  width: 100%;
  height: 160px;
  border: 3px solid var(--ink);
  background: var(--white);
  object-fit: cover;
  transform: rotate(1.5deg);
}

.action-row {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  gap: 8px;
}
.action-row:empty { display: none; }
.action-btn { flex: 1; padding: 14px 0; text-align: center; }
.action-btn:active { background: var(--lime); }
.action-btn.skip { background: var(--ink); color: var(--lime); box-shadow: 3px 3px 0 var(--cobalt); }
.action-btn.skip:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--cobalt); background: var(--ink); }

/* Gate (grab your gear) */
.gear-list { display: flex; flex-direction: column; gap: 8px; margin-top: 34px; }

/* Rest */
.workout-screen.rest {
  background: var(--cobalt);
  color: var(--white);
  padding: var(--safe-top) 22px var(--safe-bottom);
}
.rest .sticker-lime { display: block; }
.rest .seg-progress { display: none; }
.rest .topbar-time { color: var(--white); }
.rest-head { margin-top: 60px; }
.rest-title { font: 400 72px/.9 var(--display); letter-spacing: -.03em; }
.rest-number {
  margin-top: 6px;
  font: 400 clamp(150px, 60vw, 240px)/.85 var(--display);
  letter-spacing: -.07em;
  color: var(--ink);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 8px 8px 0 var(--lime);
}
.rest-bottom { margin-top: auto; padding-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.upnext-card {
  background: var(--white);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 12px;
  display: flex; gap: 14px; align-items: center;
}
.upnext-img { width: 72px; height: 72px; flex: none; border: 3px solid var(--ink); object-fit: cover; background: var(--white); }
.upnext-name { font: 400 26px/1 var(--display); text-transform: uppercase; margin-top: 4px; }

/* ============ COMPLETE ============ */

.complete-player { display: flex; flex-direction: column; flex: 1; }
.stat-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0;
  border-bottom: 3px solid var(--ink);
}
.stat-row:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-label { font: 700 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat-value { font: 400 28px/1 var(--display); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.confetti-piece {
  position: absolute;
  width: 12px; height: 12px;
  border: 2px solid var(--ink);
  background: var(--lime);
  animation: confetti-fall 2s linear forwards;
}
.confetti-piece:nth-child(even) { background: var(--cobalt); }
@keyframes confetti-fall {
  0% { top: -20px; transform: translateX(0) rotate(0deg); }
  100% { top: 100%; transform: translateX(var(--tx, 50px)) rotate(360deg); }
}
