/* World rock paper scissors championship: a blue event field beside a navy control panel. Base in ../style.css. */
.stage { display: grid; }
.field { position: relative; overflow: hidden; background: var(--blue); color: #fff; padding: 0 var(--pad) 22px; display: flex; flex-direction: column; }
.field > * { position: relative; }
/* One giant pictogram per event, cropped off the field's edge. It shows the opponent's last move. */
.giant { position: absolute; top: 62px; right: calc(-1 * clamp(28px, 5vw, 80px)); width: clamp(120px, 24vw, 320px); aspect-ratio: 1; color: #fff; }
.giant svg { width: 100%; height: 100%; display: block; }
@media (max-width: 899px) { .giant { top: 36px; right: -22vw; width: 64vw; color: rgba(255, 255, 255, 0.16); } }
.giant.swap { animation: swap 0.45s var(--ease) both; }
@keyframes swap { from { transform: translateX(14%) rotate(-8deg); opacity: 0; } }
.field h1 { font-size: clamp(36px, 9vw, 68px); margin: 22px 0 20px; max-width: min(7.6em, calc(100% - clamp(80px, 16vw, 220px))); }

.bracket { position: relative; width: calc(100% - 40px); aspect-ratio: 2 / 1; }
.bracket svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.bracket .line { stroke: rgba(255, 255, 255, 0.5); }
.bracket .you { stroke: #fff; }
.bracket .you-tag { position: absolute; left: 0; transform: translateY(calc(-100% - 6px)); color: #fff; transition: opacity 0.3s var(--ease); }
.bracket .trophy { position: absolute; right: -8px; top: 50%; width: 32px; height: 32px; color: #fff; transform: translate(100%, -50%); opacity: 0; transition: opacity 0.4s var(--ease); }

.status { display: flex; gap: clamp(28px, 6vw, 64px); margin-top: 18px; padding-top: 10px; border-top: 2px solid #fff; }
.status .ev { color: rgba(255, 255, 255, 0.9); }
.num { font-size: clamp(34px, 8vw, 56px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.of { font-size: 16px; letter-spacing: 0; color: rgba(255, 255, 255, 0.9); }

.panel { background: var(--navy); color: #fff; padding: 24px var(--pad) 28px; }
.soft, .ev.soft { color: var(--navy-soft); }
.panel-title { font-size: clamp(28px, 5vw, 38px); letter-spacing: -0.02em; line-height: 1.05; }
.panel .more { display: inline-block; margin-top: 28px; color: #fff; }

/* Start screen */
.steps { margin: 18px 0 16px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; font-size: 17px; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; background: #fff; color: var(--ink); font-weight: 800; }
.cta { display: inline-block; margin-top: 22px; padding: 16px 24px; border: 0; border-radius: 0; background: #fff; color: var(--ink); font: 800 14px var(--font); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 0.15s var(--ease); }
@media (hover: hover) { .cta:hover { background: var(--orange); } }

/* The face-off: two slots that fill when you throw. */
.opp-note { margin-top: 8px; color: var(--navy-soft); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 26px; }
.opp-note .icon { width: 24px; height: 24px; color: #fff; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 18px; max-width: 520px; }
.slot { aspect-ratio: 5 / 4; display: grid; justify-items: center; align-content: center; gap: 8px; background: rgba(255, 255, 255, 0.08); }
.slot .icon { width: clamp(54px, 13vw, 84px); height: clamp(54px, 13vw, 84px); color: #fff; animation: in 0.3s var(--ease) both; }
.slot.empty { background: transparent; outline: 2px dashed rgba(169, 182, 204, 0.5); outline-offset: -2px; }
.slot.empty .icon { display: none; }
.slot.empty .slot-label { color: var(--navy-soft); }
.verdict { margin-top: 14px; padding: 12px 14px; min-height: calc(2.5em + 24px); display: flex; align-items: center; max-width: 520px; font-size: clamp(18px, 4vw, 22px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.verdict.wait { padding-left: 0; color: var(--navy-soft); font-weight: 700; }
.verdict.win { background: #fff; color: var(--ink); }
.verdict.lose { background: var(--orange); color: var(--ink); }
.verdict.tie { background: transparent; color: #fff; outline: 2px solid #fff; outline-offset: -2px; }
.verdict.flash { animation: flash 0.35s var(--ease); }
@keyframes flash { from { transform: scale(0.96); opacity: 0.3; } }
.over .verdict { min-height: 0; }
.history { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.row { display: flex; align-items: center; gap: 8px; font-size: 15px; animation: in 0.35s var(--ease) both; }
.row .icon { width: 22px; height: 22px; color: #fff; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.controls { display: grid; margin-top: 22px; max-width: 520px; }
.controls > * { grid-area: 1 / 1; }
/* Hidden moves keep their space so the next-round button covers the same area. */
.controls > .moves[hidden] { display: grid !important; visibility: hidden; }
.controls #next { margin: 0; }
.over .controls { display: none; }
.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moves button {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
/* Hover only where there is a pointer, so a tapped button doesn't stay orange on phones. */
@media (hover: hover) { .moves button:hover { background: var(--orange); } }
.moves button:active { transform: scale(0.97); }
.moves .icon { width: 44%; aspect-ratio: 1; }
kbd { display: none; font: inherit; opacity: 0.45; }
@media (hover: hover) and (pointer: fine) { kbd { display: inline; } }

.end { margin-top: 24px; }
.end .big { font-size: clamp(64px, 16vw, 120px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.85; margin: 12px 0 6px; }
.end .crown { width: 72px; height: 72px; color: var(--orange); margin-bottom: 8px; }
.end .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0 26px; padding-top: 10px; border-top: 2px solid rgba(255, 255, 255, 0.3); }
.end .stats .val { font-size: clamp(22px, 5vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; }
.end .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.end button { display: inline-flex; align-items: center; gap: 10px; padding: 14px 20px; border: 2px solid #fff; border-radius: 0; background: transparent; color: #fff; font: 800 13px var(--font); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.end button.primary { background: #fff; color: var(--ink); }
@media (hover: hover) { .end button:hover { background: var(--orange); border-color: var(--orange); color: var(--ink); } }
.end button .icon { width: 18px; height: 18px; }

/* The math: the worked line on the silver ground, the odds on a green event field. */
.math { padding-top: clamp(40px, 7vw, 72px); }
.math h2 { font-size: clamp(36px, 6vw, 64px); padding-bottom: 14px; border-bottom: var(--rule) solid var(--ink); }
.math .worked { margin-top: clamp(24px, 4vw, 40px); font-size: clamp(30px, 6.4vw, 80px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.math .worked sup { font-size: 0.5em; }
.math .worked .lt { color: var(--blue); padding: 0 0.15em; }
.math .therefore { margin-top: 14px; font-size: clamp(18px, 2vw, 22px); max-width: 36em; color: var(--ink-soft); }
.math .therefore b { color: var(--ink); }
.math .odds { margin-top: clamp(32px, 5vw, 56px); background: var(--green); color: #fff; padding: clamp(20px, 4vw, 40px); }
.math .odds h3 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.02em; }
.math table { width: 100%; border-collapse: collapse; margin: 18px 0 20px; }
.math th, .math td { padding: 12px 0; border-top: 2px solid rgba(255, 255, 255, 0.5); text-align: left; vertical-align: baseline; }
.math th { font-weight: 700; font-size: 17px; padding-right: 16px; }
.math td { text-align: right; font-size: clamp(24px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.math .odds p { max-width: 40em; color: rgba(255, 255, 255, 0.92); }
.math .source { margin-top: 32px; font-size: 15px; color: var(--ink-soft); max-width: 60em; }

@media (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); min-height: 100svh; }
  .field { padding-bottom: 36px; }
  .field h1 { margin: 30px 0 auto; }
  .bracket { margin-top: 28px; }
  .panel { padding-top: 76px; padding-bottom: 36px; display: flex; flex-direction: column; }
  .panel .more { margin-top: auto; padding-top: 28px; align-self: flex-start; }
}

/* Phones, mid-match: bracket, score and controls share one screen. The bracket takes whatever height is left. */
@media (max-width: 899px) {
  .playing .stage { height: 100svh; grid-template-rows: minmax(0, 1fr) auto; }
  /* Game over: the verdict already names both throws, so the slots give their room to the result. */
  .over .stage { height: auto; min-height: 100svh; }
  .over .opp-note, .over .versus { display: none; }
  .playing .field { padding-bottom: 14px; }
  .playing .field h1, .playing .giant, .playing .history, .playing .panel .more { display: none; }
  .playing .bracket { flex: 1; min-height: 96px; aspect-ratio: auto; margin-top: 30px; }
  .playing .status { margin-top: 12px; padding-top: 8px; }
  .playing .num { font-size: 30px; }
  .playing .panel { padding-top: 14px; padding-bottom: 18px; }
  .playing .panel-title { font-size: 22px; }
  .playing .opp-note { margin-top: 2px; min-height: 0; font-size: 14px; }
  .playing .versus { margin-top: 10px; }
  .playing .slot { aspect-ratio: auto; height: 72px; display: flex; align-items: center; justify-content: center; gap: 10px; }
  .playing .slot .icon { width: 44px; height: 44px; }
  .playing .verdict { margin-top: 10px; padding: 8px 10px; font-size: 16px; min-height: calc(2.5em + 16px); }
  .playing .verdict.wait { padding-left: 0; }
  .over .verdict { min-height: 0; }
  .playing .controls { margin-top: 10px; }
  .playing .moves button { aspect-ratio: auto; height: 92px; }
  .playing .moves .icon { width: 40px; }
  .playing .end { margin-top: 12px; }
  .playing .end .big { font-size: 44px; margin-top: 4px; }
  .playing .end .stats { margin: 10px 0 12px; }
}
