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

:root {
  --ink: #f6f3e8;
  --muted: #b7ad8c;
  --black: #07080a;
  --panel: #12140f;
  --line: #3d3818;
  --yellow: #ffd000;
  --deep: #050505;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(120% 50% at 50% -12%, rgba(255, 208, 0, 0.18), transparent 48%),
    linear-gradient(180deg, #14180c 0%, var(--black) 32%, var(--black) 100%);
  color: var(--ink);
  font-family: Barlow, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body.page-line {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

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

button, a { -webkit-tap-highlight-color: transparent; }

p, h1, h2, dd, dt, li { overflow-wrap: break-word; }

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.shell-fit {
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.96), rgba(5, 5, 5, 0.78));
}

.brand {
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand-word {
  display: block;
  font-family: Oswald, Impact, sans-serif;
  font-style: italic;
  font-size: clamp(22px, 7vw, 32px);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 0.88;
}

.brand-word b { color: var(--ink); font-weight: 600; }

.brand-word i { color: var(--yellow); font-style: italic; font-weight: 600; }

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mast-note {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(10px, 2.8vw, 13px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
}

.crossbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 0 6px calc(6px + var(--safe-bot));
  background:
    linear-gradient(var(--yellow), var(--yellow)) 0 0 / 100% 4px no-repeat,
    var(--deep);
  overflow: hidden;
  z-index: 4;
}

.cord {
  min-width: 0;
  padding-top: 7px;
  color: var(--ink);
  text-decoration: none;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(10px, 3vw, 13px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cord::before {
  content: "";
  display: block;
  width: 2px;
  height: 7px;
  margin: 0 auto 3px;
  background: var(--yellow);
}

.plate {
  display: grid;
  align-content: center;
  min-height: 40px;
  transform: skewX(-10deg);
}

.cord.is-on .plate { background: var(--yellow); }

.label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  transform: skewX(10deg);
  line-height: 1;
}

.cord small {
  color: var(--yellow);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.cord.is-on { color: #14120a; }

.cord.is-on small { color: #14120a; }

.page {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 8px 14px 78px;
  flex: 1;
}

.shell:not(.shell-fit) .crossbar {
  position: sticky;
  bottom: 0;
}

.kicker {
  margin: 0 0 6px;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(32px, 10vw, 52px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 0.92;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 8px;
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lede {
  margin: 0 0 16px;
  color: #e6e0d0;
  font-size: clamp(15px, 3.8vw, 17px);
}

.wide-photo, .square-photo, .portrait {
  width: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.wide-photo { aspect-ratio: 16 / 10; }

.square-photo { aspect-ratio: 1; }

.portrait {
  height: min(68vh, 520px);
  object-position: center top;
}

.ticket {
  position: relative;
  margin: 0 0 14px;
  padding: 14px 12px 12px;
  background:
    repeating-linear-gradient(90deg, var(--yellow) 0 12px, transparent 12px 18px) 0 0 / 100% 6px no-repeat,
    var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.ticket .wide-photo,
.ticket .square-photo { margin-bottom: 10px; }

.index-no {
  margin: 0 0 2px;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.pair div {
  min-width: 0;
  padding: 8px;
  background: #0c0e0a;
  border: 1px solid #2c2916;
}

dt {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

dd { margin: 2px 0 0; font-size: 14px; }

.stack { display: grid; gap: 12px; }

.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.step b {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--yellow);
  color: #14120a;
  font-family: Oswald, Impact, sans-serif;
  font-size: 18px;
}

.step h2 { font-size: 20px; }

.step p { margin: 0; color: #e6e0d0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.stat {
  min-width: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat b {
  display: block;
  margin-top: 2px;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(26px, 8vw, 40px);
  font-weight: 600;
  line-height: 1;
}

.solid, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  font-family: Oswald, Impact, sans-serif;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.solid { background: var(--yellow); color: #14120a; }

.ghost {
  background: transparent;
  color: var(--yellow);
  border: 1px solid var(--yellow);
}

.rail-sample {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.rail-demo {
  position: relative;
  height: 16px;
  background: #101208;
  border: 1px solid #6a5a12;
  overflow: hidden;
}

.rail-demo i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 68%;
  width: 2px;
  background: #f6f3e8;
}

.rail-demo b {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 68%;
  width: 12px;
  background: var(--yellow);
  transform: translateX(-6px);
}

.note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.line-main {
  min-height: 0;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.board {
  position: relative;
  width: min(640px, 100%);
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(72px, 1fr) auto auto auto;
}

.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "level tools"
    "meta tools";
  gap: 2px 8px;
  align-items: center;
  padding: 2px 8px 0;
  min-width: 0;
}

.hud p, .hud-meta { margin: 0; min-width: 0; }

.hud-level { grid-area: level; }

.hud-tools {
  grid-area: tools;
  display: flex;
  gap: 4px;
}

.hud-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(12px, 3.2vw, 15px);
}

.hud-level {
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(12px, 3.4vw, 16px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-count, .hud-streak {
  color: var(--yellow);
  white-space: nowrap;
}

.hud button, .controls button, #claim, #veil-action, #veil-alt {
  border: 0;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.hud button {
  min-width: 36px;
  min-height: 30px;
  padding: 0 6px;
  background: #1b1e14;
  color: var(--yellow);
  font-size: 11px;
}

.family-flag {
  margin: 0;
  min-height: 1.15em;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(13px, 3.8vw, 18px);
  letter-spacing: 0.16em;
  text-align: center;
}

.tape {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 10px;
}

.tape span {
  min-width: 0;
  padding: 4px 2px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(10px, 3vw, 13px);
  letter-spacing: 0.08em;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.frame-wrap {
  min-height: 0;
  min-width: 0;
  margin: 4px 10px;
  background: #07080a;
  box-shadow: 0 0 0 2px #f4f1e4, 0 0 22px rgba(255, 208, 0, 0.16);
}

#pitch {
  width: 100%;
  height: 100%;
  display: block;
}

.pips {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-height: 8px;
  padding: 2px 10px 0;
}

.pip {
  width: 8px;
  height: 8px;
  background: #2a2c22;
  transform: skewX(-18deg);
}

.pip.is-now { background: transparent; box-shadow: inset 0 0 0 1px var(--yellow); }

.pip.is-clean { background: var(--yellow); }

.pip.is-parry { background: #fff4b0; }

.pip.is-spill { background: #8a846c; }

.pip.is-beaten { background: #f4f4f4; }

.controls {
  display: grid;
  gap: 6px;
  padding: 6px 10px 2px;
  min-width: 0;
}

.lane-row, .shelf-row { display: grid; gap: 6px; min-width: 0; }

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

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

.controls button, #claim {
  min-width: 0;
  min-height: 40px;
  padding: 0 6px;
  background: #1b1e14;
  color: var(--yellow);
  font-size: clamp(12px, 3.3vw, 15px);
}

.controls button.is-picked, #claim:not(:disabled) {
  background: var(--yellow);
  color: #14120a;
}

.controls button:disabled, #claim:disabled { opacity: 0.45; }

.controls button:active:not(:disabled), #claim:active:not(:disabled), .solid:active, .ghost:active {
  transform: translateY(1px);
}

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

.rail {
  position: relative;
  height: 16px;
  background: #101208;
  border: 1px solid #6a5a12;
  overflow: hidden;
}

.rail i, .rail b {
  position: absolute;
  top: 0;
  bottom: 0;
}

.rail i {
  width: 2px;
  background: #f6f3e8;
  transform: translateX(-1px);
}

.rail b {
  width: 12px;
  background: var(--yellow);
  transform: translateX(-6px);
}

#claim { min-width: 84px; }

.verdict {
  min-height: 1.15em;
  margin: 0;
  padding: 0 10px 4px;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(13px, 3.6vw, 16px);
  letter-spacing: 0.18em;
  text-align: center;
}

.verdict[data-result="parry"] { color: #fff4b0; }

.verdict[data-result="spill"] { color: #b7ad8c; }

.verdict[data-result="beaten"],
.verdict[data-result="late"] { color: #f4f4f4; }

.veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 16px 14px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(7, 8, 10, 0.2) 0%, rgba(7, 8, 10, 0.88) 42%, rgba(7, 8, 10, 0.96) 100%);
}

.veil[hidden] { display: none; }

.veil-kicker {
  margin: 0;
  color: var(--yellow);
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
}

.veil h1 {
  margin: 0;
  font-size: clamp(30px, 9vw, 48px);
}

.veil p { margin: 0; color: #e6e0d0; font-size: 15px; }

.veil-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#veil-action, #veil-alt {
  min-height: 46px;
  padding: 0 16px;
  font-size: 15px;
}

#veil-action { background: var(--yellow); color: #14120a; }

#veil-alt {
  background: transparent;
  color: var(--yellow);
  box-shadow: inset 0 0 0 1px var(--yellow);
}

@media (max-height: 700px) {
  .plate { min-height: 34px; }
  .mast { padding-top: calc(4px + var(--safe-top)); padding-bottom: 4px; }
  .family-flag { font-size: 12px; }
  .veil h1 { font-size: clamp(26px, 8vw, 36px); }
}

@media (max-height: 620px) {
  .controls button, #claim { min-height: 36px; }
}

@media (max-height: 560px) {
  body.page-line {
    height: auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .shell-fit {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
  }

  .frame-wrap { height: 150px; }
}

@media (min-width: 480px) {
  .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding-left: 18px; padding-right: 18px; }
}
