:root {
  color-scheme: dark;
  --ui-text-scale: 100%;
  --narration-text-size: 1rem;
  --layout-gap: 14px;
  --play-area-height: max(520px, calc(100vh - 124px));
  --content-max-width: calc(var(--play-area-height) + (var(--play-area-height) / 1.5625) + (var(--play-area-height) / 2.439) + var(--layout-gap) + var(--layout-gap));
  --available-content-width: min(calc(100vw - 36px), var(--content-max-width));
  --scene-pane-size: min(var(--play-area-height), calc((var(--available-content-width) - var(--layout-gap) - var(--layout-gap)) / 2.05));
  --terminal-pane-size: calc(var(--scene-pane-size) / 1.5625);
  --side-pane-size: calc(var(--scene-pane-size) / 2.439);
  --scene-max-size: min(100%, var(--play-area-height));
  --ink: #12110f;
  --ink-rgb: 18, 17, 15;
  --ink-2: #1b1715;
  --ink-2-rgb: 27, 23, 21;
  --panel-rgb: 25, 22, 20;
  --panel: rgba(var(--panel-rgb), 0.94);
  --paper: #f5ead8;
  --paper-rgb: 245, 234, 216;
  --muted: #bcae9e;
  --lacquer: #9f2540;
  --lacquer-rgb: 159, 37, 64;
  --lacquer-2: #d34a53;
  --lacquer-2-rgb: 211, 74, 83;
  --teal: #1f8b84;
  --teal-rgb: 31, 139, 132;
  --gold: #f0b85a;
  --gold-rgb: 240, 184, 90;
  --line: rgba(var(--paper-rgb), 0.16);
  --body-wash-a: rgba(var(--lacquer-rgb), 0.28);
  --body-wash-b: rgba(var(--teal-rgb), 0.24);
  --body-grid: rgba(255, 255, 255, 0.025);
  --chrome: rgba(var(--ink-rgb), 0.78);
  --chrome-strong: rgba(var(--ink-rgb), 0.97);
  --field-bg: rgba(255, 255, 255, 0.06);
  --field-focus-bg: rgba(255, 255, 255, 0.05);
  --level-0: #ffffff;
  --level-1: #4ea3ff;
  --level-2: #66d17a;
  --level-3: #f4d35e;
  --level-4: #f39a3d;
  --level-5: #e34f5f;
  --level-6: #e14fb6;
  --level-7: #9b5cff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  font-size: var(--ui-text-scale, 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

:root[data-color-scheme="sakura"] {
  --ink: #160d18;
  --ink-rgb: 22, 13, 24;
  --ink-2: #29162a;
  --ink-2-rgb: 41, 22, 42;
  --panel-rgb: 36, 21, 37;
  --paper: #fff0f7;
  --paper-rgb: 255, 240, 247;
  --muted: #e3bfd1;
  --lacquer: #d94f8f;
  --lacquer-rgb: 217, 79, 143;
  --lacquer-2: #ff85b7;
  --lacquer-2-rgb: 255, 133, 183;
  --teal: #65cfc8;
  --teal-rgb: 101, 207, 200;
  --gold: #ffd08a;
  --gold-rgb: 255, 208, 138;
  --body-wash-a: rgba(var(--lacquer-rgb), 0.34);
  --body-wash-b: rgba(255, 158, 204, 0.2);
}

:root[data-color-scheme="emerald"] {
  --ink: #0f1512;
  --ink-rgb: 15, 21, 18;
  --ink-2: #16221d;
  --ink-2-rgb: 22, 34, 29;
  --panel-rgb: 18, 28, 24;
  --paper: #edf6e9;
  --paper-rgb: 237, 246, 233;
  --muted: #abc2b3;
  --lacquer: #2f8061;
  --lacquer-rgb: 47, 128, 97;
  --lacquer-2: #58b589;
  --lacquer-2-rgb: 88, 181, 137;
  --teal: #46a9a8;
  --teal-rgb: 70, 169, 168;
  --gold: #e7bd67;
  --gold-rgb: 231, 189, 103;
  --body-wash-a: rgba(var(--lacquer-rgb), 0.28);
  --body-wash-b: rgba(var(--gold-rgb), 0.16);
}

:root[data-color-scheme="harbor"] {
  --ink: #0d1118;
  --ink-rgb: 13, 17, 24;
  --ink-2: #151c28;
  --ink-2-rgb: 21, 28, 40;
  --panel-rgb: 17, 22, 31;
  --paper: #edf3f6;
  --paper-rgb: 237, 243, 246;
  --muted: #abb9c2;
  --lacquer: #2f6f9f;
  --lacquer-rgb: 47, 111, 159;
  --lacquer-2: #4f9ed1;
  --lacquer-2-rgb: 79, 158, 209;
  --teal: #35a99a;
  --teal-rgb: 53, 169, 154;
  --gold: #e8c16e;
  --gold-rgb: 232, 193, 110;
  --body-wash-a: rgba(var(--lacquer-rgb), 0.26);
  --body-wash-b: rgba(var(--teal-rgb), 0.2);
}

:root[data-color-scheme="onsen"] {
  --ink: #15110e;
  --ink-rgb: 21, 17, 14;
  --ink-2: #211a14;
  --ink-2-rgb: 33, 26, 20;
  --panel-rgb: 27, 22, 17;
  --paper: #f6ead7;
  --paper-rgb: 246, 234, 215;
  --muted: #c5b39d;
  --lacquer: #a75337;
  --lacquer-rgb: 167, 83, 55;
  --lacquer-2: #d27b4a;
  --lacquer-2-rgb: 210, 123, 74;
  --teal: #4b9a83;
  --teal-rgb: 75, 154, 131;
  --gold: #e9be6b;
  --gold-rgb: 233, 190, 107;
  --body-wash-a: rgba(var(--lacquer-rgb), 0.24);
  --body-wash-b: rgba(var(--teal-rgb), 0.2);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.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;
}

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

body {
  background:
    linear-gradient(135deg, var(--body-wash-a), transparent 34%),
    linear-gradient(225deg, var(--body-wash-b), transparent 38%),
    repeating-linear-gradient(90deg, var(--body-grid) 0 1px, transparent 1px 44px),
    var(--ink);
  color: var(--paper);
}

body.menu-open {
  overflow: hidden;
}

.version-footer {
  position: fixed;
  left: 50%;
  bottom: 5px;
  z-index: 8;
  transform: translateX(-50%);
  color: rgba(245, 234, 216, 0.52);
  font-size: 0.68rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: wait;
  opacity: 0.64;
}

button:disabled:hover,
.chip:disabled:hover,
.is-loading-dimmed:hover {
  transform: none;
}

.is-loading-dimmed {
  cursor: wait;
  opacity: 0.52;
  filter: saturate(0.72);
}

.is-action-loading #sceneItemList button,
.is-action-loading #exitList button,
.is-action-loading #sideQuestList button {
  pointer-events: none;
}

.is-cooldown .chip {
  cursor: wait;
  opacity: 0.64;
  pointer-events: none;
}

a {
  color: var(--gold);
}

code {
  color: var(--gold);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar h1,
.setup-panel h1,
.modal-panel h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.eyebrow,
.side-label {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.menu-cluster {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.menu-toggle:hover,
.menu-toggle[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: rgba(var(--gold-rgb), 0.78);
  background: rgba(var(--gold-rgb), 0.12);
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--paper);
}

.menu-toggle svg,
.command-icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.scene-status-stack {
  position: absolute;
  right: 14px;
  bottom: 64px;
  z-index: 9;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(280px, calc(100% - 28px));
  pointer-events: none;
}

.credit-use-stack {
  position: relative;
  z-index: 3;
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  margin-bottom: 2px;
  max-width: 100%;
  min-width: max-content;
  pointer-events: none;
}

.credit-use-stack[hidden] {
  display: none;
}

.credit-use-float {
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  border: 1px solid rgba(118, 211, 145, 0.55);
  border-radius: 999px;
  padding: 4px 9px;
  color: #c9ffd6;
  background: rgba(31, 91, 54, 0.78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36), 0 0 18px rgba(118, 211, 145, 0.16);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: translateX(8px) scale(0.96);
  pointer-events: none;
}

.credit-use-float.is-visible {
  animation: creditUseFloat 2300ms ease forwards;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 34;
  opacity: 0;
  background: rgba(0, 0, 0, 0.46);
  transition: opacity 180ms ease;
}

.drawer-scrim.is-open {
  opacity: 1;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  width: min(360px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
  background: var(--chrome-strong);
  box-shadow: -22px 0 58px rgba(0, 0, 0, 0.46);
  transform: translateX(105%);
  transition: transform 200ms ease;
}

.nav-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.1;
}

.menu-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease;
}

.menu-close:hover {
  transform: translateY(-1px);
  background: rgba(var(--lacquer-2-rgb), 0.22);
}

.drawer-actions {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
}

.drawer-actions > * {
  width: 100%;
}

.credit-purchase-panel {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(var(--gold-rgb), 0.22);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.045);
}

.credit-purchase-panel[hidden] {
  display: none;
}

.star-spend-panel {
  display: grid;
  gap: 11px;
  border: 1px solid rgba(var(--teal-rgb), 0.3);
  border-radius: 8px;
  padding: 11px;
  background: linear-gradient(180deg, rgba(var(--teal-rgb), 0.12), rgba(255, 255, 255, 0.04));
}

.star-spend-panel[hidden] {
  display: none;
}

.star-spend-intro {
  margin: -2px 0 0;
  color: rgba(var(--paper-rgb), 0.78);
  font-size: 0.8rem;
  line-height: 1.35;
}

.drawer-fold {
  border: 1px solid rgba(var(--teal-rgb), 0.24);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.drawer-fold[open] {
  background: linear-gradient(180deg, rgba(var(--teal-rgb), 0.1), rgba(255, 255, 255, 0.04));
}

.drawer-language-fold {
  border-color: rgba(var(--gold-rgb), 0.28);
  background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.08), rgba(255, 255, 255, 0.035));
}

.drawer-fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 11px;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  list-style: none;
  text-transform: uppercase;
  user-select: none;
}

.drawer-fold summary::-webkit-details-marker {
  display: none;
}

.drawer-fold summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(var(--paper-rgb), 0.14);
  border-radius: 7px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.045);
  font-size: 1rem;
  line-height: 1;
}

.drawer-fold[open] summary::after {
  content: "-";
}

.drawer-fold-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(var(--paper-rgb), 0.1);
  padding: 11px;
}

.drawer-button-stack,
.visual-settings-panel,
.text-settings-panel,
.language-settings-panel {
  display: grid;
  gap: 9px;
}

.visual-settings-panel[hidden],
.text-settings-panel[hidden],
.language-settings-panel[hidden] {
  display: none;
}

.drawer-button-stack .ghost-action,
.drawer-fold .theme-select,
.star-spend-panel .voice-toggle {
  width: 100%;
}

.drawer-fold .theme-select {
  border-color: rgba(var(--gold-rgb), 0.34);
  background:
    linear-gradient(135deg, rgba(var(--gold-rgb), 0.12), rgba(var(--teal-rgb), 0.12)),
    rgba(var(--ink-rgb), 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.drawer-fold .theme-select:focus-within {
  border-color: rgba(var(--gold-rgb), 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 0 0 3px rgba(var(--gold-rgb), 0.12),
    0 14px 30px rgba(0, 0, 0, 0.22);
}

.drawer-fold .theme-select span {
  color: #ffe0a3;
  text-shadow: 0 0 12px rgba(var(--gold-rgb), 0.22);
}

.drawer-fold .theme-select select {
  border-color: rgba(var(--teal-rgb), 0.5);
  color: #fff7df;
  background:
    linear-gradient(45deg, transparent 50%, #ffe0a3 50%) calc(100% - 18px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, #ffe0a3 50%, transparent 50%) calc(100% - 13px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, rgba(var(--teal-rgb), 0.24), rgba(var(--lacquer-2-rgb), 0.16)),
    rgba(var(--panel-rgb), 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.drawer-fold .theme-select select:hover,
.drawer-fold .theme-select select:focus {
  border-color: rgba(var(--gold-rgb), 0.85);
  background:
    linear-gradient(45deg, transparent 50%, #fff7df 50%) calc(100% - 18px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, #fff7df 50%, transparent 50%) calc(100% - 13px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, rgba(var(--gold-rgb), 0.18), rgba(var(--teal-rgb), 0.24)),
    rgba(var(--panel-rgb), 1);
}

.drawer-button-stack .ghost-action[hidden] {
  display: none;
}

.voice-pitch-control {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(var(--teal-rgb), 0.25);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(var(--teal-rgb), 0.06);
}

.voice-pitch-control > span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.voice-pitch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.voice-pitch-row input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.voice-pitch-row output {
  min-width: 92px;
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.admin-cinemagraph-test-panel,
.admin-emoji-test-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(var(--gold-rgb), 0.28);
  border-radius: 8px;
  padding: 11px;
  background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.1), rgba(255, 255, 255, 0.04));
}

.admin-cinemagraph-test-panel[hidden],
.admin-emoji-test-panel[hidden],
.admin-beach-branch-test-grid[hidden] {
  display: none;
}

.admin-test-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.admin-test-button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

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

.visual-settings-panel .theme-select,
.text-settings-panel .theme-select {
  width: 100%;
}

.visual-spend-warning {
  margin: 0;
  color: rgba(var(--paper-rgb), 0.78);
  font-size: 0.78rem;
  line-height: 1.35;
}

.music-library-player {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(var(--gold-rgb), 0.22);
  border-radius: 8px;
  padding: 10px;
  background: rgba(var(--ink-rgb), 0.2);
}

.music-library-player[hidden] {
  display: none;
}

.drawer-fold .theme-select.music-library-select {
  display: grid;
  justify-items: stretch;
  gap: 7px;
  padding: 9px 10px;
}

.music-library-select span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.music-library-player audio {
  width: 100%;
  max-width: 100%;
  height: 38px;
  border-radius: 8px;
}

.music-library-player audio[hidden],
.music-library-player .fine-print[hidden] {
  display: none;
}

.credit-purchase-panel label {
  display: grid;
  gap: 6px;
}

.credit-purchase-panel label span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.credit-purchase-panel select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 8px;
  padding: 0 34px 0 11px;
  color: var(--paper);
  background:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%) calc(100% - 18px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--gold) 50%, transparent 50%) calc(100% - 13px) 50% / 7px 7px no-repeat,
    rgba(255, 255, 255, 0.055);
  appearance: none;
}

.credit-purchase-panel option {
  color: #12110f;
  background: #f5ead8;
}

.payment-button-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: stretch;
}

.paypal-button {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(255, 215, 64, 0.9);
  border-radius: 999px;
  padding: 0 16px;
  color: #10234d;
  background: linear-gradient(180deg, #ffe87c 0%, #ffc439 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.48);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.paypal-button[hidden] {
  display: none;
}

.paypal-button:hover,
.paypal-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.paypal-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  filter: grayscale(0.2);
}

.paypal-button-graphic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.paypal-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #ffffff;
  background: linear-gradient(135deg, #003087 0%, #009cde 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.42) inset;
  font-size: 1rem;
  font-weight: 950;
  font-style: italic;
}

.paypal-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: 0;
}

.paypal-wordmark span:first-child {
  color: #003087;
}

.paypal-wordmark span:last-child {
  color: #009cde;
}

.apple-pay-button-container {
  flex: 1 1 0;
  min-width: 0;
  display: block;
  min-height: 42px;
  width: 100%;
}

.apple-pay-button-container[hidden] {
  display: none;
}

.apple-pay-button-container.is-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.apple-pay-button-container apple-pay-button {
  display: block;
  width: 100%;
  height: 42px;
  --apple-pay-button-width: 100%;
  --apple-pay-button-height: 42px;
  --apple-pay-button-border-radius: 999px;
  --apple-pay-button-padding: 0;
}

.payment-status {
  min-height: 1.1em;
  margin: 0;
  color: var(--mint);
  font-size: 0.78rem;
  line-height: 1.35;
}

.payment-status.is-error {
  color: #ffb3bc;
}

.primary-action,
.ghost-action,
.command-line button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--paper);
  background: var(--lacquer);
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-action:hover,
.ghost-action:hover,
.command-line button:hover,
.chip:hover {
  transform: translateY(-1px);
  background: var(--lacquer-2);
}

.ghost-action {
  background: transparent;
  border: 1px solid var(--line);
}

.ghost-action.danger {
  border-color: rgba(var(--lacquer-2-rgb), 0.55);
}

.theme-select,
.voice-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  font-weight: 800;
}

.theme-select {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  min-height: auto;
  padding: 10px 12px;
}

.theme-select span {
  color: var(--gold);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
}

.theme-select select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 8px;
  padding: 0 34px 0 11px;
  outline: none;
  color: var(--paper);
  background:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%) calc(100% - 18px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--gold) 50%, transparent 50%) calc(100% - 13px) 50% / 7px 7px no-repeat,
    rgba(255, 255, 255, 0.055);
  appearance: none;
}

.theme-select select:focus {
  border-color: var(--gold);
}

.theme-select option {
  color: #12110f;
  background: #f5ead8;
}

.voice-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--teal);
}

.game-layout {
  width: min(var(--content-max-width), 100%);
  align-self: center;
  flex: 1;
  display: grid;
  grid-template-columns: var(--scene-pane-size) var(--terminal-pane-size) var(--side-pane-size);
  gap: var(--layout-gap);
  align-items: start;
  min-height: 0;
}

.scene-pane,
.terminal-pane,
.side-pane,
.setup-panel,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.scene-pane {
  width: var(--scene-pane-size);
  max-width: none;
  height: var(--scene-pane-size);
  aspect-ratio: 1 / 1;
  justify-self: center;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  overflow: visible;
  padding: 10px;
}

.scene-frame {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  overflow: visible;
  border-radius: 6px;
  background: #211b18;
}

.scene-frame img,
.scene-placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
  background: #211b18;
}

.cinemagraph-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.cinemagraph-layer[hidden] {
  display: none;
}

.cinemagraph-particle {
  position: absolute;
  left: var(--motion-left, 50%);
  top: var(--motion-top, 50%);
  width: var(--motion-size, 1rem);
  height: var(--motion-size, 1rem);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: cinemagraphFloat var(--motion-duration, 7s) ease-in-out infinite;
  animation-delay: var(--motion-delay, 0s);
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
}

.cinemagraph-rain {
  width: 2px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(190, 232, 255, 0.72));
  animation-name: cinemagraphRain;
  animation-timing-function: linear;
}

.cinemagraph-steam {
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent 68%);
  filter: blur(3px);
}

.cinemagraph-petal {
  width: calc(var(--motion-size, 1rem) * 0.68);
  height: calc(var(--motion-size, 1rem) * 1.18);
  border-radius: 80% 20% 70% 30%;
  background: linear-gradient(145deg, rgba(255, 204, 226, 0.9), rgba(255, 126, 180, 0.42));
  animation-name: cinemagraphPetal;
}

.cinemagraph-spark {
  width: calc(var(--motion-size, 1rem) * 0.72);
  height: calc(var(--motion-size, 1rem) * 0.72);
  background: rgba(255, 246, 184, 0.92);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.66);
}

.cinemagraph-spotlight {
  width: clamp(88px, 18%, 220px);
  height: 122%;
  border-radius: 999px 999px 38% 38%;
  background:
    radial-gradient(ellipse at 50% 4%, rgba(var(--spotlight-color, 255, 43, 194), 0.72), rgba(var(--spotlight-color, 255, 43, 194), 0.3) 32%, transparent 72%),
    linear-gradient(180deg, rgba(var(--spotlight-color, 255, 43, 194), 0.36), rgba(var(--spotlight-color, 255, 43, 194), 0.14) 46%, transparent 96%);
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
  filter: blur(1px) drop-shadow(0 0 22px rgba(var(--spotlight-color, 255, 43, 194), 0.62));
  transform-origin: 50% 0;
  animation-name: cinemagraphSpotlight;
  animation-timing-function: ease-in-out;
}

.cinemagraph-spotlight::after {
  content: "";
  position: absolute;
  inset: 0 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.08), transparent);
  filter: blur(5px);
}

.cinemagraph-heart {
  width: auto;
  height: auto;
  color: #ff9abb;
  font-size: var(--motion-size, 1.2rem);
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 94, 149, 0.72);
  animation-name: cinemagraphHeart;
}

.scene-recovery-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  min-height: 44px;
  max-width: calc(100% - 40px);
  border: 1px solid rgba(var(--gold-rgb), 0.58);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--paper);
  background: rgba(var(--ink-rgb), 0.82);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34), 0 0 22px rgba(var(--gold-rgb), 0.12);
  font-weight: 900;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
}

.scene-recovery-button:hover:not(:disabled),
.scene-recovery-button:focus-visible {
  border-color: rgba(var(--gold-rgb), 0.9);
  background: rgba(var(--lacquer-rgb), 0.84);
  outline: none;
}

.scene-recovery-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.scene-recovery-button.is-loading {
  pointer-events: none;
  border-color: rgba(var(--teal-rgb), 0.72);
  background: rgba(var(--ink-rgb), 0.9);
}

.scene-recovery-button[hidden] {
  display: none;
}

.emoji-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
}

.emoji-layer[hidden] {
  display: none;
}

.scene-emoji {
  position: absolute;
  left: var(--emoji-x, 50%);
  top: var(--emoji-y, 58%);
  font-size: var(--emoji-size, 1.75rem);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72) rotate(var(--emoji-tilt, 0deg));
  animation: emojiFlutter var(--emoji-duration, 3.4s) ease-out forwards;
  animation-delay: var(--emoji-delay, 0s);
}

.scene-placeholder {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(var(--teal-rgb), 0.34), transparent 45%),
    linear-gradient(25deg, rgba(var(--lacquer-rgb), 0.5), transparent 44%),
    #201715;
}

.scene-placeholder::before {
  content: "";
  position: absolute;
  inset: 12% 12% auto auto;
  width: 34%;
  height: 18%;
  border: 2px solid rgba(var(--gold-rgb), 0.68);
  transform: skew(-10deg);
  background: rgba(var(--ink-rgb), 0.42);
}

.street-lines {
  position: absolute;
  inset: 42% 0 0;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(245, 234, 216, 0.13) 38.5% 39.5%, transparent 40%),
    repeating-linear-gradient(0deg, transparent 0 32px, rgba(245, 234, 216, 0.08) 32px 33px);
  transform: perspective(500px) rotateX(58deg) scale(1.3);
  transform-origin: top center;
}

.scene-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  --caption-control-reserve: 190px;
  --caption-fit-scale: 1;
  --caption-progress-font-size: calc(0.56rem * var(--caption-fit-scale, 1));
  max-width: calc(100% - 28px);
  overflow: visible;
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(var(--ink-rgb), 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(6px) saturate(1.1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.76);
}

.scene-caption p,
.scene-caption h2 {
  margin: 0;
  max-width: max(0px, calc(100% - var(--caption-control-reserve, 190px)));
  min-width: 0;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-caption p {
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 800;
}

.scene-caption h2 {
  margin-top: 2px;
  font-size: 1.35rem;
  line-height: 1.1;
}

.connection-badge {
  display: inline-block;
  width: fit-content;
  max-width: max(0px, calc(100% - var(--caption-control-reserve, 190px)));
  min-width: 0;
  margin-top: 8px;
  border: 1px solid rgba(var(--gold-rgb), 0.52);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--paper);
  background: rgba(var(--lacquer-rgb), 0.42);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.connection-badge[hidden] {
  display: none;
}

.scene-progress-block {
  display: block;
  width: 100%;
  max-width: min(100%, 720px);
  margin-top: 5px;
}

.scene-progress-block[hidden] {
  display: none;
}

.scene-caption .connection-progress,
.scene-caption .connection-progress-wrap {
  gap: 2px;
}

.scene-caption .connection-progress {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 4px;
  row-gap: 2px;
}

.scene-caption .connection-progress-row {
  position: relative;
  display: block;
  height: 13px;
  min-height: 13px;
  overflow: hidden;
  border-color: rgba(245, 234, 216, 0.12);
  border-radius: 999px;
  padding: 0;
  background: rgba(0, 0, 0, 0.24);
}

.scene-caption .connection-progress-header {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 0 4px;
  pointer-events: none;
}

.scene-caption .connection-progress-header span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  width: auto;
  overflow: hidden;
  color: rgba(255, 247, 223, 0.98);
  font-size: var(--caption-progress-font-size, calc(0.56rem * var(--caption-fit-scale, 1)));
  line-height: 13px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
  white-space: nowrap;
}

.scene-caption .connection-progress-header strong {
  flex: 0 0 auto;
  min-width: 0;
  color: #fff7df;
  font-size: 0;
  line-height: 13px;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
  white-space: nowrap;
}

.scene-caption .connection-progress-header strong::after {
  content: attr(data-compact-value);
  font-size: var(--caption-progress-font-size, calc(0.56rem * var(--caption-fit-scale, 1)));
}

.scene-caption .connection-progress-subtext {
  display: none;
}

.scene-caption .connection-progress-track {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  border: 0;
  background: rgba(0, 0, 0, 0.22);
}

.scene-caption .connection-progress-fill {
  box-shadow: none;
  opacity: 0.92;
}

.scene-controls {
  position: absolute;
  right: 10px;
  top: 8px;
  bottom: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: auto;
}

.scene-controls .command-icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 8px;
  padding: 0;
}

.scene-controls .command-icon-button svg {
  width: 17px;
  height: 17px;
}

.scene-controls .scene-story-button,
.scene-controls .scene-music-button,
.scene-controls .menu-toggle,
.scene-controls .command-replay-button,
.scene-controls .command-redraw-button {
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  color: var(--paper);
  background: rgba(var(--ink-rgb), 0.78);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.scene-controls .scene-story-button:hover,
.scene-controls .scene-story-button:focus-visible,
.scene-controls .scene-music-button:hover,
.scene-controls .scene-music-button:focus-visible,
.scene-controls .menu-toggle:hover,
.scene-controls .menu-toggle:focus-visible,
.scene-controls .menu-toggle[aria-expanded="true"],
.scene-controls .command-replay-button:hover,
.scene-controls .command-replay-button:focus-visible,
.scene-controls .command-redraw-button:hover,
.scene-controls .command-redraw-button:focus-visible {
  color: #fff7df;
  border-color: rgba(var(--gold-rgb), 0.78);
  background: rgba(var(--gold-rgb), 0.18);
  outline: none;
}

.scene-controls .command-replay-button {
  border-color: rgba(var(--teal-rgb), 0.52);
  color: var(--teal);
}

.scene-controls .scene-music-button {
  border-color: rgba(var(--teal-rgb), 0.52);
  color: var(--teal);
}

.scene-controls .scene-music-button.is-playing {
  color: #d8fff9;
  background: rgba(var(--teal-rgb), 0.16);
}

.scene-controls .command-replay-button.has-replay {
  color: #d8fff9;
  background: rgba(var(--teal-rgb), 0.16);
}

.scene-controls .command-replay-button:disabled:not(.has-replay),
.scene-controls .scene-music-button:disabled,
.scene-controls .scene-story-button:disabled {
  opacity: 0.46;
}

.terminal-pane {
  height: var(--scene-pane-size);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.transcript {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: var(--narration-text-size, 1rem);
}

.line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.line-speaker {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.line p {
  margin: 0;
  color: var(--paper);
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line.player p {
  color: #a5e2dc;
}

.line.system p {
  color: var(--muted);
}

.spoken-quote {
  display: inline;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  margin: 0;
  padding: 0 2px;
  color: inherit;
  background: rgba(var(--gold-rgb), 0.08);
  font: inherit;
  line-height: inherit;
  text-align: left;
  vertical-align: baseline;
  white-space: inherit;
}

.spoken-quote:hover,
.spoken-quote:focus-visible {
  color: #fff7df;
  background: rgba(var(--gold-rgb), 0.28);
  outline: 1px solid rgba(var(--gold-rgb), 0.72);
  outline-offset: 2px;
  transform: none;
}

.command-line {
  min-height: 58px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  align-content: center;
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.command-line span {
  color: var(--gold);
  font-weight: 900;
}

.voice-input-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(var(--teal-rgb), 0.42);
  border-radius: 999px;
  padding: 0;
  color: var(--teal);
  background: rgba(var(--teal-rgb), 0.08);
  box-shadow: 0 0 0 rgba(var(--teal-rgb), 0);
}

.voice-input-button[hidden] {
  display: none;
}

.voice-input-button svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.voice-input-button:hover,
.voice-input-button:focus-visible {
  color: #d8fff9;
  border-color: rgba(var(--teal-rgb), 0.78);
  background: rgba(var(--teal-rgb), 0.16);
}

.voice-input-button.is-listening {
  color: #fff7df;
  border-color: rgba(var(--gold-rgb), 0.86);
  background: rgba(var(--gold-rgb), 0.16);
  box-shadow: 0 0 0 6px rgba(var(--gold-rgb), 0.08), 0 0 18px rgba(var(--gold-rgb), 0.18);
}

.voice-input-button.is-pending:not(.is-listening) {
  color: var(--gold);
  border-color: rgba(var(--gold-rgb), 0.62);
}

.command-redraw-button[hidden] {
  display: none;
}

.command-icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0;
}

.command-line .menu-toggle,
.command-line .command-replay-button,
.command-line .command-redraw-button {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
}

.command-line .menu-toggle:hover,
.command-line .menu-toggle[aria-expanded="true"],
.command-line .command-replay-button:hover,
.command-line .command-replay-button:focus-visible,
.command-line .command-redraw-button:hover,
.command-line .command-redraw-button:focus-visible {
  color: #fff7df;
  border-color: rgba(var(--gold-rgb), 0.78);
  background: rgba(var(--gold-rgb), 0.12);
}

.command-line .command-replay-button {
  border: 1px solid rgba(var(--teal-rgb), 0.46);
  color: var(--teal);
}

.command-line .command-replay-button.has-replay {
  color: #d8fff9;
  background: rgba(var(--teal-rgb), 0.1);
}

.command-line .command-replay-button:disabled:not(.has-replay) {
  opacity: 0.42;
}

.send-icon-button {
  border: 1px solid rgba(var(--lacquer-2-rgb), 0.72);
  background: var(--lacquer);
}

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

.cooldown-meter {
  display: block;
  width: 76px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(var(--gold-rgb), 0.45);
  border-radius: 999px;
  background: rgba(var(--gold-rgb), 0.1);
}

.cooldown-meter[hidden],
.cooldown-text[hidden] {
  display: none;
}

.cooldown-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lacquer-2), var(--gold));
  transition: width 0.25s linear;
}

.cooldown-text {
  min-width: 34px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
}

.command-line input,
.inline-form input,
.setup-form input,
.account-form input,
.profile-form input,
.profile-form select,
.profile-form textarea,
.admin-form input,
.admin-form select,
.admin-form textarea,
.table-action input,
.table-action select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  color: var(--paper);
  background: var(--field-bg);
}

.command-line input {
  flex: 1 1 6rem;
  min-width: 0;
}

.command-line input:focus,
.inline-form input:focus,
.setup-form input:focus,
.account-form input:focus,
.profile-form input:focus,
.profile-form select:focus,
.profile-form textarea:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.table-action input:focus,
.table-action select:focus {
  border-color: var(--gold);
  background: var(--field-focus-bg);
}

.admin-form textarea {
  min-height: 110px;
  padding-block: 10px;
  resize: vertical;
}

.side-pane {
  height: var(--scene-pane-size);
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-block {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.status-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.connection-status {
  display: grid;
  gap: 8px;
}

.character-description {
  display: block;
}

.character-summary {
  color: var(--paper);
}

.story-direction {
  display: grid;
  gap: 10px;
}

.story-direction-group {
  display: grid;
  gap: 4px;
}

.story-direction-label {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.story-direction-text,
.story-direction-list {
  margin: 0;
  color: var(--paper);
  font-size: 0.82rem;
  line-height: 1.35;
}

.story-direction-list {
  display: grid;
  gap: 4px;
  padding-left: 16px;
}

.story-direction-list li::marker {
  color: var(--gold);
}

.connection-name,
.connection-copy {
  margin: 0;
}

.connection-name {
  color: var(--paper);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.connection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.compact-character-details {
  gap: 5px;
}

.level-pill,
.mode-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(245, 234, 216, 0.14);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.level-pill {
  color: var(--ink);
  background: var(--gold);
}

.level-pill.level-0,
.connection-badge.level-0 {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.78);
  background: var(--level-0);
}

.level-pill.level-1,
.connection-badge.level-1 {
  color: #061522;
  border-color: rgba(78, 163, 255, 0.78);
  background: var(--level-1);
}

.level-pill.level-2,
.connection-badge.level-2 {
  color: #061806;
  border-color: rgba(102, 209, 122, 0.78);
  background: var(--level-2);
}

.level-pill.level-3,
.connection-badge.level-3 {
  color: #201703;
  border-color: rgba(244, 211, 94, 0.82);
  background: var(--level-3);
}

.level-pill.level-4,
.connection-badge.level-4 {
  color: #211005;
  border-color: rgba(243, 154, 61, 0.84);
  background: var(--level-4);
}

.level-pill.level-5,
.connection-badge.level-5 {
  color: #fff7f2;
  border-color: rgba(227, 79, 95, 0.86);
  background: var(--level-5);
}

.level-pill.level-6,
.connection-badge.level-6 {
  color: #fff7fb;
  border-color: rgba(225, 79, 182, 0.88);
  background: var(--level-6);
}

.level-pill.level-7,
.connection-badge.level-7 {
  color: #fff7ff;
  border-color: rgba(196, 153, 255, 0.92);
  background: var(--level-7);
}

.mode-pill {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.mode-pill.side-quest {
  color: var(--paper);
  border-color: rgba(var(--teal-rgb), 0.72);
  background: rgba(var(--teal-rgb), 0.48);
}

.mode-pill.special-event {
  color: #fff7ff;
  border-color: rgba(196, 153, 255, 0.82);
  background: rgba(155, 92, 255, 0.42);
}

.connection-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.connection-details,
.connection-items,
.connection-quests,
.connection-progress,
.connection-progress-wrap {
  display: grid;
  gap: 7px;
}

.connection-progress {
  gap: 9px;
}

.connection-progress-row {
  --progress-color: var(--gold);
  display: grid;
  gap: 5px;
  border: 1px solid rgba(245, 234, 216, 0.12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.connection-progress-row.level-0 {
  --progress-color: var(--level-0);
}

.connection-progress-row.level-1 {
  --progress-color: var(--level-1);
}

.connection-progress-row.level-2 {
  --progress-color: var(--level-2);
}

.connection-progress-row.level-3 {
  --progress-color: var(--level-3);
}

.connection-progress-row.level-4 {
  --progress-color: var(--level-4);
}

.connection-progress-row.level-5 {
  --progress-color: var(--level-5);
}

.connection-progress-row.level-6 {
  --progress-color: var(--level-6);
}

.connection-progress-row.level-7 {
  --progress-color: var(--level-7);
}

.connection-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.connection-progress-header span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.connection-progress-header strong {
  color: var(--paper);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}

.connection-progress-subtext {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.28;
}

.connection-progress-track {
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(245, 234, 216, 0.13);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.connection-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.28) 0 7px, transparent 7px 14px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), var(--progress-color));
  box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.28);
  transition: width 850ms cubic-bezier(0.2, 0.82, 0.22, 1);
  animation: progressShimmer 1.8s linear infinite;
}

.connection-progress-row.complete .connection-progress-fill {
  animation-duration: 2.8s;
}

.connection-detail,
.connection-item,
.mini-label {
  margin: 0;
}

.connection-detail {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.connection-detail span,
.mini-label {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.connection-detail strong {
  color: var(--paper);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.connection-item {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(245, 234, 216, 0.12);
  background: rgba(var(--teal-rgb), 0.34);
}

button.chip {
  color: var(--paper);
}

.chip.completed-chip {
  border-color: rgba(102, 209, 122, 0.72);
  background: rgba(102, 209, 122, 0.18);
  color: rgba(231, 255, 236, 0.96);
}

.quest-chip.current {
  border-color: rgba(var(--gold-rgb), 0.7);
  background: rgba(var(--gold-rgb), 0.24);
}

.quest-chip.quest-level-0 {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.14);
}

.quest-chip.quest-level-1 {
  border-color: rgba(78, 163, 255, 0.72);
  background: rgba(78, 163, 255, 0.18);
}

.quest-chip.quest-level-2 {
  border-color: rgba(102, 209, 122, 0.72);
  background: rgba(102, 209, 122, 0.18);
}

.quest-chip.quest-level-3 {
  border-color: rgba(244, 211, 94, 0.78);
  background: rgba(244, 211, 94, 0.19);
}

.quest-chip.quest-level-4 {
  border-color: rgba(243, 154, 61, 0.78);
  background: rgba(243, 154, 61, 0.2);
}

.quest-chip.quest-level-5 {
  border-color: rgba(227, 79, 95, 0.8);
  background: rgba(227, 79, 95, 0.2);
}

.quest-chip.quest-level-6 {
  border-color: rgba(225, 79, 182, 0.82);
  background: rgba(225, 79, 182, 0.22);
}

.quest-chip.quest-level-7 {
  border-color: rgba(196, 153, 255, 0.82);
  background: rgba(155, 92, 255, 0.22);
}

.quest-chip.completed {
  color: rgba(245, 234, 216, 0.82);
  box-shadow: inset 0 0 0 1px rgba(245, 234, 216, 0.18);
}

.quest-chip.current {
  box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.68), inset 0 0 0 1px rgba(var(--gold-rgb), 0.26);
}

.muted {
  color: var(--muted);
}

.map-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-action {
  width: 100%;
  margin: 0 0 10px;
}

.map-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.map-row span:last-child {
  overflow-wrap: anywhere;
}

.map-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 234, 216, 0.32);
}

.map-row.current {
  color: var(--paper);
  font-weight: 800;
}

.map-row.current .map-dot {
  background: var(--gold);
}

.map-row.side-quest .map-dot {
  background: var(--teal);
}

.map-row.side-quest span:last-child::after {
  content: " side";
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.map-row.concealed {
  color: rgba(188, 174, 158, 0.62);
}

.map-row.concealed .map-dot {
  background: rgba(245, 234, 216, 0.16);
  box-shadow: inset 0 0 0 1px rgba(245, 234, 216, 0.2);
}

.start-panel {
  margin: auto;
  max-width: 460px;
  text-align: center;
  padding: 24px;
}

.start-panel h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.start-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(var(--ink-rgb), 0.82);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.modal-panel {
  width: min(520px, 100%);
  padding: 22px;
}

.modal-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--ink-rgb), 0.72);
  color: var(--paper);
  font-size: 1.35rem;
  line-height: 1;
}

.payment-success-panel {
  display: grid;
  gap: 12px;
  text-align: center;
}

.payment-success-panel h1,
.payment-success-panel p {
  margin: 0;
}

.payment-success-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.48;
}

.playstyle-notice-backdrop {
  z-index: 44;
}

.playstyle-notice-panel {
  text-align: left;
}

.playstyle-notice-panel .primary-action {
  width: 100%;
  margin-top: 2px;
}

.ending-backdrop {
  z-index: 62;
  background:
    radial-gradient(circle at 50% 10%, rgba(var(--gold-rgb), 0.2), transparent 34%),
    linear-gradient(180deg, rgba(var(--ink-rgb), 0.9), rgba(7, 6, 7, 0.96));
}

.ending-panel {
  position: relative;
  width: min(680px, 100%);
  min-height: min(720px, calc(100vh - 42px));
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(var(--gold-rgb), 0.38);
  background:
    linear-gradient(180deg, rgba(var(--panel-rgb), 0.62), rgba(var(--ink-rgb), 0.68)),
    var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72), 0 0 42px rgba(var(--gold-rgb), 0.18);
  text-align: center;
}

.ending-memory-slideshow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.08);
}

.ending-memory-slideshow::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(var(--ink-rgb), 0.18), rgba(var(--panel-rgb), 0.34)),
    radial-gradient(circle at 50% 30%, transparent 0, rgba(0, 0, 0, 0.3) 82%);
}

.ending-memory-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  opacity: 0;
  filter: saturate(1.1) contrast(1.04) brightness(1);
  transform-origin: center center;
  transform: none;
  transition: opacity 1800ms ease-in-out;
}

.ending-memory-image.is-active {
  opacity: 0.72;
  transform: none;
}

.ending-card-glow {
  position: absolute;
  inset: -26% -8% auto;
  height: 44%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(var(--gold-rgb), 0.24), transparent 68%);
}

.ending-panel .eyebrow,
.ending-panel h1,
.ending-subtitle,
.credits-roll-window,
.ending-actions,
.ending-status {
  position: relative;
  z-index: 1;
}

.ending-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.ending-subtitle {
  margin: 0 auto;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.5;
}

.credits-roll-window {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border-block: 1px solid rgba(var(--gold-rgb), 0.18);
  mask-image: linear-gradient(180deg, transparent, black 18%, black 82%, transparent);
}

.credits-roll {
  display: grid;
  gap: 18px;
  padding: 320px 18px 360px;
}

.credits-roll.is-rolling {
  animation: endingCreditsRoll 38s linear forwards;
}

.credits-roll p {
  margin: 0;
  color: var(--paper);
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0;
}

.credits-roll-title,
.credits-roll-closing {
  color: var(--gold) !important;
  text-transform: uppercase;
  font-size: clamp(0.9rem, 1.6vw, 1.1rem) !important;
}

.ending-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes endingCreditsRoll {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-72%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .credits-roll {
    padding: 22px 18px;
  }

  .credits-roll.is-rolling {
    animation: none;
  }
}

.gallery-backdrop {
  z-index: 50;
}

.gallery-panel {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.prologue-backdrop {
  z-index: 51;
}

.prologue-panel {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.prologue-body {
  display: grid;
  gap: 13px;
}

.prologue-body p {
  margin: 0;
  color: var(--paper);
  line-height: 1.58;
}

.prologue-story-direction {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 12px;
}

.prologue-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 12px;
  border-top: 1px solid var(--line);
  margin: 4px 0 0;
  padding-top: 12px;
}

.prologue-meta dt {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.prologue-meta dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.image-gallery-card {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(245, 234, 216, 0.12);
  border-radius: 8px;
  padding: 8px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.image-gallery-card:hover,
.image-gallery-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(var(--gold-rgb), 0.62);
  background: rgba(var(--gold-rgb), 0.09);
  outline: none;
}

.image-gallery-card.current {
  border-color: rgba(var(--teal-rgb), 0.68);
  box-shadow: inset 0 0 0 1px rgba(var(--teal-rgb), 0.28);
}

.image-gallery-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background: #181311;
}

.image-gallery-caption {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.image-gallery-caption strong,
.image-gallery-caption span {
  overflow-wrap: anywhere;
}

.image-gallery-caption strong {
  font-size: 0.94rem;
  line-height: 1.2;
}

.image-gallery-caption span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.28;
}

.profile-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.consent-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.modal-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.consent-scroll {
  display: grid;
  gap: 12px;
  max-height: min(42vh, 420px);
  overflow: auto;
  padding-right: 6px;
}

.consent-scroll p {
  margin: 0;
}

.consent-scroll h2,
.terms-doc h2 {
  margin: 8px 0 0;
  color: var(--paper);
  font-size: 1rem;
  line-height: 1.25;
}

.terms-updated {
  color: rgba(245, 234, 216, 0.72);
  font-size: 0.9rem;
}

.notice-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.notice-list li + li {
  margin-top: 6px;
}

.consent-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 18px;
  color: var(--paper);
  line-height: 1.45;
}

.consent-check input {
  margin-top: 4px;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.consent-actions button {
  min-width: 170px;
}

.terms-page-panel {
  width: min(900px, calc(100vw - 36px));
}

.terms-doc {
  display: grid;
  gap: 12px;
}

.terms-toolbar {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.terms-language-control {
  display: grid;
  gap: 6px;
  max-width: 320px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.terms-language-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.terms-language-panel {
  display: grid;
  gap: 12px;
}

.terms-language-panel[hidden] {
  display: none !important;
}

.terms-note-card {
  border: 1px solid rgba(var(--gold-rgb), 0.24);
  border-radius: 8px;
  padding: 12px;
  background: rgba(var(--gold-rgb), 0.08);
}

.terms-doc p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.form-error,
.notice.error {
  color: #ffb1b1;
}

.login-backdrop {
  overflow: hidden;
  padding: 18px;
  background: #000;
  backdrop-filter: none;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 72% 22%, rgba(var(--gold-rgb), 0.16), transparent 31%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.12) 48%, rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

.login-panel {
  position: relative;
  z-index: 2;
  width: min(400px, calc(100vw - 48px));
  max-height: min(820px, calc(100vh - 36px));
  overflow: visible;
}

.login-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

.login-art img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06) translate3d(-1.5%, -1%, 0);
  transition: opacity 1600ms ease;
  will-change: opacity, transform;
}

.login-art img.is-active {
  opacity: 1;
  animation: loginArtPan 16s ease-in-out forwards;
}

.login-cinemagraph-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.login-cinemagraph-layer[hidden] {
  display: none;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 11px;
  overflow: auto;
  max-height: min(820px, calc(100vh - 36px));
  border: 1px solid rgba(245, 234, 216, 0.28);
  border-radius: 8px;
  padding: 22px;
  background: rgba(var(--ink-rgb), 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(1.12);
}

.login-game-logo {
  display: block;
  flex: 0 0 auto;
  width: min(100%, 356px);
  height: auto;
  margin: 0 auto 3px;
  border-radius: 6px;
  filter: drop-shadow(0 0 14px rgba(255, 116, 183, 0.18)) drop-shadow(0 0 18px rgba(124, 221, 255, 0.12));
}

.studio-logo {
  display: block;
  width: min(100%, 320px);
  height: auto;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card > p:not(.eyebrow):not(.fine-print):not(.form-error) {
  color: var(--muted);
  line-height: 1.48;
}

.login-language-control {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(245, 234, 216, 0.22);
  border-radius: 8px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.login-language-control[hidden] {
  display: none;
}

.login-language-control select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(245, 234, 216, 0.22);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(4, 7, 12, 0.74);
  color: var(--paper);
  font-weight: 800;
}

.login-quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

.login-quick-links a,
.login-quick-links button {
  color: var(--gold);
  font-weight: 900;
}

.login-quick-links a + a::before,
.login-quick-links button + a::before {
  content: "·";
  display: inline-block;
  margin-right: 10px;
  color: rgba(245, 234, 216, 0.5);
  font-weight: 800;
}

.login-compliance {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(245, 234, 216, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.36;
}

.login-compliance p {
  margin: 0;
}

.login-compliance strong {
  color: var(--paper);
}

.login-compliance a {
  color: var(--gold);
  font-weight: 800;
}

.login-inline-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.public-music-backdrop {
  z-index: 46;
  padding: 18px;
  overflow: hidden;
  background: rgba(var(--ink-rgb), 0.7);
}

.public-music-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #050405;
}

.public-music-art img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  display: block;
  object-fit: cover;
  opacity: 0.72;
  transform: scale(1.06) translate3d(-1.2%, -0.8%, 0);
  animation: loginArtPan 18s ease-in-out forwards;
}

.public-music-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--ink-rgb), 0.1), rgba(var(--ink-rgb), 0.42) 62%, rgba(var(--ink-rgb), 0.74)),
    linear-gradient(135deg, rgba(255, 43, 194, 0.14), rgba(40, 190, 255, 0.12));
  pointer-events: none;
}

.public-music-cinemagraph-layer {
  z-index: 2;
}

.public-music-panel {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 12px;
  width: min(620px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
}

.public-music-panel h1,
.public-music-panel p {
  margin: 0;
}

.public-music-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.public-music-select {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.public-music-panel audio {
  width: 100%;
  min-height: 44px;
}

.public-music-rights {
  border: 1px solid rgba(var(--gold-rgb), 0.22);
  border-radius: 8px;
  padding: 11px;
  background: rgba(var(--gold-rgb), 0.075);
}

.contact-shell {
  width: min(940px, calc(100vw - 36px));
}

.contact-panel {
  width: 100%;
}

.contact-logo {
  width: min(460px, 100%);
  margin: 0 0 18px;
}

.contact-intro {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.55;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.contact-card {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.contact-card a {
  font-size: 1.2rem;
  font-weight: 800;
}

.contact-card address {
  color: var(--paper);
  font-style: normal;
  line-height: 1.65;
}

.login-version-footer {
  position: absolute;
  left: 50%;
  bottom: 7px;
  z-index: 2;
  transform: translateX(-50%);
  color: rgba(245, 234, 216, 0.68);
  font-size: 0.68rem;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.72);
  white-space: nowrap;
  pointer-events: none;
}

@keyframes loginArtPan {
  from {
    transform: scale(1.06) translate3d(-1.5%, -1%, 0);
  }

  to {
    transform: scale(1.14) translate3d(1.5%, 1%, 0);
  }
}

.account-form,
.profile-form,
.admin-form {
  display: grid;
  gap: 12px;
}

.compact-admin-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.payment-package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-package-head {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.payment-package-grid label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.account-form label,
.profile-form label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.account-form label span,
.profile-form label span,
.admin-form label span {
  color: var(--paper);
  font-weight: 800;
}

.profile-form textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

.profile-guidance {
  margin-top: -4px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 8px;
  background: rgba(var(--ink-rgb), 0.34);
  font-size: 0.86rem;
}

.profile-form select {
  color: var(--paper);
  background-color: rgba(var(--ink-rgb), 0.96);
}

.profile-form select option {
  color: #12110f;
  background: #f5ead8;
}

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

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-actions button {
  min-width: 140px;
}

.secondary-account-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.text-action {
  width: fit-content;
  padding: 0;
  color: var(--gold);
  background: transparent;
  font-weight: 800;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(var(--gold-rgb), 0.5);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--gold);
  background: rgba(var(--gold-rgb), 0.08);
  font-size: 0.86rem;
  font-weight: 900;
}

.fee-badge {
  border-color: rgba(118, 211, 145, 0.5);
  color: #baf3c8;
  background: rgba(118, 211, 145, 0.08);
}

.user-badge[hidden] {
  display: none;
}

.setup-body,
.admin-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

.admin-body {
  place-items: start center;
  align-content: start;
}

.setup-shell {
  width: min(980px, 100%);
}

.admin-shell {
  width: min(1600px, 100%);
}

.setup-panel,
.admin-panel {
  padding: clamp(16px, 2vw, 24px);
}

.setup-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.setup-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.setup-form label span {
  color: var(--paper);
  font-weight: 800;
}

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

.check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.admin-utc-clock {
  margin: 6px 0 0;
  color: rgba(var(--paper-rgb), 0.78);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
}

.admin-utc-clock time {
  color: var(--mint);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  align-content: start;
}

.admin-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-card-toggle {
  width: 100%;
  min-height: 34px;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--gold);
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.admin-card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-card-title::before {
  content: "-";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  border-radius: 6px;
  color: var(--paper);
  background: rgba(var(--gold-rgb), 0.12);
  font-weight: 950;
  line-height: 1;
}

.admin-card.is-collapsed .admin-card-title::before {
  content: "+";
}

.admin-card-state {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: rgba(var(--paper-rgb), 0.78);
  background: rgba(var(--paper-rgb), 0.05);
  font-size: 0.72rem;
  font-weight: 900;
}

.admin-card-toggle:hover .admin-card-state,
.admin-card-toggle:focus-visible .admin-card-state {
  color: var(--paper);
  border-color: rgba(var(--gold-rgb), 0.6);
}

.admin-card-toggle:focus-visible {
  outline: 2px solid rgba(var(--mint-rgb), 0.72);
  outline-offset: 4px;
  border-radius: 6px;
}

.admin-card-body {
  margin-top: 10px;
}

.admin-card-body[hidden] {
  display: none;
}

.admin-card .side-label {
  margin-bottom: 10px;
}

.cafe-profile-list {
  display: grid;
  gap: 12px;
}

.cafe-profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--paper-rgb), 0.035);
  overflow: clip;
}

.cafe-profile-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.cafe-profile-card summary::-webkit-details-marker {
  display: none;
}

.cafe-profile-card summary strong,
.cafe-profile-card summary em {
  display: block;
}

.cafe-profile-card summary strong {
  color: var(--paper);
  font-size: 0.96rem;
}

.cafe-profile-card summary em {
  margin-top: 3px;
  color: rgba(var(--paper-rgb), 0.68);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.35;
}

.cafe-profile-button {
  flex: 0 0 auto;
  padding: 8px 11px;
  line-height: 1;
  pointer-events: none;
}

.cafe-profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 12px 12px;
}

.cafe-profile-fields .wide-field,
.cafe-level-grid {
  grid-column: 1 / -1;
}

.cafe-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 4px;
}

.music-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.music-category-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(var(--paper-rgb), 0.035);
}

.music-category-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.music-category-heading strong {
  display: block;
  color: var(--paper);
  font-size: 0.95rem;
}

.music-category-heading p {
  margin: 4px 0 0;
  color: rgba(var(--paper-rgb), 0.68);
  font-size: 0.78rem;
  line-height: 1.35;
}

.music-track-status {
  flex: 0 0 auto;
  border: 1px solid rgba(var(--mint-rgb), 0.42);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--mint);
  background: rgba(var(--mint-rgb), 0.1);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.music-track-status.is-empty {
  border-color: rgba(var(--paper-rgb), 0.18);
  color: rgba(var(--paper-rgb), 0.58);
  background: rgba(var(--paper-rgb), 0.04);
}

.music-category-card audio {
  width: 100%;
  max-width: 100%;
}

.music-track-list {
  display: grid;
  gap: 10px;
}

.music-track-row {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(var(--paper-rgb), 0.08);
  border-radius: 8px;
  padding: 9px;
  background: rgba(var(--ink-rgb), 0.22);
}

.music-track-row .compact-admin-form {
  margin-top: 0;
}

.music-visibility-form {
  align-items: flex-start;
}

.inline-save-status {
  min-height: 1.1em;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
}

.inline-save-status.is-error {
  color: var(--danger);
}

.music-upload-form {
  gap: 8px;
}

.admin-table-wrap {
  max-height: min(72vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--gold);
  background: rgba(var(--ink-rgb), 0.97);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.admin-table td {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-table strong {
  color: var(--paper);
}

.admin-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

.admin-table tbody tr:hover td {
  background: rgba(var(--gold-rgb), 0.045);
}

.admin-table code {
  word-break: break-word;
}

.notice-inline {
  color: #ffb1b1;
  font-weight: 800;
}

.table-action {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.table-action.single {
  grid-template-columns: 1fr;
}

.table-action button {
  min-height: 42px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 18px 0 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.notice.success {
  color: #a5e2dc;
}

.fine-print {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.48;
}

.openai-queue-badge {
  position: relative;
  z-index: 1;
  order: 2;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(260px, calc(100% - 28px));
  min-height: 34px;
  border: 1px solid rgba(var(--gold-rgb), 0.52);
  border-radius: 12px;
  padding: 5px 11px 5px 7px;
  color: var(--paper);
  background: rgba(var(--ink-rgb), 0.78);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36), 0 0 18px rgba(var(--gold-rgb), 0.14);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  pointer-events: none;
}

.openai-queue-badge[hidden] {
  display: none;
}

#openaiQueueText {
  white-space: pre-line;
}

.openai-queue-spinner {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(245, 234, 216, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

#openaiQueueText {
  overflow: visible;
  max-width: 190px;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes creditUseFloat {
  0% {
    opacity: 0;
    transform: translateX(8px) scale(0.96);
  }

  14% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  68% {
    opacity: 1;
    transform: translateX(-6px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateX(-18px) scale(0.97);
  }
}

@keyframes emojiFlutter {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.72) rotate(var(--emoji-tilt, 0deg));
  }

  16% {
    opacity: 1;
  }

  58% {
    opacity: 0.96;
    transform: translate(calc(-50% + var(--emoji-drift, 0px)), -46px) scale(1.05) rotate(calc(var(--emoji-tilt, 0deg) * -1));
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--emoji-drift-end, 0px)), -96px) scale(0.86) rotate(var(--emoji-tilt-end, 0deg));
  }
}

@keyframes cinemagraphFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.76) rotate(-4deg);
  }

  18% {
    opacity: 0.94;
  }

  72% {
    opacity: 0.72;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--motion-drift-x, 0px)), var(--motion-drift-y, -120px)) scale(1.12) rotate(18deg);
  }
}

@keyframes cinemagraphRain {
  0% {
    opacity: 0;
    transform: translate(-50%, -70px) rotate(12deg);
  }

  12% {
    opacity: 0.78;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + 34px), 170px) rotate(12deg);
  }
}

@keyframes cinemagraphPetal {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px) rotate(-20deg);
  }

  18% {
    opacity: 0.86;
  }

  52% {
    opacity: 0.76;
    transform: translate(calc(-50% + 42px), 86px) rotate(54deg);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--motion-drift-x, 0px)), var(--motion-drift-y, 140px)) rotate(160deg);
  }
}

@keyframes cinemagraphSpotlight {
  0% {
    opacity: 0.08;
    transform: translate(-50%, 0) rotate(var(--spotlight-angle-a, -18deg)) scaleX(0.78);
  }

  18% {
    opacity: 0.62;
  }

  48% {
    opacity: 0.46;
    transform: translate(-50%, 0) rotate(var(--spotlight-angle-b, 0deg)) scaleX(1.12);
  }

  78% {
    opacity: 0.58;
  }

  100% {
    opacity: 0.1;
    transform: translate(-50%, 0) rotate(var(--spotlight-angle-c, 22deg)) scaleX(0.84);
  }
}

@keyframes cinemagraphHeart {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.76);
  }

  16% {
    opacity: 0.95;
  }

  62% {
    opacity: 0.86;
    transform: translate(calc(-50% + var(--motion-drift-x, 0px)), -55px) scale(1.14);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--motion-drift-x, 0px)), var(--motion-drift-y, -120px)) scale(0.9);
  }
}

@keyframes progressShimmer {
  from {
    background-position: 0 0, 0 0;
  }

  to {
    background-position: 0 0, 28px 0;
  }
}

@media (max-width: 1320px) {
  :root {
    --play-area-height: clamp(500px, calc(100vh - 124px), 1200px);
    --content-max-width: calc(var(--play-area-height) + (var(--play-area-height) / 1.55) + var(--layout-gap));
    --available-content-width: calc(100vw - 36px);
    --scene-pane-size: min(var(--play-area-height), calc((var(--available-content-width) - var(--layout-gap)) / 1.65));
    --terminal-pane-size: calc(var(--scene-pane-size) / 1.55);
    --scene-max-size: min(100%, var(--play-area-height));
  }

  .game-layout {
    grid-template-columns: var(--scene-pane-size) var(--terminal-pane-size);
  }

  .side-pane {
    grid-column: 1 / -1;
    height: auto;
    max-height: 240px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .command-line {
    gap: 7px;
    padding-inline: 8px;
  }

  .status-block {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding-right: 14px;
    padding-bottom: 0;
  }

  .status-block:last-child {
    border-right: 0;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-table-wrap {
    max-height: none;
  }
}

@media (max-width: 760px) {
  :root {
    --play-area-height: auto;
    --content-max-width: calc(100vw - 20px);
    --scene-pane-size: min(calc(100vw - 20px), 520px);
    --terminal-pane-size: 100%;
    --side-pane-size: 100%;
    --scene-max-size: min(calc(100vw - 20px), 520px);
  }

  .app-shell {
    padding: 10px;
  }

  .game-layout,
  .side-pane,
  .setup-grid,
  .profile-grid,
  .cafe-profile-fields,
  .cafe-level-grid,
  .admin-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .login-panel {
    max-height: calc(100vh - 56px);
    width: min(340px, calc(100vw - 56px));
  }

  .login-card {
    gap: 8px;
    max-height: calc(100vh - 56px);
    padding: 13px 14px;
    background: rgba(var(--ink-rgb), 0.54);
    backdrop-filter: blur(8px) saturate(1.15);
  }

  .login-game-logo {
    width: min(100%, 292px);
    margin-bottom: 0;
  }

  .login-card h1 {
    font-size: 1.24rem;
  }

  .login-card > p:not(.eyebrow):not(.fine-print):not(.form-error),
  .login-card .fine-print {
    font-size: 0.84rem;
    line-height: 1.34;
  }

  .login-compliance {
    gap: 5px;
    padding: 8px;
    font-size: 0.72rem;
    line-height: 1.32;
  }

  .login-language-control {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 7px 8px;
    font-size: 0.72rem;
  }

  .login-quick-links {
    gap: 5px 8px;
    font-size: 0.72rem;
  }

  .login-card .account-form {
    gap: 9px;
  }

  .login-card .account-form input {
    min-height: 38px;
  }

  .login-card .primary-action {
    min-height: 36px;
  }

  .admin-header {
    flex-direction: column;
  }

  .scene-pane {
    width: var(--scene-pane-size);
    height: var(--scene-pane-size);
    max-width: var(--scene-max-size);
    aspect-ratio: 1 / 1;
    display: flex;
  }

  .scene-frame {
    max-width: none;
    height: 100%;
  }

  .scene-frame,
  .scene-frame img,
  .scene-placeholder {
    height: 100%;
    min-height: 0;
  }

  .scene-caption {
    left: 10px;
    right: 10px;
    bottom: 10px;
    --caption-control-reserve: 154px;
    max-width: calc(100% - 20px);
    padding: 8px 10px;
  }

  .scene-caption p,
  .scene-caption h2 {
    max-width: max(0px, calc(100% - var(--caption-control-reserve, 154px)));
  }

  .connection-badge {
    max-width: 100%;
  }

  .scene-caption p {
    font-size: 0.72rem;
  }

  .scene-caption h2 {
    font-size: 0.98rem;
  }

  .connection-badge {
    margin-top: 3px;
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .scene-controls {
    position: absolute;
    top: 7px;
    right: 8px;
    margin: 0;
    gap: 3px;
  }

  .scene-controls .command-icon-button {
    width: 25px;
    min-width: 25px;
    height: 25px;
    min-height: 25px;
    border-radius: 7px;
  }

  .scene-controls .command-icon-button svg {
    width: 14px;
    height: 14px;
  }

  .terminal-pane {
    height: min(27.1875vh, 243.75px);
    min-height: 202.5px;
  }

  .side-pane {
    height: auto;
    max-height: none;
  }

  .line {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .command-line {
    gap: 7px;
    padding: 8px;
  }

  .inline-form {
    grid-template-columns: auto 46px minmax(0, 1fr);
  }

  .inline-form button {
    grid-column: 1 / -1;
  }

  .cooldown-meter,
  .cooldown-text {
    width: 100%;
    text-align: left;
  }

  .cooldown-meter {
    display: none;
  }

  .status-block {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-scrim,
  .nav-drawer,
  .cinemagraph-effect,
  .cinemagraph-particle,
  .login-cinemagraph-layer,
  .scene-emoji,
  .connection-progress-fill {
    animation: none !important;
    transition: none !important;
  }

  .login-art img,
  .public-music-art img {
    animation: none;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 400ms ease;
  }

  .login-art img.is-active,
  .public-music-art img {
    opacity: 1;
    animation: none;
  }
}
