/* =========================================================================
   GOD HATES COMETS — STYLES
   Aesthetic: Illuminated manuscript meets cosmic horror.
   Palette: deep cosmos, stained-glass cobalt, sacred gold, wrath red.
   ========================================================================= */

:root {
  --cosmos: #07071a;
  --cosmos-2: #0f0a2c;
  --void: #02020b;
  --cobalt: #1a3a8a;
  --cobalt-deep: #0b1f5a;
  --gold: #d4a017;
  --gold-bright: #f5cb4a;
  --gold-dim: #8a6a10;
  --ivory: #fff4d6;
  --ivory-dim: #c7b88a;
  --wrath: #c41e3a;
  --wrath-deep: #6e0e1f;
  --plague: #4a7c2f;
  --parchment: #f4e5be;
  --ink: #2b1a08;

  --font-display: "UnifrakturMaguntia", "Times New Roman", serif;
  --font-roman: "Cinzel", "Trajan Pro", serif;
  --font-body: "Cormorant Garamond", "EB Garamond", Georgia, serif;

  --vh: 100vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  cursor: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  /* Deep cosmic gradient with a hint of cathedral glow */
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212, 160, 23, 0.18), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(26, 58, 138, 0.4), transparent 60%),
    radial-gradient(1400px 900px at 50% 50%, rgba(15, 10, 44, 0.6), var(--void) 80%),
    var(--cosmos);
}

/* Subtle film-grain overlay for that medieval texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1   0 0 0 0 1   0 0 0 0 1   0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
}

/* =========================================================================
   CANVAS — the firmament upon which battle is waged
   ========================================================================= */
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* =========================================================================
   MANDALA — decorative stained-glass rose window behind the title
   ========================================================================= */
/* The rose window sits high in the firmament and behaves like a halo of stained
   glass rather than a target. Subtle is the rule; it must never compete with
   comets for the eye's attention. */
.mandala {
  position: fixed;
  top: -40%;
  left: 50%;
  width: min(85vmin, 820px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.08;
  background:
    conic-gradient(
      from 0deg,
      var(--cobalt) 0deg 30deg,
      var(--wrath-deep) 30deg 60deg,
      var(--gold-dim) 60deg 90deg,
      var(--cobalt-deep) 90deg 120deg,
      var(--wrath) 120deg 150deg,
      var(--gold) 150deg 180deg,
      var(--cobalt) 180deg 210deg,
      var(--wrath-deep) 210deg 240deg,
      var(--gold-dim) 240deg 270deg,
      var(--cobalt-deep) 270deg 300deg,
      var(--wrath) 300deg 330deg,
      var(--gold) 330deg 360deg
    );
  -webkit-mask:
    radial-gradient(circle at center, black 0 10%, transparent 10.5% 14%, black 14.5% 24%, transparent 24.5% 28%, black 28.5% 38%, transparent 38.5% 42%, black 42.5% 48%, transparent 48.5%);
          mask:
    radial-gradient(circle at center, black 0 10%, transparent 10.5% 14%, black 14.5% 24%, transparent 24.5% 28%, black 28.5% 38%, transparent 38.5% 42%, black 42.5% 48%, transparent 48.5%);
  filter: blur(1px) saturate(1.1);
  animation: mandala-spin 360s linear infinite;
}

/* On the title screen we let the rose window shine more visibly behind the
   blackletter title — but during play it must recede. */
.mandala.mandala--play {
  opacity: 0.04;
}

@keyframes mandala-spin {
  to { transform: translateX(-50%) rotate(360deg); }
}

/* =========================================================================
   CUSTOM CURSOR — the Eye of Providence
   ========================================================================= */
#cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  margin-top: -32px;
  pointer-events: none;
  z-index: 9999;
  filter: drop-shadow(0 0 8px rgba(245, 203, 74, 0.7)) drop-shadow(0 0 24px rgba(212, 160, 23, 0.35));
  transition: transform 0.08s ease-out;
  will-change: transform;
}

#cursor.cursor--smite {
  animation: cursor-smite 240ms ease-out;
}

@keyframes cursor-smite {
  0% { transform: scale(1); }
  40% { transform: scale(1.6); filter: drop-shadow(0 0 18px rgba(245, 203, 74, 1)) drop-shadow(0 0 60px rgba(196, 30, 58, 0.6)); }
  100% { transform: scale(1); }
}

/* Make sure native cursor is hidden everywhere, including buttons */
button,
a,
input {
  cursor: none;
}

/* =========================================================================
   HUD — corner scrolls of holy reckoning
   ========================================================================= */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  /* env() resolves to 0 on devices without notches/dynamic islands, so
     this is a no-op for desktop and a savior for iPhone X+ in portrait. */
  padding: max(clamp(12px, 2vw, 28px), env(safe-area-inset-top))
           max(clamp(12px, 2vw, 28px), env(safe-area-inset-right))
           clamp(12px, 2vw, 28px)
           max(clamp(12px, 2vw, 28px), env(safe-area-inset-left));
  gap: clamp(12px, 2vw, 28px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}

.hud--visible {
  opacity: 1;
}

.hud-scroll {
  background:
    linear-gradient(180deg, rgba(244, 229, 190, 0.96), rgba(220, 200, 150, 0.92));
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  padding: 12px 18px;
  min-width: 220px;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.25),
    0 12px 32px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(212, 160, 23, 0.5),
    inset 0 0 24px rgba(212, 160, 23, 0.18);
  position: relative;
  font-feature-settings: "lnum", "ss01";
}

.hud-scroll::before,
.hud-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold-dim) 0 30%, var(--gold) 30% 60%, var(--ink) 60% 100%);
  border-radius: 50%;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.6);
}

.hud-scroll::before { left: -6px; }
.hud-scroll::after { right: -6px; }

.hud-scroll--left {
  justify-self: start;
  max-width: 320px;
}

.hud-scroll--right {
  justify-self: end;
  max-width: 360px;
}

.hud-eyebrow {
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.7;
  margin-bottom: 4px;
}

.hud-score {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 0.9;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.4);
}

.hud-combo {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink);
  margin-top: 4px;
  font-size: 14px;
}

.hud-mult {
  font-family: var(--font-roman);
  font-style: normal;
  font-weight: 800;
  color: var(--wrath-deep);
  letter-spacing: 0.05em;
}

.hud-mult.bumped {
  animation: mult-bump 320ms ease-out;
}

@keyframes mult-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); color: var(--wrath); }
  100% { transform: scale(1); }
}

.hud-bar {
  position: relative;
  height: 14px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.15) 0 2px,
      transparent 2px 8px
    ),
    rgba(43, 26, 8, 0.5);
  border: 1px solid var(--ink);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.hud-bar:last-child { margin-bottom: 0; }

.hud-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform-origin: left;
  transition: transform 0.25s ease;
}

.hud-bar--earth .hud-bar__fill {
  background:
    linear-gradient(90deg, #3aa84e, #6cc46a 40%, #f5cb4a 70%, #c41e3a 100%);
}

.hud-bar--wrath .hud-bar__fill {
  background:
    linear-gradient(90deg, var(--wrath-deep), var(--wrath) 50%, var(--gold) 90%, var(--gold-bright));
  box-shadow: 0 0 12px rgba(196, 30, 58, 0.5);
  transition: transform 0.15s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hud-bar--wrath.ready .hud-bar__fill {
  animation: wrath-pulse 1.2s ease-in-out infinite;
}

@keyframes wrath-pulse {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.4) saturate(1.4); }
}

.hud-bar__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-roman);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  z-index: 1;
}

/* Central HUD title (in-game) */
.hud-title {
  text-align: center;
  pointer-events: none;
  margin-top: 4px;
}

.hud-title__small {
  display: block;
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.hud-title__big {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  color: var(--ivory);
  text-shadow:
    0 0 18px rgba(212, 160, 23, 0.7),
    0 0 36px rgba(196, 30, 58, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.6);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Subtitle beneath the big numeral when a wave is afoot — Cinzel caps. */
.hud-title__name {
  display: block;
  font-family: var(--font-roman);
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 12px rgba(212, 160, 23, 0.4);
  min-height: 14px;
}

.hud-title__name:empty {
  display: none;
}

/* The numeral spawns dramatically when a wave begins. */
.hud-title.hud-title--bumped .hud-title__big {
  animation: hud-title-bump 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes hud-title-bump {
  0% { transform: scale(0.6); opacity: 0; filter: blur(8px); }
  60% { transform: scale(1.18); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

/* =========================================================================
   INTERMISSION BANNER — between waves, the firmament rests for 2.8s
   ========================================================================= */
.intermission {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: intermission-in 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

.intermission__inner {
  text-align: center;
  padding: clamp(20px, 4vw, 40px) clamp(36px, 6vw, 80px);
  border: 1px solid rgba(212, 160, 23, 0.55);
  background:
    radial-gradient(600px 300px at 50% 50%, rgba(212, 160, 23, 0.15), transparent 70%),
    linear-gradient(180deg, rgba(15, 10, 44, 0.78), rgba(7, 7, 26, 0.85));
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 60px rgba(212, 160, 23, 0.12),
    0 18px 60px rgba(0, 0, 0, 0.6);
  border-radius: 2px;
  display: grid;
  gap: 12px;
  position: relative;
}

.intermission__inner::before,
.intermission__inner::after {
  content: "✠";
  position: absolute;
  font-size: 22px;
  color: var(--gold);
  opacity: 0.7;
}

.intermission__inner::before { top: 6px; left: 10px; }
.intermission__inner::after { bottom: 6px; right: 10px; }

.intermission__top {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 64px);
  color: var(--ivory);
  line-height: 1;
  text-shadow:
    0 0 18px rgba(212, 160, 23, 0.65),
    0 0 36px rgba(196, 30, 58, 0.3),
    0 2px 0 rgba(0, 0, 0, 0.7);
}

.intermission__divider {
  font-family: var(--font-roman);
  color: var(--gold);
  opacity: 0.65;
  font-size: 18px;
}

.intermission__bottom {
  font-family: var(--font-roman);
  font-weight: 800;
  font-size: clamp(14px, 2vw, 22px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 14px rgba(212, 160, 23, 0.4);
}

@keyframes intermission-in {
  0% { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}

.intermission.intermission--out {
  animation: intermission-out 400ms ease-out forwards;
}

@keyframes intermission-out {
  to { opacity: 0; transform: scale(1.04); }
}

/* =========================================================================
   ACHIEVEMENT TOASTS — small parchment cards in the lower-left
   ========================================================================= */
.toasts {
  position: fixed;
  bottom: clamp(12px, 2vw, 24px);
  left: clamp(12px, 2vw, 24px);
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(360px, 80vw);
}

.toast {
  position: relative;
  background:
    linear-gradient(180deg, rgba(244, 229, 190, 0.97), rgba(220, 200, 150, 0.95));
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  padding: 10px 14px 10px 50px;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.25),
    0 14px 32px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(212, 160, 23, 0.55),
    inset 0 0 18px rgba(212, 160, 23, 0.18);
  display: grid;
  gap: 2px;
  animation: toast-in 480ms cubic-bezier(0.2, 0.7, 0.2, 1);
  transform-origin: bottom left;
}

.toast::before {
  /* Gold flourish on the left */
  content: "✠";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  color: var(--gold-dim);
  text-shadow: 0 0 10px rgba(212, 160, 23, 0.6);
}

.toast__head {
  font-family: var(--font-roman);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--wrath-deep);
  opacity: 0.85;
}

.toast__title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}

.toast__desc {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: rgba(43, 26, 8, 0.78);
  line-height: 1.3;
}

.toast.toast--out {
  animation: toast-out 420ms ease-in forwards;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateY(20px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(-30px) scale(0.94); }
}

/* =========================================================================
   RUN ACHIEVEMENTS — listed on the game-over screen (this run only)
   ========================================================================= */
.run-achievements {
  margin: 8px auto 24px;
  max-width: 540px;
  padding: 16px 20px;
  background: rgba(2, 2, 11, 0.55);
  border: 1px solid rgba(212, 160, 23, 0.3);
  border-radius: 2px;
  text-align: left;
}

.run-achievements__head {
  font-family: var(--font-roman);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-align: center;
  margin: 0 0 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.run-achievements__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.run-achievements__list li {
  position: relative;
  padding: 4px 0 4px 22px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ivory);
}

.run-achievements__list li::before {
  content: "✠";
  position: absolute;
  left: 0;
  top: 4px;
  color: var(--gold);
  font-size: 14px;
}

.run-achievements__list li b {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--gold-bright);
  margin-right: 6px;
  font-size: 17px;
}

/* =========================================================================
   DIVINE POWERS TRAY
   ========================================================================= */
.powers {
  position: fixed;
  bottom: max(clamp(14px, 2.4vw, 28px), env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease 0.4s;
}

.powers--visible {
  opacity: 1;
}

.power {
  pointer-events: auto;
  appearance: none;
  border: none;
  background:
    linear-gradient(180deg, rgba(15, 10, 44, 0.96), rgba(7, 7, 26, 0.96));
  color: var(--ivory-dim);
  border: 1px solid rgba(212, 160, 23, 0.35);
  border-radius: 6px;
  padding: 10px 16px 8px;
  min-width: 160px;
  text-align: center;
  font-family: var(--font-roman);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 2px;
  position: relative;
  transition: transform 0.15s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    0 6px 16px rgba(0, 0, 0, 0.6);
}

.power[disabled] {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.power:not([disabled]):hover {
  transform: translateY(-3px);
  color: var(--ivory);
  border-color: var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(212, 160, 23, 0.6),
    0 10px 30px rgba(212, 160, 23, 0.25);
}

.power:not([disabled]):active {
  transform: translateY(-1px) scale(0.98);
}

.power__rune {
  font-size: 26px;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.6));
}

.power__name {
  font-weight: 600;
}

.power__key {
  font-family: var(--font-roman);
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.2em;
}

.power.is-firing {
  animation: power-fire 480ms ease-out;
}

@keyframes power-fire {
  0% { transform: scale(1); }
  20% { transform: scale(1.12); box-shadow: 0 0 32px var(--wrath), inset 0 0 0 1px var(--gold-bright); }
  100% { transform: scale(1); }
}

/* =========================================================================
   PROCLAMATIONS — floating biblical text on smites
   ========================================================================= */
#proclamations {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}

.proclaim {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ivory);
  text-shadow:
    0 0 12px rgba(212, 160, 23, 0.9),
    0 0 32px rgba(196, 30, 58, 0.6),
    0 2px 0 rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  animation: proclaim-rise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  will-change: transform, opacity;
}

.proclaim--wrath {
  color: var(--wrath);
  text-shadow:
    0 0 18px rgba(196, 30, 58, 1),
    0 0 36px rgba(245, 203, 74, 0.6),
    0 2px 0 rgba(0, 0, 0, 0.7);
}

.proclaim--big {
  font-size: clamp(48px, 7vw, 110px);
  letter-spacing: 0.04em;
  animation-duration: 1400ms;
}

@keyframes proclaim-rise {
  0% { transform: translate(-50%, -40%) scale(0.5) rotate(-2deg); opacity: 0; }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
  100% { transform: translate(-50%, -130%) scale(1) rotate(1deg); opacity: 0; }
}

/* =========================================================================
   SCREENS — title and game over
   ========================================================================= */
.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
  overflow-y: auto;
  background:
    radial-gradient(900px 700px at 50% 30%, rgba(212, 160, 23, 0.18), transparent 60%),
    radial-gradient(900px 700px at 50% 90%, rgba(26, 58, 138, 0.35), transparent 60%),
    rgba(2, 2, 11, 0.85);
  backdrop-filter: blur(3px);
}

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

.screen--hiding {
  animation: screen-out 700ms cubic-bezier(0.6, 0, 0.4, 1) forwards;
}

@keyframes screen-out {
  to { opacity: 0; transform: scale(1.04); pointer-events: none; }
}

.screen__inner {
  max-width: 760px;
  width: 100%;
  text-align: center;
  position: relative;
  padding: clamp(20px, 4vw, 48px);
  border: 1px solid rgba(212, 160, 23, 0.45);
  background:
    linear-gradient(180deg, rgba(15, 10, 44, 0.6), rgba(7, 7, 26, 0.7));
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 80px rgba(212, 160, 23, 0.1),
    0 30px 80px rgba(0, 0, 0, 0.7);
  border-radius: 2px;
}

/* Filigree corners */
.screen__inner::before,
.screen__inner::after {
  content: "✠";
  position: absolute;
  font-size: 28px;
  color: var(--gold);
  opacity: 0.7;
}

.screen__inner::before { top: 10px; left: 12px; }
.screen__inner::after { bottom: 10px; right: 12px; }

.kicker {
  font-family: var(--font-roman);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  margin: 0 0 16px;
}

.kicker--red {
  color: var(--wrath);
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(56px, 11vw, 140px);
  line-height: 0.92;
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--ivory);
  text-shadow:
    0 0 28px rgba(212, 160, 23, 0.65),
    0 0 64px rgba(196, 30, 58, 0.4),
    0 2px 0 rgba(0, 0, 0, 0.7);
  display: grid;
  gap: 0;
  animation: title-shimmer 6s ease-in-out infinite;
}

.title--small {
  font-size: clamp(38px, 7vw, 84px);
}

.title__line {
  display: block;
  animation: title-drop 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.title__line:nth-child(1) { animation-delay: 0.1s; }
.title__line:nth-child(2) { animation-delay: 0.3s; }
.title__line:nth-child(3) { animation-delay: 0.5s; }

.title__line--em {
  color: var(--wrath);
  font-style: italic;
  text-shadow:
    0 0 28px rgba(196, 30, 58, 0.9),
    0 0 64px rgba(245, 203, 74, 0.4),
    0 2px 0 rgba(0, 0, 0, 0.7);
  transform: translateX(-4%);
}

@keyframes title-drop {
  0% { opacity: 0; transform: translateY(-30px) scale(0.9); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes title-shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.dedication {
  font-size: 19px;
  font-style: italic;
  color: var(--ivory-dim);
  max-width: 56ch;
  margin: 24px auto 28px;
  line-height: 1.4;
}

.dedication em {
  color: var(--gold-bright);
  font-style: italic;
  font-weight: 600;
}

.commandments {
  text-align: left;
  background: rgba(2, 2, 11, 0.55);
  border: 1px solid rgba(212, 160, 23, 0.3);
  padding: 18px 28px;
  margin: 0 auto 28px;
  max-width: 56ch;
  border-radius: 2px;
}

.commandments__head {
  font-family: var(--font-roman);
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-align: center;
  margin: 0 0 12px;
  font-weight: 600;
}

.commandments ol {
  padding-left: 22px;
  margin: 0;
  counter-reset: cmd;
  list-style: none;
}

.commandments ol li {
  position: relative;
  padding: 4px 0 4px 8px;
  font-size: 16px;
  color: var(--ivory-dim);
}

.commandments ol li::before {
  counter-increment: cmd;
  content: counter(cmd, upper-roman) ".";
  position: absolute;
  left: -22px;
  top: 4px;
  font-family: var(--font-roman);
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
  width: 22px;
}

.commandments b {
  color: var(--ivory);
}

kbd {
  font-family: var(--font-roman);
  font-size: 11px;
  background: rgba(212, 160, 23, 0.15);
  border: 1px solid rgba(212, 160, 23, 0.5);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
}

/* Divine button */
.btn-divine {
  pointer-events: auto;
  appearance: none;
  background:
    linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-dim));
  border: 1px solid var(--gold-dim);
  color: var(--ink);
  font-family: var(--font-roman);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 18px 32px 14px;
  cursor: none;
  border-radius: 3px;
  position: relative;
  display: inline-grid;
  gap: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 214, 0.6),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    0 10px 30px rgba(212, 160, 23, 0.35),
    0 0 0 4px rgba(212, 160, 23, 0.15);
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}

.btn-divine small {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(43, 26, 8, 0.7);
}

.btn-divine:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 214, 0.6),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    0 14px 36px rgba(212, 160, 23, 0.55),
    0 0 0 4px rgba(245, 203, 74, 0.25);
}

.btn-divine:active {
  transform: translateY(0);
}

.btn-divine::before,
.btn-divine::after {
  content: "✟";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink);
  font-size: 16px;
}

.btn-divine::before { left: 12px; }
.btn-divine::after { right: 12px; }

.fineprint {
  margin: 24px auto 0;
  max-width: 56ch;
  font-size: 12px;
  color: rgba(255, 244, 214, 0.45);
  font-style: italic;
  line-height: 1.5;
}

/* Game over screen */
.tallies {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 28px auto;
  max-width: 520px;
}

.tally {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: rgba(2, 2, 11, 0.55);
  border: 1px solid rgba(212, 160, 23, 0.3);
  border-radius: 2px;
}

.tally__label {
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--gold);
  text-transform: uppercase;
}

.tally__value {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--ivory);
  line-height: 1;
}

.epitaph {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 18px;
  color: var(--ivory-dim);
  max-width: 56ch;
  margin: 20px auto 28px;
  line-height: 1.4;
}

/* =========================================================================
   AUDIO TOGGLE
   ========================================================================= */
.audio-toggle {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  right: max(14px, env(safe-area-inset-right));
  z-index: 60;
  appearance: none;
  background: rgba(7, 7, 26, 0.7);
  border: 1px solid rgba(212, 160, 23, 0.45);
  color: var(--gold);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: none;
  transition: transform 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.audio-toggle:hover {
  background: rgba(212, 160, 23, 0.2);
  transform: scale(1.08);
}

/* =========================================================================
   DIVINE FURY OVERLAY (when wrath unleashes)
   ========================================================================= */
.divine-fury {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background:
    radial-gradient(900px 700px at 50% 50%, rgba(245, 203, 74, 0.25), transparent 60%),
    radial-gradient(1200px 800px at 50% 50%, rgba(196, 30, 58, 0.18), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.divine-fury.active {
  opacity: 1;
  animation: fury-flicker 220ms infinite;
}

@keyframes fury-flicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

/* =========================================================================
   TOUCH MODE — applied via body.touch from JS once a touch input is detected
   -------------------------------------------------------------------------
   The Eye-of-Providence cursor is a desktop-only conceit. On finger devices
   we restore the native cursor (so OS assistive overlays still work) and
   disable text-selection callouts so a long-press doesn't pop a share
   sheet over the gameplay. We also tell the browser to keep its hands
   off our gestures via touch-action: none on the canvas, which kills
   double-tap zoom and pull-to-refresh during play.
   ========================================================================= */
body.touch {
  cursor: auto;
  -webkit-user-select: none;
          user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body.touch html,
html body.touch,
body.touch button,
body.touch a,
body.touch input,
body.touch .btn-divine,
body.touch .audio-toggle,
body.touch .power {
  cursor: auto;
}

body.touch #cursor {
  display: none;
}

/* The canvas should never scroll, zoom, or rubber-band. The screens
   (title / game over) keep `overflow-y: auto` so they remain scrollable
   for content that exceeds a small viewport. */
body.touch #game {
  touch-action: none;
}

body.touch .screen,
body.touch .screen__inner {
  touch-action: pan-y;
}

/* =========================================================================
   ORDER OF SMITING — left-HUD level + XP bar (above the score)
   -------------------------------------------------------------------------
   The level numeral is the loudest thing in the left scroll: a blackletter
   glyph, bigger than the score below it. The XP bar to its right is thin
   and stained-gold, so it reads as filigree rather than UI plumbing.
   ========================================================================= */
.hud-eyebrow--inset {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(43, 26, 8, 0.25);
}

.hud-level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.hud-level {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 0.9;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.5);
  min-width: 1.2em;
  text-align: left;
}

.hud-level.bumped {
  animation: mult-bump 480ms ease-out;
}

.hud-xp {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hud-xp__bar {
  position: relative;
  display: block;
  height: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 8px),
    rgba(43, 26, 8, 0.45);
  border: 1px solid rgba(43, 26, 8, 0.85);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.hud-xp__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold) 60%, var(--gold-bright));
  box-shadow: 0 0 8px rgba(212, 160, 23, 0.55);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hud-xp__label {
  font-family: var(--font-roman);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.7;
}

/* =========================================================================
   TITLE-SCREEN RANK CARTOUCHE
   -------------------------------------------------------------------------
   A small parchment-colored badge above the dedication that announces the
   player's current Order of Smiting. Sits inline; doesn't compete with the
   blackletter title block above it.
   ========================================================================= */
.title-rank {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 18px auto 8px;
  padding: 8px 22px;
  background: linear-gradient(180deg, rgba(244, 229, 190, 0.96), rgba(220, 200, 150, 0.92));
  color: var(--ink);
  border: 1px solid rgba(212, 160, 23, 0.6);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(212, 160, 23, 0.45),
    0 8px 22px rgba(0, 0, 0, 0.55);
}

.title-rank__eyebrow {
  font-family: var(--font-roman);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.75;
}

.title-rank__numeral {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 0.9;
  color: var(--wrath-deep);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.6);
}

/* =========================================================================
   BLESSINGS STRIP — owned boons listed as small Cinzel-caps tags on title
   ========================================================================= */
.blessings {
  margin: 0 auto 24px;
  max-width: 64ch;
  padding: 14px 18px;
  background: rgba(2, 2, 11, 0.6);
  border: 1px solid rgba(212, 160, 23, 0.35);
  border-radius: 2px;
  text-align: center;
}

.blessings__head {
  font-family: var(--font-roman);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-align: center;
  margin: 0 0 10px;
  font-weight: 600;
}

.blessings__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 8px;
}

.blessings__list li {
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory);
  padding: 4px 10px 3px;
  background: linear-gradient(180deg, rgba(212, 160, 23, 0.22), rgba(212, 160, 23, 0.08));
  border: 1px solid rgba(212, 160, 23, 0.55);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.blessings--overflowing {
  border-color: rgba(245, 203, 74, 0.7);
  background:
    radial-gradient(420px 120px at 50% 50%, rgba(245, 203, 74, 0.12), transparent 70%),
    rgba(2, 2, 11, 0.6);
}

.blessings--overflowing .blessings__head {
  color: var(--gold-bright);
}

/* =========================================================================
   RECANT — a small confessional button at the foot of the title screen
   ========================================================================= */
.btn-recant {
  display: block;
  margin: 22px auto 0;
  background: transparent;
  border: none;
  color: rgba(255, 244, 214, 0.4);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  cursor: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.btn-recant:hover {
  color: var(--wrath);
  transform: translateY(-1px);
}

/* =========================================================================
   GAME-OVER — XP tile wide layout + "Orders Attained" flourish
   ========================================================================= */
.tally--wide {
  grid-column: 1 / -1;
}

.orders-attained {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.6vw, 34px);
  color: var(--gold-bright);
  text-align: center;
  text-shadow:
    0 0 18px rgba(245, 203, 74, 0.7),
    0 0 36px rgba(196, 30, 58, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.7);
  margin: 6px auto 14px;
  letter-spacing: 0.02em;
  animation: orders-flourish 1.6s ease-out both;
}

@keyframes orders-flourish {
  0% { opacity: 0; transform: translateY(-8px) scale(0.92); filter: blur(6px); }
  60% { opacity: 1; transform: translateY(0) scale(1.06); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================================
   LEVEL-UP BANNER — centered, brief, does NOT pause gameplay
   ========================================================================= */
.levelup-banner {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  opacity: 0;
}

.levelup-banner[aria-hidden="false"] {
  animation: levelup-show 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.levelup-banner__eyebrow {
  font-family: var(--font-roman);
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
  margin-bottom: 4px;
}

.levelup-banner__numeral {
  font-family: var(--font-display);
  font-size: clamp(80px, 14vw, 180px);
  color: var(--ivory);
  line-height: 0.9;
  text-shadow:
    0 0 32px rgba(245, 203, 74, 0.95),
    0 0 80px rgba(196, 30, 58, 0.55),
    0 4px 0 rgba(0, 0, 0, 0.75);
}

.levelup-banner__order {
  font-family: var(--font-roman);
  font-size: clamp(14px, 1.8vw, 20px);
  font-weight: 800;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85);
  margin-top: 8px;
}

@keyframes levelup-show {
  0% { opacity: 0; transform: scale(0.7); filter: blur(12px); }
  18% { opacity: 1; transform: scale(1.05); filter: blur(0); }
  72% { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.1); filter: blur(4px); }
}

/* =========================================================================
   BOON PICKER — modal, three illuminated cards, blocks input
   ========================================================================= */
.boon-picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
  background:
    radial-gradient(900px 700px at 50% 30%, rgba(245, 203, 74, 0.22), transparent 60%),
    radial-gradient(900px 700px at 50% 90%, rgba(26, 58, 138, 0.4), transparent 60%),
    rgba(2, 2, 11, 0.9);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.boon-picker[hidden] {
  display: none !important;
}

.boon-picker__inner {
  max-width: 920px;
  width: 100%;
  text-align: center;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid rgba(212, 160, 23, 0.55);
  background: linear-gradient(180deg, rgba(15, 10, 44, 0.7), rgba(7, 7, 26, 0.85));
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 80px rgba(212, 160, 23, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.7);
  border-radius: 2px;
  position: relative;
}

.boon-picker__inner::before,
.boon-picker__inner::after {
  content: "✠";
  position: absolute;
  font-size: 22px;
  color: var(--gold);
  opacity: 0.75;
}

.boon-picker__inner::before { top: 10px; left: 12px; }
.boon-picker__inner::after { bottom: 10px; right: 12px; }

.boon-picker__title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 56px);
  color: var(--ivory);
  margin: 4px 0 8px;
  text-shadow:
    0 0 22px rgba(212, 160, 23, 0.6),
    0 0 56px rgba(196, 30, 58, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.7);
}

.boon-picker__sub {
  font-size: 17px;
  font-style: italic;
  color: var(--ivory-dim);
  max-width: 52ch;
  margin: 0 auto 24px;
  line-height: 1.4;
}

.boon-picker__count {
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 18px 0 0;
  min-height: 1.2em;
}

.boon-picker__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.boon-card {
  pointer-events: auto;
  appearance: none;
  text-align: left;
  cursor: none;
  background:
    linear-gradient(180deg, rgba(244, 229, 190, 0.96), rgba(220, 200, 150, 0.92));
  color: var(--ink);
  border: 1px solid rgba(212, 160, 23, 0.7);
  border-radius: 3px;
  padding: 18px 18px 16px;
  position: relative;
  font-family: var(--font-body);
  box-shadow:
    inset 0 0 0 1px rgba(212, 160, 23, 0.45),
    inset 0 0 30px rgba(212, 160, 23, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.boon-card::before {
  content: "✟";
  position: absolute;
  top: 8px;
  right: 12px;
  color: var(--gold-dim);
  font-size: 16px;
  opacity: 0.75;
}

.boon-card:hover,
.boon-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--wrath);
  box-shadow:
    inset 0 0 0 1px rgba(212, 160, 23, 0.7),
    inset 0 0 30px rgba(245, 203, 74, 0.3),
    0 18px 38px rgba(196, 30, 58, 0.3);
  outline: none;
}

.boon-card__name {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.boon-card__rune {
  display: block;
  font-family: var(--font-roman);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--wrath-deep);
  margin-bottom: 12px;
}

.boon-card__desc {
  display: block;
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
  color: var(--ink);
  line-height: 1.4;
}

.boon-card--full {
  text-align: center;
  cursor: none;
  pointer-events: auto;
  grid-column: 1 / -1;
  background:
    radial-gradient(600px 200px at 50% 50%, rgba(245, 203, 74, 0.2), transparent 70%),
    linear-gradient(180deg, rgba(244, 229, 190, 0.96), rgba(220, 200, 150, 0.92));
}

.boon-card--full .boon-card__name {
  font-size: clamp(28px, 4vw, 44px);
}

.boon-card--full .boon-card__desc {
  font-size: 16px;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
/* Modest desktop / tablet — keep the powers in one row, just slimmer. */
@media (max-width: 1024px) {
  .power { min-width: 130px; padding: 8px 10px; }
  .powers { gap: 10px; }
  .hud-title__big { font-size: 28px; }
  .hud-title__small { letter-spacing: 0.3em; font-size: 9px; }
  .hud-scroll { min-width: 200px; padding: 10px 14px; }
  .hud-scroll--left { max-width: 260px; }
  .hud-scroll--right { max-width: 280px; }
  .hud-score { font-size: 36px; }
  .hud-level { font-size: 32px; }
  .boon-picker__cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .hud-title { display: none; }
}

/* Narrow / phone landscape — start consolidating the HUD. */
@media (max-width: 640px) {
  .hud {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .hud-title {
    grid-column: 1 / -1;
    order: -1;
  }
  .hud-title__big {
    font-size: 22px;
  }
  .hud-scroll {
    min-width: 0;
    padding: 8px 12px;
  }
  .hud-score { font-size: 30px; }
  .powers {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 95vw;
  }
  .power { min-width: 100px; padding: 8px 10px; font-size: 9px; }
  .power__rune { font-size: 18px; }
  .tallies { grid-template-columns: 1fr; }
  .tally--wide { grid-column: 1 / -1; }
  .hud-level { font-size: 26px; }
  .hud-xp__label { font-size: 8px; }
  .boon-picker__cards { grid-template-columns: 1fr; }
  .boon-card { padding: 14px 14px 12px; }
  .boon-card__name { font-size: 22px; }
  .boon-card__desc { font-size: 14px; }
  .title-rank { padding: 6px 16px; gap: 10px; }
  .title-rank__numeral { font-size: 30px; }
  .blessings__list li { font-size: 9px; padding: 3px 8px 2px; letter-spacing: 0.14em; }
}

/* =========================================================================
   PHONE PORTRAIT — ≤480px
   -------------------------------------------------------------------------
   At this size the HUD scrolls have to give up some chrome and the powers
   tray must fit in a single row WITHOUT wrapping (a wrapped row hides
   beneath the safe-area inset on iPhone). We drop the long power names
   and keep the rune + TAP — pure icon buttons. Title screen content
   (commandments) gets internal scroll so the page itself never overflows.
   ========================================================================= */
@media (max-width: 480px) {
  /* Native cursor on narrow desktop windows too — at this width we assume
     the visitor effectively has a touch-class viewport even with a mouse. */
  body { cursor: auto; }
  #cursor { display: none; }
  button, a, input, .btn-divine, .audio-toggle { cursor: pointer; }

  /* HUD: tighter scrolls, smaller score */
  .hud {
    padding: max(8px, env(safe-area-inset-top))
             max(10px, env(safe-area-inset-right))
             8px
             max(10px, env(safe-area-inset-left));
    gap: 8px;
  }
  .hud-scroll {
    padding: 6px 12px;
    min-width: 0;
    max-width: none;
  }
  .hud-scroll--left,
  .hud-scroll--right {
    max-width: none;
  }
  .hud-score { font-size: 26px; }
  .hud-eyebrow {
    font-size: 8px;
    letter-spacing: 0.18em;
    margin-bottom: 2px;
  }
  .hud-combo { font-size: 11px; margin-top: 2px; }
  .hud-bar { height: 11px; margin-bottom: 6px; }
  .hud-bar__label { font-size: 8px; letter-spacing: 0.14em; }

  /* Powers: icon-only, single row, edge-to-edge */
  .powers {
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
    transform: none;
    justify-content: space-around;
    padding: 0 max(10px, env(safe-area-inset-left)) 0 max(10px, env(safe-area-inset-right));
  }
  .power {
    min-width: 0;
    flex: 1 1 0;
    padding: 8px 6px 6px;
    grid-template-rows: auto auto;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  .power__name { display: none; }
  .power__rune { font-size: 22px; }
  .power__key { font-size: 9px; letter-spacing: 0.16em; }

  /* Title screen: keep the dramatic blackletter readable, but fit phone */
  .screen { padding: 12px; }
  .screen__inner { padding: 22px 18px; }
  .title { font-size: clamp(48px, 16vw, 84px); }
  .title--small { font-size: clamp(34px, 10vw, 56px); }
  .kicker { font-size: 10px; letter-spacing: 0.32em; margin-bottom: 10px; }
  .dedication {
    font-size: 15px;
    margin: 14px auto 18px;
    line-height: 1.35;
  }
  /* Commandments scroll inside their own panel rather than pushing the
     page so the title and CTA always stay reachable. */
  .commandments {
    padding: 12px 18px 12px 28px;
    margin-bottom: 20px;
    max-height: 32vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .commandments ol li { font-size: 14px; padding: 3px 0 3px 4px; }
  .btn-divine {
    padding: 14px 28px 12px;
    font-size: 12px;
    letter-spacing: 0.18em;
  }
  .btn-divine small { font-size: 11px; }
  .fineprint { font-size: 11px; margin-top: 16px; }

  /* Game-over single-column tallies */
  .tallies {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 20px auto;
  }
  .tally__value { font-size: 28px; }
  .epitaph { font-size: 16px; margin: 16px auto 22px; }

  /* Proclamations need to fit horizontally on a 390px screen */
  .proclaim--big { font-size: clamp(34px, 11vw, 64px); }
}

/* =========================================================================
   PHONE LANDSCAPE — ≤900px wide AND ≤500px tall
   -------------------------------------------------------------------------
   Vertical real estate is cramped; the bottom-row powers tray would cover
   the Earth. Move powers to a vertical column on the right edge and hide
   the central HUD title to free headroom. Title screen panel uses an
   internal scroll so commandments don't push the CTA off-screen.
   ========================================================================= */
@media (max-width: 900px) and (max-height: 500px) {
  .hud-title { display: none; }
  .hud {
    padding: max(6px, env(safe-area-inset-top))
             max(8px, env(safe-area-inset-right))
             6px
             max(8px, env(safe-area-inset-left));
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 8px;
  }
  .hud-scroll { padding: 6px 12px; min-width: 0; }
  .hud-score { font-size: 24px; }

  /* Powers: vertical column, right edge, vertically centered. We override
     the bottom/left/transform from the base rule completely. */
  .powers {
    flex-direction: column;
    gap: 8px;
    bottom: auto;
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    max-width: none;
    flex-wrap: nowrap;
  }
  .power {
    min-width: 0;
    width: 64px;
    padding: 6px 4px;
    font-size: 9px;
  }
  .power__name { display: none; }
  .power__rune { font-size: 20px; }

  /* Title / game-over screens: shorter panels, internal scroll for
     long content blocks. */
  .screen { padding: 8px; align-items: flex-start; padding-top: max(12px, env(safe-area-inset-top)); }
  .screen__inner { padding: 16px 24px; }
  .title { font-size: clamp(36px, 9vw, 64px); }
  .title--small { font-size: clamp(28px, 7vw, 48px); }
  .dedication { font-size: 14px; margin: 8px auto 12px; }
  .commandments {
    padding: 10px 20px 10px 26px;
    margin-bottom: 14px;
    max-height: 28vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .commandments ol li { font-size: 13px; padding: 2px 0 2px 4px; }
  .btn-divine { padding: 12px 24px 10px; font-size: 11px; }
  .tallies { grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px auto; }
  .tally { padding: 10px 12px; }
  .tally__value { font-size: 24px; }
  .epitaph { font-size: 14px; margin: 10px auto 16px; }
  .fineprint { display: none; }
}

/* Honor user motion preferences */
@media (prefers-reduced-motion: reduce) {
  .mandala { animation: none; }
  .title__line { animation: none; opacity: 1; transform: none; }
  .title { animation: none; }
  .proclaim { animation-duration: 600ms; }
}
