/* ============ M.O.E — Comp Day · Iron Forge theme ============ */
:root {
  --bg: #0a0a0a;
  --bg-2: #111214;
  --bg-3: #181a1d;
  --text: #f5f5f5;
  --muted: #a8adb3;
  --accent: #e5322d;
  --accent-dark: #b01e1a;
  --gold: #f0d060;
  --line: #26282c;
  --radius: 12px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Arial Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

h2 {
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

a { color: var(--accent); }
strong { color: var(--text); }
.how { color: var(--muted); font-size: 0.94rem; margin-bottom: 1rem; }
.fine { color: var(--muted); font-size: 0.82rem; margin-top: 0.8rem; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 1rem 0.55rem;
  background: rgba(10, 10, 10, 0.94);
  border-bottom: 2px solid var(--accent);
}
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand-mark {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}
.brand-e { color: var(--accent); }
.brand-sub {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  color: var(--muted);
  margin-top: 0.2rem;
}
.cd-chip {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  text-align: right;
  white-space: nowrap;
}

/* ---------- Tabs (bottom app bar) ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: rgba(17, 18, 20, 0.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 60px;
  padding: 0.6rem 0.25rem;
  cursor: pointer;
  border-top: 3px solid transparent;
}
.tab.is-active { color: var(--text); border-top-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Layout / cards ---------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 0.9rem 0;
}
.panel[hidden] { display: none; }
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.2rem;
  margin-bottom: 1rem;
}

/* ---------- Countdown ---------- */
.countdown-card { text-align: left; border-left: 5px solid var(--accent); }
.card-kicker {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
}
.cd-big {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 4.6rem;
  line-height: 1;
  margin: 0.3rem 0 0.4rem;
}
.cd-big .cd-unit {
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-left: 0.5rem;
}
.cd-meta { color: var(--muted); font-size: 0.92rem; }

/* ---------- Timer ---------- */
.timer-display {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 6rem;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 0.4rem 0 0.6rem;
}
.timer-display.urgent { color: var(--accent); }
.timer-display.done { color: var(--gold); }
.timer-track {
  height: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.timer-track span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}
.timer-state { text-align: center; color: var(--muted); margin: 0.7rem 0 1rem; min-height: 1.5em; }
.timer-btns { display: flex; gap: 0.6rem; }
.timer-btns .btn-big { flex: 1; }

/* ---------- Buttons / fields ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.05rem;
  min-height: 54px;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
}
.btn:active { background: var(--accent-dark); }
.btn-big { width: 100%; min-height: 64px; font-size: 1.3rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:active { background: var(--bg-3); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn.is-running { background: var(--bg-3); border-color: var(--accent); color: var(--text); }

.field { display: block; margin-bottom: 0.8rem; }
.field > span {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  padding: 0.7rem 0.8rem;
  min-height: 52px;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-row { display: flex; gap: 0.7rem; }
.field-row .field { flex: 1; }

/* ---------- Plate calculator ---------- */
.bar-picker { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.bar-opt { flex: 1; }
.bar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.bar-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.5rem 0.3rem;
  text-align: center;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  cursor: pointer;
}
.bar-opt input:checked + span { border-color: var(--accent); color: #fff; background: #2a1214; }
.bar-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.plate-stack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 84px;
  padding: 0.6rem 0.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
.plate-stack .bar-end {
  flex: 0 0 auto;
  height: 10px;
  width: 34px;
  background: #4a4f57;
  border-radius: 4px;
}
.plate {
  flex: 0 0 auto;
  border-radius: 4px;
  border: 1px solid #0b0b0c;
  position: relative;
}
.plate-stack .empty-note { color: var(--muted); font-size: 0.9rem; }
.plate-out { font-size: 1.05rem; margin-top: 0.9rem; }
.plate-out strong { color: var(--accent); }
.plate-msg { color: var(--gold); min-height: 1.4em; font-size: 0.94rem; }

/* ---------- Planner ---------- */
.event-block { border-top: 1px solid var(--line); padding: 0.9rem 0 0.2rem; }
.event-block:first-of-type { border-top: 0; }
.event-name {
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1.08rem;
}
.event-weights { color: var(--accent); font-weight: 700; font-size: 0.98rem; margin: 0.15rem 0 0.1rem; }
.event-meta { color: var(--muted); font-size: 0.86rem; margin-bottom: 0.5rem; }

/* ---------- Benchmarks / log ---------- */
.bench-table { width: 100%; border-collapse: collapse; }
.bench-table th {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: left;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--line);
}
.bench-table td { padding: 0.45rem 0.3rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.bench-table .lift-name { font-weight: 700; }
.bench-table .moe-num {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--accent);
  white-space: nowrap;
}
.bench-table .moe-sub { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.mypr-input {
  width: 92px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 0.6rem;
  min-height: 48px;
}

.bests-list { list-style: none; }
.bests-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.bests-list li:last-child { border-bottom: 0; }
.bests-list .best-num { font-family: var(--font-head); font-weight: 900; color: var(--accent); white-space: nowrap; }

.log-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.6rem;
  background: var(--bg-3);
}
.log-entry-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; }
.log-entry-ex { font-family: var(--font-head); font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; font-size: 1.05rem; }
.log-entry-date { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.log-entry-line { margin-top: 0.15rem; }
.log-entry-line strong { color: var(--accent); }
.log-entry-notes { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }
.log-del {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  margin-top: 0.55rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.log-del:active { color: #fff; border-color: var(--accent); }

/* ---------- Games ---------- */
.game-stage { position: relative; }
.game-hit {
  appearance: none;
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.game-hit svg { display: block; width: 100%; height: auto; }
.game-hit:active { border-color: var(--accent); }
.game-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#g-move { transition: transform 0.08s ease-out; }
.game-progress {
  height: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.8rem;
}
.game-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.08s linear;
}
.game-readout { margin-top: 0.8rem; min-height: 1.6em; }
.game-readout strong { color: var(--accent); }
.game-stamp {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg) scale(1.6);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.25rem 0.7rem;
  background: rgba(10, 10, 10, 0.82);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.game-stamp.show { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
.game-stamp.party { color: var(--gold); border-color: var(--gold); font-size: 1.05rem; white-space: normal; text-align: center; }
.game-stage.flash { animation: stageflash 0.35s ease; }
@keyframes stageflash {
  0% { background: rgba(229, 50, 45, 0.22); }
  100% { background: transparent; }
}

.link-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.link-card {
  display: block;
  text-decoration: none;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  min-height: 60px;
}
.link-card-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  font-size: 1.1rem;
}
.link-card-sub { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 0.1rem; }

/* ---------- Install / footer ---------- */
.install-card { border-left: 5px solid var(--accent); }
.install-card strong { color: var(--accent); }
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.6rem 1rem 1.4rem;
}
.app-footer .fine { margin-top: 0.3rem; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #g-move, .game-progress span, .game-stamp, .timer-track span { transition: none; }
  .game-stage.flash { animation: none; }
}
