/* ============================================================
   THE SECOND BUILD — BRUTALIST MONOCHROME
   Palette: #0B0B0B / #8E8E8E / #D8D8D4 / #F4F2EC / white.
   Zero color. Hard cuts. No decoration.
   ============================================================ */
:root {
  --ink: #0B0B0B;
  --gray: #8E8E8E;
  --line: #D8D8D4;
  --paper: #F4F2EC;
  --white: #FFFFFF;
  --bw: 3px; /* standard border weight */
}

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

html { scroll-behavior: auto; }

body {
  font-family: Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* concrete grain over everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--ink); color: var(--paper); }

/* ---------- TOP BAR ---------- */
.topbar {
  background: var(--ink); color: var(--paper);
  border-bottom: var(--bw) solid var(--ink);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; letter-spacing: 1.5px;
}
.brand { font-family: "Arial Black", Arial, sans-serif; font-size: 18px; letter-spacing: 0; }
.brand-num { color: var(--gray); }
.topbar-xp { border: 1px solid var(--gray); padding: 4px 10px; white-space: nowrap; }

/* ---------- NAV ---------- */
.mainnav {
  display: flex; border-bottom: var(--bw) solid var(--ink);
  background: var(--paper); position: sticky; top: 45px; z-index: 90;
  overflow-x: auto;
}
.mainnav button {
  flex: 1 0 auto; background: var(--paper); color: var(--ink);
  border: none; border-right: 2px solid var(--ink);
  font-family: "Arial Black", Arial, sans-serif; font-size: 14px; letter-spacing: 0.5px;
  padding: 14px 18px; cursor: pointer; white-space: nowrap;
}
.mainnav button:last-child { border-right: none; }
.mainnav button .n-idx {
  font-family: ui-monospace, monospace; font-size: 10px; color: var(--gray);
  display: block; letter-spacing: 2px; margin-bottom: 2px;
}
.mainnav button:hover { background: var(--ink); color: var(--paper); }
.mainnav button:hover .n-idx { color: var(--gray); }
.mainnav button.active { background: var(--ink); color: var(--paper); }
.mainnav button.active .n-idx { color: var(--paper); }

/* ---------- LAYOUT ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 20px 80px; }
.view { display: none; padding-top: 36px; }
.view.active { display: block; }

.spec-tag {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: 2px; border: 2px solid var(--ink);
  padding: 5px 12px; margin-bottom: 18px; background: var(--paper);
  text-transform: uppercase;
}

h2.h-big, .mega {
  font-family: "Arial Black", "Archivo Black", Impact, Arial, sans-serif;
  text-transform: uppercase; line-height: 0.92; letter-spacing: -1px;
}
.mega { font-size: clamp(64px, 13vw, 170px); margin: 10px 0 20px; }
h2.h-big { font-size: clamp(40px, 7vw, 84px); margin-bottom: 14px; }
.lede { font-size: 17px; max-width: 62ch; margin-bottom: 36px; font-weight: bold; }

/* ---------- HERO ---------- */
.hero-block { border: var(--bw) solid var(--ink); padding: 40px 32px; margin-bottom: 0; background: var(--white);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 26px, rgba(11,11,11,0.025) 26px, rgba(11,11,11,0.025) 28px); }
.hero-sub { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(15px, 2.4vw, 22px); margin: 6px 0 28px; max-width: 40ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- BUTTONS: hover = full invert, instant ---------- */
.btn {
  display: inline-block; font-family: "Arial Black", Arial, sans-serif; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--ink); color: var(--paper);
  border: var(--bw) solid var(--ink); padding: 16px 28px; cursor: pointer;
}
.btn:hover { background: var(--paper); color: var(--ink); }
.btn-inv { background: var(--paper); color: var(--ink); }
.btn-inv:hover { background: var(--ink); color: var(--paper); }
.btn-big { width: 100%; margin-top: 28px; font-size: 18px; padding: 20px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--ink); color: var(--paper); }

/* ---------- MARQUEE ---------- */
.marquee {
  border-top: var(--bw) solid var(--ink); border-bottom: var(--bw) solid var(--ink);
  background: var(--ink); color: var(--paper); overflow: hidden; white-space: nowrap;
}
.marquee-inner { display: inline-block; padding: 12px 0; animation: tick 22s linear infinite; }
.marquee-inner span {
  font-family: "Arial Black", Arial, sans-serif; font-size: 16px; letter-spacing: 1px;
  padding-right: 8px;
}
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- PANELS & GRIDS ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--bw) solid var(--ink); border-top: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.panel {
  border: var(--bw) solid var(--ink); background: var(--white); padding: 28px 26px;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(11,11,11,0.02) 30px, rgba(11,11,11,0.02) 32px);
}
.grid-3 .panel { border: none; border-right: var(--bw) solid var(--ink); }
.grid-3 .panel:last-child { border-right: none; }
.panel.wide { margin-top: 20px; }
.panel h3 { font-family: "Arial Black", Arial, sans-serif; font-size: 20px; margin-bottom: 12px; text-transform: uppercase; }
.panel p { font-size: 15px; }
.idx {
  font-family: "Arial Black", Arial, sans-serif; font-size: 34px; color: var(--white);
  -webkit-text-stroke: 2px var(--ink); margin-bottom: 10px; line-height: 1;
}
.big-quote { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(20px, 3.4vw, 34px); line-height: 1.15; margin: 8px 0 26px; }
.muted { color: var(--gray); font-size: 14px; margin-top: 10px; }

/* ---------- TERMS ---------- */
.term h3 { font-size: 24px; }

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border: var(--bw) solid var(--ink); }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--white); min-width: 640px; }
.spec-table th, .spec-table td { border: 2px solid var(--ink); padding: 12px 14px; text-align: left; }
.spec-table thead th { background: var(--ink); color: var(--paper); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 2px; }

/* ---------- TRAIN ---------- */
.phase-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: var(--bw) solid var(--ink); margin: 26px 0; }
.phase-btn {
  background: var(--paper); border: none; border-right: var(--bw) solid var(--ink);
  padding: 22px; cursor: pointer; text-align: left;
}
.phase-btn:last-child { border-right: none; }
.phase-btn .phase-name { display: block; font-family: "Arial Black", Arial, sans-serif; font-size: 22px; margin-top: 8px; }
.phase-btn:hover { background: var(--ink); color: var(--paper); }
.phase-btn.active { background: var(--ink); color: var(--paper); }
.phase-btn.active .spec-tag { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.week-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: var(--bw) solid var(--ink); margin-bottom: 8px; }
.week-btn { background: var(--white); border: none; border-right: 2px solid var(--ink); padding: 16px 10px; cursor: pointer; }
.week-btn:last-child { border-right: none; }
.week-btn:hover { background: var(--ink); color: var(--paper); }
.week-btn.active { background: var(--ink); color: var(--paper); }
.week-num { display: block; font-family: "Arial Black", Arial, sans-serif; font-size: 16px; }
.week-note { display: block; font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 1px; color: var(--gray); margin-top: 4px; }
.week-btn.active .week-note, .week-btn:hover .week-note { color: var(--line); }

.day-row { display: grid; grid-template-columns: repeat(5, 1fr); border: var(--bw) solid var(--ink); border-top: none; margin-bottom: 32px; }
.day-btn { background: var(--paper); border: none; border-right: 2px solid var(--ink); padding: 16px 8px; cursor: pointer; }
.day-btn:last-child { border-right: none; }
.day-btn:hover { background: var(--ink); color: var(--paper); }
.day-btn.active { background: var(--ink); color: var(--paper); }
.day-name { display: block; font-family: "Arial Black", Arial, sans-serif; font-size: 15px; }
.day-meta { display: block; font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: 0.5px; color: var(--gray); margin-top: 6px; line-height: 1.4; }
.day-btn.active .day-meta, .day-btn:hover .day-meta { color: var(--line); }

.wo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.wo-title { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(34px, 6vw, 64px); line-height: 1; }
.wo-est { font-family: ui-monospace, monospace; font-size: 14px; color: var(--gray); letter-spacing: 2px; }
.wo-focus { font-weight: bold; margin-top: 8px; }
.wo-note { color: var(--gray); font-size: 14px; margin-top: 6px; max-width: 60ch; }
.track-pick { display: flex; border: var(--bw) solid var(--ink); }
.track-btn { background: var(--paper); border: none; border-right: 2px solid var(--ink); padding: 12px 20px; cursor: pointer;
  font-family: "Arial Black", Arial, sans-serif; font-size: 13px; }
.track-btn:last-child { border-right: none; }
.track-btn:hover { background: var(--ink); color: var(--paper); }
.track-btn.active { background: var(--ink); color: var(--paper); }

/* timer */
.timer-box { border: var(--bw) solid var(--ink); background: var(--ink); color: var(--paper); padding: 18px 20px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.timer-box .spec-tag { background: var(--ink); color: var(--paper); border-color: var(--paper); margin: 0; }
.timer-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tbtn { background: transparent; color: var(--paper); border: 2px solid var(--paper); padding: 8px 14px; cursor: pointer;
  font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 1px; }
.tbtn:hover { background: var(--paper); color: var(--ink); }
.timer-read { font-family: "Arial Black", Arial, sans-serif; font-size: 34px; margin-left: auto; }

/* exercise cards */
.ex-card { border: var(--bw) solid var(--ink); background: var(--white); margin-bottom: 18px; }
.ex-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 2px solid var(--ink); flex-wrap: wrap; }
.ex-idx { font-family: "Arial Black", Arial, sans-serif; font-size: 22px; }
.ex-head h4 { font-family: "Arial Black", Arial, sans-serif; font-size: 18px; flex: 1; min-width: 180px; }
.tag { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 2px; border: 2px solid var(--ink); padding: 4px 10px; }
.tag-closer { background: var(--ink); color: var(--paper); }
.ex-spec { font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 1px; padding: 12px 18px; border-bottom: 2px solid var(--ink); background: var(--paper); }
.cues { list-style: none; padding: 14px 18px; }
.cues li { font-size: 14.5px; padding: 4px 0 4px 18px; position: relative; }
.cues li::before { content: "▸"; position: absolute; left: 0; font-weight: bold; }
.ot-line { font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 1px; background: var(--ink); color: var(--paper); padding: 10px 18px; }
.set-row { display: flex; gap: 10px; padding: 16px 18px; flex-wrap: wrap; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; padding: 16px 18px; }
.set-cell { display: flex; flex-direction: column; gap: 6px; }
.set-cell .set-box { width: 100%; }
.wt-input {
  width: 100%; box-sizing: border-box; border: 2px solid var(--ink); background: var(--paper);
  font-family: ui-monospace, monospace; font-size: 14px; font-weight: 700; text-align: center;
  padding: 8px 4px; color: var(--ink); border-radius: 0; -moz-appearance: textfield; appearance: textfield;
}
.wt-input::-webkit-outer-spin-button, .wt-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wt-input::placeholder { color: var(--gray); font-weight: 400; }
.wt-input:focus { outline: none; background: var(--white); box-shadow: 3px 3px 0 var(--ink); }
.set-box {
  width: 52px; height: 52px; border: var(--bw) solid var(--ink); background: var(--paper);
  font-family: "Arial Black", Arial, sans-serif; font-size: 16px; cursor: pointer;
}
.set-box:hover { background: var(--ink); color: var(--paper); }
.set-box.done { background: var(--ink); color: var(--paper); }

/* my own form */
.fld-label { display: block; font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 2px; margin: 18px 0 8px; }
.fld-label:first-child { margin-top: 0; }
.fld { width: 100%; border: var(--bw) solid var(--ink); background: var(--paper); padding: 14px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; }

/* ---------- PROGRESS ---------- */
.lvl-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lvl { font-family: "Arial Black", Arial, sans-serif; font-size: 28px; white-space: nowrap; }
.xp-bar { flex: 1; min-width: 160px; height: 26px; border: var(--bw) solid var(--ink); background: var(--paper); }
.xp-fill { height: 100%; background: var(--ink); }
.xp-num { font-family: ui-monospace, monospace; font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.stat .idx { font-size: 44px; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: var(--bw) solid var(--ink); margin-top: 20px; }
.badge { border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 20px 16px; min-height: 130px; }
.badge:nth-child(4n) { border-right: none; }
.badge:nth-child(n+5) { border-bottom: none; }
.badge-name { font-family: "Arial Black", Arial, sans-serif; font-size: 14px; margin-bottom: 8px; }
.badge-desc { font-size: 12.5px; color: var(--gray); }
.badge.earned { background: var(--ink); color: var(--paper); }
.badge.earned .badge-desc { color: var(--line); }
.badge.locked { background: var(--paper); }
.badge.locked .badge-name { color: var(--gray); }
.log-list { border: var(--bw) solid var(--ink); background: var(--white); margin-top: 20px; }
.log-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 2px solid var(--ink);
  font-family: ui-monospace, monospace; font-size: 12.5px; letter-spacing: 0.5px; flex-wrap: wrap; }
.log-row:last-child { border-bottom: none; }

/* ---------- CREW ---------- */
.ref-code { font-family: "Arial Black", Arial, sans-serif; font-size: 34px; letter-spacing: 3px; margin: 14px 0; }
.share-card { border: var(--bw) solid var(--ink); background: var(--ink); color: var(--paper); padding: 0; }
.sc-top { font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 3px; padding: 16px 20px; border-bottom: 2px solid var(--paper); }
.sc-mid { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(24px, 4vw, 38px); line-height: 1.1; padding: 28px 20px; }
.sc-bot { font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 2px; padding: 16px 20px; border-top: 2px solid var(--paper);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-code { font-family: "Arial Black", Arial, sans-serif; font-size: 18px; letter-spacing: 2px; }
.feed { border: var(--bw) solid var(--ink); background: var(--white); margin-top: 12px; }
.feed-post { padding: 18px 20px; border-bottom: 2px solid var(--ink); }
.feed-post:last-child { border-bottom: none; }
.feed-user { font-family: "Arial Black", Arial, sans-serif; font-size: 14px; }
.feed-post p { margin: 8px 0; font-size: 15px; }
.feed-time { font-family: ui-monospace, monospace; font-size: 11px; color: var(--gray); letter-spacing: 1px; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: var(--paper); border: var(--bw) solid var(--paper);
  outline: 2px solid var(--ink);
  font-family: "Arial Black", Arial, sans-serif; font-size: 14px; letter-spacing: 0.5px;
  padding: 16px 26px; z-index: 1000; max-width: 92vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- FOOTER ---------- */
.footer { border-top: var(--bw) solid var(--ink); background: var(--ink); color: var(--paper); margin-top: 60px; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 22px 20px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 2px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-3 .panel { border-right: none; border-bottom: var(--bw) solid var(--ink); }
  .grid-3 .panel:last-child { border-bottom: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .badge:nth-child(4n) { border-right: 2px solid var(--ink); }
  .badge:nth-child(2n) { border-right: none; }
  .badge:nth-child(n+5) { border-bottom: 2px solid var(--ink); }
  .badge:nth-last-child(-n+2) { border-bottom: none; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .week-btn:nth-child(2n) { border-right: none; }
  .week-btn { border-bottom: 2px solid var(--ink); }
  .week-btn:nth-last-child(-n+2) { border-bottom: none; }
  .day-row { grid-template-columns: repeat(2, 1fr); }
  .day-btn { border-bottom: 2px solid var(--ink); }
  .day-btn:nth-child(2n) { border-right: none; }
  .day-btn:last-child { border-bottom: none; }
  .timer-read { margin-left: 0; }
  .hero-block { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-inner { animation: none; }
}

/* ---------- PRIMER / COOLDOWN (optional, outside the 50) ---------- */
.primer { border: var(--bw) solid var(--ink); margin: 28px 0; background: var(--white); }
.primer summary { cursor: pointer; padding: 16px 20px; list-style: none; }
.primer summary::-webkit-details-marker { display: none; }
.primer summary .spec-tag::before { content: "+  "; font-weight: bold; }
.primer[open] summary .spec-tag::before { content: "\2013  "; }
.primer-body { padding: 4px 20px 20px; }

/* ---------- AUTH GATE ---------- */
.auth-gate { display: none; position: fixed; inset: 0; z-index: 200; background: var(--paper);
  overflow-y: auto; padding: 48px 20px; }
.auth-gate.show { display: block; }
.auth-card { max-width: 520px; margin: 0 auto; background: var(--white);
  border: var(--bw) solid var(--ink); padding: 36px 28px; }
.auth-card .btn-big { width: 100%; }
.auth-card .btn-inv { width: 100%; }
.auth-err { min-height: 20px; font-family: ui-monospace, monospace; font-size: 12px;
  letter-spacing: 1px; color: #a00; margin: 12px 0; }
.logout-btn { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 2px;
  background: none; border: 2px solid var(--ink); padding: 6px 10px; cursor: pointer;
  color: var(--ink); }

/* ---------- AUTH GATE V2 ---------- */
.auth-card { position: relative; }
.auth-close { position: absolute; top: 12px; right: 12px; background: none;
  border: 2px solid var(--ink); width: 36px; height: 36px; cursor: pointer;
  font-size: 16px; color: var(--ink); }
.link-btn { display: block; margin: 16px auto 0; background: none; border: none;
  font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 2px;
  text-decoration: underline; cursor: pointer; color: var(--ink); }
.log-head { cursor: pointer; }
.log-detail { padding: 4px 0 12px; }
.btn-del { margin-top: 8px; font-size: 12px; padding: 10px 14px; }

/* ---------- COACH PLATFORM (dashboard / join wall / captain) ---------- */
.tab-row { display: flex; border: var(--bw) solid var(--ink); margin: 24px 0; background: var(--white); }
.tab-row .track-btn { flex: 1; }
.tab-row .track-btn:last-child { border-right: none; }
.search-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.search-row .fld { margin-top: 0; }
#strengthChart { display: block; }
select.fld { border-radius: 0; }
