:root {
  color-scheme: dark;
  --bg: #111814;
  --panel: rgba(18, 25, 22, 0.9);
  --panel-solid: #151f1b;
  --text: #f2ead8;
  --muted: #b5ad98;
  --gold: #d8b86a;
  --gold-dark: #735d2a;
  --green: #4f8065;
  --red: #b35c4e;
  --blue: #668aa0;
  --shadow: rgba(0, 0, 0, 0.45);
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top, rgba(216, 184, 106, 0.16), transparent 34rem),
    linear-gradient(180deg, #111814 0%, #17211d 48%, #0d1210 100%);
  color: var(--text);
  overflow-x: hidden;
}

button {
  border: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: 700 1rem/1.1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 48px;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
  opacity: 0.72;
}

.game-shell {
  align-items: stretch;
  display: flex;
  justify-content: center;
  min-height: 100svh;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.game-card {
  background: var(--panel);
  border: 1px solid rgba(216, 184, 106, 0.28);
  box-shadow: 0 22px 70px var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 540px;
  min-height: calc(100svh - 24px);
  overflow: hidden;
  position: relative;
  width: 100%;
}

.scene {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.2) 36%, rgba(0, 0, 0, 0.76) 100%),
    var(--scene-image),
    linear-gradient(135deg, #24382e, #111814);
  background-position: center;
  background-size: cover;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100svh - 24px);
  overflow: hidden;
  position: relative;
  animation: scene-fade 260ms ease-out;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  z-index: 3;
}

.location-tag,
.mute-btn {
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 12, 0.68);
  border: 1px solid rgba(242, 234, 216, 0.14);
  border-radius: 999px;
  color: var(--text);
  font: 700 0.78rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 38px;
  padding: 11px 13px;
}

.mute-btn {
  min-width: 48px;
}

.stats {
  align-items: center;
  display: flex;
  gap: 6px;
}

.content {
  align-content: end;
  display: grid;
  gap: 14px;
  padding: 104px 16px 12px;
  position: relative;
  z-index: 2;
}

.title-panel {
  align-content: end;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.72)),
    url("assets/images/gate_of_years.png"),
    linear-gradient(135deg, #24382e, #111814);
  background-position: center;
  background-size: cover;
  display: grid;
  gap: 22px;
  min-height: calc(100svh - 24px);
  padding: 42svh 20px 56px;
  text-align: center;
  animation: scene-fade 260ms ease-out;
}

.video-scene {
  background: #050706;
  display: grid;
  min-height: calc(100svh - 24px);
  overflow: hidden;
  position: relative;
  animation: scene-fade 260ms ease-out;
}

.intro-video {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.video-shade {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.62));
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.video-actions {
  align-self: end;
  display: grid;
  padding: 0 16px 16px;
  position: relative;
  z-index: 2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--gold);
  font-size: clamp(2.35rem, 12vw, 4rem);
  font-weight: 400;
  line-height: 0.92;
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.72);
}

h2 {
  color: var(--gold);
  font-size: clamp(1.65rem, 8vw, 2.55rem);
  font-weight: 400;
  line-height: 1;
}

.subtitle,
.body-copy,
.log,
.favor-note {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.48;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
}

.favor-note {
  color: #d8cfae;
  font-style: italic;
}

.dialogue {
  backdrop-filter: blur(18px);
  background: rgba(8, 12, 10, 0.82);
  border: 1px solid rgba(216, 184, 106, 0.24);
  border-radius: 8px;
  box-shadow: 0 18px 44px var(--shadow);
  display: grid;
  gap: 10px;
  padding: 16px;
}

.guide-name {
  color: var(--gold);
  font: 800 0.78rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.spirit-figure {
  bottom: 104px;
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.62));
  height: clamp(175px, 42svh, 275px);
  max-width: 82%;
  object-fit: contain;
  pointer-events: none;
  position: absolute;
  right: 5%;
  transform: translateY(6px);
  z-index: 1;
}

.jack-figure {
  bottom: 72px;
  height: clamp(292px, 62svh, 480px);
  left: 50%;
  max-width: 96%;
  right: auto;
  transform: translate(-50%, 10px);
  z-index: 2;
}

.gatekeeper-figure {
  bottom: 118px;
  height: clamp(260px, 52svh, 430px);
  left: 50%;
  max-width: 92%;
  right: auto;
  transform: translate(-50%, 4px);
}

.actions {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
  position: relative;
  z-index: 3;
}

.primary,
.secondary,
.choice,
.symbol-btn,
.statue-btn {
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.22);
  padding: 15px 16px;
}

.primary {
  background: linear-gradient(180deg, #d8b86a, #a87f35);
  color: #21180a;
}

.secondary,
.choice,
.symbol-btn,
.statue-btn {
  background: rgba(242, 234, 216, 0.12);
  border: 1px solid rgba(242, 234, 216, 0.2);
}

.choice-grid,
.symbol-grid,
.statue-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.adventure-choice-grid {
  grid-template-columns: 1fr;
}

.symbol-btn,
.statue-btn {
  min-height: 62px;
}

.spirit-statue-btn {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 132px;
}

.statue-image {
  border: 1px solid rgba(216, 184, 106, 0.28);
  border-radius: 8px;
  height: 72px;
  object-fit: cover;
  width: 72px;
}

.wide {
  grid-column: 1 / -1;
}

@keyframes scene-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hotspot-pulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.96);
  }

  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

.progress-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rune {
  background: rgba(216, 184, 106, 0.14);
  border: 1px solid rgba(216, 184, 106, 0.28);
  border-radius: 8px;
  color: var(--gold);
  min-width: 42px;
  padding: 9px 10px;
  text-align: center;
}

.rune-board {
  display: grid;
  gap: 10px;
}

.rune-hint {
  color: var(--gold);
  font: 700 0.82rem/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.spirit-party {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.spirit-party img {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(216, 184, 106, 0.28);
  border-radius: 8px;
  height: 74px;
  object-fit: cover;
  width: 74px;
}

.rune-inventory {
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 12, 0.68);
  border: 1px solid rgba(242, 234, 216, 0.14);
  border-radius: 999px;
  display: flex;
  gap: 5px;
  padding: 5px;
}

.inventory-slot {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(242, 234, 216, 0.08);
  border: 1px solid rgba(242, 234, 216, 0.14);
  border-radius: 50%;
  color: rgba(242, 234, 216, 0.55);
  display: flex;
  font: 800 0.72rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 34px;
  justify-content: center;
  overflow: hidden;
}

.inventory-slot.filled {
  background: rgba(216, 184, 106, 0.16);
  border-color: rgba(216, 184, 106, 0.42);
}

.inventory-slot img {
  height: 88%;
  object-fit: contain;
  width: 88%;
}

.forest-search {
  height: min(58svh, 460px);
  inset: calc(-1 * min(58svh, 460px)) 0 auto;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.moon-hotspot {
  animation: hotspot-pulse 1.8s ease-in-out infinite;
  background:
    radial-gradient(circle, rgba(242, 234, 216, 0.92) 0 13%, rgba(216, 184, 106, 0.7) 18%, rgba(216, 184, 106, 0.14) 44%, transparent 68%);
  border: 1px solid rgba(216, 184, 106, 0.38);
  border-radius: 50%;
  box-shadow: 0 0 32px rgba(216, 184, 106, 0.46);
  height: 58px;
  left: var(--spot-x);
  min-height: 58px;
  padding: 0;
  position: absolute;
  pointer-events: auto;
  top: var(--spot-y);
  transform: translate(-50%, -50%);
  width: 58px;
}

.moon-hotspot.true-rune {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 12%, rgba(166, 196, 236, 0.75) 18%, rgba(216, 184, 106, 0.16) 45%, transparent 70%);
}

.rune-button-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.rune-button {
  align-items: center;
  background: rgba(242, 234, 216, 0.12);
  border: 1px solid rgba(242, 234, 216, 0.2);
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.22);
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 92px;
  padding: 10px 8px;
}

.rune-button img {
  height: 44px;
  object-fit: contain;
  width: 44px;
}

.rune-button span {
  font-size: 0.78rem;
}

.reward-rune {
  align-self: center;
  filter: drop-shadow(0 0 24px rgba(216, 184, 106, 0.42));
  justify-self: center;
  max-height: 112px;
  object-fit: contain;
  width: min(42vw, 140px);
}

.ending-lines {
  display: grid;
  gap: 14px;
}

.ending-lines p {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.3;
}

.ending-lines p:last-child {
  color: var(--gold);
  font-size: 1.55rem;
}

.birthday-scene {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.06) 48%, rgba(0, 0, 0, 0.48) 100%),
    var(--scene-image),
    linear-gradient(135deg, #24382e, #111814);
  background-position: center, center, center;
  background-repeat: no-repeat;
  background-size: cover, contain, cover;
}

.cake-glow {
  animation: cake-glow 4.5s ease-in-out infinite;
  background: radial-gradient(circle, rgba(216, 184, 106, 0.32), rgba(216, 184, 106, 0.08) 34%, transparent 62%);
  height: 30%;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 48%;
  transform: translate(-50%, -50%);
  width: 62%;
  z-index: 1;
}

.birthday-scene .content {
  padding-top: 58svh;
  position: static;
}

.birthday-scene .dialogue {
  position: relative;
  z-index: 2;
}

.birthday-reveal-scene .content {
  align-content: end;
  padding: 0 16px 96px;
}

.ending-reveal {
  justify-self: center;
  max-width: 92%;
  padding: 14px 18px;
  text-align: center;
}

.ending-reveal .ending-lines {
  gap: 8px;
}

.ending-reveal .ending-lines p {
  font-size: 1.2rem;
}

.ending-reveal .ending-lines p:last-child {
  font-size: 1.5rem;
}

.message-scene .content {
  align-content: end;
  padding: 0 16px 72px;
}

.message-scene .ending-lines p,
.message-scene .ending-lines p:last-child {
  color: var(--text);
  font-size: 1.18rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.3;
}

.celebration-effects {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.celebration-effects span {
  animation: sparkle-float 7s linear infinite;
  background: rgba(247, 217, 137, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(247, 217, 137, 0.76);
  height: 4px;
  left: var(--sparkle-x);
  opacity: 0;
  position: absolute;
  top: 84%;
  width: 4px;
}

.celebration-effects span:nth-child(1) {
  --sparkle-x: 16%;
  animation-delay: 0s;
}

.celebration-effects span:nth-child(2) {
  --sparkle-x: 29%;
  animation-delay: 1.1s;
}

.celebration-effects span:nth-child(3) {
  --sparkle-x: 47%;
  animation-delay: 2.2s;
}

.celebration-effects span:nth-child(4) {
  --sparkle-x: 62%;
  animation-delay: 3.1s;
}

.celebration-effects span:nth-child(5) {
  --sparkle-x: 76%;
  animation-delay: 4.2s;
}

.celebration-effects span:nth-child(6) {
  --sparkle-x: 88%;
  animation-delay: 5.4s;
}

@keyframes sparkle-float {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.75);
  }

  18%,
  70% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    transform: translateY(-52svh) scale(1.25);
  }
}

@keyframes cake-glow {
  0%,
  100% {
    opacity: 0.48;
  }

  50% {
    opacity: 0.86;
  }
}

@media (min-width: 620px) {
  .game-shell {
    align-items: center;
    padding: 24px;
  }

  .game-card,
  .scene,
  .title-panel,
  .video-scene {
    border-radius: 8px;
    min-height: min(820px, calc(100svh - 48px));
  }

  .title-panel {
    padding: 360px 28px 72px;
  }

  .content {
    padding: 142px 22px 18px;
  }

  .spirit-figure {
    bottom: 112px;
    height: clamp(275px, 52vh, 438px);
    max-width: 68%;
    right: 8%;
  }

  .jack-figure {
    bottom: 64px;
    height: clamp(440px, 66vh, 650px);
    left: 50%;
    max-width: 94%;
    right: auto;
  }

  .gatekeeper-figure {
    bottom: 120px;
    height: clamp(410px, 58vh, 620px);
    left: 50%;
    max-width: 86%;
    right: auto;
  }

  .birthday-scene .content {
    padding-top: 500px;
  }

  .birthday-reveal-scene .content {
    padding: 0 22px 102px;
  }

  .message-scene .content {
    padding: 0 22px 78px;
  }

  .spirit-statue-btn {
    min-height: 150px;
  }

  .statue-image {
    height: 88px;
    width: 88px;
  }
}
