/* ------------------------------------------------------------------ */
/* LUMENFALL — visual system                                           */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: 'Fraunces';
  src: url('assets/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Outfit';
  src: url('assets/fonts/outfit-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans: 'Outfit', 'Avenir Next', system-ui, sans-serif;
  --ink: #040d11;
  --ink-raised: #081a1e;
  --ink-soft: #102a2c;
  --cream: #f7eedb;
  --cream-dim: #ded3bd;
  --muted: #9db0a9;
  --muted-dim: #728984;
  --gold: #f1c36c;
  --gold-soft: #ffe6ac;
  --gold-deep: #b88040;
  --teal: #79d8c2;
  --rose: #e7a39f;
  --danger: #e58270;
  --line: rgba(241, 218, 172, 0.16);
  --line-strong: rgba(241, 218, 172, 0.3);
  --panel: linear-gradient(150deg, rgba(12, 33, 35, 0.97), rgba(5, 14, 17, 0.98) 68%);
  --stage-left: 0px;
  --stage-top: 0px;
  --stage-w: 1280px;
  --stage-h: 720px;
  --stage-scale: 1;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 76% 22%, rgba(33, 82, 76, 0.22), transparent 55%),
    radial-gradient(ellipse at 20% 100%, rgba(90, 55, 28, 0.16), transparent 52%),
    #040d11;
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 4px;
}

svg {
  display: block;
}

::selection {
  background: rgba(241, 195, 108, 0.32);
  color: #fff8e8;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 18px;
  top: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #15221f;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ------------------------------------------------------------------ */
/* Canvas and stage chrome                                             */
/* ------------------------------------------------------------------ */

.app {
  position: relative;
  width: 100%;
  height: 100%;
}

.game-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  outline: none;
  touch-action: none;
}

.game-canvas:focus-visible {
  outline: 2px solid rgba(255, 230, 172, 0.55);
  outline-offset: -5px;
}

.stage-ui {
  position: fixed;
  z-index: 5;
  left: var(--stage-left);
  top: var(--stage-top);
  width: var(--stage-w);
  height: var(--stage-h);
  pointer-events: none;
}

/* HUD --------------------------------------------------------------- */

.hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(10px, 1.8vw, 22px) clamp(12px, 2.2vw, 28px);
  background: linear-gradient(to bottom, rgba(3, 12, 14, 0.68), rgba(3, 12, 14, 0));
  pointer-events: none;
}

.hud__left {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.hud__right {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.chapter-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(9px, calc(11px * var(--stage-scale)), 12px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 238, 219, 0.78);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.chapter-tag__roman {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(241, 195, 108, 0.42);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--gold-soft);
  background: rgba(6, 17, 19, 0.5);
}

.chapter-tag__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chapter-tag__weather {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  border: 1px solid rgba(121, 216, 194, 0.28);
  border-radius: 999px;
  color: rgba(174, 235, 222, 0.8);
  background: rgba(5, 23, 23, 0.35);
  font-size: clamp(6px, calc(8px * var(--stage-scale)), 8px);
  letter-spacing: 0.14em;
}

.hud__stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hearts {
  display: flex;
  gap: 2px;
}

.heart {
  display: inline-grid;
  place-items: center;
  width: clamp(18px, calc(24px * var(--stage-scale)), 25px);
  height: clamp(18px, calc(24px * var(--stage-scale)), 25px);
  color: #ffbf6d;
  filter: drop-shadow(0 0 6px rgba(255, 177, 90, 0.45));
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.heart svg {
  width: 85%;
  height: 85%;
}

.heart.is-lost {
  opacity: 0.2;
  filter: grayscale(1) drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
  transform: scale(0.86);
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(11px, calc(14px * var(--stage-scale)), 15px);
  font-variant-numeric: tabular-nums;
  color: var(--cream);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.hud-stat svg {
  width: clamp(13px, calc(17px * var(--stage-scale)), 18px);
  height: clamp(13px, calc(17px * var(--stage-scale)), 18px);
  color: var(--gold-soft);
  margin-right: 1px;
}

.hud-stat__total {
  color: rgba(237, 228, 207, 0.46);
  font-size: 0.78em;
}

.dash-meter {
  position: relative;
  width: clamp(68px, calc(104px * var(--stage-scale)), 112px);
  height: 7px;
  margin-top: 1px;
  border-radius: 99px;
  background: rgba(3, 12, 14, 0.6);
  border: 1px solid rgba(241, 218, 172, 0.18);
  overflow: hidden;
}

.dash-meter__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-soft));
  box-shadow: 0 0 8px rgba(255, 209, 127, 0.45);
  transition: width 0.05s linear;
}

.dash-meter__label {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 7px;
  letter-spacing: 0.16em;
  color: rgba(244, 231, 203, 0.45);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(241, 218, 172, 0.22);
  border-radius: 50%;
  color: var(--cream);
  background: rgba(6, 18, 20, 0.42);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s var(--ease-out);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.icon-button:hover {
  background: rgba(26, 52, 51, 0.72);
  border-color: rgba(255, 230, 172, 0.48);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button--on-art {
  background: rgba(4, 14, 17, 0.48);
}

.sound-icon .sound-slash {
  display: none;
}

[data-mute][aria-pressed='true'] .sound-icon .sound-waves {
  display: none;
}

[data-mute][aria-pressed='true'] .sound-icon .sound-slash {
  display: block;
}

/* Boss HUD ---------------------------------------------------------- */

.boss-hud {
  position: absolute;
  top: clamp(72px, calc(94px * var(--stage-scale)), 104px);
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 68%);
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.boss-hud.is-visible {
  opacity: 1;
}

.boss-hud__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-bottom: 6px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.boss-hud__title span {
  font-family: var(--font-display);
  font-size: clamp(14px, calc(19px * var(--stage-scale)), 21px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.boss-hud__title small {
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 230, 206, 0.48);
}

.boss-hud__bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(3, 9, 12, 0.8);
  border: 1px solid rgba(241, 195, 108, 0.3);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.boss-hud__bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b315f, #b780cf 45%, #ffca78);
  box-shadow: 0 0 14px rgba(192, 138, 224, 0.55);
  transition: width 0.45s var(--ease-out);
}

.boss-hud__pips {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 5px;
}

.boss-hud__pips i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 8px rgba(255, 223, 159, 0.65);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.boss-hud__pips i.is-lost {
  opacity: 0.18;
  transform: scale(0.6);
  box-shadow: none;
}

/* Toasts and hints -------------------------------------------------- */

.toast {
  position: absolute;
  top: clamp(94px, calc(126px * var(--stage-scale)), 142px);
  left: 50%;
  transform: translate(-50%, -10px);
  width: min(460px, 82%);
  padding: 13px 20px 14px;
  border: 1px solid rgba(241, 218, 172, 0.24);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(9, 28, 30, 0.94), rgba(4, 13, 16, 0.95));
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 244, 213, 0.08);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, transform 0.28s var(--ease-out), visibility 0.28s;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast__title {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.toast__detail {
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(244, 234, 214, 0.7);
}

.toast--sigil {
  border-color: rgba(255, 218, 140, 0.48);
  box-shadow: 0 0 50px rgba(247, 203, 110, 0.12), 0 20px 50px rgba(0, 0, 0, 0.34);
}

.toast--boss {
  top: 28%;
  width: min(620px, 88%);
  border-color: rgba(186, 136, 211, 0.4);
  background: linear-gradient(145deg, rgba(22, 12, 29, 0.94), rgba(4, 10, 14, 0.96));
}

.toast--boss .toast__title {
  font-family: var(--font-display);
  font-size: clamp(17px, 2vw, 24px);
  letter-spacing: 0.12em;
  color: #f3d9ff;
}

.toast--checkpoint {
  border-color: rgba(117, 216, 194, 0.35);
}

.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 4%, 34px);
  transform: translate(-50%, 8px);
  max-width: min(620px, 74%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(241, 218, 172, 0.16);
  background: rgba(4, 14, 17, 0.76);
  backdrop-filter: blur(10px);
  color: rgba(247, 238, 219, 0.82);
  font-size: clamp(10px, calc(12px * var(--stage-scale)), 13px);
  letter-spacing: 0.02em;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s var(--ease-out), visibility 0.35s;
  pointer-events: none;
}

.hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

body.is-touch .hint {
  bottom: 100px;
}

.rotate-note {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(245, 234, 211, 0.56);
  background: rgba(3, 12, 14, 0.5);
  border: 1px solid rgba(241, 218, 172, 0.12);
  pointer-events: none;
}

.rotate-note svg {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

/* Touch controls ---------------------------------------------------- */

.touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 clamp(14px, 3vw, 32px);
  pointer-events: none;
}

.touch-controls__move,
.touch-controls__action {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 1.4vw, 14px);
  pointer-events: none;
}

.touch-button {
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: clamp(56px, 9vw, 78px);
  height: clamp(56px, 9vw, 78px);
  padding: 0;
  border: 1px solid rgba(247, 238, 219, 0.22);
  border-radius: 50%;
  color: rgba(247, 238, 219, 0.88);
  background: radial-gradient(circle at 35% 28%, rgba(41, 79, 73, 0.52), rgba(4, 14, 17, 0.64));
  backdrop-filter: blur(14px);
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 245, 215, 0.1);
  -webkit-backdrop-filter: blur(14px);
}

.touch-button svg {
  width: 25%;
  height: 25%;
  opacity: 0.92;
}

.touch-button span {
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(247, 238, 219, 0.55);
}

.touch-button.is-held {
  transform: scale(0.94);
  background: radial-gradient(circle at 35% 28%, rgba(84, 128, 112, 0.8), rgba(14, 38, 37, 0.85));
  border-color: rgba(255, 230, 172, 0.55);
}

.touch-button--jump {
  width: clamp(68px, 11vw, 94px);
  height: clamp(68px, 11vw, 94px);
  border-color: rgba(255, 224, 158, 0.38);
  background: radial-gradient(circle at 35% 28%, rgba(133, 103, 58, 0.62), rgba(15, 22, 20, 0.76));
  color: var(--gold-soft);
}

.touch-button--jump svg {
  width: 28%;
  height: 28%;
}

.touch-button--dash {
  width: clamp(52px, 8vw, 70px);
  height: clamp(52px, 8vw, 70px);
  color: var(--teal);
  border-color: rgba(121, 216, 194, 0.3);
}

/* Weather accents for HUD and chapter cards. */
body[data-atmosphere='day'] .chapter-tag__weather,
body[data-atmosphere='day'] .chapter-chip__weather {
  color: rgba(255, 218, 141, 0.9);
  border-color: rgba(241, 195, 108, 0.38);
}

body[data-atmosphere='fog'] .chapter-tag__weather,
body[data-atmosphere='fog'] .chapter-chip__weather {
  color: rgba(218, 200, 245, 0.85);
  border-color: rgba(193, 166, 230, 0.32);
}

body[data-atmosphere='rain'] .chapter-tag__weather,
body[data-atmosphere='rain'] .chapter-chip__weather {
  color: rgba(174, 235, 226, 0.9);
  border-color: rgba(117, 216, 194, 0.38);
}

body[data-atmosphere='night'] .chapter-tag__weather,
body[data-atmosphere='night'] .chapter-chip__weather {
  color: rgba(194, 190, 248, 0.9);
  border-color: rgba(147, 139, 220, 0.34);
}

body[data-atmosphere='day'] .chapter-weather__dot { background: var(--gold); box-shadow: 0 0 10px rgba(241, 195, 108, 0.7); }
body[data-atmosphere='fog'] .chapter-weather__dot { background: #cdbcf0; box-shadow: 0 0 10px rgba(205, 188, 240, 0.7); }
body[data-atmosphere='rain'] .chapter-weather__dot { background: var(--teal); box-shadow: 0 0 10px rgba(121, 216, 194, 0.7); }
body[data-atmosphere='night'] .chapter-weather__dot { background: #b7b1f2; box-shadow: 0 0 10px rgba(183, 177, 242, 0.7); }

/* ------------------------------------------------------------------ */
/* Screens and title                                                  */
/* ------------------------------------------------------------------ */


.main {
  position: relative;
  z-index: 10;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  animation: screenIn 0.4s var(--ease-soft) both;
}

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

.screen--title {
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(20px, env(safe-area-inset-top))
    clamp(24px, 5vw, 76px)
    max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, rgba(3, 11, 15, 0.46) 0%, rgba(3, 11, 15, 0.22) 38%, transparent 68%),
    linear-gradient(0deg, rgba(3, 11, 15, 0.46), transparent 28%);
}

.title-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  opacity: 0;
  animation: fadeIn 0.8s 0.1s ease forwards;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(247, 238, 219, 0.7);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brandmark__mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(241, 195, 108, 0.36);
  border-radius: 50%;
  color: var(--gold-soft);
  background: rgba(4, 14, 17, 0.38);
  box-shadow: 0 0 24px rgba(247, 203, 110, 0.09);
}

.brandmark__mark svg {
  width: 18px;
  height: 18px;
}

.title-nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  color: rgba(247, 238, 219, 0.7);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s ease, background 0.2s ease;
}

.text-button svg {
  width: 16px;
  height: 16px;
}

.text-button:hover {
  color: var(--cream);
  background: rgba(247, 238, 219, 0.07);
}

.title-main {
  width: min(700px, 72vw);
  margin-top: auto;
  margin-bottom: auto;
  padding: 4vh 0 3vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}

.title-main::before {
  content: '';
  position: absolute;
  left: -6%;
  top: 28%;
  width: 56%;
  height: 40%;
  background: radial-gradient(ellipse, rgba(255, 198, 100, 0.06), transparent 70%);
  filter: blur(24px);
  pointer-events: none;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 14px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 227, 167, 0.8);
}

.eyebrow__line {
  display: inline-block;
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 219, 149, 0.8));
}

.title-main > * {
  opacity: 0;
  animation: riseIn 0.85s var(--ease-out) forwards;
}

.title-main > :nth-child(1) { animation-delay: 0.12s; }
.title-main > :nth-child(2) { animation-delay: 0.2s; }
.title-main > :nth-child(3) { animation-delay: 0.34s; }
.title-main > :nth-child(4) { animation-delay: 0.43s; }
.title-main > :nth-child(5) { animation-delay: 0.52s; }
.title-main > :nth-child(6) { animation-delay: 0.62s; }

.logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 10.4vw, 9.4rem);
  font-weight: 600;
  font-optical-sizing: auto;
  line-height: 0.86;
  letter-spacing: 0.035em;
  color: #f8edd2;
  background: linear-gradient(178deg, #fff9e9 6%, #f8e8c2 34%, #edc57f 66%, #b77a3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 7px 28px rgba(248, 194, 97, 0.13));
  text-wrap: balance;
}

.tagline {
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: 0.015em;
  color: #f6dfb4;
}

.lede {
  max-width: 46ch;
  margin: 18px 0 0;
  color: rgba(240, 231, 213, 0.7);
  font-size: clamp(0.94rem, 1.2vw, 1.04rem);
  line-height: 1.68;
  font-weight: 300;
}

.title-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: clamp(24px, 4vh, 38px);
  position: relative;
  z-index: 1;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0) scale(0.985);
}

.button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.button svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.button--primary {
  color: #1c2924;
  background:
    linear-gradient(180deg, #fff5d8 0%, #f5d591 52%, #dcae5e 100%);
  border-color: rgba(255, 242, 207, 0.6);
  box-shadow:
    0 14px 34px rgba(4, 10, 11, 0.35),
    0 0 0 1px rgba(86, 55, 19, 0.1) inset,
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.button--primary:hover {
  background: linear-gradient(180deg, #fff9e8 0%, #f9dda2 52%, #e4b96b 100%);
  box-shadow:
    0 18px 40px rgba(4, 10, 11, 0.42),
    0 0 32px rgba(238, 186, 92, 0.16);
}

.button__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  text-align: left;
}

.button__content small {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-top: 1px;
}

.button--ghost {
  color: rgba(248, 238, 218, 0.84);
  background: rgba(5, 17, 20, 0.32);
  border-color: rgba(247, 230, 197, 0.24);
  backdrop-filter: blur(10px);
}

.button--ghost:hover {
  background: rgba(31, 58, 55, 0.46);
  border-color: rgba(255, 230, 172, 0.5);
}

.button--soft {
  color: rgba(247, 238, 219, 0.85);
  background: rgba(247, 238, 219, 0.06);
  border-color: rgba(247, 238, 219, 0.12);
}

.button--soft:hover {
  background: rgba(247, 238, 219, 0.1);
}

.button--text {
  min-height: 44px;
  padding: 8px 14px;
  color: rgba(237, 228, 208, 0.58);
  background: transparent;
  border-color: transparent;
  font-size: 12px;
}

.button--text:hover {
  color: var(--cream);
  background: rgba(247, 238, 219, 0.05);
}

.title-record {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 238, 219, 0.1);
  color: rgba(238, 229, 211, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-record__label {
  color: rgba(241, 195, 108, 0.64);
  letter-spacing: 0.16em;
}

.title-record__item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.title-record__item strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--gold-soft);
}

.title-record__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(247, 238, 219, 0.24);
}

.chapter-select {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(680px, 100%);
  margin-top: 14px;
}

.chapter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid rgba(247, 238, 219, 0.1);
  border-radius: 9px;
  background: rgba(4, 15, 18, 0.3);
  color: rgba(244, 233, 210, 0.68);
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-out);
}

.chapter-chip:not(:disabled):hover {
  background: rgba(37, 66, 61, 0.45);
  border-color: rgba(255, 228, 173, 0.35);
  color: var(--cream);
  transform: translateY(-1px);
}

.chapter-chip:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.chapter-chip__roman {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(241, 195, 108, 0.27);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--gold-soft);
}

.chapter-chip__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chapter-chip__weather {
  display: inline;
  margin-left: auto;
  font-size: 7px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(173, 231, 218, 0.62);
}

.chapter-chip__sigils {
  display: none;
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 0.04em;
  color: rgba(241, 195, 108, 0.55);
  font-variant-numeric: tabular-nums;
}

.chapter-chip.is-current {
  border-color: rgba(241, 195, 108, 0.3);
  background: rgba(64, 58, 38, 0.2);
}

.title-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 238, 219, 0.09);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(240, 230, 210, 0.42);
  opacity: 0;
  animation: fadeIn 1s 0.75s ease forwards;
}

.title-foot__note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 9px rgba(121, 216, 194, 0.8);
  animation: breathe 2.8s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/* Chapter card                                                       */
/* ------------------------------------------------------------------ */

.screen--chapter {
  align-items: center;
  justify-content: flex-start;
  padding: clamp(24px, 6vh, 64px) clamp(24px, 8vw, 120px);
  background:
    radial-gradient(ellipse at 70% 50%, rgba(23, 61, 58, 0.38), transparent 58%),
    linear-gradient(90deg, rgba(2, 8, 10, 0.86), rgba(2, 8, 10, 0.54) 48%, rgba(2, 8, 10, 0.18));
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.chapter-card {
  position: relative;
  max-width: 690px;
  width: 100%;
  padding-left: clamp(0px, 2vw, 22px);
  animation: riseIn 0.8s var(--ease-out) both;
  z-index: 1;
}

.chapter-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 7vw, 6.2rem);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.025em;
  color: #f6e7c9;
  text-wrap: balance;
}

.chapter-subtitle {
  margin: 17px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.08rem, 1.8vw, 1.38rem);
  color: rgba(245, 224, 185, 0.7);
}

.chapter-weather {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(189, 233, 220, 0.78);
}

.chapter-weather__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(121, 216, 194, 0.7);
  animation: breathe 3s ease-in-out infinite;
}

.chapter-weather small {
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(238, 229, 211, 0.35);
}

.chapter-quote {
  margin: clamp(24px, 4vh, 42px) 0;
  padding: 6px 0 6px 20px;
  border-left: 1px solid rgba(241, 195, 108, 0.58);
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 2vw, 1.6rem);
  font-style: italic;
  line-height: 1.45;
  color: rgba(255, 239, 207, 0.82);
}

.ornament-line {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 330px;
  margin: 0 0 22px;
  color: rgba(241, 195, 108, 0.52);
}

.ornament-line span {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(241, 195, 108, 0.36));
}

.ornament-line span:last-child {
  background: linear-gradient(90deg, rgba(241, 195, 108, 0.36), transparent);
}

.ornament-line svg {
  width: 17px;
  height: 17px;
}

.chapter-objective {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: clamp(26px, 4vh, 42px);
}

.chapter-objective__label {
  font-size: 8px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(240, 230, 210, 0.42);
}

.chapter-objective strong {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(247, 238, 219, 0.84);
}

.chapter-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.chapter-roman {
  position: fixed;
  right: clamp(12px, 6vw, 110px);
  bottom: -0.18em;
  z-index: 0;
  font-family: var(--font-display);
  font-size: clamp(16rem, 38vw, 38rem);
  font-weight: 500;
  line-height: 0.7;
  color: rgba(247, 230, 195, 0.035);
  pointer-events: none;
  user-select: none;
}

/* ------------------------------------------------------------------ */
/* Modal panels                                                       */
/* ------------------------------------------------------------------ */

.screen--modal {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 8, 10, 0.56);
  backdrop-filter: blur(13px) saturate(0.8);
  -webkit-backdrop-filter: blur(13px) saturate(0.8);
  overflow-y: auto;
  z-index: 30;
}

.panel {
  position: relative;
  width: min(570px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: clamp(28px, 4.8vw, 50px);
  border: 1px solid rgba(241, 218, 172, 0.17);
  border-radius: 24px;
  background: var(--panel);
  box-shadow:
    0 50px 120px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 247, 223, 0.08);
  scrollbar-width: thin;
  scrollbar-color: rgba(241, 195, 108, 0.35) transparent;
  animation: panelIn 0.42s var(--ease-out) both;
}

.panel::-webkit-scrollbar,
.screen::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb,
.screen::-webkit-scrollbar-thumb {
  background: rgba(241, 195, 108, 0.28);
  border-radius: 99px;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 0%, rgba(247, 203, 110, 0.07), transparent 52%);
}

.panel > * {
  position: relative;
}

.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 5.2vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: #f7e9cc;
}

.panel__lede {
  margin: 16px 0 0;
  color: rgba(239, 230, 212, 0.66);
  font-size: 14px;
  line-height: 1.68;
  font-weight: 300;
}

.panel__close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  width: 38px;
  height: 38px;
  background: rgba(247, 238, 219, 0.045);
}

.panel__close svg {
  width: 15px;
  height: 15px;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 27px;
}

.panel-actions .button {
  justify-content: flex-start;
  width: 100%;
}

.panel-actions .button svg {
  margin-left: 2px;
}

.panel-actions--row {
  flex-direction: row;
  flex-wrap: wrap;
}

.panel-actions--row .button {
  width: auto;
  flex: 1 1 220px;
}

.panel--pause .button--primary {
  justify-content: center;
}

.panel__current {
  margin-top: 22px;
  padding: 12px 15px;
  border: 1px solid rgba(241, 218, 172, 0.11);
  border-radius: 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240, 230, 210, 0.5);
  background: rgba(2, 9, 11, 0.28);
}

.panel__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(247, 238, 219, 0.08);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(238, 229, 211, 0.35);
}

.sound-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 229, 211, 0.5);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.sound-switch:hover {
  color: var(--cream);
  background: rgba(247, 238, 219, 0.05);
}

.sound-switch .sound-icon {
  width: 16px;
  height: 16px;
}

/* Help -------------------------------------------------------------- */

.panel--help {
  width: min(760px, 100%);
}

.controls-grid {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.control-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(247, 238, 219, 0.07);
}

.control-row:last-child {
  border-bottom: 0;
}

.control-row__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(241, 218, 172, 0.16);
  border-radius: 10px;
  color: var(--gold-soft);
  background: rgba(2, 9, 11, 0.25);
}

.control-row__icon svg {
  width: 17px;
  height: 17px;
}

.control-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.control-row strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--cream);
}

.control-row span {
  font-size: 11px;
  color: rgba(239, 230, 212, 0.5);
}

kbd {
  display: inline-block;
  min-width: 19px;
  padding: 1px 5px;
  border: 1px solid rgba(247, 238, 219, 0.2);
  border-bottom-color: rgba(247, 238, 219, 0.3);
  border-radius: 4px;
  background: rgba(247, 238, 219, 0.05);
  color: rgba(246, 234, 210, 0.8);
  font-family: var(--font-sans);
  font-size: 9px;
  text-align: center;
}

.help-notes {
  display: grid;
  gap: 14px;
  margin: 24px 0 28px;
  padding: 20px;
  border: 1px solid rgba(117, 216, 194, 0.14);
  border-radius: 16px;
  background: rgba(6, 23, 24, 0.38);
}

.help-notes > div {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
}

.help-notes__mark {
  font-family: var(--font-display);
  font-size: 11px;
  color: rgba(241, 195, 108, 0.6);
}

.help-notes p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(239, 230, 212, 0.55);
}

.help-notes strong {
  color: rgba(247, 238, 219, 0.86);
  font-weight: 500;
}

.panel__done {
  width: 100%;
}

.panel__small {
  margin: 14px 0 0;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(238, 229, 211, 0.32);
  text-align: center;
}

/* Results ----------------------------------------------------------- */

.panel--result {
  width: min(650px, 100%);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 28px 0 0;
  border: 1px solid rgba(241, 218, 172, 0.12);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(241, 218, 172, 0.08);
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 15px 14px;
  background: rgba(3, 12, 14, 0.68);
}

.result-stats__label {
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 230, 212, 0.38);
}

.result-stats strong {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.result-stats small {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(239, 230, 212, 0.3);
}

.result-quote {
  margin: 23px 0 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-style: italic;
  color: rgba(247, 230, 194, 0.62);
}

.gameover-mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 10px auto 4px;
  border-radius: 50%;
  color: rgba(229, 130, 112, 0.6);
  border: 1px solid rgba(229, 130, 112, 0.24);
  background: radial-gradient(circle, rgba(229, 130, 112, 0.08), transparent 70%);
}

.gameover-mark svg {
  width: 32px;
  height: 32px;
}

.screen--gameover .panel {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(143, 57, 45, 0.14), transparent 58%),
    var(--panel);
  border-color: rgba(229, 130, 112, 0.21);
}

.screen--gameover .panel h2 {
  color: #f1cbb5;
}

/* Victory ----------------------------------------------------------- */

.screen--victory {
  background: rgba(3, 10, 12, 0.44);
}

.panel--victory {
  width: min(690px, 100%);
  border-color: rgba(255, 220, 146, 0.36);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(253, 213, 137, 0.16), transparent 48%),
    linear-gradient(150deg, rgba(34, 34, 23, 0.97), rgba(6, 15, 17, 0.98) 64%);
  box-shadow:
    0 50px 140px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(247, 200, 108, 0.1);
}

.panel--victory h2 {
  font-size: clamp(3.2rem, 6.6vw, 5rem);
  color: #fff0ca;
  text-shadow: 0 0 40px rgba(255, 214, 135, 0.18);
}

.victory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 30px 0;
}

.victory-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 229, 172, 0.14);
  border-radius: 12px;
  background: rgba(4, 12, 13, 0.38);
}

.victory-stats span {
  font-size: 8px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: rgba(247, 230, 194, 0.42);
}

.victory-stats strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold-soft);
}

.victory-note {
  margin: 0 0 24px;
  padding: 17px 0;
  border-top: 1px solid rgba(255, 229, 172, 0.12);
  border-bottom: 1px solid rgba(255, 229, 172, 0.12);
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  line-height: 1.65;
  color: rgba(255, 239, 206, 0.68);
}

.victory-note em {
  color: var(--gold-soft);
}

/* ------------------------------------------------------------------ */
/* Landscape gate                                                     */
/* ------------------------------------------------------------------ */

.screen--rotate {
  z-index: 40;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background:
    radial-gradient(ellipse at 70% 22%, rgba(44, 100, 92, 0.3), transparent 52%),
    rgba(2, 8, 10, 0.94);
  backdrop-filter: blur(12px);
}

.rotate-card {
  width: min(470px, 100%);
  text-align: left;
}

.rotate-card__device {
  position: relative;
  width: 150px;
  height: 142px;
  margin: 0 auto 30px;
  display: grid;
  place-items: center;
}

.device {
  position: relative;
  width: 66px;
  height: 116px;
  border: 2px solid rgba(247, 238, 219, 0.55);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(25, 61, 61, 0.6), rgba(3, 12, 15, 0.85));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), 0 0 34px rgba(241, 195, 108, 0.08);
  animation: deviceTurn 3.8s var(--ease-soft) infinite;
}

.device::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: rgba(247, 238, 219, 0.3);
  transform: translateX(-50%);
}

.device__screen {
  position: absolute;
  inset: 15px 6px 12px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 70% 30%, rgba(247, 201, 119, 0.45), transparent 32%),
    linear-gradient(180deg, #0d343c, #061419);
}

.device__lantern {
  position: absolute;
  left: 50%;
  top: 48%;
  color: var(--gold-soft);
  transform: translate(-50%, -50%);
}

.device__lantern svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 12px rgba(255, 211, 129, 0.7));
}

.rotate-arrow {
  position: absolute;
  right: 2px;
  bottom: 14px;
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--gold-soft);
  opacity: 0.75;
  animation: rotateArrow 3.8s var(--ease-soft) infinite;
}

.rotate-card h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.7rem, 11vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.025em;
  color: #f7e9cc;
}

.rotate-card__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 28px;
}

.rotate-card__actions .button {
  padding-left: 0;
}

@keyframes deviceTurn {
  0%, 18% { transform: rotate(0deg); }
  42%, 72% { transform: rotate(90deg); }
  92%, 100% { transform: rotate(0deg); }
}

@keyframes rotateArrow {
  0%, 18% { transform: rotate(0deg); }
  42%, 72% { transform: rotate(-90deg); }
  92%, 100% { transform: rotate(0deg); }
}

/* ------------------------------------------------------------------ */
/* Animations                                                         */
/* ------------------------------------------------------------------ */

@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 980px) {
  .screen--title {
    padding-left: clamp(22px, 5vw, 48px);
    padding-right: clamp(22px, 5vw, 48px);
    background:
      linear-gradient(90deg, rgba(3, 11, 15, 0.68) 0%, rgba(3, 11, 15, 0.34) 50%, transparent 82%),
      linear-gradient(0deg, rgba(3, 11, 15, 0.5), transparent 32%);
  }
  .title-main {
    width: min(620px, 78vw);
  }
  .brandmark__text {
    display: none;
  }
  .title-foot {
    font-size: 8px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .screen--title {
    padding-top: 14px;
    padding-bottom: 12px;
  }
  .title-main {
    padding: 1vh 0;
    width: min(600px, 68vw);
  }
  .eyebrow {
    margin-bottom: 8px;
    font-size: 8px;
  }
  .logo {
    font-size: clamp(3.5rem, 8.6vw, 5.9rem);
  }
  .tagline {
    margin-top: 9px;
    font-size: 1.15rem;
  }
  .lede {
    display: none;
  }
  .title-actions {
    margin-top: 18px;
  }
  .button {
    min-height: 46px;
    padding: 9px 20px;
    font-size: 13px;
  }
  .title-record {
    margin-top: 10px;
    padding-top: 8px;
    font-size: 8px;
  }
  .title-record__label {
    display: none;
  }
  .chapter-select {
    margin-top: 9px;
    gap: 5px;
  }
  .chapter-chip {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 8px;
  }
  .chapter-chip__name {
    display: none;
  }
  .chapter-chip__weather {
    display: inline;
    font-size: 6px;
  }
  .chapter-chip__sigils {
    display: none;
  }
  .chapter-chip__roman {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
  .title-foot {
    padding-top: 10px;
  }
  .screen--chapter {
    padding-top: 20px;
    padding-bottom: 20px;
    align-items: flex-start;
  }
  .chapter-title {
    font-size: clamp(2.4rem, 5.3vw, 4.1rem);
  }
  .chapter-quote {
    margin: 15px 0;
    font-size: 1.05rem;
  }
  .chapter-subtitle {
    margin-top: 8px;
    font-size: 1rem;
  }
  .chapter-objective {
    margin-bottom: 18px;
  }
  .ornament-line {
    display: none;
  }
  .chapter-roman {
    font-size: 22rem;
  }
  .panel {
    padding: 24px 30px;
    border-radius: 20px;
  }
  .panel h2 {
    font-size: clamp(2rem, 4.4vw, 2.9rem);
  }
  .panel__lede {
    margin-top: 10px;
    font-size: 12px;
  }
  .panel-actions {
    margin-top: 17px;
  }
  .controls-grid {
    margin-top: 16px;
    grid-template-columns: 1fr 1fr;
    gap: 6px 18px;
  }
  .control-row {
    padding: 7px 0;
    grid-template-columns: 36px 1fr;
  }
  .control-row__icon {
    width: 36px;
    height: 36px;
  }
  .help-notes {
    margin: 16px 0 18px;
    padding: 14px;
    gap: 8px;
  }
  .panel__small {
    display: none;
  }
  .panel__done {
    margin-top: 4px;
  }
  .result-stats {
    margin-top: 18px;
  }
  .result-stats > div {
    padding: 10px 12px;
  }
  .result-stats strong {
    font-size: 21px;
  }
  .result-quote {
    margin-top: 14px;
  }
  .victory-stats {
    margin: 18px 0;
  }
  .victory-note {
    margin-bottom: 15px;
    padding: 12px 0;
  }
  .touch-button {
    width: 60px;
    height: 60px;
  }
  .touch-button--jump {
    width: 76px;
    height: 76px;
  }
  .touch-button--dash {
    width: 55px;
    height: 55px;
  }
  .boss-hud {
    top: 64px;
  }
}

@media (orientation: portrait) {
  .screen--title {
    padding:
      max(18px, env(safe-area-inset-top))
      clamp(20px, 6vw, 32px)
      max(18px, env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(3, 11, 15, 0.82) 0%, rgba(3, 11, 15, 0.46) 42%, rgba(3, 11, 15, 0.08) 68%, rgba(3, 11, 15, 0.5) 100%);
    overflow-y: auto;
  }
  .title-main {
    width: 100%;
    margin-top: max(28px, 5vh);
    margin-bottom: auto;
    padding: 4vh 0 5vh;
  }
  .logo {
    font-size: clamp(2.7rem, 12.6vw, 4.9rem);
    letter-spacing: 0.012em;
  }
  .tagline {
    margin-top: 12px;
    font-size: clamp(1.2rem, 5.2vw, 1.55rem);
  }
  .lede {
    margin-top: 13px;
    max-width: 38ch;
    font-size: 0.92rem;
    line-height: 1.6;
  }
  .title-actions {
    margin-top: 22px;
    width: 100%;
    flex-direction: column;
  }
  .title-actions .button {
    width: 100%;
  }
  .button--primary .button__content {
    align-items: flex-start;
  }
  .title-record {
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 12px;
    font-size: 8.5px;
    gap: 6px;
  }
  .chapter-select {
    margin-top: 11px;
  }
  .chapter-chip {
    gap: 5px;
    padding: 6px;
    justify-content: center;
  }
  .chapter-chip__name,
  .chapter-chip__sigils {
    display: none;
  }
  .chapter-chip__weather {
    display: inline;
    margin-left: 0;
    font-size: 6.5px;
  }
  .title-record__label {
    width: 100%;
    margin-bottom: 2px;
  }
  .title-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 8px;
    letter-spacing: 0.12em;
  }
  .title-nav {
    flex: none;
  }
  .brandmark__mark {
    width: 30px;
    height: 30px;
  }
  .text-button span {
    display: none;
  }
  .screen--chapter {
    padding: 22px;
    background:
      linear-gradient(180deg, rgba(2, 8, 10, 0.9), rgba(2, 8, 10, 0.64)),
      radial-gradient(ellipse at 70% 20%, rgba(23, 61, 58, 0.4), transparent 58%);
    align-items: stretch;
    justify-content: center;
    overflow-y: auto;
  }
  .chapter-title {
    font-size: clamp(2.6rem, 13vw, 4rem);
  }
  .chapter-quote {
    margin: 18px 0;
    font-size: 1.08rem;
  }
  .chapter-subtitle {
    font-size: 1rem;
  }
  .chapter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .chapter-actions .button {
    width: 100%;
  }
  .chapter-roman {
    display: none;
  }
  .panel {
    padding: 28px 22px;
    max-height: calc(100dvh - 32px);
    border-radius: 20px;
  }
  .screen--modal {
    padding: 16px;
  }
  .panel h2 {
    font-size: clamp(2.25rem, 11vw, 3.2rem);
  }
  .controls-grid {
    gap: 4px;
  }
  .control-row {
    grid-template-columns: 36px 1fr;
    gap: 10px;
    padding: 8px 0;
  }
  .control-row__icon {
    width: 36px;
    height: 36px;
  }
  .help-notes {
    padding: 14px;
    margin: 18px 0;
  }
  .result-stats {
    grid-template-columns: 1fr 1fr;
  }
  .victory-stats {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .panel-actions--row {
    flex-direction: column;
  }
  .panel-actions--row .button {
    width: 100%;
    flex: none;
  }
  .panel__foot {
    flex-wrap: wrap;
  }
  .toast {
    top: 22%;
    width: 90%;
  }
  .rotate-card {
    width: 100%;
    padding: 0 4px;
  }
  .rotate-card__device {
    margin-bottom: 22px;
  }
  .boss-hud {
    width: 88%;
  }
}

@media (hover: none) {
  .button:hover,
  .icon-button:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 24px;
  text-align: center;
}
