:root {
  color-scheme: light;
  --game-teal: #0d6175;
  --game-teal-bright: #178ca7;
  --game-gold: #f4c95d;
  --game-cream: #fff8e5;
  --game-paper: #fff1c7;
  --game-green: #4f8d59;
  --game-coral: #d85d5d;
  --game-ink: #382a20;
  --game-white: #ffffff;
  --game-border: rgba(56, 42, 32, 0.25);
  font-family:
    "Hiragino Maru Gothic ProN",
    "Hiragino Sans",
    "Yu Gothic",
    Meiryo,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--game-cream);
}

body {
  min-width: 0;
  margin: 0;
  color: var(--game-ink);
  background: var(--game-cream);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.game-site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 58px;
  padding: 8px clamp(12px, 3vw, 32px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 248, 229, 0.96);
  border-bottom: 1px solid var(--game-border);
  backdrop-filter: blur(12px);
}

.game-brand,
.game-home-link {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  color: var(--game-ink);
  font-weight: 900;
  text-decoration: none;
}

.game-brand {
  gap: 9px;
  font-size: clamp(17px, 4.8vw, 22px);
}

.game-brand img {
  width: 34px;
  height: 34px;
}

.game-home-link {
  min-height: 40px;
  padding: 5px 9px;
  color: var(--game-teal);
  font-size: 14px;
}

.game-page {
  padding-bottom: 72px;
}

.game-stage,
.lesson-band {
  scroll-margin-top: 112px;
}

.game-stage {
  padding: clamp(18px, 4vw, 36px) clamp(10px, 3vw, 28px) clamp(26px, 5vw, 48px);
  background:
    linear-gradient(180deg, #dff4ff 0%, #fff2c7 68%, #f3dfa9 100%);
}

.game-heading {
  width: min(960px, 100%);
  margin: 0 auto 14px;
}

.game-eyebrow,
.lesson-kicker {
  margin: 0 0 4px;
  color: var(--game-teal);
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 900;
}

.game-heading h1,
.lesson-inner h2 {
  margin: 0;
  letter-spacing: 0;
}

.game-heading h1 {
  font-size: clamp(27px, 7vw, 44px);
  line-height: 1.15;
}

.game-heading p:last-child {
  margin: 7px 0 0;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 700;
  line-height: 1.6;
}

.game-frame {
  position: relative;
  width: min(960px, 100%);
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #bfe8ff;
  border: 3px solid rgba(56, 42, 32, 0.55);
  border-radius: 6px;
  box-shadow: 0 10px 0 rgba(56, 42, 32, 0.16);
}

.game-focus-controls {
  display: flex;
  width: min(960px, 100%);
  margin: 16px auto 0;
  justify-content: center;
}

.game-focus-enter,
.game-focus-exit {
  min-height: 48px;
  padding: 10px 17px;
  color: var(--game-white);
  background: var(--game-teal);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(56, 42, 32, 0.24);
  font: inherit;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 900;
  cursor: pointer;
}

.game-focus-exit {
  position: absolute;
  z-index: 100000;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: none;
  min-height: 44px;
  padding: 7px 14px;
  background: rgba(31, 42, 44, 0.88);
  box-shadow: none;
  font-size: 15px;
}

.game-focus-rotate-hint {
  display: none;
}

body.game-focus-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.game-page[data-game-focus-active="true"] .game-frame,
.game-frame:fullscreen {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: grid;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  place-items: center;
  aspect-ratio: auto;
  background: #142f35;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.game-page[data-game-focus-active="true"] .game-focus-exit,
.game-frame:fullscreen .game-focus-exit {
  display: block;
}

.game-page[data-game-focus-active="true"] .game-frame > canvas,
.game-frame:fullscreen > canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(100vw, calc(100dvh * 16 / 9)) !important;
  height: min(100dvh, calc(100vw * 9 / 16)) !important;
  transform: translate(-50%, -50%);
}

.game-frame::backdrop {
  background: #142f35;
}

@media (orientation: portrait) and (max-width: 720px) {
  .game-page[data-game-focus-active="true"] .game-focus-rotate-hint,
  .game-frame:fullscreen .game-focus-rotate-hint {
    position: absolute;
    z-index: 99999;
    top: max(64px, calc(env(safe-area-inset-top) + 54px));
    left: 50%;
    display: block;
    margin: 0;
    padding: 7px 12px;
    color: #fff;
    background: rgba(20, 47, 53, 0.84);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    transform: translateX(-50%);
  }
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

#game canvas {
  display: block;
  outline: none;
}

.game-followup {
  display: flex;
  width: min(960px, 100%);
  margin: 18px auto 0;
  align-items: center;
  justify-content: center;
}

.lesson-action {
  display: inline-flex;
  min-height: 48px;
  padding: 10px 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--game-white);
  background: var(--game-teal);
  border: 0;
  border-radius: 7px;
  box-shadow: 0 5px 0 rgba(56, 42, 32, 0.24);
  font-size: clamp(16px, 4vw, 19px);
  font-weight: 900;
  text-decoration: none;
}

.lesson-action::after {
  content: "↓";
  font-size: 1.2em;
}

.game-page[data-game-complete="true"] .lesson-action {
  color: var(--game-ink);
  background: var(--game-gold);
}

.lesson-nav {
  position: sticky;
  z-index: 90;
  top: 58px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--game-white);
  border-block: 1px solid var(--game-border);
}

.lesson-nav a {
  display: grid;
  min-width: 0;
  min-height: 46px;
  padding: 7px 5px;
  place-items: center;
  color: var(--game-ink);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.lesson-nav a + a {
  border-left: 1px solid var(--game-border);
}

.lesson-nav a:hover {
  color: var(--game-white);
  background: var(--game-teal);
}

.lesson-band {
  padding: clamp(36px, 8vw, 72px) clamp(16px, 5vw, 44px);
}

.passage-band {
  background: var(--game-cream);
}

.truth-band {
  background: #e8f5e8;
}

.response-band {
  background: #fff0d6;
}

.adult-band {
  background: #e6f2f5;
}

.lesson-inner {
  width: min(780px, 100%);
  margin: 0 auto;
}

.lesson-inner h2 {
  color: var(--game-ink);
  font-size: clamp(25px, 6vw, 38px);
  line-height: 1.25;
}

.lesson-lead {
  margin: 12px 0 0;
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 800;
  line-height: 1.85;
}

.scripture-reference {
  margin: 22px 0 8px;
  color: var(--game-teal);
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 900;
}

.scripture-quote {
  margin: 0;
  padding: clamp(20px, 5vw, 34px);
  background: var(--game-paper);
  border: 2px solid rgba(108, 78, 38, 0.34);
  border-left: 7px solid var(--game-gold);
  border-radius: 6px;
  box-shadow: 0 7px 0 rgba(56, 42, 32, 0.1);
  font-family:
    "Yu Mincho",
    "Hiragino Mincho ProN",
    serif;
  font-size: clamp(18px, 4.7vw, 25px);
  font-weight: 700;
  line-height: 2;
}

ruby {
  ruby-position: over;
}

rt {
  color: var(--game-teal);
  font-family:
    "Hiragino Maru Gothic ProN",
    "Hiragino Sans",
    sans-serif;
  font-size: 0.48em;
  font-weight: 700;
}

.scripture-source {
  margin: 11px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.truth-grid,
.response-grid,
.adult-grid {
  display: grid;
  margin-top: 22px;
  gap: 18px;
}

.truth-block,
.response-block,
.adult-block {
  min-width: 0;
}

.truth-block + .truth-block,
.response-block + .response-block,
.adult-block + .adult-block {
  padding-top: 18px;
  border-top: 1px solid var(--game-border);
}

.truth-block h3,
.response-block h3,
.adult-block h3 {
  margin: 0;
  color: var(--game-teal);
  font-size: clamp(18px, 4.5vw, 23px);
  line-height: 1.4;
}

.truth-block p,
.response-block p,
.adult-block p,
.adult-block li {
  font-size: clamp(15px, 3.8vw, 18px);
  line-height: 1.85;
}

.truth-block p,
.response-block p,
.adult-block p {
  margin: 8px 0 0;
}

.response-prayer {
  color: var(--game-teal);
  font-weight: 900;
}

.adult-notice {
  margin: 0 0 22px;
  padding: 10px 14px;
  color: var(--game-teal);
  background: var(--game-white);
  border: 1px solid rgba(13, 97, 117, 0.32);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
}

.adult-block ul,
.adult-block ol {
  margin: 9px 0 0;
  padding-left: 1.4em;
}

.adult-block li + li {
  margin-top: 8px;
}

.game-footer {
  padding: 28px 18px 92px;
  color: var(--game-white);
  background: var(--game-teal);
  text-align: center;
}

.game-footer a {
  color: var(--game-white);
  font-weight: 900;
}

.fallback {
  display: none;
}

@media (min-width: 760px) {
  .truth-grid,
  .response-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
  }

  .truth-block + .truth-block,
  .response-block + .response-block {
    padding-top: 0;
    padding-left: 30px;
    border-top: 0;
    border-left: 1px solid var(--game-border);
  }

  .adult-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
  }

  .adult-block + .adult-block {
    padding-top: 0;
    border-top: 0;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .game-site-header {
    min-height: 44px;
    padding: 4px 10px;
  }

  .game-brand {
    gap: 7px;
    font-size: 16px;
  }

  .game-brand img {
    width: 28px;
    height: 28px;
  }

  .game-home-link {
    min-height: 34px;
    padding: 3px 7px;
    font-size: 12px;
  }

  .game-stage {
    display: flex;
    min-height: calc(100svh - 44px);
    padding: 6px 10px 10px;
    flex-direction: column;
  }

  .game-heading {
    margin-bottom: 6px;
    text-align: center;
  }

  .game-eyebrow,
  .game-heading p:last-child {
    display: none;
  }

  .game-heading h1 {
    font-size: 20px;
    line-height: 1.1;
  }

  .game-frame {
    width: auto;
    max-width: 100%;
    height: calc(100svh - 88px);
    margin-inline: auto;
  }

  .game-followup {
    display: none;
  }

  .lesson-nav {
    top: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
