@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=Oswald:wght@500;600;700&display=swap');

:root {
  --ink: #000000;
  --graphite: #101218;
  --panel: #161920;
  --yellow: #ffc100;
  --yellow-deep: #e6ac00;
  --paper: #f6f3ea;
  --mute: #9aa3b2;
  --hit: #ff5a3c;
  --line: rgba(255, 193, 0, 0.32);
  --safe-top: env(safe-area-inset-top);
  --safe-bot: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: #000;
  color: var(--paper);
}

body {
  min-height: 100dvh;
  font-family: Manrope, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background-color: var(--ink);
  background-image:
    radial-gradient(ellipse at 50% -8%, rgba(255, 193, 0, 0.16), transparent 42%),
    repeating-linear-gradient(-16deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px);
  overflow-x: hidden;
}

body.is-drill {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; border: 0; background: none; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, p { overflow-wrap: break-word; }

h1, h2, h3 {
  font-family: Oswald, Impact, sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}

h1 { font-size: clamp(1.7rem, 8vw, 2.7rem); line-height: 0.95; }

h2 { font-size: clamp(1.25rem, 5vw, 1.7rem); }

p { margin: 0; }

[hidden] { display: none !important; }

.mast { background: #000; padding-top: var(--safe-top); }

.mast-inner, main, .sheet-card {
  width: min(560px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.mast-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px 0;
}

.wordmark {
  display: flex;
  align-items: baseline;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(1.35rem, 6vw, 1.8rem);
  letter-spacing: 0.08em;
  line-height: 1;
}

.mel { color: var(--paper); }

.tron { color: var(--yellow); }

.rank-chip {
  min-width: 0;
  margin: 0;
  text-align: right;
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mast-meta { display: flex; align-items: center; gap: 6px; }

.marks {
  min-width: 28px;
  padding: 4px 7px;
  background: var(--yellow);
  color: #111;
  font-family: Oswald, Impact, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.sound {
  width: 42px;
  height: 32px;
  border: 1px solid var(--line);
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 12px 12px;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.rail a {
  flex: 0 0 auto;
  transform: skewX(-14deg);
  border: 1px solid rgba(255, 193, 0, 0.28);
  background: #0c0e13;
  color: var(--paper);
  padding: 8px 12px;
}

.rail a span {
  display: block;
  transform: skewX(14deg);
  font-family: Oswald, Impact, sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rail a.is-active {
  background: var(--yellow);
  color: #111;
  border-color: var(--yellow);
}

.rail a.is-locked { color: #6e7582; border-color: #2a2e38; }

.bulbs {
  height: 12px;
  background:
    radial-gradient(circle at 8px 50%, #ffe58a 0 3px, #5a4810 3.4px 4.2px, transparent 4.6px) 0 0 / 18px 12px repeat-x;
  opacity: 0.9;
}

main {
  padding: 12px 12px calc(16px + var(--safe-bot));
  display: grid;
  gap: 12px;
}

body.is-drill main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.eyebrow, .section-title {
  margin: 0;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-title { font-size: 1rem; }

.lede { color: var(--mute); }

.hero-frame { position: relative; background: #0b0d12; }

.hero-frame img {
  width: 100%;
  height: clamp(180px, 34vh, 280px);
  object-fit: cover;
}

.hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 42px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92) 68%);
}

.identity {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.identity img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.identity h2 {
  font-size: 1.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity p, .lede, .note { color: var(--mute); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 12px;
  background: linear-gradient(#ffe36a, var(--yellow) 42%, var(--yellow-deep));
  color: #14120a;
  font-family: Oswald, Impact, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  touch-action: manipulation;
}

.btn-ghost {
  background: transparent;
  color: var(--yellow);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-block { width: 100%; }

.btn:active { transform: translateY(1px); }

.btn:disabled { opacity: 0.38; }

.btn:focus-visible, a:focus-visible, .sound:focus-visible, input:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.panel {
  background: linear-gradient(90deg, var(--yellow) 0 4px, var(--panel) 4px);
  border: 1px solid rgba(255, 193, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.plate {
  margin: 0;
  padding: 8px 10px;
  background: #0c0e12;
  border: 1px dashed rgba(255, 193, 0, 0.45);
  color: var(--yellow);
  font-size: 0.86rem;
}

.ticket-grid, .split, .gear-grid, .stack, .ready, .live {
  display: grid;
  gap: 10px;
}

.ticket {
  display: grid;
  background: #12151c;
  border: 1px solid rgba(255, 193, 0, 0.2);
  min-width: 0;
}

.ticket.is-locked { opacity: 0.62; }

.ticket img { width: 100%; height: 96px; object-fit: cover; }

.ticket div, .link-card, .night-tease { padding: 10px; display: grid; gap: 4px; min-width: 0; }

.ticket h3 {
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket p { color: var(--mute); font-size: 0.82rem; }

.night-tease { padding: 0; overflow: hidden; }

.night-tease img { width: 100%; height: 120px; object-fit: cover; }

.night-tease div { padding: 12px; }

.link-card img { width: 100%; height: 88px; object-fit: cover; }

.meters, .stat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meter, .stat-row {
  position: relative;
  min-width: 0;
  padding: 8px;
  background: #12151c;
  border: 1px solid rgba(255, 193, 0, 0.16);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
}

.meter span, .stat-row span { color: var(--mute); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

.meter b, .stat-row b, .scoreline span, .hud strong {
  font-family: Oswald, Impact, sans-serif;
  font-variant-numeric: tabular-nums;
}

.meter i, .stat-row i {
  grid-column: 1 / -1;
  display: block;
  height: 4px;
  width: 0;
  background: var(--yellow);
}

.stat-row { grid-template-columns: minmax(0, 1fr) auto; }

.stat-row small { grid-column: 1 / -1; color: var(--mute); }

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.hud div {
  min-width: 0;
  padding: 8px;
  background: #10131a;
  border-top: 2px solid var(--yellow);
}

.hud strong {
  display: block;
  font-size: clamp(1.3rem, 6vw, 1.9rem);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call {
  margin: 0;
  text-align: center;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(1.8rem, 10vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
  min-height: 1.05em;
}

.note { min-height: 2.5em; text-align: center; font-size: 0.86rem; }

.dial {
  --gate: 24deg;
  width: min(68vw, 230px);
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
}

.dial-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from calc(var(--gate) * -1), var(--yellow) 0 calc(var(--gate) * 2), rgba(255, 193, 0, 0.16) 0 360deg);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60% 80%, transparent 82%);
  mask: radial-gradient(circle, transparent 58%, #000 60% 80%, transparent 82%);
}

.dial-ring.is-hot { filter: drop-shadow(0 0 10px var(--yellow)); }

.needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 42%;
  border-radius: 4px;
  background: linear-gradient(#fff4c2, var(--yellow));
  transform-origin: center bottom;
  transform: translate(-50%, -100%) rotate(0deg);
  z-index: 2;
}

.bag-core {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 193, 0, 0.45);
  z-index: 1;
}

.bag-core img { width: 100%; height: 100%; object-fit: cover; }

.bag-core.is-hit { animation: punch 0.18s ease; }

@keyframes punch {
  50% { transform: scale(0.94); }
}

.hands, .slips, .counters {
  display: grid;
  gap: 8px;
}

.hands, .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.slips { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.slips .btn { font-size: 0.92rem; padding-left: 4px; padding-right: 4px; }

.mitts {
  width: min(100%, 300px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mitt {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #3a404c;
  background: radial-gradient(circle at 50% 45%, #2a303a, #0c0e12 70%);
  color: var(--mute);
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.mitt-lead { grid-column: 2; grid-row: 1; }
.mitt-hook { grid-column: 1; grid-row: 2; }
.mitt-cross { grid-column: 3; grid-row: 2; }
.mitt-body { grid-column: 2; grid-row: 3; }

.mitt.is-arm { border-color: rgba(255, 193, 0, 0.45); color: var(--yellow); }

.mitt.is-live {
  background: radial-gradient(circle at 50% 45%, #ffe27a, var(--yellow) 42%, #8a6a00 74%);
  color: #16120a;
  border-color: #fff1b0;
}

.mitt.is-feint {
  background: transparent;
  border: 3px dashed var(--yellow);
  color: var(--yellow);
}

.lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: clamp(150px, 28vh, 230px);
}

.lane {
  position: relative;
  background: linear-gradient(#0e1117, #1a1e28);
  border: 1px solid #2c313c;
  overflow: hidden;
}

.lane em {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.lane .shard {
  position: absolute;
  left: 18%;
  width: 64%;
  height: 18px;
  top: -12%;
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(255, 193, 0, 0.65);
}

.lane.is-tell { border-color: var(--yellow); }
.lane.is-ghost { border-color: #5c6370; }
.lane.is-ghost .shard { background: #5c6370; box-shadow: none; }
.lane.is-gate { box-shadow: inset 0 -28px 0 rgba(255, 193, 0, 0.28); }
.lane.is-picked { outline: 2px solid var(--paper); }

.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.pip {
  flex: 1 1 30%;
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #10131a;
  border: 1px solid #2c313c;
  font-family: Oswald, Impact, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.pip.is-mirror { border-style: dashed; border-color: var(--yellow); color: var(--yellow); }
.pip.is-now { background: var(--yellow); color: #16120a; }

.btn.is-lit {
  background: var(--yellow);
  color: #16120a;
}

.btn.is-picked { box-shadow: inset 0 0 0 2px #111, inset 0 0 0 4px var(--paper); }

.fight { display: grid; gap: 8px; }

.bars { display: grid; gap: 6px; }

.bar-row { display: grid; grid-template-columns: minmax(0, 96px) minmax(0, 1fr); gap: 8px; align-items: center; }

.beat {
  margin: 0;
  min-height: 2.4em;
  text-align: center;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(1rem, 4.6vw, 1.35rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--yellow);
}

.bar-row span, .bar-row b {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track { height: 8px; background: #0c0e12; border: 1px solid #2a2e38; }

.track i { display: block; height: 100%; width: 0; background: var(--yellow); }

.track.them i { background: var(--paper); }
.track.stam i { background: #f3ff6a; }

.tells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tells span {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #2c313c;
  background: #10131a;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.tells span.is-live { background: var(--yellow); color: #16120a; border-color: var(--yellow); }
.tells span.is-ghost { border-style: dashed; color: #8b93a3; }
.tells span.is-arrive { background: var(--hit); color: #fff; border-color: var(--hit); }

.rival-card {
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
}

.crest, .rival-photo {
  width: 72px;
  height: 84px;
  border: 1px solid var(--line);
  background: #0c0e12;
  position: relative;
  object-fit: cover;
}

.crest-voss::before,
.crest-quill::before,
.crest-kade::before,
.crest-kade::after {
  content: "";
  position: absolute;
  background: var(--yellow);
}

.crest-voss::before { left: 50%; top: 14px; bottom: 14px; width: 4px; transform: translateX(-50%); }
.crest-quill::before { left: 14px; right: 14px; top: 36px; height: 4px; transform: rotate(-24deg); }
.crest-kade::before, .crest-kade::after { left: 16px; right: 16px; height: 4px; }
.crest-kade::before { top: 28px; }
.crest-kade::after { top: 46px; }

.doctrine { display: grid; gap: 0; background: #12151c; border: 1px solid rgba(255, 193, 0, 0.18); }
.doctrine img { width: 100%; height: 140px; object-fit: cover; }
.doctrine div { padding: 12px; display: grid; gap: 8px; }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.board li, .summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 4px 8px;
  padding: 8px 10px;
  background: #12151c;
  border-left: 3px solid var(--yellow);
  min-width: 0;
}

.summary {
  grid-template-columns: 1fr 1fr;
}

.summary div, .board li { min-width: 0; }

.summary { padding: 0; background: transparent; border: 0; }

.summary div {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: #12151c;
  border-top: 2px solid var(--yellow);
}

.summary span, .board span, .board small { color: var(--mute); font-size: 0.78rem; }

.summary b, .board b {
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board li span, .board li b, .board li small { overflow: hidden; text-overflow: ellipsis; }

.board li { grid-template-columns: minmax(0, 1fr) auto; }

.board small { grid-column: 1 / -1; }

.gear-card, .rename, .ready img.wide {
  min-width: 0;
}

.ready img.wide, .locker-hero {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.rename { display: grid; gap: 8px; }

.rename input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  background: #0c0e12;
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 16px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.sheet-card {
  max-height: calc(100dvh - 24px);
  overflow: auto;
  gap: 10px;
}

.scoreline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.scoreline span { font-size: clamp(2rem, 10vw, 3rem); line-height: 0.9; color: var(--yellow); }

.scoreline small { color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--safe-bot));
  z-index: 40;
  width: min(480px, calc(100% - 24px));
  margin: 0;
  padding: 12px 14px;
  background: var(--yellow);
  color: #16120a;
  font-weight: 700;
  transform: translate(-50%, 150%);
  transition: transform 0.25s ease;
}

.toast.is-on { transform: translate(-50%, 0); }

.endmark { color: var(--mute); text-align: center; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; }

@media (min-width: 380px) {
  .ticket-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 460px) {
  .split { grid-template-columns: 1fr 1fr; }
  .gear-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-height: 700px) {
  .dial { width: min(48vw, 180px); }
  .hero-frame img { height: 160px; }
  .ready img.wide, .locker-hero, .doctrine img { height: 110px; }
  .lanes { height: 140px; }
  .mitts { width: min(100%, 240px); }
  .tells span { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .bag-core.is-hit, .toast { animation: none; transition: none; }
}
