/* Rally. Swiss: one grid, heavy grotesk numerals, one red thing at a time.
   Palette comes from the venue via applyUi(). Switzer is the brand face,
   loaded from the repo's brand folder; anything else falls back cleanly. */
@font-face { font-family: 'Switzer'; font-weight: 400; src: url(../fonts/Switzer-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Switzer'; font-weight: 600; src: url(../fonts/Switzer-600.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Switzer'; font-weight: 800; src: url(../fonts/Switzer-800.woff2) format('woff2'); font-display: swap; }
:root { --paper: #f1f0ec; --ink: #0a0a0a; --accent: #e4002b; --soft: #6b6b6b; --line: color-mix(in srgb, var(--ink) 16%, transparent); --wash: color-mix(in srgb, var(--paper) 86%, transparent); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: 'Switzer', 'Helvetica Neue', Arial, sans-serif; -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: none; }
body:has(#menu.on) canvas#c { cursor: default; }
button { font: inherit; color: inherit; cursor: pointer; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }
kbd { font: inherit; font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* ------------------------------------------------------------ menus */
#menu { position: fixed; inset: 0; display: none; z-index: 20; overflow: auto; padding: 28px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#menu.on { display: flex; align-items: safe center; justify-content: center; }
#menu.title { justify-content: flex-start; align-items: safe center; background: linear-gradient(90deg, var(--wash) 0 44%, transparent 70%); }
#menu.pause, #menu.over, #menu.howto, #menu.settings { background: var(--wash); }

.title { width: min(540px, 100%); display: flex; flex-direction: column; gap: 22px; }
.title h1 { font-weight: 800; font-size: clamp(76px, 12vw, 148px); line-height: .82; letter-spacing: -4px; margin: 0; }
.title h1 i { display: inline-block; width: .34em; height: .34em; background: var(--accent); margin-left: .06em; vertical-align: .02em; }
.title header p { margin: 14px 0 0; font-size: 18px; line-height: 1.45; max-width: 40ch; color: var(--soft); }
.modes { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.mode { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: baseline; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 13px 4px; }
.mode .n { grid-row: span 2; font-size: 13px; font-weight: 600; color: var(--soft); }
.mode b { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.mode small { font-size: 14px; color: var(--soft); }
.mode:hover b, .mode:focus-visible b { color: var(--accent); }
.mode:focus-visible { outline: none; }
.mode.primary b { font-size: 40px; }
.opts { display: flex; flex-direction: column; gap: 8px; padding: 4px 4px 14px 54px; border-bottom: 1px solid var(--line); }
.group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.group > label { width: 84px; font-size: 13px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--soft); }
.chip { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--ink); color: var(--paper); }
.chip:hover:not(.on) { border-color: var(--accent); color: var(--accent); }
.venue { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid transparent; background: transparent; border-radius: 999px; padding: 3px 11px 3px 4px; font-size: 14px; font-weight: 600; }
.venue i { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(90deg, var(--t) 0 46%, var(--l) 46% 54%, var(--t) 54%); box-shadow: 0 0 0 2px var(--f), 0 0 0 3.5px var(--ink); }
.venue.on { border-color: var(--ink); }
.title footer { display: flex; gap: 22px; }
.link { background: none; border: 0; padding: 0; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }

.card { width: min(520px, 100%); background: var(--paper); border-top: 6px solid var(--ink); padding: 26px 28px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px color-mix(in srgb, var(--ink) 18%, transparent); }
.card h2 { margin: 0 0 4px; font-size: 48px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.card .sub { margin: -6px 0 0; color: var(--soft); font-size: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.btn { border: 1.5px solid var(--ink); background: transparent; padding: 11px 20px; border-radius: 999px; font-weight: 800; font-size: 16px; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn:hover { border-color: var(--accent); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.how { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; font-size: 16px; line-height: 1.45; }
.keys { margin: 0; font-size: 14px; color: var(--soft); line-height: 1.8; }
input[type=range] { flex: 1; accent-color: var(--accent); }
dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
dl div { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
dt { font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--soft); font-weight: 600; }
dd { margin: 2px 0 0; font-size: 26px; font-weight: 800; }

/* ------------------------------------------------------------ hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; display: none; }
#hud.on { display: block; }
.board { position: absolute; left: 22px; top: 20px; background: var(--paper); border-top: 5px solid var(--ink); min-width: 230px; box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 14%, transparent); }
.board .row { display: grid; grid-template-columns: 16px 1fr 34px 56px; align-items: center; padding: 6px 12px 6px 10px; border-bottom: 1px solid var(--line); }
.board .row i { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.board .row.serve i { background: var(--accent); }
.board .nm { font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; }
.board .gm { font-size: 15px; font-weight: 600; color: var(--soft); text-align: right; }
.board .pt { font-size: 32px; font-weight: 800; text-align: right; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.mode-machine .board, .mode-keepup .board, .mode-classic .board { display: none; }
.corner { position: absolute; right: 22px; top: 20px; display: flex; gap: 14px; align-items: center; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.corner #uRally { color: var(--accent); }
.corner button { pointer-events: auto; border: 1.5px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.msg { position: absolute; left: 0; right: 0; top: 31%; text-align: center; opacity: 0; }
.msg h2 { margin: 0; font-size: clamp(56px, 10vw, 130px); font-weight: 800; letter-spacing: -3px; line-height: .9; }
.msg p { margin: 10px 0 0; font-size: 18px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; }
.msg.good h2 { color: var(--accent); }
.msg.on { animation: msg 1.7s ease-out forwards; }
@keyframes msg { 0% { opacity: 0; transform: translateY(14px); } 12% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; } }
.shot { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; opacity: 0; white-space: nowrap; }
.shot b { font-size: 40px; font-weight: 800; letter-spacing: -1px; margin-right: 4px; }
.shot span { color: var(--soft); margin-left: 8px; }
.shot.on { animation: shot 1.6s ease-out forwards; }
@keyframes shot { 0% { opacity: 0; } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.hint { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; opacity: 0; transition: opacity .3s; white-space: nowrap; }
.hint.on { opacity: 1; }
.replay { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 6px 16px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; font-size: 15px; display: none; }
.replay span { font-weight: 400; letter-spacing: .4px; text-transform: none; margin-left: 8px; opacity: .85; }
.replay.on { display: block; }
.flash { position: absolute; right: 22px; bottom: 22px; font-weight: 800; font-size: 22px; opacity: 0; }
.flash.on { animation: shot 1.4s forwards; }

body.backdrop #menu, body.backdrop #hud { display: none !important; }
body.backdrop canvas#c { cursor: default; }

@media (max-width: 720px) {
  #menu { padding: 18px; }
  #menu.title { background: var(--wash); }
  .opts { padding-left: 4px; }
  .board { left: 10px; top: 10px; min-width: 180px; }
  .board .pt { font-size: 24px; }
  .corner { right: 10px; top: 10px; }
  .corner #uLevel { display: none; }
  .hint { bottom: 70px; font-size: 13px; white-space: normal; text-align: center; width: 80vw; }
}
@media (prefers-reduced-motion: reduce) { .msg.on, .shot.on { animation-duration: .01s; } }

/* the boot credit (shared/brand.js): ink on the bright hall, a hard 1px light edge for the darker rooms */
.wl-credit.ry { color: #111111; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
