/* The games page and the game view. Colors and font are the website's (src/index.css): the blue for the brand and
   the controls, the orange of its buttons (accent-700, white text at 5.2:1) for the main action of each screen. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

:root {
  --page: #f8fafc;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #475569;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --cta: #c2410c;
  --cta-hover: #9a3412;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
html.playing, html.playing body { overflow: hidden; overscroll-behavior: none; }
button, a { font: inherit; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* the games page */
.top, .hub, .foot { max-width: 960px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 4px; }
.brand { color: var(--primary-dark); font-size: 1.125rem; font-weight: 600; }
.lang { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.seg {
  min-width: 48px; min-height: 40px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.seg[aria-pressed='true'] { background: var(--primary); color: #fff; }
.hub { padding-top: 8px; padding-bottom: 16px; }
h1 { margin: 8px 0 4px; font-size: 1.75rem; line-height: 1.2; }
.intro { margin: 0 0 20px; color: var(--muted); }
.cards { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.card h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.card p { flex: 1; margin: 0; color: var(--muted); }
.card .cta { align-self: flex-start; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 8px; padding-bottom: 24px; font-size: 0.875rem; }
.foot a { color: var(--muted); }
.error { margin: 24px 0; font-weight: 600; }
.noscript { max-width: 960px; margin: 16px auto; padding: 0 16px; }

/* buttons */
.cta, .ghost {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
  font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
}
.cta { min-height: 48px; padding: 8px 20px; border: 0; background: var(--cta); color: #fff; font-size: 1.0625rem; }
.cta:hover { background: var(--cta-hover); }
.ghost { min-height: 44px; padding: 6px 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
.ghost:disabled { opacity: 0.45; cursor: default; }
.ghost:disabled:hover { border-color: var(--line); color: var(--ink); }

/* the game view */
.game {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--page);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px;
  padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.stats { display: flex; gap: 18px; }
.stat { display: flex; flex-direction: column; margin: 0; line-height: 1.15; }
.label { color: var(--muted); font-size: 0.75rem; }
.num { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; }
.stage { position: relative; flex: 1; min-height: 0; }
/* the game sits at the bottom of the space, so a desk or a floor meets the bottom of the screen */
.area {
  position: absolute; inset: 0; display: grid; place-items: end center; outline: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
canvas { display: block; border-radius: 6px; background: #fff; }
.countdown {
  position: absolute; inset: 0; display: none; place-items: center; pointer-events: none;
  color: var(--primary-dark); font-size: 6rem; font-weight: 600; text-shadow: 0 2px 0 #fff;
}
.countdown.show { display: grid; }
.overlay {
  position: absolute; inset: 0; display: none; place-items: center; padding: 16px; overflow-y: auto;
  background: rgb(248 250 252 / 0.82);
}
.overlay.show { display: grid; }
.panel {
  display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; padding: 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 10px 30px rgb(15 23 42 / 0.14);
}
.panel h2 { margin: 0; font-size: 1.5rem; line-height: 1.25; }
.panel h3 { margin: 0; font-size: 1.125rem; line-height: 1.3; }
.panel p { margin: 0; }
.keys { color: var(--muted); font-size: 0.9375rem; }
.final { display: flex; flex-direction: column; }
.big { font-size: 3rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.best { color: var(--primary-dark); font-weight: 600; }
.lead { font-size: 1.125rem; font-weight: 600; }
.offer { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--primary-soft); }
.note { padding: 10px 12px; border-left: 4px solid var(--primary); border-radius: 6px; background: var(--card); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
