:root {
  color-scheme: dark;
  --night: #080705;
  --raised: #100c08;
  --bone: #eee5d2;
  --muted: #9f9b8d;
  --ember: #d7824f;
  --ember-light: #ffd59a;
  --ash: #33261e;
  --line: rgba(238,229,210,.14);
  --line-strong: rgba(238,229,210,.28);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--night); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--bone);
  background:
    radial-gradient(circle at 50% 10%, rgba(215,130,79,.08), transparent 34rem),
    linear-gradient(#070604, #0b0805 52%, #070604);
  font-family: var(--sans);
  overflow-x: hidden;
}
button, a { font: inherit; }
button { color: inherit; }

.ember-shell { width: min(calc(100% - 32px), 1160px); margin: 0 auto; padding: 26px 0 52px; }
.game-header { min-height: 92px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.back-link, .sound-button {
  color: var(--muted);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .17em;
  text-decoration: none;
  text-transform: uppercase;
}
.back-link { justify-self: start; }
.back-link:hover { color: var(--ember-light); }
.sound-button { justify-self: end; border: 0; background: transparent; cursor: pointer; }
.sound-button:hover { color: var(--ember-light); }
.title-lockup { text-align: center; }
.title-lockup span { color: var(--ember); font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; }
.title-lockup h1 { margin: 5px 0 0; font-family: var(--serif); font-size: clamp(2rem, 5vw, 4.1rem); font-weight: 400; line-height: .9; }

.game-stage { position: relative; }
.shrine-frame {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(255,255,255,.025), transparent 18%),
    #0b0805;
  box-shadow: inset 0 0 80px rgba(0,0,0,.55);
}
.shrine-frame::before, .shrine-frame::after {
  position: absolute;
  z-index: 3;
  width: 54px;
  height: 54px;
  border-color: rgba(215,130,79,.48);
  content: "";
  pointer-events: none;
}
.shrine-frame::before { top: 5px; left: 5px; border-top: 1px solid; border-left: 1px solid; }
.shrine-frame::after { right: 5px; bottom: 5px; border-right: 1px solid; border-bottom: 1px solid; }
.crown-mark {
  position: absolute;
  top: -28px;
  left: 50%;
  z-index: 5;
  width: 62px;
  aspect-ratio: 1;
  border: 1px solid rgba(215,130,79,.42);
  border-radius: 50%;
  background: var(--night);
  transform: translateX(-50%);
}
.crown-mark::before, .crown-mark::after { position: absolute; top: 50%; left: 50%; width: 78%; height: 1px; background: rgba(255,213,154,.42); content: ""; transform: translate(-50%,-50%) rotate(45deg); }
.crown-mark::after { transform: translate(-50%,-50%) rotate(-45deg); }
.crown-mark span { position: absolute; inset: 35%; border-radius: 50%; background: var(--ember); box-shadow: 0 0 18px rgba(215,130,79,.7); }
.canvas-wrap { position: relative; overflow: hidden; aspect-ratio: 8 / 5; background: #050403; touch-action: none; }
canvas { width: 100%; height: 100%; display: block; }
.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .13;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.025) 4px),
    radial-gradient(circle at 20% 40%, rgba(255,255,255,.05) 0 1px, transparent 1.5px);
  background-size: auto, 7px 7px;
  mix-blend-mode: screen;
}
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
  background: radial-gradient(circle at center, rgba(15,10,6,.72), rgba(4,3,2,.94));
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.game-overlay.is-visible { opacity: 1; pointer-events: auto; }
.overlay-kicker { margin: 0 0 12px; color: var(--ember); font-size: .63rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.game-overlay h2 { max-width: 760px; margin: 0; font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 5.8rem); font-weight: 400; line-height: .9; }
.game-overlay > p:not(.overlay-kicker) { max-width: 590px; margin: 25px 0 0; color: #c7bca7; font-family: var(--serif); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.65; }
.game-overlay button {
  margin-top: 30px;
  padding: 14px 23px;
  border: 1px solid rgba(255,213,154,.48);
  background: rgba(215,130,79,.11);
  color: var(--ember-light);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: .18s ease;
}
.game-overlay button:hover, .game-overlay button:focus-visible { background: rgba(215,130,79,.23); transform: translateY(-2px); }
.game-overlay small { margin-top: 18px; color: var(--muted); font-size: .62rem; letter-spacing: .08em; }

.mobile-controls { display: none; grid-template-columns: repeat(3, minmax(70px, 112px)); justify-content: center; gap: 10px; margin-top: 18px; }
.mobile-controls button {
  min-height: 64px;
  border: 1px solid var(--line-strong);
  background: rgba(16,12,8,.92);
  color: var(--bone);
  font-size: 1.35rem;
  cursor: pointer;
  touch-action: none;
}
.mobile-controls button.is-active { border-color: var(--ember-light); background: rgba(215,130,79,.22); }
.mobile-controls .thrust-control { color: var(--ember-light); }
.game-notes { display: flex; justify-content: center; gap: clamp(18px, 4vw, 52px); padding: 24px 10px 0; color: var(--muted); font-size: .65rem; letter-spacing: .11em; text-transform: uppercase; }
.game-notes p { margin: 0; }
.game-notes strong { color: var(--bone); font-weight: 700; }
.status-line { min-height: 20px; margin: 22px 0 0; color: var(--muted); font-family: var(--serif); font-size: .98rem; text-align: center; }

@media (max-width: 760px) {
  .ember-shell { width: min(calc(100% - 20px), 1160px); padding-top: 12px; }
  .game-header { min-height: 82px; grid-template-columns: 1fr auto; }
  .title-lockup { grid-column: 1 / -1; grid-row: 1; }
  .back-link, .sound-button { grid-row: 2; padding-bottom: 10px; }
  .shrine-frame { padding: 7px; }
  .crown-mark { width: 46px; top: -20px; }
  .mobile-controls { display: grid; }
  .game-notes { flex-wrap: wrap; gap: 10px 22px; }
  .game-overlay { padding: 20px; }
  .game-overlay small { max-width: 280px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
