/* YDAKF: the arcade screen is the largest 384 x 216 box that fits the window, centred, and the
   page does not scroll. Light and dark follow the app's theme
   (html.dark, set by ydakf-theme.js); their values are the app's own tokens from
   app/assets/tailwind/application.css, copied because this page does not load that stylesheet.
   The app's green monitor theme (html.green beside html.dark) paints everything a phosphor
   green. */
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}
:root {
  --bg: hsl(0 0% 100%);          /* --background */
  --screen: hsl(0 0% 100%);      /* --card */
  --ink: hsl(11 16% 20%);        /* --foreground */
  --dim: hsl(215 16% 47%);       /* --muted-foreground */
  --line: hsl(214 30% 91%);      /* --border */
  --gold: hsl(45 93% 47%);       /* --warning */
  --red: hsl(0 72% 51%);         /* --destructive */
  --warn-bg: 45 100% 93%;        /* --alert-warning-bg, the LCN ticker's surface */
  --warn-border: 45 80% 70%;     /* --alert-warning-border */
  --warn-text: 35 80% 30%;       /* --alert-warning-text */
  --primary: 201 96% 32%;        /* --primary */
  --primary-fg: 0 0% 100%;       /* --primary-foreground */
  --logo-backdrop: 0 0% 100%;    /* --logo-backdrop, the same in every theme */
  --scan: rgba(0, 0, 0, .05);
  --veil: rgba(255, 255, 255, .95);
  --font-pixel: "Press Start 2P", ui-monospace, "SF Mono", Menlo, monospace;
  --font-ui: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:root.dark {
  --bg: hsl(214 16% 14%);
  --screen: hsl(228 17% 7%);
  --ink: hsl(0 0% 100%);
  --dim: hsl(215 20.2% 65.1%);
  --line: hsl(222 17% 24%);
  --warn-bg: 45 100% 15%;
  --warn-border: 45 80% 40%;
  --warn-text: 45 90% 80%;
  --primary: 199 95% 48%;
  --primary-fg: 222 47% 11%;
  --scan: rgba(0, 0, 0, .28);
  --veil: rgba(3, 3, 3, .94);
  color-scheme: dark;
}
/* the green monitor theme: the shades of PALETTES.green in ydakf.js; --gold and --red keep
   their values */
:root.green {
  --bg: #010603;
  --screen: #020c05;
  --ink: #4dff7a;
  --dim: #2bbf55;
  --line: #0f4420;
  --primary: 135 100% 60%;
  --primary-fg: 140 70% 4%;
  --scan: rgba(0, 0, 0, .35);
  --veil: rgba(2, 12, 5, .95);
  color-scheme: dark;
}
html, body { height: 100%; }
html { box-sizing: border-box; overflow: hidden; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  -webkit-user-select: none;
  user-select: none;
  /* the border around the screen takes game touches too (ydakf.js, "touch") */
  touch-action: none;
  -webkit-touch-callout: none;
}
.back {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: max(8px, env(safe-area-inset-left, 0px));
  z-index: 3;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--screen);
}
.back:hover, .back:focus-visible { color: var(--ink); }
/* twice as tall on a phone (46 px against 23), for a thumb, from the same top left corner */
@media (pointer: coarse) {
  .back { padding-top: 17.5px; padding-bottom: 17.5px; }
}
/* :root's padding takes the top and bottom safe areas, so the height left is 100dvh minus them */
.cab {
  position: relative;
  container-type: inline-size;
  width: min(100%, calc((100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 384 / 216));
  width: min(100%, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 384 / 216));
}
canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 384 / 216;
  image-rendering: pixelated;
  background: var(--screen);
  touch-action: none;
  -webkit-touch-callout: none;
}
.cab::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, var(--scan) 2px 3px);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
kbd {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}
.rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.rotate svg { width: 64px; height: 64px; }
/* in the window's bottom right corner, as .back is in the top left */
.manual-btn {
  position: fixed;
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--dim);
  background: var(--screen);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 8px;
  cursor: pointer;
}
.manual-btn:hover { color: var(--ink); }
/* twice as tall on a phone, as .back */
@media (pointer: coarse) {
  .manual-btn { padding-top: 17.5px; padding-bottom: 17.5px; }
}/* under REGISTER TO VIEW SCORES, which the canvas draws from x 168, y 46..64 of 384 x 216 */
.register-btn {
  position: absolute;
  z-index: 2;
  left: 43.75%;
  top: 33%;
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--screen);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 8px 12px;
  text-decoration: none;
}
.register-btn:hover, .register-btn:focus-visible { background: var(--line); }
/* on the results screen, left of the ? MANUAL button; wraps on a narrow screen */
.videos-btn {
  position: absolute;
  z-index: 2;
  left: 10px;
  bottom: 10px;
  max-width: calc(50% - 64px);
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: .08em;
  text-align: left;
  color: var(--ink);
  background: var(--screen);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 6px 8px;
  text-decoration: none;
  cursor: pointer;
}
.videos-btn:hover, .videos-btn:focus-visible { background: var(--line); }
.videos-btn:disabled { cursor: default; color: var(--dim); border-color: var(--line); }
/* the start screen's speaker, in its bottom left corner; a 44 px target on a phone */
.sound-btn {
  position: absolute;
  z-index: 2;
  left: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--dim);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
.sound-btn[hidden], .sound-btn svg[hidden] { display: none; }
.sound-btn svg { width: 16px; height: 16px; }
.sound-btn:hover, .sound-btn:focus-visible { color: var(--ink); }
@media (pointer: coarse) {
  .sound-btn { width: 44px; height: 44px; left: 0; bottom: 0; }
}
/* over the YDAKF title the canvas draws at x 12..156, y 36..90 of 384 x 216 */
.title-link {
  position: absolute;
  z-index: 2;
  left: 3.1%;
  top: 16.7%;
  width: 37.5%;
  height: 25%;
  border-radius: 3px;
}
.title-link:focus-visible { outline: 1px solid var(--ink); }
/* the results screen's call to action: ydakf.js sets its box in % of the screen and paints
   its own canvas (drawCta) at CTA_SCALE times the game's resolution */
.cta-btn {
  position: absolute;
  z-index: 2;
  display: block;
  text-decoration: none;
  cursor: pointer;
}
.cta-btn canvas { width: 100%; height: 100%; }
/* the results screen's high scores, signed in: ydakf.js places and sizes it in % of the screen and
   paints it at BOARD_SCALE times the game's resolution */
.results-board {
  position: absolute;
  z-index: 1;
  aspect-ratio: auto;
  max-width: none;
  background: transparent;
  pointer-events: none;
}
/* The results screen's sponsor: the LCN ticker's message (LcnTickerComponent, lcn.css) with the
   same parts and the app's tokens, inside a pixel border the canvas draws around it at the
   game's resolution. ydakf.js places it in % of the screen; its height follows its content.
   Sizes are the ticker's in em of its 13 px title, and the title is 4.6 game pixels (100cqw / 384
   is one game pixel of .cab), so the box keeps its place on the screen at any size: 13 px on a
   1,081 px wide screen. */
.sponsor-box {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: calc(100cqw / 384 * 4.6);
  background: hsl(var(--warn-bg));
  border: 1px solid hsl(var(--warn-border));
  border-radius: 0.6em;
  overflow: hidden;
}
.sponsor-box[hidden] { display: none; }
/* the ticker's timing (lcn.css): slides in, its footer grows in 3 s later (ydakf.js removes
   .sponsor-footer-pending), and fades out when it goes */
@keyframes sponsor-enter {
  from { opacity: 0; transform: translateY(0.9em); }
  to   { opacity: 1; transform: translateY(0); }
}
.sponsor-box:not([hidden]) { animation: sponsor-enter 0.28s ease-out; }
.sponsor-box.sponsor-hiding { opacity: 0; transition: opacity 0.3s ease; }
.sponsor-footer { max-height: 3.1em; opacity: 1; transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease; }
.sponsor-footer.sponsor-footer-pending { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .sponsor-box:not([hidden]) { animation: none; }
  .sponsor-box.sponsor-hiding, .sponsor-footer { transition: none; }
}
.sponsor-content { display: flow-root; padding: 0.6em 0.92em; }
.sponsor-icon {
  float: left;
  margin: 0 0.6em 0 0;
  border-radius: 0.3em;
  width: 2.15em;
  height: 2.15em;
  box-sizing: border-box;
  padding: 0.15em;
  background: hsl(var(--logo-backdrop));
  object-fit: contain;
}
.sponsor-title {
  display: block;
  font-size: 1em;
  font-weight: 600;
  color: hsl(var(--warn-text));
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  overflow: hidden;
}
.sponsor-disclaimer { margin: 0; padding: 0 1em; font-size: 0.92em; color: hsl(var(--warn-text)); }
.sponsor-disclaimer[hidden] { display: none; }
.sponsor-footer { display: flex; align-items: center; gap: 0.6em; padding: 0.46em 0.6em 0.46em 0.92em; }
.sponsor-label {
  font-size: 0.92em;
  color: hsl(var(--warn-text));
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sponsor-label.sponsor-badge {
  flex: 0 1 auto;
  padding: 0.08em 0.5em;
  border-radius: 999px;
  font-weight: 600;
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}
.sponsor-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background: hsl(var(--primary));
  color: hsl(var(--primary-fg));
  font-family: inherit;
  font-size: 0.92em;
  font-weight: 700;
  height: 2.34em;
  padding: 0 1.17em;
  border: none;
  border-radius: 0.5em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
/* On a phone (ydakf.js, SPONSOR_X / SPONSOR_W) the text is 1.5 times the size above, the button is
   20 px tall, and the disclaimer sits in the footer between the label and the button. */
@media (pointer: coarse) {
  .sponsor-box { font-size: calc(100cqw / 384 * 4.6 * 1.5); }
  .sponsor-content { padding: 0.4em 0.92em; }
  .sponsor-icon { width: 1.8em; height: 1.8em; }
  .sponsor-footer { padding-top: 0.25em; padding-bottom: 0.4em; }
  .sponsor-footer { max-height: calc(20px + 1em); }
  .sponsor-footer .sponsor-label { flex: 0 1 auto; }
  .sponsor-footer .sponsor-disclaimer {
    flex: 1;
    min-width: 0;
    padding: 0;
    line-height: 1.25;
    max-height: calc(1.25em * 2);
    overflow: hidden;
  }
  .sponsor-cta { height: 20px; }
}
.sponsor-cta:hover { opacity: 0.9; }
.sponsor-cta[hidden] { display: none; }
.sponsor-cta:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; }
.cta-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.replay {
  position: absolute;
  left: 25%;
  top: 25%;
  width: 50%;
  height: 50%;
  z-index: 3;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--screen);
  box-shadow: 0 0 0 4px var(--bg);
}
.replay canvas { display: block; width: 100%; height: 100%; border-radius: 4px; }
.manual {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow-y: auto;
  background: var(--veil);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(24px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
}
.manual-inner { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.manual header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.manual h2 { font-family: var(--font-pixel); font-size: 16px; line-height: 1.4; margin: 0; text-wrap: balance; }
.manual h3 { font-family: var(--font-pixel); font-size: 11px; line-height: 1.5; margin: 0; }
.manual .lede { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.6; max-width: 62ch; }
.manual .why { display: flex; flex-direction: column; gap: 8px; }
.manual .why p { margin: 0; font-size: 13px; line-height: 1.6; max-width: 62ch; }
.manual .close {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink);
  background: var(--screen);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  cursor: pointer;
}
.trick {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 14px 20px;
  align-items: start;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.trick .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.trick .pts { font-family: var(--font-pixel); font-size: 10px; color: var(--dim); white-space: nowrap; }
.strip {
  width: 100%;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--screen);
}
.trick dl { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; line-height: 1.55; }
.trick dt { color: var(--dim); text-transform: uppercase; letter-spacing: .1em; font-size: 10px; padding-top: 3px; }
.trick dd { margin: 0; min-width: 0; }
@media (max-width: 560px) { .trick { grid-template-columns: minmax(0, 1fr); } }
@media (pointer: coarse) and (orientation: portrait) {
  .rotate { display: flex; }
}
