:root {
  color-scheme: dark;
  --bg: #020103;
  --surface: rgba(11, 8, 15, 0.82);
  --surface-strong: #0d0914;
  --line: rgba(187, 153, 243, 0.24);
  --text: #f1edf8;
  --muted: #b1a7bc;
  --violet: #8b5cf6;
  --violet-2: #c084fc;
  --gold: #e0bc72;
  --red: #a84b32;
  --blue: #7cb7ff;
  --shadow: rgba(91, 35, 168, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(2, 1, 3, 0.08), rgba(2, 1, 3, 0.9) 58rem),
    url("./assets/thal-scales-background.png") center top / contain no-repeat fixed,
    #020103;
  font-family: Georgia, "Times New Roman", serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle at 50% 35%, rgba(96, 48, 176, 0.32), transparent 23rem),
    linear-gradient(90deg, rgba(168, 64, 41, 0.11), transparent 32%, transparent 68%, rgba(90, 157, 255, 0.11)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(2, 1, 3, 0.82) 74%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(224, 188, 114, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(192, 132, 252, 0.022) 1px, transparent 1px);
  background-size: 96px 96px;
  opacity: 0.6;
  mask-image: radial-gradient(circle at 50% 45%, black, transparent 78%);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(224, 188, 114, 0.18);
  background: linear-gradient(90deg, rgba(5, 3, 6, 0.92), rgba(13, 8, 20, 0.82), rgba(3, 4, 9, 0.92));
  backdrop-filter: blur(20px);
  box-shadow: 0 0.9rem 3rem rgba(0, 0, 0, 0.36);
}

.brand {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 46%, var(--gold) 47% 53%, transparent 54%),
    linear-gradient(180deg, transparent 43%, var(--gold) 44% 49%, transparent 50%),
    radial-gradient(circle at 29% 61%, transparent 0 0.25rem, var(--gold) 0.28rem 0.31rem, transparent 0.34rem),
    radial-gradient(circle at 71% 61%, transparent 0 0.25rem, var(--gold) 0.28rem 0.31rem, transparent 0.34rem);
  box-shadow: 0 0 22px rgba(216, 180, 106, 0.24);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.main-nav a,
.login-button,
.hero-actions a,
.sigil-menu button,
.upload-panel button,
.bookcase button,
.locked-panel button,
.permission-panel button,
.login-options button,
.book-popup-grid button {
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  color: var(--text);
  background: rgba(10, 7, 14, 0.7);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  font-size: 0.92rem;
}

.main-nav a:hover,
.main-nav a.is-current,
.main-nav a.is-sigil-hover,
.login-button:hover,
.hero-actions a:hover,
.upload-panel button:hover,
.bookcase button:hover,
.locked-panel button:hover,
.permission-panel button:hover,
.login-options button:hover,
.book-popup-grid button:hover {
  border-color: rgba(232, 121, 249, 0.68);
  background: rgba(42, 23, 68, 0.72);
  box-shadow: 0 0 24px rgba(129, 77, 217, 0.28);
  transform: translateY(-1px);
}

.login-button {
  padding: 0.45rem 0.9rem;
}

.nav-toggle {
  display: none;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(22rem, 1.28fr);
  min-height: max(calc(100vh - 4.35rem), calc(100vw * 0.5625));
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 4.4rem) clamp(1rem, 5vw, 5rem) clamp(2.5rem, 7vw, 6rem);
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  height: 12rem;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(2, 1, 3, 0.94));
  pointer-events: none;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(2, 1, 3, 0.05) 43%, rgba(0, 0, 0, 0.16)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(2, 1, 3, 0.16) 72%, rgba(2, 1, 3, 0.66)),
    url("./assets/thal-scales-background.png") center center / cover no-repeat;
}

.hero-backdrop::before,
.hero-backdrop::after {
  position: absolute;
  content: "";
  opacity: 0.55;
}

.hero-backdrop::before {
  left: 50%;
  top: 13%;
  width: min(38vw, 32rem);
  height: min(38vw, 32rem);
  opacity: 0;
  border: 1px solid rgba(224, 188, 114, 0.16);
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(224, 188, 114, 0.24) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(224, 188, 114, 0.22) 50%, transparent 50.2%),
    radial-gradient(circle, transparent 0 54%, rgba(192, 132, 252, 0.1) 55%, transparent 56%);
}

.hero-backdrop::after {
  left: 50%;
  top: 42%;
  width: min(30vw, 27rem);
  height: min(30vw, 27rem);
  border: 1px solid rgba(192, 132, 252, 0.2);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: inset 0 0 3rem rgba(76, 29, 149, 0.18);
}

.hero-copy {
  max-width: 39rem;
  padding: clamp(0.8rem, 1.6vw, 1.2rem) 0;
  background: linear-gradient(90deg, rgba(3, 2, 4, 0.5), rgba(3, 2, 4, 0.08));
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.76);
  transform: translateY(clamp(-1.5rem, -2.2vh, -1rem));
}

.kicker {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 1rem;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(2.55rem, 6vw, 5.625rem);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: 0.035em;
  text-shadow: 0 0 28px rgba(107, 70, 193, 0.58), 0 0 7rem rgba(224, 188, 114, 0.18);
}

h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 500;
}

h3 {
  color: #f6e7b4;
  font-size: 1.15rem;
}

.hero-copy p:not(.kicker) {
  max-width: 36rem;
  color: #eee7f3;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-style: italic;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.7rem;
}

.hero-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1rem;
}

.primary-action {
  border-color: rgba(216, 180, 106, 0.56) !important;
  background: linear-gradient(90deg, rgba(96, 49, 30, 0.84), rgba(69, 38, 99, 0.72)) !important;
}

.crystal-stage {
  position: relative;
  min-height: clamp(31rem, 72vh, 48rem);
  overflow: visible;
  filter: drop-shadow(0 0 2rem rgba(96, 65, 188, 0.2));
  transform: translateY(clamp(-1.5rem, -2.2vh, -1rem));
}

#crystal-canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: clamp(31rem, 72vh, 48rem);
  display: block;
}

.heptagram,
.arc-flow {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(88%, 43rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.heptagram {
  z-index: 1;
  overflow: visible;
  object-fit: contain;
  opacity: 0.25;
  filter:
    drop-shadow(0 0 0.9rem rgba(168, 88, 255, 0.78))
    drop-shadow(0 0 2.2rem rgba(96, 33, 180, 0.64));
}

.arc-flow {
  z-index: 3;
}

.arc-flow line {
  stroke: rgba(0, 0, 0, 0);
  stroke-width: 3.9;
  stroke-linecap: round;
  filter:
    blur(2.5px)
    drop-shadow(0 0 1.1rem rgba(255, 40, 40, 0.94))
    drop-shadow(0 0 3.4rem rgba(148, 0, 0, 0.82));
}

.arc-flow.is-active line {
  animation: arc-flow-pulse 780ms ease-out;
}

@keyframes arc-flow-pulse {
  0% {
    stroke: rgba(0, 0, 0, 0);
    stroke-dasharray: 0 120;
  }

  28% {
    stroke: rgba(3, 0, 0, 0.96);
    stroke-dasharray: 24 120;
  }

  100% {
    stroke: rgba(0, 0, 0, 0);
    stroke-dasharray: 96 120;
  }
}

.sigil-menu {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 4;
  width: min(88%, 43rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sigil-button {
  position: absolute;
  left: var(--sigil-x);
  top: var(--sigil-y);
  display: grid;
  width: clamp(3.7rem, 7.2vw, 5.7rem);
  height: clamp(3.7rem, 7.2vw, 5.7rem);
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  appearance: none;
}

.sigil-button img {
  width: 126%;
  height: 126%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 0.18rem rgba(255, 218, 119, 0.35))
    drop-shadow(0 0 0.35rem rgba(112, 64, 164, 0.18));
  transition: filter 180ms ease, opacity 180ms ease;
}

.sigil-button:hover,
.sigil-button:focus-visible {
  background: transparent !important;
  box-shadow: none !important;
  border-color: transparent !important;
  transform: translate(-50%, -50%) !important;
}

.sigil-button:hover img,
.sigil-button:focus-visible img,
.sigil-button.is-active img {
  filter:
    drop-shadow(0 0 0.45rem rgba(255, 232, 188, 1))
    drop-shadow(0 0 1.1rem rgba(255, 192, 76, 0.82))
    drop-shadow(0 0 1.8rem rgba(187, 93, 255, 0.58));
}

.sigil-vita {
  --sigil-x: 50%;
  --sigil-y: 92%;
}

.sigil-galerie {
  --sigil-x: 17%;
  --sigil-y: 76%;
}

.sigil-forschung {
  --sigil-x: 9%;
  --sigil-y: 41%;
}

.sigil-foki {
  --sigil-x: 32%;
  --sigil-y: 12%;
}

.sigil-begleiter {
  --sigil-x: 68%;
  --sigil-y: 12%;
}

.sigil-musik {
  --sigil-x: 91%;
  --sigil-y: 41%;
}

.sigil-abzeichen {
  --sigil-x: 83%;
  --sigil-y: 76%;
}

.stage-note {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.3rem;
  margin: 0;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.82rem;
  text-align: center;
}

.page-section {
  display: none;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 5vw, 5rem);
  border-bottom: 1px solid rgba(224, 188, 114, 0.14);
  background:
    linear-gradient(180deg, rgba(2, 1, 3, 0.82), rgba(2, 1, 3, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(91, 35, 168, 0.18), transparent 30rem);
}

.page-section.is-active {
  display: block;
}

#vita {
  display: none !important;
}

.section-heading {
  max-width: 50rem;
  margin-bottom: 1.6rem;
}

.vita-grid,
.gallery-grid,
.music-grid,
.badge-admin,
.research-layout {
  display: grid;
  gap: 1rem;
}

.vita-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.upload-panel,
.bookcase,
.locked-panel,
.permission-panel,
.track,
.badge-grid article {
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: 0 1.2rem 3.8rem rgba(0, 0, 0, 0.42);
}

.panel,
.bookcase,
.locked-panel,
.permission-panel,
.track {
  padding: 1.2rem;
}

.panel p,
.bookcase p,
.locked-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.gallery-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-tile {
  min-height: 17rem;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: #f7eac6;
  background:
    linear-gradient(180deg, transparent 34%, rgba(3, 2, 5, 0.88)),
    url("./assets/thal-scales-background.png") center / cover,
    radial-gradient(circle at 50% 28%, rgba(232, 121, 249, 0.3), transparent 32%),
    #0d0914;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.image-tile.moon {
  background:
    linear-gradient(180deg, transparent 36%, rgba(3, 2, 5, 0.9)),
    radial-gradient(circle at 50% 24%, #d8d0e7 0 1.8rem, transparent 1.9rem),
    radial-gradient(circle at 45% 45%, rgba(168, 85, 247, 0.24), transparent 44%),
    #0d0914;
}

.image-tile.scales {
  background:
    linear-gradient(180deg, transparent 36%, rgba(3, 2, 5, 0.92)),
    linear-gradient(90deg, transparent 48%, rgba(216, 180, 106, 0.75) 49% 51%, transparent 52%),
    radial-gradient(circle at 36% 48%, rgba(216, 180, 106, 0.28), transparent 12%),
    radial-gradient(circle at 64% 48%, rgba(216, 180, 106, 0.28), transparent 12%),
    #0d0914;
}

.image-tile.crystal {
  background:
    linear-gradient(180deg, transparent 36%, rgba(3, 2, 5, 0.92)),
    conic-gradient(from 25deg at 52% 40%, #050409, #44156a, #12051f, #050409),
    #0d0914;
}

.research-layout {
  grid-template-columns: minmax(18rem, 0.9fr) minmax(18rem, 1.1fr);
}

.upload-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.upload-panel label,
.permission-panel label {
  display: grid;
  gap: 0.4rem;
  color: #f6e7b4;
}

.upload-panel input,
.upload-panel textarea,
.permission-panel input {
  width: 100%;
  border: 1px solid rgba(196, 166, 255, 0.2);
  border-radius: 0.35rem;
  color: var(--text);
  background: rgba(5, 4, 9, 0.78);
}

.upload-panel input,
.permission-panel input {
  min-height: 2.6rem;
  padding: 0.65rem;
}

.upload-panel textarea {
  min-height: 7rem;
  padding: 0.65rem;
  resize: vertical;
}

.file-drop {
  min-height: 6rem;
  place-items: center;
  border: 1px dashed rgba(216, 180, 106, 0.42);
  border-radius: 0.45rem;
  background: rgba(216, 180, 106, 0.05);
}

.file-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.upload-panel button,
.bookcase button,
.locked-panel button,
.permission-panel button {
  padding: 0.6rem 1rem;
}

.bookcase-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.book-spines {
  display: flex;
  align-items: end;
  gap: 0.35rem;
  height: 13rem;
  padding: 1rem;
  border: 1px solid rgba(216, 180, 106, 0.18);
  background: rgba(3, 2, 5, 0.34);
}

.book-spines span {
  width: 18%;
  border: 1px solid rgba(246, 231, 180, 0.24);
  border-radius: 0.18rem 0.18rem 0 0;
  background: linear-gradient(90deg, #1e122e, #4c1c67 48%, #120a1c);
}

.book-spines span:nth-child(2) {
  height: 82%;
  background: linear-gradient(90deg, #28170d, #6c3f1e 48%, #160b05);
}

.book-spines span:nth-child(3) {
  height: 96%;
  background: linear-gradient(90deg, #091915, #225b4c 48%, #050d0b);
}

.book-spines span:nth-child(4) {
  height: 72%;
  background: linear-gradient(90deg, #260d15, #7d1d32 48%, #12060a);
}

.book-spines span:nth-child(5) {
  height: 88%;
}

.book-spines span:nth-child(1) {
  height: 68%;
}

.music-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.track {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.8rem;
  align-items: center;
}

.track button {
  grid-row: span 2;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(232, 121, 249, 0.46);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 38%, #f6e7b4 39% 45%, transparent 46%),
    linear-gradient(30deg, transparent 47%, #f6e7b4 48% 55%, transparent 56%),
    rgba(168, 85, 247, 0.18);
}

.track span {
  font-size: 1.1rem;
}

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

.locked-panel {
  max-width: 42rem;
}

.badge-admin {
  grid-template-columns: minmax(16rem, 0.7fr) minmax(18rem, 1.3fr);
}

.permission-panel ul {
  margin: 1rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.badge-grid article {
  min-height: 10rem;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #f6e7b4;
  background:
    radial-gradient(circle at 50% 38%, rgba(216, 180, 106, 0.28), transparent 30%),
    rgba(18, 14, 26, 0.78);
}

.modal {
  width: min(34rem, calc(100vw - 2rem));
  border: 1px solid rgba(232, 121, 249, 0.38);
  border-radius: 0.5rem;
  color: var(--text);
  background: #0d0914;
  box-shadow: 0 2rem 7rem rgba(0, 0, 0, 0.7), 0 0 40px rgba(168, 85, 247, 0.18);
}

.modal::backdrop {
  background: rgba(3, 2, 5, 0.78);
  backdrop-filter: blur(7px);
}

.modal form {
  position: relative;
  margin: 0;
  padding: 1.4rem;
}

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

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 45%, var(--text) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, var(--text) 46% 54%, transparent 55%),
    rgba(20, 15, 29, 0.8);
}

.login-options,
.book-popup-grid {
  display: grid;
  gap: 0.7rem;
}

.login-options button,
.book-popup-grid button {
  padding: 0.75rem;
  text-align: left;
}

.named-login {
  display: grid;
  gap: 0.4rem;
  color: #f6e7b4;
}

.named-login input {
  min-height: 2.6rem;
  padding: 0.65rem;
  border: 1px solid rgba(196, 166, 255, 0.2);
  border-radius: 0.35rem;
  color: var(--text);
  background: rgba(5, 4, 9, 0.78);
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-toggle {
    display: inline-grid;
    justify-self: end;
    width: 2.6rem;
    height: 2.6rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    background: rgba(20, 15, 29, 0.72);
  }

  .nav-toggle span {
    width: 1.25rem;
    height: 1px;
    background: var(--text);
  }

  .main-nav,
  .login-button {
    display: none;
  }

  .main-nav.is-open,
  .login-button.is-open {
    display: flex;
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .main-nav.is-open a {
    flex: 1 1 12rem;
    justify-content: center;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 1.5rem;
  }

  .hero-backdrop {
    background-position: center top;
  }

  .hero-copy {
    order: 1;
    padding-top: 1rem;
    transform: translateY(-0.75rem);
  }

  .crystal-stage {
    order: 2;
    min-height: clamp(24rem, 62vh, 34rem);
    transform: translateY(-0.75rem);
  }

  #crystal-canvas {
    min-height: clamp(24rem, 62vh, 34rem);
  }

  .vita-grid,
  .gallery-grid,
  .research-layout,
  .music-grid,
  .badge-admin {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sigil-menu,
  .heptagram,
  .arc-flow {
    top: 50%;
    width: min(96%, 28rem);
  }

  .sigil-button {
    width: 3.35rem;
    height: 3.35rem;
  }

  .bookcase-header {
    align-items: stretch;
    flex-direction: column;
  }

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

/* v16 app layout */
html,
body {
  height: 100%;
}

body {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(2, 1, 3, 0.03), rgba(2, 1, 3, 0.72) 88vh),
    url("./assets/thal-scales-background.png") center center / contain no-repeat fixed,
    linear-gradient(90deg, #090102 0%, #050103 28%, #020103 50%, #02040a 72%, #030812 100%);
}

.site-shell {
  height: 100vh;
  overflow: hidden;
}

.komi-app {
  height: calc(100vh - 4.35rem);
  overflow: hidden;
}

.topbar {
  position: relative;
}

.brand {
  border: 0;
  background: transparent;
}

.hero.app-viewport {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(24rem, 1.28fr);
  align-items: start;
  padding-top: clamp(1.3rem, 2.2vw, 2.4rem);
  padding-bottom: 0;
  transition: grid-template-columns 760ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero.app-viewport::after {
  display: none;
}

.hero-backdrop {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(2, 1, 3, 0.02) 44%, rgba(0, 0, 0, 0.14)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(2, 1, 3, 0.1) 70%, rgba(2, 1, 3, 0.38)),
    url("./assets/thal-scales-background.png") center center / contain no-repeat,
    linear-gradient(90deg, #090102 0%, #050103 28%, #020103 50%, #02040a 72%, #030812 100%);
}

.hero-copy,
.section-panel {
  align-self: start;
  margin-top: clamp(3rem, 7vh, 5.2rem);
}

.hero-copy {
  transform: none;
}

.crystal-stage {
  align-self: start;
  min-height: min(76vh, 48rem);
  margin-top: clamp(-0.2rem, 1vh, 0.8rem);
  transform: none;
  transform-origin: 62% 14%;
  transition:
    transform 760ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-left 760ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, margin-left;
}

.heptagram,
.arc-flow,
.sigil-menu {
  top: 43%;
}

body.is-section .hero.app-viewport {
  grid-template-columns: minmax(21rem, 0.74fr) minmax(22rem, 1.26fr);
}

body.is-section .crystal-stage {
  margin-left: clamp(2rem, 5vw, 5rem);
  transform: scale(0.75);
}

body.is-section .section-panel {
  display: block;
}

.section-panel {
  width: min(100%, 36rem);
  max-height: calc(100vh - 8rem);
  border: 1px solid rgba(192, 132, 252, 0.22);
  border-radius: 0.5rem;
  background: linear-gradient(145deg, rgba(5, 3, 8, 0.82), rgba(13, 8, 20, 0.58));
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.38), inset 0 0 3rem rgba(77, 35, 130, 0.1);
  overflow: hidden;
}

.panel-head,
.detail-toolbar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(224, 188, 114, 0.13);
}

.panel-head h2,
.entry-detail h2 {
  margin: 0;
}

.icon-action,
.delete-entry {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(224, 188, 114, 0.28);
  border-radius: 50%;
  color: var(--text);
  background: rgba(9, 6, 13, 0.72);
  cursor: pointer;
}

.icon-action:hover,
.delete-entry:hover {
  border-color: rgba(232, 121, 249, 0.68);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.22);
}

.entry-list {
  max-height: calc(100vh - 15rem);
  overflow: auto;
  padding: 0.7rem;
}

.entry-row-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.entry-row {
  width: 100%;
  min-height: 3.1rem;
  margin: 0.24rem 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(192, 132, 252, 0.16);
  border-radius: 0.35rem;
  color: var(--text);
  background: rgba(4, 3, 7, 0.54);
  text-align: left;
  cursor: pointer;
}

.entry-row span,
.entry-row small {
  display: block;
}

.entry-row small {
  margin-top: 0.18rem;
  color: var(--gold);
  font-size: 0.72rem;
}

.entry-row:hover {
  border-color: rgba(224, 188, 114, 0.48);
  background: rgba(31, 18, 47, 0.62);
}

.entry-detail {
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding-bottom: 1.2rem;
}

.entry-detail h2,
.detail-content {
  padding-inline: 1rem;
}

.entry-detail h2 {
  margin-top: 1rem;
}

.detail-content {
  color: var(--muted);
  line-height: 1.65;
}

.detail-content h2 {
  padding: 0;
  color: var(--text);
}

.detail-content blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--gold);
  color: #d8ccdf;
}

.detail-image {
  display: block;
  width: calc(100% - 2rem);
  max-height: 15rem;
  margin: 1rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(224, 188, 114, 0.25);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.24);
  cursor: zoom-in;
}

.detail-image img {
  width: 100%;
  height: 100%;
  max-height: 15rem;
  object-fit: contain;
}

.empty-state {
  margin: 1rem;
  color: var(--muted);
}

.main-nav a.is-disabled,
.sigil-button.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(0.45);
}

.main-nav a.is-disabled:hover {
  border-color: var(--line);
  background: rgba(10, 7, 14, 0.7);
  box-shadow: none;
  transform: none;
}

.modal label,
.editor-modal label {
  display: grid;
  gap: 0.35rem;
  margin: 0.8rem 0;
  color: var(--muted);
}

.modal input,
.editor-modal input {
  min-height: 2.55rem;
  border: 1px solid rgba(192, 132, 252, 0.22);
  border-radius: 0.35rem;
  color: var(--text);
  background: rgba(3, 2, 5, 0.82);
  padding: 0.45rem 0.65rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.permission-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(224, 188, 114, 0.16);
}

.permission-panel ul {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.editor-modal {
  width: min(54rem, calc(100vw - 2rem));
}

.format-toolbar {
  display: flex;
  gap: 0.35rem;
  margin: 0.8rem 0;
}

.format-toolbar button {
  width: 2.2rem;
  height: 2.2rem;
  min-height: 0;
  padding: 0;
}

.hidden-toggle {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.hidden-toggle input {
  min-height: 0;
  width: 1.1rem;
  height: 1.1rem;
}

.rich-editor {
  min-height: 16rem;
  max-height: 42vh;
  overflow: auto;
  padding: 0.8rem;
  border: 1px solid rgba(192, 132, 252, 0.22);
  border-radius: 0.35rem;
  background: rgba(3, 2, 5, 0.82);
  line-height: 1.6;
}

.image-modal {
  width: min(76rem, calc(100vw - 2rem));
  border: 0;
  padding: 0;
  background: transparent;
}

.image-modal::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.image-modal form {
  position: relative;
  margin: 0;
}

.image-modal img {
  display: block;
  width: 100%;
  max-height: 88vh;
  object-fit: contain;
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .site-shell,
  .komi-app {
    height: auto;
    overflow: visible;
  }

  .hero.app-viewport,
  body.is-section .hero.app-viewport {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 4.35rem);
  }

  .hero-copy,
  .section-panel {
    margin-top: 1rem;
  }

  body.is-section .crystal-stage {
    margin-left: 0;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero.app-viewport,
  .crystal-stage {
    transition: none;
  }
}

@media (min-aspect-ratio: 2 / 1) and (min-width: 961px) {
  body {
    background:
      linear-gradient(180deg, rgba(2, 1, 3, 0.03), rgba(2, 1, 3, 0.66) 88vh),
      url("./assets/thal-scales-background-wide-v18.png") center center / cover no-repeat fixed,
      #020103;
  }

  .hero-backdrop {
    background:
      linear-gradient(90deg, rgba(0, 0, 0, 0.34), rgba(2, 1, 3, 0.01) 44%, rgba(0, 0, 0, 0.1)),
      linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(2, 1, 3, 0.08) 70%, rgba(2, 1, 3, 0.34)),
      url("./assets/thal-scales-background-wide-v18.png") center center / cover no-repeat;
  }
}
