.reaction-page {
  --reaction-error: #ffb1a7;
  --watch-rule: #bda47761;
  --watch-metal: #b79a69;
  scrollbar-gutter: stable;
}

:root[data-theme=light] .reaction-page { --reaction-error:#a22f32; --watch-rule:#8d795650; --watch-metal:#81653d; }

.reaction-page ::selection { background: var(--gold); color: var(--bar); }

.reaction-page .play-layout {
  grid-template-columns:minmax(0,1.4fr) minmax(270px,.9fr);
  grid-template-areas:"title title" "watch controls" "scores scores";
  gap:20px 32px; align-items:start; align-content:start;
  max-width:1076px; min-height:0; padding-block:24px 44px;
}
.reaction-page .watch-heading { grid-area:title; display:flex; align-items:center; gap:14px; }
.reaction-page .watch-heading img { width:54px; height:54px; border:1px solid var(--watch-metal); border-radius:7px; }
.reaction-page .watch-heading h1 { font-size:38px; line-height:1.08; text-wrap:balance; }
.reaction-page .watch-heading::after { content:""; flex:1; border-top:1px solid var(--watch-rule); }
.reaction-controls { min-width: 0; }
.reaction-page .reaction-controls { grid-area:controls; align-self:center; }
.reaction-controls .intro { max-width:31ch; margin:0 0 18px; font:500 21px/1.3 var(--woodays-type,Georgia,serif); color:inherit; }
.reaction-page .scene,.reaction-page .scene:hover:not(:disabled) {
  grid-area:watch; display:block; aspect-ratio:1.52; min-height:0; border:1px solid #b69763;
  background:linear-gradient(0deg,#19252590,transparent 45%),#3e2a32 url('/hall-mini.webp') 54% center / cover;
  box-shadow:0 5px 12px #18221e29;
}
.reaction-page .scene .night-art { inset:0 38% -4% -7%; }
.reaction-page .scene .night-art :is(svg > circle,[data-ridge]) { display:none; }
.reaction-page .scene-caption {
  left:16px; bottom:12px; color:#fff1ca; text-shadow:0 1px 3px #141417;
  font:italic 650 18px/1.15 var(--woodays-type,Georgia,serif);
}
.reaction-page .scene::after { inset:5px; border:1px solid #f8dfb16b; border-radius:4px; transition:none; }
.reaction-page .scene.ready::after { border:3px solid #ffdf94; }
.reaction-page .scene:focus-visible { outline: 3px solid #ffc97f; outline-offset: 4px; }
.reaction-page .beats { gap:7px; padding:3px 0; }
.reaction-page .beats i {
  width:34px; height:9px; border:1px solid var(--watch-metal); border-radius:2px;
  background:var(--input); box-shadow:inset 0 1px 2px #15212536;
}
.reaction-page .beats i.active { background:#edb76b; border-color:#ddb06e; box-shadow:inset 0 -2px #ad764b; }

.reaction-page #reaction-status {
  display: flex;
  align-items: center;
  min-height: 48px;
  margin: 8px 0;
  font-weight: 600;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.reaction-page [data-phase=ready] #reaction-status,
.reaction-page [data-phase=scored] #reaction-status { font-size: 30px; line-height: 1.2; color: var(--gold); }
.reaction-page [data-phase=early] #reaction-status { color: var(--reaction-error); }
.reaction-page #react { min-height: 52px; gap: 12px; }
.reaction-page #react strong { overflow-wrap: anywhere; }
.reaction-page #react kbd { flex: none; font-size: 12px; font-weight: 500; }
.reaction-page #react:active:not(:disabled) { background: #ffda9e; }
.reaction-page #react:disabled { opacity: 1; background: var(--button); color: var(--muted); cursor: wait; }
.reaction-page #react:focus-visible { outline-width: 3px; }

.reaction-page #reaction-feedback {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.reaction-page #reaction-feedback[data-error] { color: var(--reaction-error); }
.reaction-page .personal-best { gap:16px; margin-top:8px; align-items:baseline; border-color:var(--watch-rule); }
.reaction-page .personal-best strong { flex: none; font-variant-numeric: tabular-nums; }
.reaction-page .reaction-ranking { grid-area:scores; margin-top:2px; padding-top:16px; border-color:var(--watch-rule); }
.reaction-page .ranking-heading h2 { font-size:23px; }
.reaction-page .ranking-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.reaction-page .ranking-heading h2 { margin: 0; line-height: 1.4; }
.reaction-page #ranking-retry { flex: none; min-height: 44px; }
.reaction-page #ranking-status { margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.reaction-page #reaction-ranking { padding-inline-start: 25px; font-variant-numeric: tabular-nums; }
.reaction-page #reaction-ranking li { padding: 3px 0 3px 5px; border-bottom: 1px solid var(--line); }
.reaction-page #reaction-ranking li::marker { color: var(--muted); font-size: 12px; }
.reaction-page #reaction-ranking li:last-child { border-bottom: 0; }
.reaction-page .ranking-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; }
.reaction-page #reaction-ranking .player-name { min-height: 44px; }
.reaction-page #reaction-ranking .profile-trigger { min-height: 44px; }
.reaction-page .ranking-entry > strong {
  float: none;
  margin-inline-start: 0;
  white-space: nowrap;
  font-size: 14px;
}
.reaction-page #reaction-rank { margin-top: 12px; font-size: 13px; color: var(--gold); }
.reaction-page .ranking-note { line-height: 1.6; }
.reaction-page :is(#ranking-title,.profile-trigger):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 735px) {
  .reaction-page .play-layout { grid-template-columns:minmax(0,1fr); grid-template-areas:"title" "watch" "controls" "scores"; max-width:570px; gap:16px; padding:18px 18px max(28px,env(safe-area-inset-bottom)); }
  .reaction-page .scene,.reaction-page .scene:hover:not(:disabled) { height:clamp(155px,29svh,235px); aspect-ratio:auto; }
  .reaction-page .watch-heading { gap:10px; }
  .reaction-page .watch-heading h1 { font-size:29px; }
  .reaction-page .watch-heading img { width:42px; height:42px; }
  .reaction-controls .intro { max-width:none; margin:0 0 10px; }
}

@media (max-width: 420px) {
  .reaction-page .bar { gap: 8px; padding-inline: 12px; flex-wrap: wrap; }
  .reaction-page .bar .back { padding-left: 8px; font-size: 13px; }
  .reaction-page .bar :is(.icon-button,.tool) { width: 44px; min-height: 44px; flex: none; }
  .reaction-page .play-layout { padding-inline: 16px; }
  .reaction-page .watch-heading h1 { font-size:26px; }
}

@media (forced-colors: active) {
  .reaction-page .scene.ready::after { border-color: Highlight; }
  .reaction-page .beats i { border: 1px solid CanvasText; }
  .reaction-page .beats i.active { background: Highlight; forced-color-adjust: none; }
}
