/* Website build only: fonts served from the site itself (no requests to Google),
   and the small reset the Claude Artifact viewer otherwise supplies. */
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/vt323-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/vt323-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/vt323-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Righteous";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/righteous-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Righteous";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/righteous-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
/* Keep content clear of a phone's notch and home bar, as the Artifact viewer does. */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  /* Layout: one screen, a phosphor-green CRT playfield centred like an arcade cabinet, control strip beneath.
     Deliberately single-theme: the 1972 cabinet look is dark by design. */
  :root {
    --bg: #070908;
    --field: #0b100d;
    --phosphor: #e6f7ea;
    --dim: #7f9486;
    --line: #253029;
    --accent: #9cffc0;
    /* Brick Wall: coloured brick bands and the blue paddle strip. */
    --brick-yellow: #f2e15a;
    --brick-green: #5fdc84;
    --brick-orange: #ff9d3d;
    --brick-red: #ff5f52;
    --paddle-blue: #62b4ff;
    /* Calendar easter eggs: the Halloween ghost and Christmas snow. */
    --ghost: #e9eeff;
    --snow: #f4f8ff;
    /* The coins that overflow the coin box. */
    --coin: #e9b93a;
    --coin-dark: #9c6b12;
    --coin-light: #ffe28a;
    /* Maze Muncher: the maze, its pellets, the muncher and the four drones. */
    --muncher: #b6ff4a;
    --maze: #3a56ff;
    --pellet: #e6fff0;
    --drone-iris: #a874ff;
    --drone-jade: #33d6a0;
    --drone-sol: #ffd84a;
    --drone-zinc: #cfd8e3;
    --drone-off: #5d6470; /* a drone powered down by a power pellet */
    /* The arcade's birthday: the 1972 cabinet. */
    --room: #2e2016;
    --wood: #6b4528;
    --wood-dark: #3f2715;
    --marquee: #f6b543;
    --marquee-light: #ffd477;
    --marquee-deep: #d98a22;
    --marquee-ink: #2b1a0c;
    --bezel: #0b0a08;
    --panel: #1c1712;
    --knob-hi: #fffaf0;
    --knob: #d9cfb8;
    --knob-lo: #8f846d;
    --font-marquee: "Righteous", "Arial Rounded MT Bold", system-ui, sans-serif;
    --font-display: "VT323", Consolas, system-ui, sans-serif;
    color-scheme: dark;
  }
  html { height: 100%; }
  body {
    min-height: 100%;
    background: var(--bg);
    color: var(--phosphor);
    font-family: var(--font-display);
    box-sizing: border-box;
    display: grid;
    place-items: center;
    padding-block: 16px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .cabinet {
    width: min(100%, 960px, max(480px, calc((100vh - 270px) * 1.6)));
    width: min(100%, 960px, max(480px, calc((100dvh - 270px) * 1.6)));
    display: grid;
    gap: 16px;
  }
  .screen {
    position: relative;
    aspect-ratio: 16 / 10;
    max-width: 100%;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(156, 255, 192, 0.06), inset 0 0 80px rgba(0, 0, 0, 0.6);
  }
  .screen::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.18) 2px 3px);
  }
  canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: none;
    outline: none;
  }
  canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
  .bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    font-size: 20px;
    line-height: 1.1;
  }
  .seg { display: flex; }
  .seg button + button { border-inline-start: none; }
  .bar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  [hidden] { display: none !important; }
  select {
    font: inherit;
    max-width: 100%;
    color: var(--phosphor);
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 4px 8px;
    cursor: pointer;
  }
  select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  button {
    font: inherit;
    color: var(--dim);
    background: transparent;
    border: 1px solid var(--line);
    padding: 4px 12px;
    cursor: pointer;
    letter-spacing: 0.04em;
  }
  button:hover { color: var(--phosphor); }
  button[aria-pressed="true"].mode { background: var(--phosphor); color: var(--bg); border-color: var(--phosphor); }
  /* Settings panel: an operator-menu box under the screen, one column per option. */
  .options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 28px;
    padding: 16px 20px 20px;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 20px;
    line-height: 1.1;
  }
  .options-title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    font: inherit;
    font-size: 18px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
  }
  .options-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  /* align-content: start keeps a short column from stretching its rows to match a taller neighbour. */
  .opt { display: grid; align-content: start; gap: 10px; min-width: 0; }
  .opt-head { display: grid; gap: 2px; }
  .opt-label { color: var(--phosphor); text-transform: uppercase; letter-spacing: 0.08em; }
  .opt-note { color: var(--dim); font-size: 18px; }
  /* Equal-width buttons that never shrink below their label: short of room they wrap, never overflow. */
  .choices { display: flex; flex-wrap: wrap; gap: 8px; }
  .choice {
    position: relative;
    flex: 1 1 0;
    min-width: max-content;
    padding: 8px 12px;
    text-align: center;
    white-space: nowrap;
  }
  button[aria-pressed="true"].choice {
    color: var(--phosphor);
    border-color: var(--phosphor);
    background: rgba(156, 255, 192, 0.1);
  }
  button[aria-pressed="true"].choice::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 5px;
    height: 5px;
    background: currentColor;
    box-shadow: 0 0 6px var(--accent);
  }
  /* Two players have no computer opponent, so the panel drops to two columns. */
  .options.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  @media (max-width: 720px) {
    .options, .options.duo { grid-template-columns: minmax(0, 1fr); }
  }
  button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .hint { margin: 0; color: var(--dim); min-width: 0; flex: 1 1 260px; text-align: center; }
  kbd {
    font: inherit;
    color: var(--phosphor);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    padding: 0 5px;
  }
  /* The ball that escapes the screen, and what it does to the page. */
  .escapee {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    pointer-events: none;
    background: var(--phosphor);
    box-shadow: 0 0 12px var(--accent);
  }
  .escapee.pumpkin { background: var(--brick-orange); border-radius: 45%; box-shadow: 0 0 12px var(--brick-orange); }
  .escapee.snowball { background: var(--snow); border-radius: 50%; box-shadow: 0 0 12px var(--snow); }
  .screen.shake { animation: shake 0.35s ease-out; }
  @keyframes shake {
    20% { translate: 0 7px; }
    40% { translate: -5px -2px; }
    60% { translate: 3px 3px; }
    80% { translate: -2px 0; }
  }
  button.bonk { animation: bonk 0.4s ease-out; }
  @keyframes bonk {
    0% { transform: scale(0.88); box-shadow: 0 0 0 2px var(--accent), 0 0 20px var(--accent); }
    100% { transform: none; box-shadow: none; }
  }
  /* The arcade's birthday: the page becomes a 1972 cabinet. A warm black-and-white TV in a black bezel,
     wood-grain cabinet, backlit marquee, the instruction plate and the two paddle knobs. */
  :root:not(.retro) .retro-only { display: none !important; }
  :root.retro {
    --bg: #1a120c;
    --field: #12100d;
    --phosphor: #f4efe1;
    --dim: #a89c84;
    --line: #4b3a29;
    --accent: #ffbf5e;
  }
  .retro body { background: radial-gradient(ellipse at 50% 25%, var(--room) 0%, var(--bg) 70%); }
  .retro .cabinet {
    width: min(100%, 980px, max(520px, calc((100vh - 430px) * 1.6 + 80px)));
    width: min(100%, 980px, max(520px, calc((100dvh - 430px) * 1.6 + 80px)));
    box-sizing: border-box;
    padding: 0 24px 22px;
    border-radius: 14px 14px 8px 8px;
    background:
      repeating-linear-gradient(91deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 11px),
      repeating-linear-gradient(89deg, rgba(255, 220, 170, 0.05) 0 1px, transparent 1px 23px),
      linear-gradient(180deg, var(--wood), var(--wood-dark));
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  }
  .marquee {
    margin: 0 -24px;
    padding: 14px 24px 12px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(180deg, var(--marquee-light), var(--marquee) 55%, var(--marquee-deep));
    color: var(--marquee-ink);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 0 40px rgba(246, 181, 67, 0.25);
  }
  .marquee-title {
    margin: 0;
    font-family: var(--font-marquee);
    font-weight: 400;
    font-size: clamp(34px, 6vw, 56px);
    line-height: 1;
    letter-spacing: 0.06em;
  }
  .marquee-sub { font-size: 22px; letter-spacing: 0.1em; text-transform: uppercase; }
  .retro .screen {
    box-sizing: content-box; /* the 16:10 ratio stays on the picture, not the bezel */
    border: 16px solid var(--bezel);
    border-radius: 26px;
    box-shadow: 0 0 0 3px var(--wood-dark);
  }
  .retro .screen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  }
  .bezel-note {
    margin: -6px 0 0;
    padding: 6px 12px;
    background: var(--bezel);
    border-radius: 6px;
    color: var(--marquee);
    font-size: 20px;
    letter-spacing: 0.18em;
    text-align: center;
  }
  .controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18%;
    background: linear-gradient(180deg, var(--bezel), var(--panel));
    border-radius: 8px;
  }
  .knob {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--knob-hi), var(--knob) 60%, var(--knob-lo));
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  }
  .knob::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 5px;
    width: 3px;
    height: 14px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--marquee-ink);
  }
  .coin {
    padding: 6px 10px;
    border: 2px solid var(--line);
    border-radius: 4px;
    color: var(--marquee);
    font-size: 22px;
    letter-spacing: 0.1em;
  }

  /* Text for screen readers only. */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* The menu of hidden games, opened by holding the start screen. */
  .secrets {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(7, 9, 8, 0.86);
  }
  .secret {
    min-width: min(80%, 320px);
    padding: 10px 16px;
    font-size: clamp(20px, 4vw, 30px);
    color: var(--phosphor);
    border-color: var(--dim);
    letter-spacing: 0.12em;
  }
  .secret:hover, .secret:focus-visible { background: var(--phosphor); color: var(--bg); }
  .secrets-close {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    min-width: 44px;
    min-height: 44px;
    font-size: 26px;
  }

  @media (prefers-reduced-motion: reduce) {
    .screen.shake { animation: none; }
    button.bonk { animation-duration: 0.01s; }
  }

.catalogue-link {
  justify-self: start;
  color: var(--dim);
  font-size: 20px;
  text-decoration: none;
}
.catalogue-link:hover, .catalogue-link:focus-visible { color: var(--phosphor); text-decoration: underline; }
.back-arrow { display: inline-block; }
[dir="rtl"] .back-arrow { transform: scaleX(-1); }
