/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

:root {
  --bg-top: #10251d;
  --bg-bottom: #08120d;
  --panel: rgba(11, 13, 27, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f6f2ff;
  --muted: #cbbff8;
  --accent: #9cefc0;
  --lava: #33cfff;
  --lava-glow: rgba(51, 207, 255, 0.35);
}

html {
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(156, 239, 192, 0.08), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

.game-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.game-shell {
  width: min(1100px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
}

.game-copy {
  display: grid;
  gap: 6px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  font-weight: 700;
}

.game-copy h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.game-root {
  display: grid;
}

/* Reserve the frame footprint before buildScene populates #game-root, so the
   page never reflows on load. The HUD now overlays the canvas, so the empty
   root reserves only the 16:9 canvas box sized from its own width. */
.game-root:empty::after {
  content: "";
  display: block;
  aspect-ratio: 960 / 540;
  border-radius: 18px;
  background: linear-gradient(180deg, #1b2950 0%, #0c1228 70%, #110e18 100%);
}

.game-frame {
  display: grid;
}

/* HUD overlays the top of the canvas. */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--text);
  pointer-events: none;
}

.hud-stats {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  transform: translateY(-260%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.hud.hud-enter .hud-stats {
  transform: translateY(0);
  opacity: 1;
}

.hud-pill {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(10, 12, 26, 0.55);
  backdrop-filter: blur(6px);
}

.hud-level-index {
  color: var(--muted);
  font-weight: 700;
}

.canvas-shell {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.game-canvas {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(180deg, #1b2950 0%, #0c1228 70%, #110e18 100%);
  image-rendering: auto;
}

.game-canvas:focus {
  outline: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background: linear-gradient(180deg, rgba(5, 8, 18, 0.1), rgba(5, 8, 18, 0.72));
  pointer-events: none;
}

.overlay.overlay-bare {
  background: none;
}

.overlay-card {
  max-width: 420px;
  margin: 0 16px;
  padding: 20px 22px;
  border-radius: 18px;
  background: rgba(10, 12, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.overlay-bare .overlay-card {
  display: none;
}

.overlay-card h2 {
  margin: 0;
  display: grid;
  gap: 4px;
}

.overlay-title-line {
  display: block;
}

.overlay-title-line:first-child:not(:last-child) {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.overlay-title-line:last-child {
  font-size: 1.6rem;
}

.overlay-body {
  margin: 10px 0 0;
  font-size: 1rem;
  color: var(--muted);
}

.overlay-body[hidden] {
  display: none;
}

.overlay-message {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  max-width: 420px;
  padding: 0 16px;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.game-instructions {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

.game-instructions span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  padding: 0.15em 0.4em;
  margin-inline: 0.15em;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 700;
}

.noscript-message {
  margin: 0 auto 24px;
  width: min(1100px, calc(100% - 48px));
  padding: 14px 18px;
  box-sizing: border-box;
  border-radius: 14px;
  background: rgba(255, 107, 61, 0.12);
  border: 1px solid rgba(255, 107, 61, 0.28);
}

@media only screen and (max-width: 720px) {
  .game-page {
    padding: 14px;
  }

  .game-shell {
    padding: 18px;
    border-radius: 20px;
  }

  .hud {
    align-items: flex-start;
  }
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

