:root {
  color-scheme: dark;
  --ink: #070b0d;
  --navy: #081921;
  --teal: #0d3e42;
  --teal-bright: #70d0c7;
  --cream: #f6ecd8;
  --muted: #cdbf9f;
  --gold: #c9a45e;
  --gold-soft: #e8d093;
  --danger: #d78879;
  --panel: rgba(4, 13, 17, 0.91);
  --glass: rgba(8, 27, 33, 0.82);
  --border: rgba(218, 187, 117, 0.48);
  --transition-speed: 650ms;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(19, 77, 76, 0.28), transparent 42%),
    #020506;
  color: var(--cream);
  cursor:
    url('/images/cursors/pointer.cur') 6 0,
    url('/images/cursors/pointer.png') 6 0,
    auto;
  font-family: Georgia, "Times New Roman", serif;
}

a,
button,
label,
summary,
[role="button"],
[onclick],
input[type="button"],
input[type="submit"],
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 3px;
}

#game-viewport {
  display: grid;
  width: 100vw;
  height: 100dvh;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#vn-stage {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.9);
  container-type: inline-size;
  isolation: isolate;
}

#background-layer,
#background-layer-next {
  position: absolute;
  inset: 0;
  z-index: -5;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity var(--transition-speed) ease;
  transform: scale(1.015);
}

#background-layer-next {
  opacity: 0;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 22%, transparent 63%, rgba(0, 0, 0, 0.5)),
    radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.46));
}

#character-layer {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.character {
  position: absolute;
  bottom: -56%;
  left: var(--x);
  height: 160%;
  width: auto;
  max-width: none;
  opacity: 0;
  filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.65));
  image-rendering: auto;
  backface-visibility: hidden;
  transform: translate3d(-50%, 2.5%, 0);
  will-change: transform, opacity;
  transition:
    opacity calc(var(--transition-speed) * 0.7) ease,
    transform calc(var(--transition-speed) * 0.7) ease,
    filter 240ms ease;
}

.character.is-visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.character.is-speaking {
  filter: drop-shadow(0 15px 24px rgba(0, 0, 0, 0.75)) brightness(1.04);
}

.cast-count-2 .character {
  bottom: -41%;
  height: 138%;
}

.cast-count-3 .character {
  bottom: -22%;
  height: 118%;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.is-active {
  display: block;
}

#title-screen {
  z-index: 6;
  padding: 7.5% 7.5% 5%;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(3, 12, 15, 0.92), rgba(3, 12, 15, 0.25) 48%, rgba(3, 12, 15, 0.72)),
    linear-gradient(to top, rgba(2, 8, 10, 0.86), transparent 56%);
}

.title-sigil {
  display: flex;
  flex-direction: column;
  width: 6.6cqw;
  min-width: 54px;
  aspect-ratio: 0.9;
  margin: 0 auto 1.4cqw;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(232, 208, 147, 0.8);
  border-radius: 50% 50% 16% 16% / 38% 38% 16% 16%;
  background:
    linear-gradient(145deg, rgba(232, 208, 147, 0.1), transparent 46%),
    rgba(4, 19, 23, 0.78);
  box-shadow:
    inset 0 0 0 4px rgba(201, 164, 94, 0.08),
    inset 0 -1.8cqw 2.4cqw rgba(0, 0, 0, 0.2),
    0 0 30px rgba(201, 164, 94, 0.15);
  color: var(--gold-soft);
}

.title-sigil .title-mark {
  margin: -0.3cqw 0 -0.2cqw;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.3cqw;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0 18px rgba(232, 208, 147, 0.2);
}

.title-sigil .title-wordmark {
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 0.48cqw;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.5cqw;
  color: var(--teal-bright);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 0.92cqw;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

#game-title {
  margin: 0;
  color: var(--cream);
  font-size: 5.2cqw;
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 0.88;
  text-shadow: 0 4px 25px #000;
}

#game-title span {
  display: block;
  color: var(--gold-soft);
  font-size: 0.52em;
  font-style: italic;
  letter-spacing: 0.12em;
}

.title-tagline {
  margin: 1.8cqw 0 2.3cqw;
  color: var(--muted);
  font-size: 1.2cqw;
  font-style: italic;
  letter-spacing: 0.04em;
}

.title-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 12.5cqw));
  gap: 0.72cqw;
  justify-content: center;
}

button {
  border: 1px solid var(--border);
  border-radius: 3px;
  background:
    linear-gradient(120deg, rgba(15, 59, 63, 0.86), rgba(6, 24, 29, 0.9));
  color: var(--cream);
  letter-spacing: 0.06em;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--gold-soft);
  background: linear-gradient(120deg, rgba(19, 79, 82, 0.95), rgba(8, 34, 40, 0.95));
  color: #fff9e9;
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.title-actions button {
  min-height: 2.8cqw;
  padding: 0.65cqw 1cqw;
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 0.95cqw;
  text-transform: uppercase;
}

.conclave-return {
  display: inline-block;
  margin-top: 1.45cqw;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.84cqw;
  letter-spacing: 0.08em;
  text-underline-offset: 4px;
}

.game-topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.35cqw 1.7cqw;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
  pointer-events: none;
}

.game-topbar > * {
  pointer-events: auto;
}

#chapter-label {
  display: block;
  color: var(--gold-soft);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 0.86cqw;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#location-label {
  display: block;
  margin-top: 0.24cqw;
  color: rgba(246, 236, 216, 0.78);
  font-size: 0.9cqw;
  font-style: italic;
}

.topbar-actions {
  display: flex;
  gap: 0.45cqw;
}

.icon-button {
  display: grid;
  width: 2.55cqw;
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: rgba(4, 16, 20, 0.76);
  font-family: Arial, sans-serif;
  font-size: 1.1cqw;
}

#dialogue-ui {
  position: absolute;
  right: 2.1%;
  bottom: 2.1%;
  left: 2.1%;
  z-index: 5;
  min-height: 27.5%;
  padding: 1.3cqw 2cqw 0.9cqw;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-top-color: rgba(232, 208, 147, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(9, 38, 43, 0.92), rgba(3, 13, 17, 0.95)),
    var(--glass);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(9px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.ui-hidden #dialogue-ui,
.ui-hidden .game-topbar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12%);
}

#restore-dialogue {
  position: absolute;
  bottom: 3.1%;
  left: 50%;
  z-index: 12;
  min-width: 12.5cqw;
  padding: 0.62cqw 1.1cqw;
  border-color: rgba(232, 208, 147, 0.82);
  border-radius: 999px;
  background: rgba(4, 24, 28, 0.93);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 20px rgba(80, 210, 204, 0.12);
  color: var(--gold-soft);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 0.78cqw;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

#restore-dialogue span {
  display: inline-grid;
  min-width: 1.45em;
  min-height: 1.45em;
  margin-left: 0.45em;
  place-items: center;
  border: 1px solid rgba(232, 208, 147, 0.45);
  border-radius: 4px;
  font-size: 0.82em;
}

.ui-hidden #restore-dialogue {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translate(-50%, 0);
}

.dialogue-ornament {
  position: absolute;
  top: -1px;
  left: 7%;
  width: 22%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.speaker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65cqw;
}

#speaker-name {
  margin: 0;
  color: var(--gold-soft);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 1.18cqw;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

#dialogue-text {
  max-width: 91%;
  min-height: 4.65cqw;
  margin: 0;
  color: #fff9e9;
  font-size: 1.38cqw;
  line-height: 1.46;
  text-shadow: 0 2px 3px #000;
}

.mode-indicators {
  display: flex;
  gap: 0.45cqw;
  font-family: Arial, sans-serif;
  font-size: 0.66cqw;
}

.mode-indicators span {
  display: none;
  padding: 0.25cqw 0.42cqw;
  border: 1px solid rgba(112, 208, 199, 0.48);
  border-radius: 2px;
  color: var(--teal-bright);
}

.mode-indicators span.is-active {
  display: inline-block;
}

#continue-indicator {
  position: absolute;
  right: 1.55cqw;
  bottom: 1.45cqw;
  width: 0.58cqw;
  height: 0.58cqw;
  border-right: 2px solid var(--gold-soft);
  border-bottom: 2px solid var(--gold-soft);
  opacity: 0;
  transform: rotate(45deg);
}

#continue-indicator.is-visible {
  animation: continue-pulse 1s ease-in-out infinite;
}

@keyframes continue-pulse {
  0%, 100% { opacity: 0.3; transform: rotate(45deg) translate(0, 0); }
  50% { opacity: 1; transform: rotate(45deg) translate(3px, 3px); }
}

.quick-controls {
  display: flex;
  gap: 0.35cqw;
  justify-content: center;
  margin-top: auto;
  padding-top: 0.8cqw;
}

.quick-controls button {
  padding: 0.25cqw 0.55cqw;
  border-color: rgba(205, 191, 159, 0.23);
  background: rgba(0, 0, 0, 0.24);
  color: rgba(246, 236, 216, 0.72);
  font-family: Arial, sans-serif;
  font-size: 0.65cqw;
  letter-spacing: 0.03em;
}

.controls-note {
  padding: 0.7cqw 0.85cqw;
  border-left: 3px solid rgba(80, 210, 204, 0.7);
  background: rgba(9, 42, 47, 0.42);
}

.controls-help {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8cqw;
}

.controls-help section {
  padding: 0.9cqw 1cqw;
  border: 1px solid rgba(205, 191, 159, 0.2);
  border-radius: 6px;
  background: rgba(4, 19, 23, 0.56);
}

.controls-help h3 {
  margin: 0 0 0.35cqw;
  color: var(--gold-soft);
  font-size: 1cqw;
}

.controls-help p {
  margin: 0;
}

.controls-help kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.08em 0.38em;
  border: 1px solid rgba(232, 208, 147, 0.5);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff9e9;
  font-family: Arial, sans-serif;
  font-size: 0.85em;
  text-align: center;
}

#choice-layer {
  position: absolute;
  top: 18%;
  right: 15%;
  left: 15%;
  z-index: 8;
  display: grid;
  gap: 0.72cqw;
  pointer-events: none;
}

#choice-layer.is-active {
  pointer-events: auto;
}

.choice-button {
  min-height: 3.15cqw;
  padding: 0.72cqw 1.2cqw;
  border-color: rgba(232, 208, 147, 0.65);
  background:
    linear-gradient(90deg, rgba(5, 24, 29, 0.97), rgba(13, 56, 60, 0.95), rgba(5, 24, 29, 0.97));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 1.05cqw;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  animation: choice-in 280ms ease forwards;
}

.choice-button small {
  display: block;
  margin-top: 0.22cqw;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72em;
  letter-spacing: 0.02em;
}

@keyframes choice-in {
  to { opacity: 1; transform: translateY(0); }
}

.modal-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 3.5%;
  place-items: center;
  background: rgba(0, 5, 8, 0.77);
  backdrop-filter: blur(8px);
}

.modal-panel.is-open {
  display: grid;
}

.panel-card {
  width: min(47cqw, 92%);
  max-height: 89%;
  padding: 2.2cqw;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(11, 46, 50, 0.95), rgba(4, 15, 19, 0.98) 55%),
    var(--panel);
  box-shadow: 0 25px 70px #000;
}

.panel-card h2 {
  margin: 0 0 1.1cqw;
  color: var(--gold-soft);
  font-size: 2.2cqw;
  font-weight: 400;
}

.panel-card p,
.panel-card label,
.panel-card li {
  font-size: 1.02cqw;
  line-height: 1.5;
}

.notice-card {
  width: min(44cqw, 92%);
}

.age-check {
  display: flex;
  gap: 0.75cqw;
  align-items: flex-start;
  margin: 1.5cqw 0 1.2cqw;
  padding: 0.85cqw;
  border: 1px solid rgba(112, 208, 199, 0.25);
  background: rgba(0, 0, 0, 0.2);
}

.age-check input {
  width: 1.2cqw;
  height: 1.2cqw;
  accent-color: var(--teal-bright);
}

.name-field {
  display: grid;
  gap: 0.45cqw;
  color: var(--gold-soft);
}

.name-field input,
.setting-row input[type="range"] {
  width: 100%;
}

.name-field input {
  padding: 0.75cqw 0.9cqw;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.36);
  color: var(--cream);
}

.field-note {
  margin: 0.55cqw 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.78cqw !important;
}

.panel-actions {
  display: flex;
  gap: 0.7cqw;
  justify-content: flex-end;
  margin-top: 1.5cqw;
}

.panel-actions button,
.pause-grid button {
  padding: 0.72cqw 1cqw;
  font-family: Arial, sans-serif;
  font-size: 0.86cqw;
  text-transform: uppercase;
}

.panel-actions .secondary {
  background: rgba(0, 0, 0, 0.24);
}

.pause-card {
  width: min(40cqw, 90%);
  text-align: center;
}

.pause-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65cqw;
}

.shortcut-line {
  margin: 1.2cqw 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72cqw !important;
}

.wide-card {
  width: min(66cqw, 94%);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(205, 191, 159, 0.22);
}

.panel-heading h2 {
  margin-bottom: 0.8cqw;
}

.panel-close {
  width: 2.4cqw;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 1.5cqw;
}

.panel-content {
  padding-top: 1.1cqw;
}

.save-grid,
.ending-grid,
.relationship-grid,
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8cqw;
}

.save-slot,
.ending-card,
.relationship-card,
.evidence-card {
  min-height: 8.3cqw;
  padding: 0.9cqw;
  border: 1px solid rgba(205, 191, 159, 0.25);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
}

.save-slot h3,
.ending-card h3,
.relationship-card h3,
.evidence-card h3 {
  margin: 0 0 0.45cqw;
  color: var(--gold-soft);
  font-size: 1.08cqw;
}

.save-slot p,
.ending-card p,
.relationship-card p,
.evidence-card p {
  margin: 0.22cqw 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72cqw;
}

.evidence-card {
  display: flex;
  flex-direction: column;
  gap: 0.35cqw;
}

.evidence-card.is-locked {
  opacity: 0.48;
  filter: saturate(0.25);
}

.evidence-card button {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.42cqw 0.7cqw;
  font-family: Arial, sans-serif;
  font-size: 0.68cqw;
  text-transform: uppercase;
}

.evidence-connection {
  padding-top: 0.42cqw;
  border-top: 1px solid rgba(112, 208, 199, 0.2);
  color: var(--cream) !important;
}

.evidence-progress,
.evidence-note {
  color: var(--muted);
  font-family: Arial, sans-serif;
}

.slot-actions {
  display: flex;
  gap: 0.45cqw;
  margin-top: 0.8cqw;
}

.slot-actions button {
  flex: 1;
  padding: 0.45cqw;
  font-size: 0.68cqw;
}

.ending-card {
  position: relative;
  overflow: hidden;
}

.ending-card.is-locked {
  filter: saturate(0);
}

.ending-card.is-locked::after {
  content: "?";
  position: absolute;
  right: 0.6cqw;
  bottom: -0.6cqw;
  color: rgba(246, 236, 216, 0.08);
  font-size: 5.5cqw;
}

.history-list {
  max-height: 38cqw;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  padding: 0.75cqw 0;
  border-bottom: 1px solid rgba(205, 191, 159, 0.14);
}

.history-list strong {
  display: block;
  margin-bottom: 0.18cqw;
  color: var(--gold-soft);
  font-family: Arial, sans-serif;
  font-size: 0.75cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-list span {
  color: var(--cream);
  font-size: 0.94cqw;
}

.settings-grid {
  display: grid;
  gap: 1cqw;
}

.setting-row {
  display: grid;
  grid-template-columns: 10cqw 1fr 4cqw;
  gap: 1cqw;
  align-items: center;
}

.setting-row label,
.setting-row output {
  font-family: Arial, sans-serif;
  font-size: 0.82cqw;
}

.setting-row output {
  color: var(--gold-soft);
  text-align: right;
}

.credits-copy a {
  color: var(--teal-bright);
}

.credits-copy h3 {
  margin: 1.25cqw 0 0.4cqw;
  color: var(--gold-soft);
  font-size: 1.1cqw;
}

#scene-fade {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

#scene-fade.is-active {
  opacity: 1;
  pointer-events: auto;
}

#fade-caption {
  max-width: 65%;
  color: var(--gold-soft);
  font-size: 1.35cqw;
  font-style: italic;
  letter-spacing: 0.08em;
  text-align: center;
}

#toast {
  position: absolute;
  top: 5.4cqw;
  left: 50%;
  z-index: 40;
  padding: 0.6cqw 1cqw;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(3, 16, 20, 0.94);
  color: var(--cream);
  font-family: Arial, sans-serif;
  font-size: 0.78cqw;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@media (max-width: 760px), (max-height: 500px) {
  .title-actions {
    grid-template-columns: repeat(3, 14.5cqw);
  }

  .title-actions button {
    min-height: 3.5cqw;
    font-size: 1.2cqw;
  }

  .conclave-return,
  .eyebrow {
    font-size: 1.15cqw;
  }

  #dialogue-text {
    font-size: 1.65cqw;
  }

  #speaker-name {
    font-size: 1.4cqw;
  }

  .quick-controls button {
    font-size: 0.82cqw;
  }

  .panel-card p,
  .panel-card label,
  .panel-card li {
    font-size: 1.35cqw;
  }

  .save-grid,
  .ending-grid,
  .relationship-grid,
  .evidence-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-aspect-ratio: 4 / 5) {
  #vn-stage {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
  }

  #title-screen {
    padding: 11vh 7vw 5vh;
  }

  .title-sigil {
    width: 66px;
    margin-bottom: 18px;
  }

  .title-sigil .title-mark {
    margin: -3px 0 -1px;
    font-size: 34px;
  }

  .title-sigil .title-wordmark {
    font-size: 6px;
  }

  .eyebrow,
  .panel-kicker {
    margin-bottom: 7px;
    font-size: 11px;
  }

  #game-title {
    font-size: clamp(46px, 14vw, 66px);
  }

  .title-tagline {
    margin: 22px 0 24px;
    font-size: 16px;
  }

  .title-actions {
    grid-template-columns: repeat(2, minmax(0, 140px));
    gap: 9px;
  }

  .title-actions button {
    min-height: 44px;
    padding: 9px 12px;
    font-size: 12px;
  }

  .conclave-return {
    margin-top: 20px;
    font-size: 12px;
  }

  .game-topbar {
    padding: 14px 13px;
  }

  #chapter-label {
    max-width: 260px;
    font-size: 10px;
  }

  #location-label {
    margin-top: 3px;
    font-size: 11px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .icon-button {
    width: 34px;
    font-size: 15px;
  }

  .character {
    bottom: -35%;
    height: 125%;
  }

  .cast-count-2 .character {
    bottom: 0;
    left: clamp(20%, var(--x), 80%);
    height: 78%;
  }

  .cast-count-3 .character {
    bottom: 0;
    left: clamp(18%, var(--x), 82%);
    height: 65%;
  }

  #dialogue-ui {
    right: 10px;
    bottom: 11px;
    left: 10px;
    min-height: 28%;
    padding: 15px 16px 12px;
  }

  .speaker-row {
    margin-bottom: 8px;
  }

  #speaker-name {
    font-size: 14px;
  }

  #dialogue-text {
    max-width: 100%;
    min-height: 88px;
    font-size: 16px;
    line-height: 1.42;
  }

  .mode-indicators {
    gap: 5px;
    font-size: 9px;
  }

  .quick-controls {
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    padding-top: 12px;
  }

  .quick-controls button {
    padding: 5px 7px;
    font-size: 9px;
  }

  #restore-dialogue {
    bottom: 22px;
    min-width: 170px;
    padding: 10px 16px;
    font-size: 12px;
  }

  .controls-note {
    padding: 9px 11px;
  }

  .controls-help {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .controls-help section {
    padding: 11px 12px;
  }

  .controls-help h3 {
    margin-bottom: 5px;
    font-size: 14px;
  }

  #choice-layer {
    top: 17%;
    right: 5%;
    left: 5%;
    gap: 8px;
  }

  .choice-button {
    min-height: 50px;
    padding: 10px 13px;
    font-size: 14px;
  }

  .modal-panel {
    padding: 16px;
  }

  .panel-card,
  .notice-card,
  .pause-card,
  .wide-card {
    width: 100%;
    max-height: 92%;
    padding: 20px;
  }

  .panel-card h2 {
    margin-bottom: 12px;
    font-size: 25px;
  }

  .panel-card p,
  .panel-card label,
  .panel-card li {
    font-size: 14px;
  }

  .name-field {
    gap: 6px;
  }

  .name-field input {
    padding: 11px 12px;
  }

  .field-note,
  .shortcut-line {
    font-size: 11px !important;
  }

  .panel-actions {
    gap: 8px;
    margin-top: 18px;
  }

  .panel-actions button,
  .pause-grid button {
    padding: 10px 11px;
    font-size: 11px;
  }

  .panel-close {
    width: 34px;
    font-size: 20px;
  }

  .panel-content {
    padding-top: 12px;
  }

  .save-grid,
  .ending-grid,
  .relationship-grid,
  .evidence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .save-slot,
  .ending-card,
  .relationship-card,
  .evidence-card {
    min-height: 118px;
    padding: 10px;
  }

  .save-slot h3,
  .ending-card h3,
  .relationship-card h3,
  .evidence-card h3 {
    font-size: 13px;
  }

  .save-slot p,
  .ending-card p,
  .relationship-card p,
  .evidence-card p {
    font-size: 10px;
  }

  .evidence-card button,
  .slot-actions button {
    padding: 6px;
    font-size: 9px;
  }

  #toast {
    top: 72px;
    padding: 8px 12px;
    font-size: 11px;
  }
}

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