/* Arcade (arcade.js + the arcade game screens in games.js). Its own voice: an arcade at night. The hall
   floor is loud arcade carpet, the machines are indigo cabinets with lit white marquees, and every game
   plays on a black CRT. The two players are periwinkle blue (the challenger) and white. See DESIGN.md. */
@font-face { font-family: "Jersey 10"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/Jersey10-400.woff2) format("woff2"); }

.arcade-vars, .match.arcade {
  --ac-night: #0b0c1a;     /* the room, and the chrome around a game */
  --ac-carpet: #10122a;
  --ac-cab: #3340a0;       /* cabinet body (the letterboard felt) */
  --ac-cab-dark: #222b73;  /* cabinet sides, button rims */
  --ac-marquee: #f6f7ff;   /* lit marquee */
  --ac-screen: #000000;    /* the CRT */
  --ac-ink: #eef0fb;
  --ac-ink-2: #9ea3c6;
  --ac-line: #262a52;
  --ac-p0: #7c8cff;        /* challenger */
  --ac-p1: #eef0fa;        /* challenged */
  --ac-pixel: "Jersey 10", "Barlow Condensed", var(--font);
}

/* ---------- the game screen (a match of an arcade game) ---------- */
.match.arcade { padding: 0; place-items: stretch; background: var(--ac-night); color: var(--ac-ink); font-family: var(--font); }
.match.arcade :focus-visible { outline: 3px solid var(--ac-p1); outline-offset: 2px; }
.ag-screen { position: relative; max-width: 820px; }
.ag-top { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 6px; }
.ag-top > :first-child { justify-self: start; }
.ag-title { margin: 0; font: 400 34px/1 var(--ac-pixel); letter-spacing: .04em; color: var(--ac-marquee); white-space: nowrap; }
.ag-btn { min-height: 40px; padding: 6px 16px; border-radius: 10px; border: 2px solid var(--ac-line); background: transparent; color: var(--ac-ink);
  font: 700 15px/1 var(--font); cursor: pointer; }
.ag-btn:active { background: var(--ac-line); }

/* face-off strip, compact */
.ag-versus { flex: none; padding: 0 16px 6px; }
.ag-versus .mt-versus { width: min(100%, 440px); margin: 0 auto; grid-template-columns: 1fr auto 1fr; }
.ag-versus .mt-pl { flex-direction: row; justify-content: flex-end; gap: 8px; }
.ag-versus .mt-pl.p1 { flex-direction: row-reverse; }
.ag-versus .mt-pl.p0 { --pc: var(--ac-p0); --ps: #1c2250; }
.ag-versus .mt-pl.p1 { --pc: var(--ac-p1); --ps: #2b2d3a; }
.ag-versus .mt-face { width: 42px; height: 42px; flex: none; background: #171a3a; border-width: 2px; }
.ag-versus .mt-name { border: 0; background: none; padding: 0; color: var(--ac-ink); font: 400 22px/1 var(--ac-pixel); letter-spacing: .03em; }
.ag-versus .mt-pl.won .mt-name, .ag-versus .mt-pl.on .mt-name { background: none; }
.ag-versus .mt-score { padding: 0 6px; font: 400 30px/1 var(--ac-pixel); color: var(--ac-marquee); }
.ag-versus .mt-vs { font-size: 22px; color: var(--ac-ink-2); }

/* the stage belongs to the game (public/arcade/<kind>.js) */
.ag-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--ac-screen);
  margin: 0 max(0px, env(safe-area-inset-right)) 0 max(0px, env(safe-area-inset-left)); border-top: 2px solid var(--ac-line); border-bottom: 2px solid var(--ac-line);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* iOS won't let you type into an input whose ancestor is user-select: none */
.ag-stage input, .ag-stage textarea { -webkit-user-select: text; user-select: text; }
.ag-status { flex: none; margin: 0; min-height: 0; padding: 0 16px calc(6px + var(--sab)); text-align: center; color: var(--ac-ink-2); font: 400 22px/1.3 var(--ac-pixel); letter-spacing: .03em; }
.ag-status:empty { padding-top: 0; }

/* "3 2 1 Go" */
.ag-count { position: absolute; left: 0; right: 0; top: 45%; text-align: center; pointer-events: none; z-index: 5;
  font: 400 140px/1 var(--ac-pixel); color: var(--ac-marquee); text-shadow: 0 0 18px #7c8cff99; opacity: 0; }
.ag-count.on { animation: ag-count .9s ease-out; }
@keyframes ag-count { 0% { opacity: 0; transform: scale(1.6); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* game over: a card rises over the bottom of the stage; the final board stays visible behind it */
.ag-over { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; pointer-events: none;
  padding: 0 12px calc(14px + var(--sab)); }
.ag-card { pointer-events: auto; width: min(100%, 380px); padding: 16px 16px 16px; border-radius: 16px; text-align: center;
  background: var(--ac-night); border: 2px solid var(--ac-line); animation: ag-rise .25s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes ag-rise { from { transform: translateY(24px); opacity: 0; } }
.ag-result { margin: 0; font: 400 46px/1 var(--ac-pixel); letter-spacing: .03em; color: var(--ac-marquee); }
.ag-detail { margin: 4px 0 0; color: var(--ac-ink-2); font-size: 16px; }
.ag-card .mt-acts { margin-top: 14px; }
.ag-card .mt-sub { margin-top: 10px; color: var(--ac-ink-2); }
.ag-card .pz-btn { font-family: var(--font); font-weight: 700; border-radius: 10px; background: transparent; color: var(--ac-ink); border-color: var(--ac-line); }
.ag-card .pz-btn.blue { background: var(--ac-cab); border-color: var(--ac-cab); color: #fff; }
.match.arcade.is-over .ag-status { visibility: hidden; }

/* Cabinet buttons for on-screen controls. .ag-key is a round arcade button; .wide makes a pill.
   Games lay them out in their own .ag-pad rows at the bottom of the stage. */
.ag-pad { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px 12px 12px; z-index: 3; }
.ag-key { flex: none; display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border-radius: 50%;
  border: 0; background: var(--ac-cab); color: #fff; font: 400 24px/1 var(--ac-pixel); letter-spacing: .02em;
  box-shadow: inset 0 -5px 0 var(--ac-cab-dark), 0 0 0 3px #151836; touch-action: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ag-key.wide { width: auto; min-width: 76px; padding: 0 16px; border-radius: 29px; }
.ag-key.dark { background: #22264a; box-shadow: inset 0 -5px 0 #111330, 0 0 0 3px #151836; }
.ag-key:active, .ag-key.down { transform: translateY(3px); box-shadow: inset 0 -2px 0 var(--ac-cab-dark), 0 0 0 3px #151836; }
.ag-key.dark:active, .ag-key.dark.down { box-shadow: inset 0 -2px 0 #111330, 0 0 0 3px #151836; }
.ag-key:disabled { opacity: .4; }
.ag-key svg { width: 26px; height: 26px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) { .ag-count.on, .ag-card { animation: none; } .ag-count.on { opacity: 1; } }

/* ---------- the hall ---------- */
.arc {
  position: fixed; left: 0; right: 0; top: 0; height: var(--app-h); z-index: 30; display: flex; flex-direction: column;
  color: var(--ac-ink); font-family: var(--font);
  /* arcade carpet: squiggles, zigzags, rings and confetti in indigo, periwinkle and white on a midnight floor */
  background: var(--ac-carpet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 32q10-14 20 0t20 0t20 0' stroke='%23b3bcff' opacity='.45'/%3E%3Cpath d='M122 18l18 30h-36z' stroke='%234a5ad6' opacity='.8'/%3E%3Ccircle cx='58' cy='112' r='12' stroke='%23eef0fb' opacity='.28'/%3E%3Cpath d='M118 128l10-10l10 10l10-10l10 10' stroke='%237c8cff' opacity='.55'/%3E%3Cpath d='M16 166q15-20 30 0' stroke='%234a5ad6' opacity='.7'/%3E%3Cpath d='M92 158l8 8m0-8l-8 8' stroke='%23eef0fb' opacity='.3'/%3E%3C/g%3E%3Crect x='80' y='62' width='10' height='10' fill='%234a5ad6' opacity='.8' transform='rotate(20 85 67)'/%3E%3Ccircle cx='160' cy='84' r='4' fill='%23b3bcff' opacity='.45'/%3E%3Ccircle cx='28' cy='84' r='3' fill='%23eef0fb' opacity='.35'/%3E%3Crect x='100' y='92' width='4' height='14' fill='%23b3bcff' opacity='.4' transform='rotate(-30 102 99)'/%3E%3C/svg%3E") 0 0 / 180px 180px;
  opacity: 0; transition: opacity .2s;
}
.arc.in { opacity: 1; }
body.in-arcade { background: var(--ac-night, #0b0c1a); }
.arc :focus-visible { outline: 3px solid var(--ac-p1); outline-offset: 3px; }
.arc-top { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--ac-night); border-bottom: 3px solid var(--ac-cab); }
.arc-top > :first-child { justify-self: start; }

/* the sign: neon letters that light up one by one when you walk in */
.arc-sign { margin: 0; display: flex; gap: 2px; font: 400 44px/.9 var(--ac-pixel); letter-spacing: .02em; }
.arc-sign b { font-weight: 400; color: var(--ac-marquee); text-shadow: 0 0 6px #7c8cff, 0 0 18px #3340a0; }
.arc.in .arc-sign b { animation: arc-lit .5s steps(2, jump-none) both; }
.arc-sign b:nth-child(2) { animation-delay: .08s !important; } .arc-sign b:nth-child(3) { animation-delay: .16s !important; }
.arc-sign b:nth-child(4) { animation-delay: .24s !important; } .arc-sign b:nth-child(5) { animation-delay: .32s !important; }
.arc-sign b:nth-child(6) { animation-delay: .4s !important; }
@keyframes arc-lit { 0% { color: #2f3466; text-shadow: none; } 40% { color: var(--ac-marquee); text-shadow: 0 0 6px #7c8cff, 0 0 18px #3340a0; } 60% { color: #2f3466; text-shadow: none; } }

.arc-floor { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.arc-cabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 28px 22px; max-width: 980px; margin: 0 auto;
  padding: 24px 22px calc(34px + var(--sab)); }
.arc-empty { grid-column: 1 / -1; text-align: center; color: var(--ac-ink-2); }
.cab-spot { min-width: 0; }

/* a cabinet: lit marquee, CRT in a bezel, control panel, coin door; the right edge is the cabinet's side */
.cab { position: relative; display: flex; flex-direction: column; width: calc(100% - 7px); padding: 0 10px; border: 0; border-radius: 8px 8px 3px 3px;
  background: var(--ac-cab); box-shadow: 7px 0 0 var(--ac-cab-dark); color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cab:active { transform: translateY(2px); }
.cab-marquee { display: grid; place-items: center; height: 40px; margin: 0 -5px; border-radius: 6px 6px 2px 2px; border: 3px solid #151836;
  background: var(--ac-marquee); box-shadow: 0 0 14px #7c8cff40; overflow: hidden; }
.cab-marquee span { font: 400 30px/1 var(--ac-pixel); letter-spacing: .03em; color: var(--ac-cab); white-space: nowrap; }
.cab:hover .cab-marquee, .cab:focus-visible .cab-marquee { box-shadow: 0 0 22px #7c8cff99; }
.cab-screen { position: relative; display: grid; place-items: center; margin-top: 10px; aspect-ratio: 1 / .86; border-radius: 14px; border: 6px solid #151836; background: #000; overflow: hidden; }
.cab-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(#0000 0 2px, #ffffff0a 2px 3px); }
.cab-ic { display: grid; place-items: center; width: 64%; aspect-ratio: 1; }
.cab-ic svg { display: block; width: 100%; height: 100%; }
.cab-screen.live::before { content: ""; position: absolute; top: 7px; left: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ac-p0); z-index: 1;
  animation: arc-live 1.2s steps(2, jump-none) infinite; }
@keyframes arc-live { 50% { opacity: .25; } }
.cab-panel { position: relative; display: flex; align-items: center; gap: 7px; height: 30px; margin: 10px -8px 0; padding: 0 14px; border-radius: 5px; background: var(--ac-cab-dark); }
.cab-panel .stick { position: relative; width: 12px; height: 12px; margin-right: auto; border-radius: 50%; background: #0a0b1c; box-shadow: 0 5px 0 -3px #0a0b1c; }
.cab-panel .bt { width: 12px; height: 12px; border-radius: 50%; background: var(--ac-p0); box-shadow: inset 0 -2px 0 #0004; }
.cab-panel .bt.w { background: var(--ac-marquee); }
.cab-door { display: grid; place-items: center; height: 40px; }
.cab-door i { width: 16px; height: 20px; border-radius: 3px; background: #151836; box-shadow: inset 0 0 0 5px #151836, inset 0 0 0 7px #b3bcff; }
.cab-blurb { margin: 10px 0 0; font-size: 15px; line-height: 1.35; color: var(--ac-ink); }
.cab-meta { margin: 4px 0 0; font-size: 14px; line-height: 1.35; color: var(--ac-ink-2); }
.cab-live { display: inline-flex; align-items: baseline; gap: 6px; color: #b3bcff; }
.cab-live i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ac-p0); }

/* who to play: a sheet from the bottom */
.arc-pick { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-end; justify-content: center; background: #02030aa8; }
.arc-pick[hidden] { display: none; }
.arc-sheet { width: min(100%, 480px); max-height: 82%; display: flex; flex-direction: column; padding: 18px 16px calc(14px + var(--sab));
  border-radius: 20px 20px 0 0; background: var(--ac-night); border-top: 3px solid var(--ac-cab); transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .9, .3, 1); }
.arc-pick.in .arc-sheet { transform: none; }
.arc-sheet-head { margin: 0 0 8px; font: 400 36px/1 var(--ac-pixel); letter-spacing: .03em; color: var(--ac-marquee); }
.arc-people { overflow-y: auto; margin: 0 -16px; padding: 0 16px; }
.arc-person { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--ac-line);
  background: none; color: var(--ac-ink); text-align: left; font: inherit; cursor: pointer; }
.arc-person:disabled { opacity: .45; cursor: default; }
.arc-person:not(:disabled):active { background: #ffffff0a; }
.arc-face { flex: none; width: 46px; height: 46px; border-radius: 50%; background: #171a3a; overflow: hidden; display: grid; place-items: center; }
.arc-face .mface, .arc-face img, .arc-face svg { display: block; width: 100%; height: 100%; }
.arc-face .mface.flat svg { padding: 8%; }
.arc-who { display: flex; flex-direction: column; min-width: 0; }
.arc-name { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-state { font-size: 14px; color: var(--ac-ink-2); }
.arc-state.here { color: #b3bcff; }
.arc-none { color: var(--ac-ink-2); margin: 8px 0 16px; }
.arc-cancel { align-self: center; margin-top: 12px; min-width: 140px; min-height: 44px; }

/* the header button (in the chat's letterboard); a fourth round button makes the board tight on small phones */
.arcade-go { flex: none; width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 2px solid var(--letter); background: transparent; color: var(--letter); display: grid; place-items: center; }
.arcade-go svg { width: 24px; height: 24px; fill: currentColor; }
.arcade-go:active { transform: translateY(1px); }
@media (max-width: 400px) { .top { gap: 9px; padding-right: 10px; padding-left: 14px; } .arcade-go, .top .plaza-go { width: 42px; height: 42px; } }
@media (max-width: 340px) { .top { gap: 6px; } .arcade-go, .top .plaza-go { width: 38px; height: 38px; } .arcade-go svg { width: 20px; height: 20px; } }

@media (prefers-reduced-motion: reduce) {
  .arc, .arc-sheet { transition: none; }
  .arc.in .arc-sign b, .cab-screen.live::before { animation: none; }
}
