:root {
  --black: #050505;
  --coal: #0c0c0d;
  --iron: #17191a;
  --stone: #b9b3aa;
  --ash: #d8d1c6;
  --dim: #7f7a73;
  --blood: #d0172f;
  --blood-dark: #70101b;
  --brass: #b29353;
  --mold: #53635a;
  --line: rgba(216, 209, 198, 0.18);
  --panel: rgba(12, 12, 13, 0.78);
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.55);
  --theme-primary: var(--blood);
  --theme-secondary: #11090a;
  --theme-glass: rgba(208, 23, 47, 0.42);
  --theme-glow: rgba(208, 23, 47, 0.24);
  --theme-metal: #5a252a;
  --room-mist: radial-gradient(circle at 50% 30%, rgba(208, 23, 47, 0.18), transparent 18rem);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--ash);
  background: var(--black);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 20%, rgba(112, 16, 27, 0.28), transparent 26rem),
    linear-gradient(145deg, #050505 0%, #111313 55%, #070605 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.room-shell {
  height: 100svh;
  overflow: hidden;
}

.landing {
  min-height: 100vh;
}

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 100vh;
  padding: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.82)),
    url("/assets/temple-gate.png");
  background-size: cover;
  background-position: center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 42%, transparent 0 20rem, rgba(0,0,0,0.52) 45rem);
  mix-blend-mode: screen;
  opacity: 0.24;
}

.hero-shade {
  position: absolute;
  inset: auto 0 0;
  height: 48vh;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.94));
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(780px, 100%);
}

.overline {
  margin: 0 0 0.65rem;
  color: var(--brass);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.7rem;
  color: var(--blood);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 10vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 0 26px rgba(208, 23, 47, 0.6), 0 0 3px #000;
}

h2 {
  margin-bottom: 0.8rem;
  color: var(--ash);
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 34rem;
  color: var(--stone);
  font-size: 1.2rem;
  line-height: 1.6;
}

.name-form,
.name-modal {
  display: grid;
  gap: 1rem;
  width: min(620px, 100%);
}

.field {
  display: grid;
  gap: 0.55rem;
  color: var(--stone);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select,
textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.86rem 0.95rem;
  color: var(--ash);
  background: rgba(5, 5, 5, 0.78);
  outline: none;
}

.field input:focus,
.field textarea:focus,
textarea:focus,
select:focus,
input:focus {
  border-color: var(--blood);
  box-shadow: 0 0 0 3px rgba(208, 23, 47, 0.18);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.primary-button,
.ghost-button,
.door-row,
.map-node,
.portal,
.song-title,
.link-chip,
.icon-button {
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ash);
  background: rgba(9, 9, 9, 0.86);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 0.82rem 1.05rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-button {
  border-color: rgba(208, 23, 47, 0.78);
  background: linear-gradient(180deg, #d0172f, #7b101c);
  box-shadow: 0 0 24px rgba(208, 23, 47, 0.22);
}

.ghost-button {
  background: rgba(5, 5, 5, 0.72);
}

.small {
  min-height: 38px;
  padding: 0.62rem 0.78rem;
  font-size: 0.78rem;
}

.primary-button:hover,
.ghost-button:hover,
.door-row:hover,
.song-title:hover,
.link-chip:hover,
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(208, 23, 47, 0.8);
  box-shadow: 0 0 28px rgba(208, 23, 47, 0.16);
}

.map-node:hover,
.portal:hover {
  border-color: rgba(208, 23, 47, 0.8);
  box-shadow: 0 0 28px rgba(208, 23, 47, 0.16);
}

.topbar,
.room-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0;
}

.topbar h1,
.room-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
}

.hall-view,
.map-view,
.room-view,
.loading-view {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.86), rgba(5, 5, 5, 0.96)),
    url("/assets/temple-gate.png");
  background-attachment: scroll;
  background-size: cover;
  background-position: center;
}

.hall-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 1rem;
  width: min(1280px, calc(100% - 2rem));
  margin: 2rem auto 0;
}

.hall-copy,
.door-list,
.ledger,
.arena,
.scratch-wall,
.song-details,
.name-modal {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hall-copy {
  padding: clamp(1rem, 3vw, 2rem);
  min-height: 320px;
}

.hall-copy p {
  color: var(--stone);
  line-height: 1.65;
}

.bloodline {
  color: var(--blood) !important;
  font-weight: 900;
}

.door-list {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  max-height: 68vh;
  overflow: auto;
  padding: 0.85rem;
}

.door-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  min-height: 58px;
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.door-row span {
  font-weight: 900;
}

.door-row small,
.song-title small,
.link-chip small,
.map-node small {
  color: var(--dim);
}

.door-row.visited {
  border-color: rgba(178, 147, 83, 0.65);
}

.temple-map {
  position: relative;
  width: min(1180px, calc(100% - 2rem));
  height: min(74vh, 780px);
  min-height: 520px;
  margin: 1.2rem auto 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.028) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(208, 23, 47, 0.12), transparent 22rem),
    rgba(9, 9, 9, 0.9);
  background-size: 54px 54px, 54px 54px, auto, auto;
  box-shadow: var(--shadow);
}

.map-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-lines line {
  stroke: rgba(178, 147, 83, 0.42);
  stroke-width: 0.25;
  vector-effect: non-scaling-stroke;
}

.map-node {
  position: absolute;
  display: grid;
  gap: 0.15rem;
  min-width: 112px;
  min-height: 48px;
  padding: 0.55rem 0.72rem;
  translate: -50% -50%;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.main-node {
  border-color: var(--blood);
  background: rgba(112, 16, 27, 0.88);
}

.map-node.visited {
  border-color: var(--brass);
}

.room-view {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100svh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-bottom: 0;
  background-image:
    linear-gradient(180deg, rgba(5, 5, 5, 0.78), rgba(5, 5, 5, 0.94)),
    var(--room-bg, url("/assets/temple-gate.png"));
}

.room-grid {
  display: grid;
  grid-template-columns: 25% 50% 25%;
  gap: 0.9rem;
  width: min(1420px, calc(100% - 2rem));
  margin: 0 auto;
  align-items: start;
}

.ledger,
.arena,
.scratch-wall {
  min-height: 68vh;
}

.ledger,
.scratch-wall {
  padding: 1rem;
}

.ledger p {
  color: var(--stone);
  line-height: 1.62;
}

.arena {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.door-orbit {
  position: relative;
  height: 250px;
  border: 1px solid rgba(216, 209, 198, 0.12);
  border-radius: 6px;
  background:
    radial-gradient(circle at center, rgba(208, 23, 47, 0.2) 0 0.3rem, transparent 0.35rem),
    radial-gradient(circle at center, rgba(178, 147, 83, 0.08), transparent 10rem);
}

.portal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(170px, 42%);
  min-height: 42px;
  padding: 0.46rem 0.62rem;
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(-92px)
    rotate(calc(var(--angle) * -1));
  border-color: rgba(208, 23, 47, 0.62);
  color: var(--ash);
  font-size: 0.76rem;
  font-weight: 900;
}

.song-wall {
  display: grid;
  gap: 0.55rem;
}

.section-title {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.section-title h2 {
  margin: 0;
}

.section-title span {
  color: var(--brass);
  font-weight: 900;
}

.song-line {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 0.5rem;
  align-items: stretch;
}

.song-title {
  display: grid;
  gap: 0.25rem;
  min-height: 54px;
  padding: 0.62rem 0.76rem;
  text-align: left;
}

.song-title span {
  overflow-wrap: anywhere;
  font-weight: 900;
}

.icon-button {
  min-width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-weight: 900;
}

.fade-carve {
  animation: carve 460ms ease both;
}

@keyframes carve {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.song-details {
  position: absolute;
  inset: clamp(0.7rem, 1.2vw, 1rem);
  z-index: 8;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  padding: 1rem;
  max-height: none;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(18, 17, 16, 0.96), rgba(5, 5, 6, 0.96)),
    var(--surface-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: auto, cover;
  background-position: center;
}

.song-details:empty {
  display: none;
}

.song-details-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: start;
  border-bottom: 1px solid rgba(216, 209, 198, 0.14);
  padding-bottom: 0.7rem;
}

.song-details-title {
  min-width: 0;
}

.song-details-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.song-details-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--brass);
  font-weight: 900;
}

.song-details-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}

.song-details-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
}

.temple-player-slot {
  position: fixed;
  left: calc(max(1rem, calc((100vw - 1500px) / 2 + 1rem)) + clamp(430px, 34vw, 460px));
  bottom: 1rem;
  z-index: 21;
  width: clamp(380px, 30vw, 520px);
  min-width: 0;
  pointer-events: auto;
}

.temple-player {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(208, 23, 47, 0.34);
  border-radius: 6px;
  padding: 0.62rem;
  background:
    linear-gradient(180deg, rgba(112, 16, 27, 0.16), rgba(5, 5, 5, 0.78)),
    rgba(5, 5, 5, 0.72);
}

.temple-player.is-idle {
  border-color: rgba(216, 209, 198, 0.12);
  background: rgba(5, 5, 5, 0.5);
}

.player-empty {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--dim);
  line-height: 1.45;
}

.player-empty .overline {
  margin: 0;
}

.temple-player-slot .player-empty span {
  display: none;
}

.player-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  gap: 0.55rem;
  align-items: center;
}

.player-round,
.player-stop {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(208, 23, 47, 0.58);
  border-radius: 999px;
  color: var(--ash);
  background: rgba(9, 9, 9, 0.92);
  font-weight: 900;
}

.player-round {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 24px rgba(208, 23, 47, 0.18);
}

.player-stop {
  width: 34px;
  height: 34px;
  color: #ffbdc6;
}

.player-round:hover,
.player-stop:hover {
  border-color: var(--blood);
  box-shadow: 0 0 24px rgba(208, 23, 47, 0.2);
}

.player-meta {
  min-width: 0;
}

.player-meta strong,
.player-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta strong {
  color: var(--ash);
  font-size: 0.92rem;
}

.player-meta small {
  margin-top: 0.16rem;
  color: var(--dim);
}

.player-timeline {
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr) 2.8rem;
  gap: 0.42rem;
  align-items: center;
  color: var(--stone);
  font-size: 0.72rem;
  font-weight: 800;
}

.player-timeline span:last-child {
  text-align: right;
}

.player-seek {
  width: 100%;
  padding: 0;
  accent-color: var(--blood);
  cursor: pointer;
}

.player-seek:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.lyrics {
  margin: 0;
  white-space: pre-wrap;
  color: var(--stone);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.62;
}

.linked-songs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  min-height: 0;
}

.song-details .linked-songs,
.song-details .placements {
  max-height: 116px;
  overflow: auto;
  overscroll-behavior: contain;
}

.link-chip {
  display: inline-grid;
  gap: 0.2rem;
  padding: 0.52rem 0.7rem;
  text-align: left;
}

.placements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.placements span {
  border: 1px solid rgba(178, 147, 83, 0.35);
  border-radius: 4px;
  padding: 0.3rem 0.48rem;
  color: var(--brass);
  font-size: 0.78rem;
}

.scratch-wall {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
}

.scratch-wall label {
  color: var(--blood);
  font-size: 0.86rem;
  font-weight: 900;
}

.scratch-wall textarea {
  min-height: 420px;
  resize: vertical;
  color: var(--stone);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    rgba(5, 5, 5, 0.7);
  background-size: 22px 22px;
}

.save-state,
.empty-text,
.muted-text {
  color: var(--dim);
}

.room-footer {
  position: fixed;
  left: max(1rem, calc((100vw - 1500px) / 2 + 1rem));
  bottom: 1rem;
  z-index: 20;
  width: auto;
  margin: 0;
  padding: 0;
}

.room-footer .primary-button {
  min-width: min(410px, calc(100vw - 2rem));
  box-shadow:
    0 0 28px rgba(208, 23, 47, 0.28),
    0 16px 44px rgba(0, 0, 0, 0.52);
}

.theme-boinya {
  --theme-primary: #b01824;
  --theme-secondary: #2b0708;
  --theme-glass: rgba(219, 34, 47, 0.48);
  --theme-glow: rgba(176, 24, 36, 0.32);
  --theme-metal: #5c1b1f;
  --room-mist: radial-gradient(circle at 20% 80%, rgba(176, 24, 36, 0.22), transparent 18rem);
}

.theme-generaly-peschanyh-karerov {
  --theme-primary: #c4a15b;
  --theme-secondary: #342610;
  --theme-glass: rgba(214, 176, 92, 0.46);
  --theme-glow: rgba(196, 161, 91, 0.28);
  --theme-metal: #72613e;
  --room-mist: radial-gradient(circle at 70% 25%, rgba(196, 161, 91, 0.2), transparent 19rem);
}

.theme-izgnanie {
  --theme-primary: #98a2ad;
  --theme-secondary: #111820;
  --theme-glass: rgba(159, 178, 193, 0.34);
  --theme-glow: rgba(152, 162, 173, 0.22);
  --theme-metal: #48535e;
  --room-mist: radial-gradient(circle at 18% 20%, rgba(152, 162, 173, 0.18), transparent 16rem);
}

.theme-inkvizitor {
  --theme-primary: #d4b15f;
  --theme-secondary: #35130b;
  --theme-glass: rgba(219, 180, 77, 0.46);
  --theme-glow: rgba(212, 177, 95, 0.25);
  --theme-metal: #7a5124;
  --room-mist: radial-gradient(circle at 50% 18%, rgba(212, 177, 95, 0.19), transparent 20rem);
}

.theme-kursk {
  --theme-primary: #4f8ea3;
  --theme-secondary: #07181f;
  --theme-glass: rgba(79, 142, 163, 0.42);
  --theme-glow: rgba(52, 130, 155, 0.28);
  --theme-metal: #244d5c;
  --room-mist: radial-gradient(circle at 50% 88%, rgba(38, 116, 142, 0.22), transparent 22rem);
}

.theme-lilit {
  --theme-primary: #b42d72;
  --theme-secondary: #240a19;
  --theme-glass: rgba(180, 45, 114, 0.46);
  --theme-glow: rgba(180, 45, 114, 0.3);
  --theme-metal: #68264c;
  --room-mist: radial-gradient(circle at 80% 35%, rgba(180, 45, 114, 0.22), transparent 18rem);
}

.theme-missioner {
  --theme-primary: #b78f4d;
  --theme-secondary: #17130d;
  --theme-glass: rgba(183, 143, 77, 0.42);
  --theme-glow: rgba(183, 143, 77, 0.24);
  --theme-metal: #6d5737;
  --room-mist: radial-gradient(circle at 35% 22%, rgba(183, 143, 77, 0.18), transparent 16rem);
}

.theme-orel-i-volki {
  --theme-primary: #788d9a;
  --theme-secondary: #11171a;
  --theme-glass: rgba(120, 141, 154, 0.42);
  --theme-glow: rgba(120, 141, 154, 0.22);
  --theme-metal: #44545d;
  --room-mist: radial-gradient(circle at 70% 72%, rgba(120, 141, 154, 0.18), transparent 17rem);
}

.theme-pepel-vatikana-teni-1929 {
  --theme-primary: #c6c0ae;
  --theme-secondary: #191714;
  --theme-glass: rgba(198, 192, 174, 0.34);
  --theme-glow: rgba(198, 192, 174, 0.2);
  --theme-metal: #726d61;
  --room-mist: radial-gradient(circle at 50% 20%, rgba(198, 192, 174, 0.18), transparent 18rem);
}

.theme-proklyataya-moneta {
  --theme-primary: #d0a642;
  --theme-secondary: #241a08;
  --theme-glass: rgba(208, 166, 66, 0.46);
  --theme-glow: rgba(208, 166, 66, 0.28);
  --theme-metal: #7a642c;
  --room-mist: radial-gradient(circle at 72% 52%, rgba(208, 166, 66, 0.2), transparent 18rem);
}

.theme-sozdanie-mira {
  --theme-primary: #8fb7d5;
  --theme-secondary: #08121c;
  --theme-glass: rgba(143, 183, 213, 0.42);
  --theme-glow: rgba(78, 151, 206, 0.24);
  --theme-metal: #41637a;
  --room-mist: radial-gradient(circle at 50% 28%, rgba(143, 183, 213, 0.2), transparent 22rem);
}

.theme-tampliery {
  --theme-primary: #d7c48c;
  --theme-secondary: #251d12;
  --theme-glass: rgba(215, 196, 140, 0.42);
  --theme-glow: rgba(215, 196, 140, 0.23);
  --theme-metal: #746743;
  --room-mist: radial-gradient(circle at 50% 68%, rgba(215, 196, 140, 0.18), transparent 17rem);
}

.theme-tancevalnaya-chuma {
  --theme-primary: #9f7fd6;
  --theme-secondary: #171021;
  --theme-glass: rgba(159, 127, 214, 0.42);
  --theme-glow: rgba(159, 127, 214, 0.25);
  --theme-metal: #58456f;
  --room-mist: radial-gradient(circle at 20% 48%, rgba(159, 127, 214, 0.18), transparent 18rem);
}

.theme-chernobyl {
  --theme-primary: #a7c957;
  --theme-secondary: #10180b;
  --theme-glass: rgba(167, 201, 87, 0.42);
  --theme-glow: rgba(167, 201, 87, 0.26);
  --theme-metal: #536b35;
  --room-mist: radial-gradient(circle at 82% 25%, rgba(167, 201, 87, 0.2), transparent 18rem);
}

.theme-chuma {
  --theme-primary: #7e9f6d;
  --theme-secondary: #10170d;
  --theme-glass: rgba(126, 159, 109, 0.4);
  --theme-glow: rgba(126, 159, 109, 0.24);
  --theme-metal: #4b6440;
  --room-mist: radial-gradient(circle at 25% 72%, rgba(126, 159, 109, 0.2), transparent 18rem);
}

.theme-chernoe-evangelie {
  --theme-primary: #a88ec7;
  --theme-secondary: #100b16;
  --theme-glass: rgba(168, 142, 199, 0.42);
  --theme-glow: rgba(168, 142, 199, 0.24);
  --theme-metal: #5b4d6e;
  --room-mist: radial-gradient(circle at 50% 15%, rgba(168, 142, 199, 0.18), transparent 18rem);
}

.theme-shkola-v-beslane {
  --theme-primary: #dad6c8;
  --theme-secondary: #171513;
  --theme-glass: rgba(218, 214, 200, 0.32);
  --theme-glow: rgba(218, 214, 200, 0.17);
  --theme-metal: #6c675d;
  --room-mist: radial-gradient(circle at 32% 22%, rgba(218, 214, 200, 0.15), transparent 16rem);
}

.theme-yama-anatomiya-pozora {
  --theme-primary: #b46b4c;
  --theme-secondary: #1e100b;
  --theme-glass: rgba(180, 107, 76, 0.42);
  --theme-glow: rgba(180, 107, 76, 0.24);
  --theme-metal: #68402f;
  --room-mist: radial-gradient(circle at 50% 90%, rgba(180, 107, 76, 0.2), transparent 20rem);
}

.hall-view,
.map-view,
.room-view {
  background-image:
    linear-gradient(180deg, rgba(3, 3, 4, 0.62), rgba(3, 3, 4, 0.94)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.032) 0 1px, transparent 1px 46px),
    url("/assets/temple-gate.png");
  background-blend-mode: normal, screen, screen, normal;
}

.hall-view::before,
.map-view::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(178, 147, 83, 0.18), transparent 32rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.64), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.68));
  opacity: 0.85;
}

.topbar,
.room-header,
.hall-grid,
.temple-map,
.room-grid {
  position: relative;
  z-index: 1;
}

.topbar,
.room-header {
  border-bottom: 1px solid rgba(216, 209, 198, 0.14);
  background:
    linear-gradient(90deg, transparent, rgba(5, 5, 5, 0.58), transparent);
}

.hall-corridor-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  overflow: hidden;
}

.hall-corridor-topbar {
  z-index: 5;
  width: min(1500px, calc(100% - 2rem));
}

.corridor-shell {
  --corridor-scale: 1.02;
  --corridor-pan: 0%;
  --corridor-light: 0.86;
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 2rem));
  min-height: calc(100vh - 136px);
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 1px solid rgba(216, 209, 198, 0.2);
  border-radius: 8px;
  background: #050403;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 28px 96px rgba(0, 0, 0, 0.72);
}

.corridor-shell::before,
.corridor-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.corridor-shell::before {
  z-index: 0;
  background-image:
    radial-gradient(ellipse at 50% 42%, rgba(84, 55, 34, 0.26), rgba(0, 0, 0, 0.72)),
    url("/assets/cinematic-stone-tile.jpg");
  background-position: center;
  background-size: 420px 420px;
  filter: brightness(0.42) contrast(1.12) saturate(0.78);
  opacity: 0.52;
}

.corridor-shell::after {
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 0 34%, rgba(0, 0, 0, 0.28) 75%, rgba(0, 0, 0, 0.66)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5px);
  mix-blend-mode: multiply;
  opacity: 0.78;
}

.hall-corridor {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hall-corridor canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
}

.hall-corridor.is-hovering-door canvas,
.hall-corridor canvas:active {
  cursor: pointer;
}

.corridor-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 0 36%, rgba(0, 0, 0, 0.2) 72%, rgba(0, 0, 0, 0.5)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.38));
  opacity: 0.72;
}

.corridor-status,
.corridor-door-card,
.corridor-controls {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(216, 209, 198, 0.2);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(14, 12, 10, 0.72), rgba(5, 5, 5, 0.84)),
    rgba(5, 5, 5, 0.76);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.corridor-status {
  left: 1rem;
  top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  align-items: center;
  max-width: min(680px, calc(100% - 2rem));
  padding: 0.62rem 0.72rem;
  color: var(--stone);
  font-size: 0.78rem;
  font-weight: 900;
}

.corridor-status p {
  margin: 0;
}

.corridor-status span {
  color: var(--brass);
}

.corridor-door-card {
  left: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.28rem;
  width: min(420px, calc(100% - 2rem));
  padding: 0.84rem 0.95rem;
}

.corridor-door-card strong {
  overflow-wrap: anywhere;
  color: var(--ash);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  line-height: 1.08;
  text-shadow: 0 0 18px rgba(208, 23, 47, 0.28), 0 2px 4px #000;
}

.corridor-door-card span {
  color: var(--stone);
  line-height: 1.42;
}

.corridor-controls {
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  max-width: min(620px, calc(100% - 2rem));
  padding: 0.62rem;
}

.corridor-controls .primary-button,
.corridor-controls .ghost-button {
  width: auto;
}

.corridor-fallback {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 0.85rem;
  min-height: 100%;
  padding: 1rem;
  overflow: auto;
}

.hall-grid {
  grid-template-columns: minmax(280px, 0.65fr) minmax(420px, 1.35fr);
  align-items: stretch;
}

.hall-copy,
.door-list,
.ledger,
.arena,
.scratch-wall,
.song-details {
  border-color: rgba(216, 209, 198, 0.22);
  background:
    linear-gradient(180deg, rgba(22, 22, 20, 0.84), rgba(7, 7, 8, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 24px 90px rgba(0, 0, 0, 0.62);
}

.door-list {
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 0.85rem;
  max-height: 72vh;
  padding: 1rem;
}

.cathedral-door {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--theme-primary) 68%, #0b0b0c);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 17%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.45)),
    linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 28%, #070707), var(--theme-secondary));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -22px 34px rgba(0, 0, 0, 0.42),
    0 0 30px var(--theme-glow);
}

.cathedral-door::before {
  content: "";
  position: absolute;
  inset: 8px 10px 10px;
  z-index: -1;
  border: 1px solid rgba(216, 209, 198, 0.2);
  border-bottom-color: rgba(0, 0, 0, 0.4);
  border-radius: 46% 46% 5px 5px / 30px 30px 5px 5px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, 0.38) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 30%);
}

.cathedral-door::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 10px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-primary) 72%, #ede1bc);
  box-shadow: 0 0 18px var(--theme-glow);
  opacity: 0.76;
}

.door-row {
  grid-template-columns: 1fr;
  align-content: end;
  min-height: 132px;
  padding: 1rem;
  border-radius: 44% 44% 7px 7px / 34px 34px 7px 7px;
  text-align: center;
}

.door-row:hover,
.map-door:hover,
.gothic-portal:hover {
  transform: translateY(-3px);
  border-color: var(--theme-primary);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 34px var(--theme-glow),
    0 18px 42px rgba(0, 0, 0, 0.52);
}

.door-row-label,
.map-door-title,
.portal-title {
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 4px #000, 0 0 14px rgba(0, 0, 0, 0.8);
}

.door-row-label {
  display: grid;
  gap: 0.28rem;
}

.door-row-label span,
.map-door-title,
.portal-title {
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

.door-row-label small {
  color: color-mix(in srgb, var(--theme-primary) 58%, var(--stone));
}

.door-row.visited,
.map-node.visited {
  border-color: color-mix(in srgb, var(--theme-primary) 55%, var(--brass));
}

.temple-map {
  height: clamp(820px, 94vh, 980px);
  min-height: 820px;
  border-color: rgba(216, 209, 198, 0.22);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(178, 147, 83, 0.11), transparent 18rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.55), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.58)),
    repeating-linear-gradient(90deg, rgba(216, 209, 198, 0.045) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(216, 209, 198, 0.035) 0 1px, transparent 1px 46px),
    #090909;
}

.cathedral-plan::before,
.cathedral-plan::after {
  content: "";
  position: absolute;
  top: 5%;
  bottom: 5%;
  width: 18%;
  border: 1px solid rgba(216, 209, 198, 0.13);
  border-radius: 50% 50% 6px 6px / 18% 18% 6px 6px;
  opacity: 0.42;
}

.cathedral-plan::before {
  left: 4%;
}

.cathedral-plan::after {
  right: 4%;
}

.map-rose-window {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(26vw, 260px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border: 1px solid rgba(216, 209, 198, 0.18);
  border-radius: 50%;
  background:
    conic-gradient(from 8deg, rgba(208, 23, 47, 0.3), rgba(178, 147, 83, 0.26), rgba(79, 142, 163, 0.26), rgba(159, 127, 214, 0.22), rgba(208, 23, 47, 0.3)),
    radial-gradient(circle, transparent 0 26%, rgba(0, 0, 0, 0.55) 27% 29%, transparent 30% 44%, rgba(0, 0, 0, 0.55) 45% 47%, transparent 48%);
  filter: blur(0.2px);
  opacity: 0.28;
  box-shadow: 0 0 70px rgba(178, 147, 83, 0.16);
}

.map-vault {
  position: absolute;
  top: 9%;
  bottom: 9%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(216, 209, 198, 0.18), transparent);
  opacity: 0.72;
}

.map-vault-left {
  left: 33.3%;
}

.map-vault-right {
  right: 33.3%;
}

.map-lines line {
  stroke: rgba(178, 147, 83, 0.36);
  stroke-dasharray: 2 3;
  stroke-width: 0.35;
}

.map-node.map-door {
  position: absolute;
  width: clamp(98px, 9vw, 148px);
  min-width: 0;
  min-height: clamp(94px, 12vh, 128px);
  padding: 2rem 0.55rem 0.78rem;
  border-radius: 44% 44% 7px 7px / 32px 32px 7px 7px;
  font-size: clamp(0.58rem, 0.8vw, 0.78rem);
  line-height: 1.05;
}

.map-node.map-door:hover {
  translate: -50% calc(-50% - 3px);
}

.main-node.map-door {
  width: clamp(118px, 11vw, 170px);
  min-height: clamp(110px, 14vh, 152px);
  border-color: rgba(208, 23, 47, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 18%),
    linear-gradient(180deg, #8b1522, #170607);
}

.map-door small {
  position: relative;
  z-index: 2;
  color: color-mix(in srgb, var(--theme-primary) 62%, var(--stone));
  font-size: 0.72em;
}

.room-view {
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(4, 4, 5, 0.52), rgba(4, 4, 5, 0.95)),
    var(--room-mist),
    repeating-linear-gradient(90deg, rgba(216, 209, 198, 0.042) 0 1px, transparent 1px 68px),
    repeating-linear-gradient(0deg, rgba(216, 209, 198, 0.028) 0 1px, transparent 1px 42px),
    var(--room-bg, url("/assets/temple-gate.png"));
  background-blend-mode: normal, screen, screen, screen, normal;
}

.room-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.room-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% -8%, var(--theme-glow), transparent 34rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.68), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.72));
}

.stained-window {
  position: absolute;
  top: 12vh;
  width: min(18vw, 180px);
  height: min(58vh, 520px);
  border: 1px solid rgba(216, 209, 198, 0.14);
  border-radius: 50% 50% 8px 8px / 64px 64px 8px 8px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, 0.44) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(0, 0, 0, 0.42) 38px 40px),
    conic-gradient(from 45deg, var(--theme-glass), rgba(178, 147, 83, 0.22), rgba(64, 91, 107, 0.22), var(--theme-glass));
  filter: blur(0.3px);
  opacity: 0.2;
  box-shadow: 0 0 95px var(--theme-glow);
}

.stained-window-left {
  left: 4vw;
}

.stained-window-right {
  right: 4vw;
}

.apse-shadow {
  position: absolute;
  left: 50%;
  top: 13vh;
  width: min(42vw, 560px);
  height: min(58vh, 560px);
  translate: -50% 0;
  border: 1px solid rgba(216, 209, 198, 0.08);
  border-radius: 50% 50% 12px 12px / 80px 80px 12px 12px;
  background: radial-gradient(ellipse at 50% 20%, var(--theme-glow), transparent 62%);
  opacity: 0.5;
}

.room-header h1 {
  color: color-mix(in srgb, var(--theme-primary) 74%, var(--ash));
  text-shadow: 0 0 28px var(--theme-glow), 0 3px 5px #000;
}

.room-header {
  padding: clamp(0.55rem, 1.2vh, 0.9rem) 0;
}

.room-header h1 {
  font-size: clamp(2rem, 4.8vh, 3.6rem);
}

.room-chamber {
  --room-gap: clamp(0.7rem, 1.2vw, 1rem);
  position: relative;
  width: min(1500px, calc(100% - 2rem));
  height: clamp(500px, calc(100vh - 142px), 820px);
  height: clamp(500px, calc(100svh - 142px), 820px);
  min-height: 500px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(216, 209, 198, 0.18);
  border-radius: 8px;
  background: #050403;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 28px 96px rgba(0, 0, 0, 0.72);
}

.room-chamber::before,
.room-chamber::after {
  content: "";
  display: none;
}

.room-chamber::before {
  z-index: 1;
  bottom: -13%;
  height: 38%;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.62)),
    var(--floor-bg, var(--room-bg, url("/assets/temple-gate.png")));
  transform-origin: bottom center;
  transform: rotateX(70deg);
  box-shadow: inset 0 40px 80px rgba(0, 0, 0, 0.46);
}

.room-chamber::after {
  z-index: 1;
  top: -17%;
  height: 32%;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18)),
    var(--ceiling-bg, var(--room-bg, url("/assets/temple-gate.png")));
  transform-origin: top center;
  transform: rotateX(-68deg);
  box-shadow: inset 0 -34px 80px rgba(0, 0, 0, 0.5);
}

.room-chamber-scene,
.room-chamber-vignette {
  position: absolute;
  inset: 0;
}

.room-chamber-scene {
  z-index: 0;
  opacity: 0.96;
}

.room-chamber-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.room-chamber-vignette {
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 0 33%, rgba(0, 0, 0, 0.22) 66%, rgba(0, 0, 0, 0.74)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.56), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.58));
}

.room-chamber-content {
  position: absolute;
  inset: clamp(0.75rem, 1.4vw, 1.2rem) clamp(0.75rem, 1.4vw, 1.2rem) max(clamp(0.75rem, 1.4vw, 1.2rem), 7.6rem);
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(360px, 1.18fr) minmax(240px, 0.9fr);
  gap: var(--room-gap);
  align-items: stretch;
  min-height: 0;
  pointer-events: none;
}

.room-wall {
  position: relative;
  pointer-events: auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  contain: layout paint;
  scrollbar-color: rgba(178, 147, 83, 0.42) rgba(0, 0, 0, 0.28);
  scrollbar-width: thin;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.032),
    0 22px 62px rgba(0, 0, 0, 0.52);
}

.room-chamber .ledger,
.room-chamber .arena,
.room-chamber .scratch-wall {
  min-height: 0;
}

.room-wall-history {
  --surface-bg: var(--wall-history-bg);
  z-index: 2;
  left: auto;
  top: auto;
  width: auto;
  transform: none;
}

.room-wall-songs {
  --surface-bg: var(--wall-songs-bg);
  z-index: 1;
  left: auto;
  top: auto;
  width: auto;
  transform: none;
}

.room-wall-notes {
  --surface-bg: var(--wall-notes-bg);
  z-index: 2;
  right: auto;
  top: auto;
  width: auto;
  transform: none;
}

.room-wall::-webkit-scrollbar {
  width: 8px;
}

.room-wall::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.28);
}

.room-wall::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(178, 147, 83, 0.45);
}

.room-grid {
  grid-template-columns: minmax(240px, 0.86fr) minmax(390px, 1.44fr) minmax(240px, 0.86fr);
  gap: 1rem;
}

.ledger,
.scratch-wall {
  position: relative;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(20, 16, 13, 0.54), rgba(5, 5, 6, 0.72)),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 22px),
    var(--surface-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: auto, auto, cover;
  background-position: center;
}

.ledger::before,
.scratch-wall::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(216, 209, 198, 0.11);
  border-radius: 5px;
}

.ledger h2 {
  color: color-mix(in srgb, var(--theme-primary) 50%, var(--ash));
}

.arena {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: clamp(124px, 18vh, 210px) minmax(0, 1fr);
  gap: 0.72rem;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 50% 12%, var(--theme-glow), transparent 22rem),
    linear-gradient(180deg, rgba(10, 10, 10, 0.5), rgba(5, 5, 6, 0.74)),
    var(--surface-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: auto, auto, cover;
  background-position: center;
}

.arena::before {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px solid rgba(216, 209, 198, 0.09);
  border-radius: 50% 50% 8px 8px / 52px 52px 8px 8px;
}

.door-orbit {
  display: grid;
  align-content: start;
  min-height: 0;
  height: 100%;
  padding: 1rem;
  overflow: auto;
  overscroll-behavior: contain;
  border-color: rgba(216, 209, 198, 0.16);
  background:
    radial-gradient(ellipse at 50% 0%, var(--theme-glow), transparent 18rem),
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.56)),
    repeating-linear-gradient(90deg, rgba(216, 209, 198, 0.03) 0 1px, transparent 1px 54px),
    var(--wall-doors-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: auto, auto, auto, cover;
  background-position: center;
}

.altar-window {
  align-self: start;
  justify-self: center;
  width: min(54%, 360px);
  height: clamp(64px, 8vh, 98px);
  border: 1px solid rgba(216, 209, 198, 0.12);
  border-radius: 50% 50% 8px 8px / 56px 56px 8px 8px;
  background:
    conic-gradient(from 25deg, var(--theme-glass), rgba(178, 147, 83, 0.23), rgba(83, 99, 90, 0.2), var(--theme-glass)),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 42%);
  opacity: 0.42;
  box-shadow: 0 0 80px var(--theme-glow);
}

.portal-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 0.8rem;
  align-self: end;
  width: 100%;
}

.portal.gothic-portal {
  position: relative;
  left: auto;
  top: auto;
  display: grid;
  place-items: end center;
  width: 100%;
  min-height: clamp(96px, 12vh, 132px);
  padding: 2.4rem 0.74rem 1rem;
  transform: none;
  border-radius: 46% 46% 8px 8px / 42px 42px 8px 8px;
  font-size: 0.82rem;
}

.portal.gothic-portal:hover {
  transform: translateY(-4px);
}

.portal-arch {
  position: absolute;
  inset: 10px 12px 12px;
  border: 1px solid rgba(216, 209, 198, 0.16);
  border-radius: 48% 48% 5px 5px / 38px 38px 5px 5px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, 0.38) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    radial-gradient(ellipse at 50% 16%, rgba(255, 255, 255, 0.13), transparent 36%),
    linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 24%, #111), var(--theme-secondary));
}

.song-wall {
  position: relative;
  z-index: 1;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 0.55rem;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  border-top: 1px solid rgba(216, 209, 198, 0.12);
  padding-top: 0.65rem;
}

.song-wall .section-title {
  position: sticky;
  top: -0.65rem;
  z-index: 2;
  margin: -0.65rem -0.25rem 0.1rem 0;
  padding: 0.65rem 0.25rem 0.55rem 0;
  background:
    linear-gradient(180deg, rgba(12, 12, 12, 0.94), rgba(12, 12, 12, 0.72)),
    var(--surface-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: auto, cover;
  background-position: center;
  backdrop-filter: blur(8px);
}

.song-line {
  min-height: 60px;
  border-left: 2px solid color-mix(in srgb, var(--theme-primary) 42%, transparent);
  padding-left: 0.35rem;
  contain: layout paint;
}

.song-line.fade-carve {
  animation: none;
}

.song-line.is-selected {
  border-left-color: var(--theme-primary);
}

.song-line.is-selected .song-title {
  border-color: color-mix(in srgb, var(--theme-primary) 76%, rgba(216, 209, 198, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 24px var(--theme-glow);
}

.song-title,
.link-chip {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.18)),
    rgba(8, 8, 8, 0.84);
}

.temple-player {
  border-color: color-mix(in srgb, var(--theme-primary) 50%, rgba(216, 209, 198, 0.18));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 16%, rgba(5, 5, 5, 0.82)), rgba(5, 5, 5, 0.82)),
    rgba(5, 5, 5, 0.72);
}

.scratch-wall textarea {
  border-color: rgba(216, 209, 198, 0.15);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    radial-gradient(circle at 24% 18%, var(--theme-glow), transparent 16rem),
    linear-gradient(180deg, rgba(5, 5, 5, 0.52), rgba(5, 5, 5, 0.68)),
    var(--wall-notes-bg, var(--room-bg, url("/assets/temple-gate.png")));
  background-size: 22px 22px, 22px 22px, auto, auto, cover;
  background-position: center;
}

.room-chamber .scratch-wall textarea {
  height: 100%;
  min-height: 0;
  resize: none;
}

.scratch-wall label {
  color: color-mix(in srgb, var(--theme-primary) 72%, var(--blood));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.82);
}

.name-modal {
  position: relative;
  padding: 1.2rem;
}

.name-modal h2 {
  color: var(--blood);
}

.modal-close {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: min(420px, calc(100% - 2rem));
  border: 1px solid rgba(208, 23, 47, 0.55);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  color: var(--ash);
  background: rgba(12, 12, 13, 0.95);
  box-shadow: var(--shadow);
}

.loading-view {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
}

.loading-mark {
  width: 68px;
  height: 68px;
  border: 2px solid rgba(216, 209, 198, 0.2);
  border-top-color: var(--blood);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

@media (max-width: 980px) {
  .room-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .room-view {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 1rem;
  }

  .topbar,
  .room-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hall-grid,
  .room-grid {
    grid-template-columns: 1fr;
  }

  .room-chamber {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .room-chamber::before,
  .room-chamber::after {
    display: none;
  }

  .room-chamber-scene {
    position: relative;
    height: 54vh;
    min-height: 360px;
  }

  .room-chamber-vignette {
    display: none;
  }

  .room-chamber-content {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: 1fr;
    padding: 0.75rem;
    perspective: none;
  }

  .room-wall,
  .room-wall-history,
  .room-wall-songs,
  .room-wall-notes {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
    height: auto;
    max-height: none;
    transform: none;
  }

  .room-footer {
    position: relative;
    left: auto;
    bottom: auto;
    width: min(1420px, calc(100% - 2rem));
    margin: 0.9rem auto 0;
    padding-bottom: 1rem;
  }

  .room-footer .primary-button {
    width: 100%;
    min-width: 0;
  }

  .temple-player-slot {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: auto;
  }

  .arena {
    overflow: visible;
    grid-template-rows: auto;
  }

  .song-wall {
    overflow: visible;
    max-height: none;
  }

  .song-details {
    position: relative;
    inset: auto;
    max-height: min(640px, 72vh);
  }

  .ledger,
  .arena,
  .scratch-wall {
    min-height: auto;
  }

  .scratch-wall textarea {
    min-height: 260px;
  }

  .temple-map {
    height: 820px;
    min-height: 820px;
  }
}

@media (min-width: 981px) and (max-width: 1279px) {
  .room-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .room-view {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 1rem;
  }

  .room-chamber {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .room-chamber-scene {
    position: relative;
    height: 52vh;
    min-height: 360px;
  }

  .room-chamber-vignette {
    display: none;
  }

  .room-chamber-content {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(360px, 1.1fr);
    padding: 0.85rem;
    perspective: none;
  }

  .room-wall,
  .room-wall-history,
  .room-wall-songs,
  .room-wall-notes {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
    height: auto;
    max-height: none;
    transform: none;
  }

  .room-wall-notes {
    grid-column: 1 / -1;
  }

  .song-wall {
    max-height: 420px;
  }

  .song-details {
    position: relative;
    inset: auto;
    max-height: min(640px, 72vh);
  }

  .room-footer {
    position: relative;
    left: auto;
    bottom: auto;
    width: min(1420px, calc(100% - 2rem));
    margin: 0.9rem auto 0;
    padding-bottom: 1rem;
  }

  .room-footer .primary-button {
    width: 100%;
    min-width: 0;
  }

  .temple-player-slot {
    position: static;
    width: min(1500px, calc(100% - 2rem));
    margin: 0.9rem auto 0;
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 1rem;
  }

  .button-row {
    align-items: stretch;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .map-node {
    min-width: 92px;
    font-size: 0.72rem;
  }

  .portal {
    width: 46%;
    font-size: 0.68rem;
  }

  .song-line {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .hall-grid {
    grid-template-columns: 1fr;
  }

  .door-list {
    max-height: none;
  }

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

  .stained-window {
    opacity: 0.12;
  }
}

@media (max-width: 700px) {
  .hall-corridor-view {
    overflow: auto;
  }

  .corridor-shell {
    min-height: 72vh;
    margin-bottom: 0.75rem;
  }

  .corridor-status {
    left: 0.65rem;
    right: 0.65rem;
    top: 0.65rem;
    max-width: none;
  }

  .corridor-door-card {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 5.1rem;
    width: auto;
  }

  .corridor-door-card strong {
    font-size: 1.08rem;
  }

  .corridor-controls {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
    max-width: none;
    justify-content: stretch;
  }

  .corridor-controls .primary-button,
  .corridor-controls .ghost-button {
    flex: 1 1 46%;
    width: auto;
  }

  .temple-map {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem;
    height: auto;
    min-height: 0;
    padding: 1rem;
    overflow: visible;
  }

  .map-lines {
    display: none;
  }

  .map-rose-window {
    top: 50%;
    width: 72%;
    opacity: 0.14;
  }

  .map-node.map-door {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: 100%;
    min-height: 118px;
    padding: 1.8rem 0.42rem 0.64rem;
    translate: none;
    font-size: 0.62rem;
  }

  .map-node.map-door:hover {
    transform: translateY(-2px);
    translate: none;
  }

  .main-node.map-door {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(164px, 62%);
    min-height: 136px;
  }

  .portal-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .portal.gothic-portal {
    min-height: 156px;
  }
}

@media (max-width: 520px) {
  .door-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .door-row {
    min-height: 120px;
    padding: 0.78rem;
  }

  .door-row-label span,
  .map-door-title,
  .portal-title {
    font-size: 0.82rem;
  }

  .room-header h1,
  .topbar h1 {
    font-size: clamp(1.8rem, 12vw, 3.2rem);
  }
}

