:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111417;
}

* {
  box-sizing: border-box;
  -webkit-touch-callout: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.08), transparent 28rem),
    linear-gradient(135deg, #111417, #1f2921 48%, #15181b);
}

.game-shell {
  position: relative;
  flex: none;
  /* Keep the iPad-shaped frame even before the game's resize handler runs. */
  width: min(100%, calc(100vh * 4 / 3));
  width: min(100%, calc(100dvh * 4 / 3));
  height: auto;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-touch-callout: none;
  background: transparent;
  cursor: url("assets/gold-gauntlet-cursor-v2.svg") 24 3, auto;
}

.game-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: auto;
}

.board-layer { z-index: 0; }
.interface-layer { z-index: 2; }

.intro-cutscene {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: #000000;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}

.intro-cutscene.is-visible {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

#introCutscene:not(.is-visible) {
  /* The black overlay covers the handoff; do not crossfade the old video over gameplay. */
  transition: none;
}

.cutscene-fade {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

#introCutscene,
#endingCutscene {
  /* Show the whole 4:3 source frame without cropping either cinematic. */
  object-fit: contain;
  object-position: center;
}

.save-name-input {
  position: absolute;
  z-index: 4;
  display: none;
  height: 48px;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.48);
  border-radius: 6px;
  outline: none;
  background: #161d21;
  color: #ffffff;
  font: 700 18px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.save-name-input:focus {
  border-color: #f3c84b;
  box-shadow: 0 0 0 3px rgba(243, 200, 75, 0.18), 0 8px 24px rgba(0, 0, 0, 0.34);
}

.save-name-input.is-visible {
  display: block;
}

/* Use the supplied transparent gauntlet on every game screen and control. */
* { cursor: url("assets/gold-gauntlet-cursor-v2.svg") 24 3, auto !important; }
