:root {
  --night-surface: radial-gradient(ellipse at 76% 55%, #454155, #232636 59%, #151824);
}
body:has(#intro:not([hidden])) {
  color: #f5f2e8;
  background: #121522;
}
body:has(#intro:not([hidden])) main { width: 100%; }
body:has(#intro:not([hidden])) .sitehead { border-color: #ffffff28; }
body:has(#intro:not([hidden])) .brand img { filter: invert(1); }
body:has(#intro:not([hidden])) .brand span { border-color: #ffffff33; }
body:has(#intro:not([hidden])) .library span { color: var(--light); }
#intro :is(button, a):focus-visible, body:has(#intro:not([hidden])) :is(.headinner, .afterword) :is(button, a):focus-visible {
  outline: 2px solid #f3fff1; outline-offset: 4px;
}
.night-hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--night-surface);
}
.night-contours { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.night-inner, .night-utilities, #intro:not([hidden]) ~ .afterword { width: min(1240px, 90%); margin-inline: auto; }
.night-inner {
  position: relative; min-height: clamp(465px, 44vw, 640px);
  display: grid; grid-template-columns: 1.1fr .9fr; align-items: center;
  padding: clamp(38px, 4vw, 64px) 3%;
}
.night-copy { position: relative; z-index: 1; }
.night-kicker { display: flex; align-items: center; gap: 14px; font: 600 11px/1.4 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .12em; color: #c2c7dc; }
.night-copy h1 { margin: 12px 0 9px; font: 900 clamp(82px, 9.6vw, 152px)/.95 'Arial Black', 'Helvetica Neue', Arial, sans-serif; letter-spacing: -.09em; }
.night-line { font: italic clamp(33px, 3.8vw, 57px)/1.04 var(--display); letter-spacing: -.04em; }
.night-play {
  display: inline-flex; justify-content: space-between; align-items: center; gap: 35px;
  margin-top: clamp(30px, 3.9vw, 58px); padding: 13px 21px; min-height: 52px;
  font: 600 18px/1.2 Montreal, Arial, sans-serif; background: var(--green); color: #0d2011;
  border: 1px solid #74be65; border-radius: 4px; box-shadow: 0 3px 0 #326531;
  touch-action: manipulation;
}
.night-play:hover { background: #73c66d; }
.night-play:active { transform: translateY(2px); box-shadow: 0 1px 0 #326531; }
.night-play span { font-size: 22px; }
.night-cabinet {
  justify-self: center; width: clamp(167px, 17vw, 250px); padding: 6px; border-radius: 7px;
  border: 1px solid #788094; background: #282c3b; transform: perspective(800px) rotateY(-9deg) rotate(5deg);
  box-shadow: 6px 6px 0 #090c17, 12px 15px 25px #03041155;
}
.night-cabinet canvas { width: 100%; display: block; height: auto; }
.night-utilities, .night-links { display: flex; align-items: center; }
.night-utilities { justify-content: space-between; gap: 10px; padding: 4px 0; color: #d2d5df; }
.night-links { gap: clamp(12px, 1.8vw, 28px); }
.night-links :is(a,button) { display: inline-flex; align-items: center; background: none; border: 0; padding: 0; min-height: 44px; font-size: 14px; }
.night-links :is(a,button):hover { text-decoration: underline; text-underline-offset: 4px; }
.night-utilities .levels i { background: var(--mid); }
#intro:not([hidden]) ~ .afterword {
  --muted: #b8bdc8; --line: #383d4b; --ink: #f5f2e8; --forest: #a8d8a6;
  border-color: var(--line); padding-block: clamp(24px, 3vw, 42px);
}
#intro:not([hidden]) ~ .afterword .smallbtn { color: #f4f2e8; border-color: #626777; background: #222634; }
#intro:not([hidden]) ~ .afterword .smallbtn:hover { background: #303747; }
@media (max-width: 700px) {
  .night-inner { display: flex; align-items: flex-start; min-height: clamp(330px, 52svh, 470px); padding: clamp(28px, 6svh, 50px) 0 32px; }
  .night-copy h1 { font-size: clamp(66px, 15.5vw, 105px); }
  .night-line { max-width: 7ch; font-size: clamp(34px, 8vw, 48px); }
  .night-kicker { gap: 9px; font-size: 10px; }
  .night-play { margin-top: clamp(26px, 5svh, 46px); min-width: 155px; }
  .night-cabinet { position: absolute; width: clamp(90px, 25vw, 155px); right: 2%; top: 21%; transform: rotate(7deg); padding: 4px; }
  .night-utilities { gap: 6px; }
  .night-links { gap: 14px; }
}
@media (max-width: 375px) {
  .night-play { padding-inline: 15px; gap: 22px; }
  .night-cabinet { top: 31%; right: 2%; width: 87px; }
  .night-links { gap: 10px; }
  .night-links :is(a,button), .night-utilities .music { font-size: 13px; }
}
@media (max-height: 465px) and (orientation: landscape) {
  .night-inner { min-height: 235px; display: grid; padding-block: 18px; }
  .night-cabinet { position: static; width: 92px; }
  .night-copy h1 { font-size: clamp(65px, 9vw, 95px); }
  .night-line { max-width: none; font-size: 30px; }
  .night-play { min-height: 44px; margin-top: 16px; padding: 7px 18px; }
}

/* Reserve space for the real scores and daily challenge; the poster takes the rest. */
@media (min-width: 701px) {
  body:has(#intro:not([hidden])) {
    min-height: 100dvh; display: grid; grid-template-rows: auto 1fr;
  }
  body:has(#intro:not([hidden])) main {
    display: flex; flex-direction: column;
  }
  #intro:not([hidden]) {
    flex: 1; display: flex; flex-direction: column;
  }
  .night-hero { flex: 1; display: grid; }
  .night-inner {
    min-height: 0; padding-block: clamp(12px, 2.5dvh, 36px);
  }
  .night-copy h1 { font-size: clamp(58px, min(9.6vw, 14dvh), 152px); }
  .night-line { font-size: clamp(28px, min(3.8vw, 5.8dvh), 57px); }
  .night-play { margin-top: clamp(16px, 4dvh, 48px); }
  .night-cabinet { width: clamp(84px, min(17vw, 24dvh), 250px); }
  #intro:not([hidden]) ~ .afterword { padding-block: clamp(12px, 2dvh, 26px); }
  #intro:not([hidden]) ~ .afterword h2 { font-size: clamp(26px, 3.8dvh, 40px); margin-bottom: 8px; }
  #intro:not([hidden]) ~ .afterword .scoreitem { padding-block: 2px; }
}
@media (min-width: 701px) and (max-height: 720px) {
  body:has(#intro:not([hidden])) .headinner { min-height: 48px; }
  .night-cabinet { width: min(16vw, 20dvh); }
  #intro:not([hidden]) ~ .afterword #ranking { max-width: 30rem; }
  #intro:not([hidden]) ~ .afterword .scoreitem { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 7px; padding-block: 1px; font-size: 14px; line-height: 1.2; }
  #intro:not([hidden]) ~ .afterword .scoreitem span:nth-child(2) { overflow-wrap: anywhere; }
}
@media (min-width: 701px) and (max-height: 600px) {
  .night-inner { padding-block: 8px; }
  .night-copy h1 { font-size: 54px; margin: 3px 0; }
  .night-line { font-size: 26px; }
  .night-play { min-height: 44px; margin-top: 8px; padding-block: 7px; }
  .night-utilities { padding-block: 0; }
  #intro:not([hidden]) ~ .afterword { padding-block: 8px; }
  #intro:not([hidden]) ~ .afterword .daily-offer { display: flex; gap: 8px; }
}

/* The title reserves a separate lane for the cabinet, even on a small phone. */
.night-premise { margin-top: 13px; color: #c4c9d7; font-size: clamp(14px, 1.1vw, 17px); line-height: 1.35; }
.night-play { margin-top: clamp(14px, 2.8dvh, 32px); }
@media (min-width: 701px) {
  .night-links :is(#dailyShortcut, a[href="#scores"]) { display: none; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .night-inner { display: grid; grid-template-columns: minmax(0, 1fr) clamp(80px, 24vw, 140px); align-content: center; align-items: center; gap: 0 14px; padding-block: 32px; }
  .night-copy { display: contents; }
  .night-kicker, .night-copy h1 { grid-column: 1 / -1; }
  .night-copy h1 { margin: 10px 0 16px; font-size: clamp(68px, 16.5vw, 110px); }
  .night-line { grid-column: 1; max-width: 10ch; font-size: clamp(31px, 8vw, 47px); letter-spacing: -.015em; }
  .night-premise { grid-column: 1; max-width: 23ch; margin-top: 10px; }
  .night-play { grid-column: 1; justify-self: start; margin-top: 20px; min-width: 0; }
  .night-cabinet { position: static; grid-area: 3 / 2 / 6; width: 93%; transform: rotate(5deg); }
  #intro:not([hidden]) ~ .afterword h2 { letter-spacing: -.025em; }
}
@media (min-width: 701px) and (max-height: 600px) {
  .night-premise { margin-top: 3px; }
  .night-play { margin-top: 8px; }
}

/* Live play keeps the navy field, with one green accent for an available move. */
:root:has(#play:not([hidden])) {
  color-scheme: dark;
  --paper: #141723; --ink: #f5f2e8; --line: #383e50; --muted: #b9bfce; --forest: #c5e5b6; --soft: #252a39;
  background: #141723;
}
body:has(#play:not([hidden])) .brand img { filter: invert(1); }
#play :focus-visible, body:has(#play:not([hidden])) :is(.sitehead, dialog) :focus-visible { outline-color: #c2ec99; }
#play button, dialog button { -webkit-tap-highlight-color: transparent; }
#play .run-actions .smallbtn { border-color: #62697d; }
#play .run-actions button { white-space: nowrap; }
#play .stats b { font-family: system-ui, sans-serif; font-weight: 650; letter-spacing: -.035em; }
#play .point-total b { color: #ccedb8; }
#play .run-actions .music[aria-pressed=false] .levels { position: relative; }
#play .run-actions .music[aria-pressed=false] .levels::after { content: ''; position: absolute; width: 20px; height: 2px; transform: rotate(-45deg); background: currentColor; }
#play .film-poster { background: #293041; border-color: #4d5363; }
#play .film-poster img { filter: grayscale(.72); opacity: .61; }
#play .film-poster:is(:hover,:focus-visible) img { opacity: .9; }
#play .film-play { color: #e2f7ce; background: #161e29ed; border-color: #d9e5dc99; }
#play .film-credit { color: #b7becd; }
#play .discover h2 { color: #e1e1de; }
body:has(#play:not([hidden])) dialog { background: #232735; color: #f5f2e8; border-color: #555d71; border-radius: 8px; }
body:has(#play:not([hidden])) dialog::backdrop { background: #080b15b8; }
body:has(#play:not([hidden])) dialog .primary { background: #c5e5b6; color: #17251c; }
.pause-links { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.pause-links .smallbtn { grid-column: 1 / -1; }
.pause-links .textbutton { text-align: center; min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .motion-setting { display: flex; } }
#play .power-card {
  --accent: #dec59d; --card-ink: #e5d1b3;
  color: #dfe0e4; background: #202431; border-color: #414655;
}
#play .power-card[data-power=tclear] { --accent: #abd7e7; --card-ink: #c3e4ef; }
#play .power-card[data-power=explore] { --accent: #cbb3df; --card-ink: #dfcdea; }
#play .power-card[data-power=scatter] { --accent: #bce19b; --card-ink: #d1edb8; }
#play .power-card.collected { background: color-mix(in srgb, #1b2030 91%, var(--accent)); border-color: color-mix(in srgb, #333849 64%, var(--accent)); }
#play .power-card.ready .card-state, #play .power-card.ready .card-status::before { color: var(--accent); border-color: var(--accent); }
#play .power-card h3 { color: #f5f2e8; }
#play .power-card .card-status { color: #bfc6d2; font-variant-numeric: tabular-nums; }
#play .power-card .card-action:enabled { color: #15202a; background: var(--accent); border-color: var(--accent); }
.card-action kbd { margin-left: 8px; padding: 1px 4px; border: 1px solid currentColor; border-radius: 3px; }
.card-meter { display: block; width: 100%; height: 3px; background: #3b4050; }
.card-meter i { display: block; height: 100%; background: var(--accent); }
.power-card.collected:not(.ready) .card-meter i { background: #8992a0; }
#play .power-card.collected .card-status::before { border-color: #afc6b0; }
.card-book .power-card { color: #332f28; }
body:has(#play:not([hidden])) .card-book .power-card :focus-visible { outline-color: #367533; }
.hold-slot { display: grid; place-items: center; position: relative; background: #101522; border: 1px solid #454c61; color: #c9cddd; border-radius: 4px; padding: 0; min-height: 44px; min-width: 44px; }
.hold-slot #hold { width: 100%; margin: 0; max-width: 78px; box-shadow: none; }
#holdHint { position: absolute; font: 500 12px/1 Montreal, sans-serif; }
.hold-slot:disabled { border-style: dashed; opacity: .72; }
@media (min-width: 701px) and (min-height: 471px) {
  .hold-slot { width: 52%; max-width: 78px; }
  #play .console .pieces #hold { width: 100%; }
  .card-rail .power-card .card-status { margin-bottom: 0; }
  .card-rail .power-card h3 { margin-top: auto; }
  .card-rail .power-card .card-meter { margin-top: 3px; }
  .console .pad [data-act=soft] { margin-left: 0; }
}
.feedback { min-width: 0; margin-top: auto; }
.feedback #clearCall { border: 0; margin: 5px 0 0; padding: 0; }
#unlockCall { margin: 10px 0 0; padding-left: 8px; border-left: 2px solid #c5e5a7; color: #eff6e8; }
#unlockCall small, #unlockCall strong { display: block; }
#unlockCall small { font: 650 10px/1.25 Montreal, sans-serif; color: #b8dea2; }
#unlockCall strong { font: 400 clamp(17px,1.5vw,24px)/1.05 var(--display); margin-top: 2px; }
@media (max-width: 700px), (max-width: 1000px) and (max-height: 470px) {
  #play .power-card .card-meter { height: 2px; }
  .feedback { margin-top: 4px; }
  .feedback #clearCall.fresh { position: static; background: transparent; text-align: left; }
  #unlockCall { margin-top: 6px; padding-left: 3px; }
  #unlockCall small { font-size: 10px; }
  #unlockCall strong { font: 600 11px/1.12 Montreal, sans-serif; overflow-wrap: anywhere; }
  .console .pad [data-act=hold] { display: none; }
  .hold-slot { width: 100%; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .console .pad { gap: 3px; padding: 0 3px; margin: 8px 0 max(8px, env(safe-area-inset-bottom)); }
  .console .pad button { min-width: 44px; min-height: 46px; }
  .console .pad [data-act=ccw], .console .pad [data-act=drop] { margin-left: 6px; }
  .console .touchline { font-size: 11px; padding: 0 0 4px; }
  .console .well { width: min(calc(100% - 59px), calc((100dvh - 282px - env(safe-area-inset-bottom)) / 2)); }
  .game-expanded .console .well { width: min(calc(100% - 59px), calc((100dvh - 200px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) / 2)); }
  #play .pieces .hold-slot canvas { height: 35px; object-fit: contain; }
}
@media (max-width: 360px) and (orientation: portrait) {
  #expandLabel { display: none; }
  #play .expand { min-width: 44px; }
}
@media (max-height: 470px) and (max-width: 1000px) and (orientation: landscape) {
  :root { --landscape-chrome: 170px; }
  :root.game-expanded { --landscape-chrome: 98px; }
  .console .pad [data-act=hold] { display: none; }
}

@media (min-width: 701px) and (min-height: 471px) {
  .arena > .card-rail { position: relative; }
  .card-rail > .card-stack { position: absolute; inset: 0; grid-auto-rows: minmax(0, 1fr); }
  .card-rail .card-stack:has(> :nth-child(4)) { grid-template-rows: repeat(4,minmax(0,1fr)); gap: 8px; }
  .card-rail .card-stack:has(> :nth-child(4)) .power-card { justify-content: center; padding: 8px 13px; gap: 4px; }
  .card-rail .card-stack:has(> :nth-child(4)) h3 { font-size: clamp(17px,1.35vw,21px); line-height: 1.06; margin: 0; }
  .card-rail .card-stack:has(> :nth-child(4)) p { font-size: 13px; line-height: 1.24; margin: 0; }
  .card-rail .card-stack:has(> :nth-child(4)) .card-meter { flex: 0 0 3px; margin: 0; }
  .card-rail .card-stack:has(> :nth-child(4)) .card-action { flex-shrink: 0; min-height: 32px; padding-block: 4px; }
  #play .card-rail .power-card:has(.card-action) .card-action { min-height: 32px; }
}
@media (min-width: 701px) and (max-height: 700px) and (min-height: 471px) {
  #play { margin-block: 5px 12px; }
  #play .arena { margin-top: 8px; }
  .arena > .console { justify-content: flex-start; }
  .console .pad { margin-block: 12px 8px; }
  .console .station { position: relative; padding-bottom: 26px; }
  .console .hud { position: static; }
  .console .feedback { position: absolute; inset: auto 0 0; height: 24px; display: flex; align-items: center; justify-content: center; gap: 12px; }
  .console .feedback :is(#clearCall,#unlockCall) { display: flex; align-items: baseline; gap: 4px; margin: 0; padding-block: 0; }
  .console .feedback #clearValue { font: 650 15px/1 Montreal,sans-serif; }
  .console .feedback #clearName, .console .feedback #unlockCall strong { margin: 0; font: 600 12px/1.1 Montreal,sans-serif; }
  .card-rail .card-stack:has(> :nth-child(4)) .power-card { padding-block: 5px; gap: 2px; }
  .card-rail .card-stack:has(> :nth-child(4)) .power-card p { display: none; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .card-rail .card-stack:has(> :nth-child(4)) { grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-flow: row; grid-auto-rows: minmax(44px,1fr); }
  #play .card-stack:has(> :nth-child(4)) .power-card { padding-block: 3px; gap: 1px; min-height: 44px; }
  #play .station { position: relative; padding-bottom: 30px; margin-bottom: 0; }
  #play .station .hud { position: static; }
  #play .station .feedback { position: absolute; left: 1%; right: 1%; bottom: 0; height: 28px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; }
  #play .feedback :is(#clearCall,#unlockCall) { display: flex; align-items: baseline; gap: 4px; margin: 0; padding-block: 0; }
  #play .feedback #clearName { margin: 0; font-size: 11px; }
  #play .feedback #unlockCall strong { font: 600 12px/1.1 Montreal,sans-serif; margin: 0; }
  #play .feedback .touchline { display: block; padding: 0; font-size: 11px; }
  #play .feedback:has(:is(#clearCall,#unlockCall):not([hidden])) .touchline { display: none; }
  .console .well { width: min(calc(100% - 59px), calc((100dvh - 302px - env(safe-area-inset-bottom)) / 2)); }
  .game-expanded .console .well { width: min(calc(100% - 59px), calc((100dvh - 224px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) / 2)); }
  .arena:has(.card-stack > :nth-child(4)) .well { width: min(calc(100% - 59px), calc((100dvh - 344px - env(safe-area-inset-bottom)) / 2)); }
  .game-expanded .arena:has(.card-stack > :nth-child(4)) .well { width: min(calc(100% - 59px), calc((100dvh - 266px - env(safe-area-inset-bottom)) / 2)); }
}

.pause-schools { display: none; }
.console .pad :is([data-act=ccw],[data-act=cw]) { font: 400 24px/1 Arial, sans-serif; }
@media (max-width: 700px) and (orientation: portrait) {
  .card-rail .power-card { padding-right: 10px; }
  .card-rail .power-name::before { content: '›'; position: absolute; right: 4px; top: 4px; font: 14px/1 Arial, sans-serif; color: #b4c2ce; }
}
@media (max-width: 700px) and (max-height: 680px) and (orientation: portrait) {
  body:has(#play:not([hidden])) .sitehead { display: none; }
  .pause-schools { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); }
  .pause-schools a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
  :root:not(.game-expanded) .console .well { width: min(calc(100% - 59px), calc((100dvh - 238px - env(safe-area-inset-bottom)) / 2)); }
  :root:not(.game-expanded) .arena:has(.card-stack > :nth-child(4)) .well { width: min(calc(100% - 59px), calc((100dvh - 292px - env(safe-area-inset-bottom)) / 2)); }
}
/* First-power guide: the earned power, then every power with its key and when it arrives. */
@property --countdown { syntax: '<number>'; inherits: false; initial-value: 1; }
#modal:has(.first-power) { width: min(440px, 92vw); }
#modal:has(.first-power) h2 { margin-bottom: 18px; padding-right: 48px; font-size: clamp(30px, 4.2vw, 38px); line-height: 1.02; text-wrap: balance; }
.first-power-timer {
  position: absolute; top: clamp(20px, 4vw, 30px); right: clamp(20px, 4vw, 30px);
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 2px solid transparent;
  background:
    linear-gradient(#191e2b, #191e2b) padding-box,
    conic-gradient(#c5e5b6 calc(var(--countdown, 1) * 1turn), #383e50 0) border-box;
  color: #f5f2e8; font: 600 15px/1 Montreal, Arial, sans-serif; font-variant-numeric: tabular-nums;
  transition: --countdown .25s ease;
}
@media (prefers-reduced-motion: reduce) { .first-power-timer { transition: none; } }
.first-power { display: grid; gap: 20px; }
.first-power p { margin: 0; }
.first-power-reward { padding: 14px 16px 15px; border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0; background: #191e2b; }
.first-power-tag, .first-power-how h4 { font: 650 11px/1.2 Montreal, Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.first-power .first-power-tag { margin-bottom: 6px; color: var(--accent); }
.first-power-reward h3 { margin: 0 0 4px; color: #f5f2e8; font: 400 26px/1.1 var(--display); }
.first-power-reward p:last-child { color: #c4c9d7; font-size: 15px; line-height: 1.4; }
.first-power-how h4 { margin: 0 0 6px; color: #9aa2b4; }
.first-power-how > p { color: #dfe2ea; font-size: 15px; line-height: 1.4; text-wrap: pretty; }
.power-keys { margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px solid #383e50; }
.power-keys li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 0; padding: 9px 0; border-bottom: 1px solid #383e50; color: #9aa2b4; }
.power-keys kbd { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid #555d71; border-radius: 5px; color: #c4c9d7; font: 650 13px/1 Montreal, Arial, sans-serif; }
.power-keys li.ready kbd { background: var(--accent); border-color: var(--accent); color: #15202a; }
.power-keys strong, .power-keys small { display: block; }
.power-keys strong { color: #c9cedb; font-size: 15px; font-weight: 600; line-height: 1.25; }
.power-keys li.ready strong { color: #f5f2e8; }
.power-keys small { margin-top: 1px; font-size: 13px; line-height: 1.3; }
.power-keys-when { font: 600 12px/1 Montreal, Arial, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.power-keys li.ready .power-keys-when { color: var(--accent); }
.first-power-note { color: #9aa2b4; font-size: 13px; line-height: 1.4; }
#modal:has(.first-power) #close { width: 100%; justify-content: center; gap: 10px; margin-top: 22px; }
#modal:has(.first-power) .resume-key {
  padding: 2px 7px; border: 1px solid #17251c4d; border-radius: 4px; background: #17251c14;
  font: 600 12px/1.2 Montreal, Arial, sans-serif; letter-spacing: .01em;
}
@media (pointer: coarse) { #modal:has(.first-power) .resume-key { display: none; } }
@media (max-height: 600px) {
  #modal:has(.first-power) { padding-block: 16px; }
  #modal:has(.first-power) h2 { margin-bottom: 10px; padding-right: 40px; font-size: 28px; }
  .first-power-timer { top: 16px; width: 32px; height: 32px; font-size: 13px; }
  .first-power { gap: 12px; }
  .first-power-reward { padding-block: 9px 10px; }
  .first-power-reward h3 { font-size: 22px; }
  .power-keys li { padding-block: 5px; }
  .power-keys small { display: none; }
  #modal:has(.first-power) #close { margin-top: 12px; }
}
@media (max-height: 460px) and (min-width: 600px) {
  #modal:has(.first-power) { width: min(760px, 94vw); }
  .first-power { grid-template-columns: 1fr 1.15fr; align-items: start; column-gap: 22px; }
  .first-power-how { grid-column: 2; grid-row: 1 / span 2; }
  .first-power-how > p { font-size: 14px; }
  .power-keys { margin-top: 8px; }
}

/* Title leaderboard styling. */
#intro:not([hidden]) ~ .afterword .score-list .podium .rank, #intro:not([hidden]) ~ .afterword .best-note strong { color: #ffd497; }
#intro:not([hidden]) ~ .afterword .best-card { background: #181c2a; }
#intro:not([hidden]) ~ .afterword #ranking { max-width: none; }

/* In play: the live top 10 sits where the film used to be. */
.live-board { align-self: start; padding: 14px; border: 1px solid #2c3142; border-radius: 6px; background: #181c29; }
.live-board[hidden] { display: none; }
#play .live-board h2 { margin: 0; display: flex; justify-content: space-between; font: 600 11px/1.2 Montreal, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #9aa2b4; }
.live-board h2 span { color: #c5e5b6; }
.live-next { margin-top: 12px; padding: 12px; border: 1px solid #ffd49766; border-radius: 5px; background: #221f22; }
.live-label { margin: 0; font: 600 11px/1.2 Montreal, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #ffd497; }
.live-target { margin: 6px 0 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.live-target span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-target strong { font: 400 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.live-meter { display: block; margin-top: 10px; height: 6px; border-radius: 3px; background: #3a3634; overflow: hidden; }
.live-meter i { display: block; height: 100%; background: #ffd497; transition: width .3s ease-out; }
.live-gap { margin: 8px 0 0; font-size: 13px; color: #dfe2ea; font-variant-numeric: tabular-nums; }
.live-ranks { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; }
.live-ranks li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 26px; margin: 0; padding: 0 6px; border-radius: 3px; color: #c4c9d7; font-variant-numeric: tabular-nums; }
.live-ranks li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-ranks li.next { background: #2a2620; color: #ffd497; }
.live-ranks li.you { background: #22392a; color: #e6ffd2; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .live-meter i { transition: none; } }
