@font-face {
  font-family: 'Pixelify Sans';
  src: url('pixelify-sans.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: block;
}
@font-face {
  font-family: 'Press Start 2P';
  src: url('press-start-2p.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* A Gassoft compilation box from 1999: deep purple, gold trim, and the
   whole cast on the cards. */
:root {
  --bg: #1a1238;
  --bg2: #2a1a52;
  --ink: #fff8e8;
  --dim: #b8aed8;
  --gold: #ffcc33;
  --gold2: #e89a10;
  --edge: #0a0618;
  --p1: #4ac8ff;
  --p2: #ff6a8a;
  --good: #6ae87a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse at 50% -10%, #4a2a8a 0%, var(--bg) 60%) var(--bg);
  color: var(--ink);
  font-family: 'Pixelify Sans', sans-serif; font-weight: 600;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
#app { height: 100%; }
.screen { height: 100%; display: flex; flex-direction: column; align-items: center; padding: 12px 16px; }

/* ------------------------------------------------------------------ menu */
#menu { justify-content: center; gap: 10px; overflow-y: auto; overflow-x: hidden; text-align: center; }
.presents { font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: 3px; color: var(--dim); margin: 0; }
.logo {
  font-family: 'Press Start 2P', monospace; font-weight: 400; margin: 0; line-height: 1.2;
  font-size: clamp(28px, 9vw, 54px); color: var(--gold);
  text-shadow: 3px 3px 0 #a0400a, 6px 6px 0 var(--edge);
}
.logo small { font-size: 0.42em; color: var(--ink); vertical-align: middle; text-shadow: 2px 2px 0 var(--edge); }
.fan { position: relative; height: clamp(90px, 22vh, 150px); width: min(420px, 90vw); margin: 4px 0 clamp(14px, 4vh, 30px); }
.fan .card { position: absolute; left: 50%; bottom: 0; transform-origin: 50% 100%; pointer-events: none; }
.blurb { max-width: 460px; margin: 0; color: var(--dim); font-size: 15px; line-height: 1.35; }
.buttons { display: flex; flex-direction: column; gap: 8px; width: min(320px, 90vw); }
.buttons.row { flex-direction: row; flex-wrap: wrap; justify-content: center; width: auto; }
.big {
  font-family: 'Press Start 2P', monospace; font-size: 13px; padding: 14px 18px;
  background: linear-gradient(var(--gold), var(--gold2)); color: #2a1400;
  border: 3px solid var(--edge); border-radius: 10px; box-shadow: 0 4px 0 var(--edge);
}
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.big.alt { background: linear-gradient(#8a7ad8, #5a48a8); color: var(--ink); }
.options { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.toggle, .small {
  font-size: 13px; padding: 7px 11px; background: #2e2260; border: 2px solid var(--edge); border-radius: 8px; color: var(--ink);
}
.toggle[aria-pressed="true"] { background: #4a3a90; color: var(--gold); }
.best { margin: 0; color: var(--gold); font-size: 14px; min-height: 1em; }
.tiny { margin: 0; color: var(--dim); font-size: 13px; }
/* Numbers in the arcade face: in the pixel face at small sizes a 5 can pass for a 9, and a 2 for an 8. */
b.n { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 0.78em; letter-spacing: 0; }

/* ------------------------------------------------------------------ play */
#play { padding: 8px 10px; gap: 6px; }
.hud { padding-top: max(0px, calc(var(--corner-b, 0px) - 10px)); /* below the site's corner buttons (--corner-b) */ width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; min-height: 44px; }
.hud .stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.hud .stat b { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 15px; color: var(--gold); margin-top: 3px; }
.hud .stat span { font-size: 12px; color: var(--dim); letter-spacing: 1px; }
.hud .player { flex: 1; padding: 5px 8px; border-radius: 8px; border: 2px solid transparent; text-align: center; opacity: 0.55; transition: opacity 0.2s, border-color 0.2s; }
.hud .player.on { opacity: 1; border-color: currentColor; background: #ffffff10; }
.hud .player.p1 { color: var(--p1); }
.hud .player.p2 { color: var(--p2); }
.hud .player b { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 18px; display: block; margin-top: 3px; }
.hud .turn { font-family: 'Press Start 2P', monospace; font-size: 9px; color: var(--ink); text-align: center; flex: 0 0 auto; line-height: 1.6; }
.board { flex: 1; width: 100%; display: grid; place-content: center; gap: var(--gap, 8px); min-height: 0; perspective: 900px; }
.bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.bartools { display: flex; gap: 6px; flex: none; }
.toast { flex: 1; margin: 0; text-align: center; font-size: 14px; color: var(--good); line-height: 1.2; min-height: 1.2em; }
.toast i { font-style: normal; color: var(--dim); }

/* ------------------------------------------------------------------ cards
   A card is a button with two faces; turning it over is a 3D flip. */
.card {
  width: var(--cw, 80px); height: var(--ch, 106px); padding: 0; border: 0; background: none;
  position: relative; perspective: 600px;
}
.card .inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform 0.32s cubic-bezier(.3,.7,.3,1.2);
}
.card.up .inner, .card.done .inner { transform: rotateY(180deg); }
.card .side {
  position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 2px solid var(--edge); box-shadow: 0 3px 0 var(--edge);
  overflow: hidden;
}
.card .back {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 28%, transparent 28%),
    repeating-linear-gradient(45deg, #3a2a7a 0 6px, #30226a 6px 12px);
  display: grid; place-items: center;
}
.card .back::before {
  content: ''; position: absolute; inset: 5px; border: 2px solid var(--gold); border-radius: 5px; opacity: 0.8;
}
.card .back::after {
  content: 'G'; font-family: 'Press Start 2P', monospace; color: var(--gold); font-size: calc(var(--cw, 80px) * 0.32);
  text-shadow: 2px 2px 0 var(--edge); position: relative;
}
.card .face { transform: rotateY(180deg); background: var(--tone, #f4ecd8); display: flex; flex-direction: column; }
.card .face canvas { flex: 1; width: 100%; min-height: 0; display: block; }
.card .face .nm {
  font-size: calc(var(--cw, 80px) * 0.135); line-height: 1.05; padding: 2px 3px 3px; text-align: center;
  background: #000000a8; color: #fff; display: none;
}
.names .card .face .nm, .card.done .face .nm { display: block; }
.card .face .strip { height: 5px; background: var(--game, #888); flex: none; }
.card.done .side { box-shadow: 0 0 0 2px var(--good), 0 3px 0 var(--edge); }
.card.done { animation: pop 0.4s ease-out; }
.card.miss .face { animation: shake 0.35s; }
.card:not(.up):not(.done):hover .inner { transform: translateY(-3px); }
.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
@keyframes pop { 50% { transform: scale(1.1); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ------------------------------------------------------------------ zoom
   On a phone the card you turn comes forward and fills the screen. */
.zoom { position: fixed; inset: 0; z-index: 10; background: #0a0618b0; transition: background 0.25s; }
.zoom.fade { background: #0a061800; }
.zcard {
  position: fixed; border-radius: 14px; border: 3px solid var(--edge); background: var(--tone, #f4ecd8);
  box-shadow: 0 10px 0 var(--edge), 0 0 40px #0008;
  display: flex; flex-direction: column; align-items: stretch; overflow: hidden;
  transition: left 0.28s cubic-bezier(.2,.8,.3,1.05), top 0.28s cubic-bezier(.2,.8,.3,1.05), width 0.28s cubic-bezier(.2,.8,.3,1.05), height 0.28s cubic-bezier(.2,.8,.3,1.05);
}
.zcard canvas { flex: 1; min-height: 0; width: 100%; display: block; }
.zcard .zname { font-family: 'Press Start 2P', monospace; font-size: clamp(11px, 3.6vw, 16px); text-align: center; padding: 10px 8px 4px; background: #1a1238; color: var(--gold); line-height: 1.4; }
.zcard .zgame { text-align: center; padding: 0 8px 4px; background: #1a1238; color: var(--ink); font-size: 15px; }
.zcard .zline { text-align: center; padding: 0 10px 12px; background: #1a1238; color: var(--dim); font-size: 14px; line-height: 1.3; }
.zcard.small .zname, .zcard.small .zgame, .zcard.small .zline { opacity: 0; }
.zcard .zname, .zcard .zgame, .zcard .zline { transition: opacity 0.2s 0.15s; }

/* ------------------------------------------------------------------ results */
#end { overflow-y: auto; gap: 10px; text-align: center; padding-top: max(18px, calc(var(--corner-b, 0px) + 4px)); /* below the site's corner buttons (--corner-b) */ }
.title { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: clamp(16px, 5vw, 24px); color: var(--gold); margin: 0; text-shadow: 3px 3px 0 var(--edge); line-height: 1.4; }
.stats { margin: 0; font-size: 17px; line-height: 1.5; }
.stats .stars { font-family: 'Press Start 2P', monospace; color: var(--gold); font-size: 22px; letter-spacing: 6px; display: block; margin: 4px 0; }
.sub { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 11px; color: var(--dim); margin: 8px 0 0; }
.cast { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; width: min(820px, 100%); }
.cast li, .who-item { display: flex; align-items: center; gap: 8px; background: #ffffff0d; border: 2px solid #ffffff14; border-radius: 8px; padding: 6px; text-align: left; }
.cast canvas, .who-item canvas { width: 46px; height: 56px; flex: none; border-radius: 5px; }
.cast b, .who-item b { display: block; font-size: 14px; color: var(--ink); line-height: 1.15; }
.cast small, .who-item small { display: block; font-size: 12px; color: var(--dim); line-height: 1.2; margin-top: 2px; }

/* ------------------------------------------------------------------ who's who */
#who { overflow-y: auto; gap: 8px; }
.whohead { padding-top: max(0px, calc(var(--corner-b, 0px) - 10px)); /* below the site's corner buttons (--corner-b) */ width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.whohead .small { justify-self: start; }
.whoblurb { margin: 0; color: var(--dim); font-size: 14px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 900px; }
.chips button { font-size: 12px; padding: 5px 9px; border-radius: 14px; border: 2px solid var(--edge); background: #2e2260; color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--gold); color: #2a1400; }
#whoList { width: min(900px, 100%); padding-bottom: 20px; }
.who-game { margin: 14px 0 6px; font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 11px; color: var(--gold); display: flex; align-items: center; gap: 8px; line-height: 1.5; }
.who-game i { width: 14px; height: 14px; border-radius: 3px; flex: none; border: 2px solid var(--edge); }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.who-item { cursor: pointer; border: 2px solid #ffffff14; color: inherit; font: inherit; width: 100%; }
.who-item:hover { border-color: var(--gold); }

@media (max-width: 480px) {
  .big { font-size: 12px; padding: 13px 14px; }
  .hud { font-size: 13px; }
  .hud .player b { font-size: 15px; }
  .who-grid { grid-template-columns: 1fr 1fr; }
  .who-item canvas { width: 38px; height: 46px; }
  .cast { grid-template-columns: 1fr 1fr; }
}
/* The card art for the site: the title and a fan of the cast. */
body.cover .buttons, body.cover .options, body.cover .best, body.cover .blurb { display: none; }
body.cover #menu { overflow: hidden; gap: 4px; }
body.cover .fan { height: 38vh; width: 100vw; margin: 5vh 0 9vh; }
body.cover .tiny { font-size: 14px; }

/* Short screens (small phones): less around the board, more for the cards. */
@media (max-height: 700px) {
  #play { padding: 4px 6px; gap: 3px; }
  .hud { min-height: 34px; font-size: 12px; }
  .hud .stat b, .hud .player b { font-size: 13px; margin-top: 1px; }
  .hud .player { padding: 2px 6px; }
  .bar { min-height: 32px; }
  .bar .small { padding: 4px 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .card .inner, .zcard { transition: none; }
}
