@font-face {
  font-family: 'Silkscreen';
  src: url('/_vercel/immutable/e6c72ea4702249202bcdd79d3343057e4e25ef1f04e3fcffd8602ab53b40b4cc/silkscreen-400.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Silkscreen';
  src: url('/_vercel/immutable/5741b7f01a127f40ed70281fa2f686e8fc2cfe241930a120e4d1a1cebe78f995/silkscreen-700.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* A cold summit with one hot element: FireRed crimson marks the actions that start play. */
:root {
  --snow: #edf3ea;
  --ice: #c0d0c1;
  --slate: #20342d;
  --dusk: #5c7468;
  --bezel: #16231f;
  --night: #173b35;
  --crimson: #d3202b;
  --crimson-deep: #a3151e;
  --on-dark: #f7f2da;

  --page: var(--snow);
  --text: var(--slate);
  --muted: var(--dusk);
  --line: var(--ice);

  --font-pixel: 'Silkscreen', 'Courier New', monospace;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

  --column: 736px; /* the 720px (3x) screen plus its bezel */
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0f1915;
    --text: #dce8dd;
    --muted: #91a89a;
    --line: #2b3c34;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.68), transparent 42%),
    repeating-linear-gradient(0deg, rgba(32, 52, 45, 0.025) 0 1px, transparent 1px 4px),
    var(--page);
  color: var(--text);
  font: 16px/1.55 var(--font-body);
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 50% -12%, rgba(75, 119, 96, 0.17), transparent 44%),
      repeating-linear-gradient(0deg, rgba(220, 232, 221, 0.025) 0 1px, transparent 1px 4px),
      var(--page);
  }
}

a { color: inherit; text-underline-offset: 3px; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--crimson);
  outline-offset: 3px;
}

.app {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 40px var(--gutter) 48px;
}

/* Masthead ----------------------------------------------------------------- */

.masthead {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
}

.title {
  margin: 0;
  color: var(--text);
  font: 700 58px/1 var(--font-pixel);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 rgba(211, 32, 43, 0.16);
}

/* Screen ------------------------------------------------------------------- */

.bezel {
  padding: 8px;
  background: var(--bezel);
  border-radius: 14px;
}

.screen {
  position: relative;
  aspect-ratio: 3 / 2;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
  container-type: size; /* the title card scales with the screen (cqh units) */
}

/* Nostalgist sets inline sizes on the canvas; the screen box decides the real size. */
.game-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  image-rendering: pixelated;
}

.card {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  color: var(--on-dark);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #2f5d51 0%, var(--night) 55%, #102a26 100%);
}

.app[data-state="title"] .card-title,
.app[data-state="reveal"] .card-reveal,
.app[data-state="loading"] .card-loading,
.app[data-state="error"] .card-error { display: flex; }

.card-heading {
  position: relative;
  margin: 0;
  font: 700 25px/1.2 var(--font-pixel);
}

.card-note {
  position: relative;
  max-width: 34ch;
  margin: 0;
  font-size: 15px;
  color: #c4d8ca;
}

/* Title card: RED, the player's stats, then Play (or today's result). */
.card-title { gap: 3cqh; padding: 3cqh; }

.red-sprite {
  position: relative;
  height: 32cqh;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 1cqh 0 rgba(0, 0, 0, 0.35));
}

.stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 5cqw;
  margin: 0;
}

.stats div {
  display: flex;
  flex-direction: column-reverse; /* number above its label */
  align-items: center;
}

.stats dd {
  margin: 0;
  font: 700 max(20px, 8.8cqh)/1 var(--font-pixel);
  font-variant-numeric: tabular-nums;
}

.stats dt {
  margin-top: 1cqh;
  font: 400 max(10px, 3.2cqh)/1.1 var(--font-pixel);
  color: #c4d8ca;
  white-space: nowrap;
}

.card-title .button-play {
  padding: max(10px, 2.6cqh) max(28px, 9cqh);
  font-size: max(18px, 6cqh);
}

.wordle-question { position: relative; display: grid; justify-items: center; gap: 2cqh; }
.wordle-question h2 { margin: 0; font: 700 max(14px, 4.2cqh)/1.2 var(--font-pixel); }
.answer-actions { display: flex; justify-content: center; gap: 12px; }
.answer-actions .button { padding: 7px 22px; border-color: #8db5a3; font-size: max(12px, 3.5cqh); }

.card-reveal { gap: 1.5cqh; padding: 3cqh; }
.reveal-eyebrow, .reveal-caption { margin: 0; color: #c4d8ca; font: 400 max(10px, 2.8cqh)/1.2 var(--font-pixel); }
.reveal-word {
  margin: 0;
  color: var(--on-dark);
  font: 700 max(22px, 7.4cqh)/1 var(--font-pixel);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.reveal-team {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1cqh 2cqw;
  width: min(100%, 540px);
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.reveal-team li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  padding: 0.8cqh 1.5cqw;
  border: 1px solid #6f988b;
  border-radius: 3px;
  background: #12312e;
  font: 400 max(9px, 3.1cqh)/1.15 var(--font-pixel);
}
.reveal-team li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal-team .team-role { flex: none; color: #ffd36d; font-size: 0.8em; }
.card-reveal .button-play { padding: max(7px, 2cqh) 36px; font-size: max(16px, 5cqh); }

.played {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.2cqh;
}

.played p { margin: 0; }

.played-result { font: 700 max(14px, 5.2cqh)/1.25 var(--font-pixel); }

.played-next {
  font: 400 max(10px, 3.4cqh)/1.3 var(--font-pixel);
  color: #c4d8ca;
  font-variant-numeric: tabular-nums;
}

/* Snow on the title card: the page's one piece of ambient motion. */
.snow {
  position: absolute;
  inset: -160px 0 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 110px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 150px 60px, #dfe9f1 50%, transparent 51%),
    radial-gradient(2px 2px at 60px 150px, #fff 50%, transparent 51%);
  background-size: 160px 160px;
  opacity: 0.55;
  animation: snowfall 9s linear infinite;
}

@keyframes snowfall {
  from { transform: translate(0, 0); }
  to { transform: translate(-40px, 160px); }
}

@media (prefers-reduced-motion: reduce) {
  .snow { animation: none; }
}

.meter {
  width: min(320px, 70%);
  height: 10px;
  padding: 2px;
  border: 2px solid #8fa3b5;
  border-radius: 3px;
}

.meter-fill {
  width: 0;
  height: 100%;
  background: var(--crimson);
  transition: width 0.2s linear;
}

/* Buttons ------------------------------------------------------------------ */

.button {
  font: 700 16px/1 var(--font-pixel);
  padding: 12px 18px;
  border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
  color: inherit;
  background: none;
}

.button:disabled { cursor: default; opacity: 0.45; }

.button-play {
  position: relative;
  padding: 15px 40px;
  font-size: 24px;
  color: #fff;
  background: var(--crimson);
  border-color: var(--crimson-deep);
  border-radius: 4px;
  box-shadow: 0 4px 0 var(--crimson-deep);
  text-shadow: 2px 2px 0 rgba(100, 10, 16, 0.35);
}

.button-play:hover { background: #e2303a; }
.button-play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--crimson-deep); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.button-run {
  color: #fff;
  background: var(--crimson);
  border-color: var(--crimson-deep);
}

.button-run:not(:disabled):hover { background: #e2303a; }

.button-quiet {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 0 var(--line);
}

.button-quiet:not(:disabled):hover { border-color: var(--muted); }

@media (prefers-color-scheme: dark) {
  .button-quiet { background: rgba(255, 255, 255, 0.035); }
}

/* Touch controls (phones and tablets only) ---------------------------------- */

.pad {
  display: none;
  grid-template-columns: 1fr auto;
  grid-template-areas: "dpad face" "meta meta";
  align-items: center;
  gap: 18px 12px;
  margin-top: 18px;
  padding: 18px 12px 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (pointer: coarse) {
  .pad { display: grid; }
}

.dpad {
  grid-area: dpad;
  position: relative;
  width: 144px;
  height: 144px;
  touch-action: none;
}

.dpad-arm {
  position: absolute;
  width: 48px;
  height: 48px;
  background: var(--bezel);
}

.dpad-up { left: 48px; top: 0; border-radius: 8px 8px 0 0; }
.dpad-down { left: 48px; bottom: 0; border-radius: 0 0 8px 8px; }
.dpad-left { left: 0; top: 48px; border-radius: 8px 0 0 8px; }
.dpad-right { right: 0; top: 48px; border-radius: 0 8px 8px 0; }
.dpad-center { left: 48px; top: 48px; }

.dpad[data-dir="up"] .dpad-up,
.dpad[data-dir="down"] .dpad-down,
.dpad[data-dir="left"] .dpad-left,
.dpad[data-dir="right"] .dpad-right { background: var(--crimson); }

.face {
  grid-area: face;
  display: flex;
  gap: 16px;
  padding-right: 4px;
}

.pad-button {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  font: 700 20px/1 var(--font-pixel);
  color: var(--on-dark);
  background: var(--bezel);
  touch-action: none;
}

.pad-a { transform: translateY(-22px); }

.pad-button.is-down,
.pad-pill.is-down { background: var(--crimson); }

.meta {
  grid-area: meta;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.pad-pill {
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  font: 400 12px/1 var(--font-pixel);
  color: var(--on-dark);
  background: var(--dusk);
  touch-action: none;
}

/* Full screen: the console fills the display, screen as large as fits. */
.console:fullscreen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  background: var(--bezel);
  color: var(--on-dark);
}

.console:fullscreen .bezel {
  width: min(100%, calc((100vh - 120px) * 1.5));
  margin: 0 auto;
  padding: 0;
}

.console:fullscreen .toolbar { justify-content: center; }
.console:fullscreen .button-quiet { border-color: #3a4c5e; }

@media (pointer: coarse) {
  .console:fullscreen .bezel { width: min(100%, calc((100vh - 360px) * 1.5)); }
}

/* RED's team: a little FireRed party screen below the controls guide. ---------- */

.red-team { margin-top: 28px; }

.team-window {
  overflow: hidden;
  border: 3px solid #17362f;
  border-radius: 8px;
  background: #dbe7d8;
  box-shadow: 0 4px 0 #17362f, 0 12px 24px rgba(32, 52, 45, 0.12);
}

.team-window-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 3px solid #17362f;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px),
    #1d4a41;
  color: var(--on-dark);
}

.team-window-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 0 2px var(--on-dark);
}

.team-window-title {
  margin: 0;
  font: 700 18px/1 var(--font-pixel);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.team-window-meta {
  margin-left: auto;
  color: #b8d6c4;
  font: 400 9px/1.2 var(--font-pixel);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.team-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  list-style: none;
  background:
    repeating-linear-gradient(135deg, rgba(23, 54, 47, 0.045) 0 2px, transparent 2px 7px),
    #dbe7d8;
}

.team-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 76px;
  padding: 10px 12px 10px 5px;
  border: 2px solid #5b8f8b;
  border-radius: 5px;
  background: linear-gradient(180deg, #306b7f 0%, #24576c 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
  color: #fff;
}

.team-row-lead {
  border-color: #a63c2a;
  background: linear-gradient(180deg, #a3482d 0%, #8e3825 100%);
}

.team-sprite {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 2px solid #17362f;
  border-radius: 3px;
  background: #f6f0d9;
  box-shadow: inset 0 0 0 2px #fff;
}

.team-sprite img {
  display: block;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.team-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.team-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.team-name {
  overflow: hidden;
  font: 700 17px/1.1 var(--font-pixel);
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-level {
  margin-left: auto;
  flex: none;
  color: #d4eee0;
  font: 400 11px/1 var(--font-pixel);
}

.team-row-lead .team-level { color: #ffe2c8; }

.team-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font: 400 10px/1.2 var(--font-pixel);
}

.type {
  padding: 2px 5px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.28);
}

.type-electric { background: #e8bb2e; color: #3b2c00; text-shadow: none; }
.type-psychic { background: #ad3f74; }
.type-normal { background: #b0b19f; color: #2b2b22; text-shadow: none; }
.type-grass { background: #6fb95e; color: #173d17; text-shadow: none; }
.type-poison { background: #87519a; }
.type-fire { background: #ba4326; }
.type-flying { background: #9cb0df; color: #1b2b50; text-shadow: none; }
.type-water { background: #376fbf; }

.team-item {
  overflow: hidden;
  color: #ffe3a3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-ability {
  margin-top: 3px;
  font: 400 10px/1.4 var(--font-pixel);
}

.team-label {
  margin-right: 5px;
  color: #d4eee0;
}

.team-row-lead .team-label { color: #ffe2c8; }

.team-moves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 5px 0 0;
  padding: 7px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  list-style: none;
  font: 400 11px/1.4 var(--font-pixel);
}

.team-note {
  margin: 0;
  padding: 9px 14px;
  border-top: 3px solid #17362f;
  background: #f6f0d9;
  color: #203f36;
  font: 400 11px/1.4 var(--font-pixel);
}

@media (max-width: 640px) {
  .red-team { margin-top: 22px; }
  .team-window { border-radius: 6px; }
  .team-window-bar { padding: 8px 10px; }
  .team-window-title { font-size: 15px; }
  .team-window-meta { display: none; }
  .team-list { gap: 6px; padding: 8px; }
  .team-row { grid-template-columns: 58px minmax(0, 1fr); gap: 9px; min-height: 68px; padding: 8px 9px 8px 4px; }
  .team-sprite, .team-sprite img { width: 54px; height: 54px; }
  .team-name { font-size: 13px; }
  .team-level { font-size: 9px; }
  .team-details { gap: 4px; font-size: 8px; }
  .team-ability { font-size: 9px; }
  .team-moves { gap: 4px 8px; font-size: 10px; }
  .team-note { padding: 8px 10px; font-size: 9px; }
}

/* Guide -------------------------------------------------------------------- */

.guide {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 2px solid var(--line);
}

.guide-heading {
  margin: 0 0 12px;
  font: 700 18px/1.2 var(--font-pixel);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.keys { margin: 0; max-width: 34em; }

.keys div {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
}

.keys dt { display: flex; flex-wrap: wrap; gap: 4px; }
.keys dd { margin: 0; }

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 2px 6px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 3px;
  font: 400 12px/1.3 var(--font-pixel);
  text-align: center;
}

.guide-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* Footer: the fan-project disclaimer and the licenses link. */

.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.footer p { margin: 0 0 8px; max-width: 64ch; }
.footer p:last-child { margin-bottom: 0; }

/* Small screens ------------------------------------------------------------ */

@media (max-width: 640px) {
  .app { padding-top: 24px; }
  .title { font-size: 44px; }
  .bezel { padding: 5px; border-radius: 10px; }
  .card-loading, .card-error { gap: 12px; padding: 16px; }
  .card-heading { font-size: 20px; }
  .card-note { font-size: 13px; }
  .card-error .button-play { padding: 12px 32px; font-size: 22px; }
  .toolbar .button { padding: 10px 14px; font-size: 16px; }
}

@media (max-width: 360px) {
  .title { font-size: 36px; }
  .stats { width: 100%; gap: 0 1cqw; }
  .stats dt { font-size: 8px; }
}
