:root {
  --ink: #0b0b0d;
  --panel: #10120f;
  --felt: #10281c;
  --felt-deep: #0b1c15;
  --gold: #f5c400;
  --gold-deep: #c89600;
  --green: #1e8f4e;
  --cream: #f3efe4;
  --muted: #b7b1a2;
  --line: rgba(245, 196, 0, 0.42);
  --hurt: #c4554a;
  --top: 58px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--cream);
  overflow: hidden;
}

body {
  font-family: Barlow, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--gold);
}

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

[hidden] {
  display: none !important;
}

.app {
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 40% at 50% -10%, rgba(245, 196, 0, 0.08), transparent 42%),
    var(--ink);
  overflow: hidden;
  position: relative;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: #070708;
  border-bottom: 1px solid var(--line);
}

.brand {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 18px;
  height: 26px;
  flex: 0 0 auto;
  background:
    linear-gradient(var(--green), var(--green)) left top / 3px 100% no-repeat,
    linear-gradient(var(--gold), var(--gold)) left bottom / 100% 3px no-repeat;
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 4px;
  height: 3px;
  background: var(--gold);
}

.brand-mark::before {
  top: 6px;
  width: 10px;
  transform: skewX(-28deg);
}

.brand-mark::after {
  top: 13px;
  width: 13px;
}

.brand-text {
  min-width: 0;
}

.brand-text strong {
  display: block;
  font-family: Oswald, Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 6vw, 26px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 0.9;
  transform: skewX(-10deg);
  white-space: nowrap;
}

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

.house-link,
.text-btn {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: Oswald, Impact, sans-serif;
  font-size: 12px;
  padding: 8px 2px;
  min-height: 40px;
}

.house-link.is-active,
.text-btn[aria-pressed="false"] {
  color: var(--cream);
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 10px 8px;
  -webkit-overflow-scrolling: touch;
}

.felt {
  position: relative;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 196, 0, 0.09), transparent 36%),
    linear-gradient(180deg, var(--felt), var(--felt-deep));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 0 3px #070708, 0 0 0 4px rgba(245, 196, 0, 0.28);
  padding: 8px;
  overflow: hidden;
}

.marquee {
  height: 8px;
  margin: -8px -8px 8px;
  background-image: radial-gradient(circle, #ffe08a 1.4px, transparent 1.7px);
  background-size: 12px 8px;
  background-repeat: repeat-x;
  background-position: center;
  opacity: 0.9;
}

.bout-head {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.foe-photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex: 0 0 auto;
  background: #070708;
}

.app.is-card .bout-head {
  flex-direction: column;
  align-items: stretch;
}

.app.is-card .foe-photo {
  width: 100%;
  height: clamp(108px, 24vh, 188px);
}

.bout-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.kicker,
.page-kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: Oswald, Impact, sans-serif;
  font-size: 11px;
}

h1,
.bout-copy h1,
.page-title {
  margin: 2px 0 0;
  font-family: Oswald, Impact, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 0.92;
  font-size: clamp(26px, 8vw, 40px);
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.live-meta {
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--cream);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #b7f0cb;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: Oswald, Impact, sans-serif;
  font-size: 11px;
}

.live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.app.is-card .head-side {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.pips {
  display: flex;
  gap: 6px;
}

.pips span {
  width: 9px;
  height: 9px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.pips span.is-done {
  background: var(--gold);
}

.pips span.is-now {
  background: var(--green);
  border-color: var(--green);
}

.token-flag {
  margin: 0;
  padding: 3px 6px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: Oswald, Impact, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rails {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

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

.rail-row > span:first-child {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail {
  display: block;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

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

.rail i.is-foe {
  background: var(--hurt);
}

.rail i.is-stam {
  background: var(--green);
}

.rail i.is-low {
  background: var(--hurt);
}

.card-panel,
.corner-panel,
.result-panel {
  margin-top: 8px;
}

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

.rules li {
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.22);
  border-left: 2px solid var(--gold);
  color: var(--cream);
  font-size: 13px;
  line-height: 1.35;
}

.rule-label {
  display: block;
  color: var(--gold);
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.combo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.combo,
.ghost,
.gold-btn,
.enter,
.quiet-btn {
  border: 0;
  text-decoration: none;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.combo {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--line);
  font-size: 12px;
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.combo small {
  display: block;
  font-family: Barlow, sans-serif;
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
  color: var(--muted);
}

.combo.is-on {
  background: linear-gradient(#ffe56a, var(--gold) 55%, var(--gold-deep));
  color: #16140c;
  border-color: transparent;
}

.combo.is-on small {
  color: #3a320c;
}

.combo:disabled {
  opacity: 0.45;
}

.gold-btn,
.enter {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(#ffe56a, var(--gold) 42%, var(--gold-deep));
  color: #16140c;
  font-size: 16px;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.quiet-btn,
.ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--line);
  width: 100%;
  margin-top: 8px;
  font-size: 14px;
}

.note,
.fine,
.lead,
.sheet p,
.sheet li {
  overflow-wrap: break-word;
}

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

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

.cue {
  min-width: 0;
  min-height: 62px;
  padding: 6px 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(245, 196, 0, 0.2);
  border-radius: 10px;
  text-align: center;
}

.cue.is-on {
  border-color: var(--gold);
}

.cue[data-family="high"].is-on {
  box-shadow: inset 0 0 0 1px rgba(245, 196, 0, 0.45);
}

.cue[data-family="low"].is-on {
  border-color: #3dba7a;
}

.cue[data-family="body"].is-on {
  border-color: var(--cream);
}

.cue[data-family="clinch"].is-on {
  border-color: var(--hurt);
}

.cue-index {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.cue strong,
.cue em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cue strong {
  margin-top: 4px;
  font-size: clamp(11px, 3.2vw, 14px);
  font-weight: 600;
}

.cue em {
  margin-top: 2px;
  font-style: normal;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold);
}

.timer {
  margin-top: 8px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.timer span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transform: scaleX(1);
  transform-origin: left center;
}

.read-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.readout {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.7em;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.readout.is-clean {
  color: #ffe08a;
}

.readout.is-hurt {
  color: #f0c2ba;
}

.key-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--gold);
  min-width: 44px;
  min-height: 36px;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

.legend {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.legend p {
  margin: 0;
  font-size: 12px;
  color: var(--cream);
}

.warn {
  margin: 6px 0 0;
  color: #ffe08a;
  font-size: 12px;
}

.actions {
  flex: 0 0 auto;
  display: block;
  padding: 8px 10px;
  background: #070708;
}

.actions .gold-btn {
  margin-top: 0;
}

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

.action {
  position: relative;
  isolation: isolate;
  min-height: 52px;
  border: 0;
  background: transparent;
  padding: 8px 8px;
  min-width: 0;
  overflow: hidden;
  touch-action: manipulation;
}

.action::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: skewX(-8deg);
  border: 1px solid var(--line);
  background: #10261c;
}

.action strong,
.action small {
  display: block;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action strong {
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(12px, 3.5vw, 16px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

.action small {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.action-block,
.action-slip {
  color: var(--gold);
}

.action-strike::before,
.action-counter::before {
  background: linear-gradient(#ffe56a, var(--gold) 48%, var(--gold-deep));
  border-color: transparent;
}

.action-strike,
.action-counter {
  color: #16140c;
}

.action.is-chosen::before {
  box-shadow: 0 0 0 1px #fff6c2;
}

.action:disabled {
  opacity: 0.38;
}

.dock {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #070708;
  border-top: 1px solid var(--line);
}

.dock a {
  min-width: 0;
  min-height: 46px;
  padding: 6px 6px 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  background: #14140f;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  font-family: Oswald, Impact, sans-serif;
  font-size: clamp(9px, 2.55vw, 12px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dock a.is-active {
  background: linear-gradient(#ffe56a, var(--gold) 46%, var(--gold-deep));
  color: #16140c;
}

.tick {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: currentColor;
  opacity: 0.55;
}

.dock a.is-active .tick {
  opacity: 1;
}

.page-title {
  margin-bottom: 8px;
}

.lead {
  margin: 0 0 12px;
  color: #ddd6c6;
  font-size: 14.5px;
}

.sheet {
  background: linear-gradient(180deg, rgba(16, 40, 28, 0.96), rgba(11, 28, 21, 0.96));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  margin: 0 0 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.sheet h2,
.person h2,
.stat-grid strong {
  margin: 0 0 4px;
  font-family: Oswald, Impact, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(18px, 5vw, 24px);
  line-height: 1;
}

.sheet p,
.sheet li,
.person p {
  margin: 0 0 6px;
  color: #e6e0d2;
  font-size: 14px;
}

.sheet p:last-child,
.person p:last-child {
  margin-bottom: 0;
}

.sheet ul,
.sheet ol {
  margin: 0;
  padding-left: 18px;
}

.banner {
  width: 100%;
  height: clamp(120px, 28vh, 200px);
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #070708;
}

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

.person img {
  width: 92px;
  height: 112px;
  object-fit: cover;
  border-radius: 12px;
}

.person.is-sealed {
  opacity: 0.62;
}

.person .enter.is-sealed,
.enter:disabled {
  background: transparent;
  color: var(--muted);
  pointer-events: none;
  box-shadow: none;
  border: 1px solid rgba(245, 196, 0, 0.2);
  clip-path: none;
}

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

.stat-grid div {
  min-width: 0;
  background: #10281c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
}

.stat-grid strong {
  display: block;
  color: var(--gold);
  font-size: clamp(16px, 5vw, 22px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.log li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
}

.log b {
  display: block;
  font-family: Oswald, Impact, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.log span,
.log em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.log .win {
  color: var(--gold);
}

.log .loss {
  color: #f0c2ba;
}

.fine {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.fine a {
  color: var(--gold);
}

.corner-panel h2,
.result-panel h2 {
  margin: 0 0 6px;
  font-family: Oswald, Impact, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 0.95;
}

[data-combo] {
  margin-bottom: 8px;
}

[data-combo].is-owned {
  border-left: 2px solid var(--gold);
  padding-left: 8px;
}

.own-tag {
  color: var(--gold);
  font-family: Oswald, Impact, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.combo.is-owned {
  outline: 1px solid var(--gold);
}

@media (max-width: 340px) {
  .stage {
    padding: 8px;
  }

  .person {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .person img {
    width: 74px;
    height: 92px;
  }

  .dock a {
    letter-spacing: 0.02em;
    padding-left: 4px;
    padding-right: 4px;
    clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
  }

  .action {
    min-height: 48px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .rail-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }
}

@media (min-width: 400px) {
  .stage {
    padding: 12px;
  }

  .action {
    min-height: 58px;
  }

  .cue {
    min-height: 70px;
  }
}

@media (max-height: 700px) {
  .app.is-card .foe-photo {
    height: 88px;
  }

  .rules li {
    padding: 4px 7px;
    font-size: 12px;
  }

  .note {
    margin-top: 4px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer span,
  .rail i {
    transition: none;
  }
}
