:root {
  color-scheme: dark;
  --ink: #f6efe2;
  --muted: #c7bda8;
  --subtle: #92876f;
  --obsidian: #080908;
  --green: #0f2b24;
  --green-2: #183b31;
  --gold: #c7a75a;
  --gold-2: #806326;
  --wine: #702536;
  --paper: #e7d5b2;
  --line: rgba(199, 167, 90, 0.28);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  font-family: "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(112, 37, 54, 0.28), transparent 30rem),
    linear-gradient(145deg, #060706 0%, #101a16 46%, #080908 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.13;
  background-image:
    linear-gradient(rgba(199, 167, 90, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(199, 167, 90, 0.2) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

a {
  color: inherit;
}

.shell {
  overflow: hidden;
}

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: clamp(24px, 5vw, 72px);
  place-items: center;
  background:
    linear-gradient(90deg, rgba(4, 5, 5, 0.9) 0%, rgba(4, 5, 5, 0.62) 54%, rgba(4, 5, 5, 0.32) 100%),
    url("assets/trial-chamber.png") center / cover;
}

.login-panel {
  width: min(480px, 100%);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(199, 167, 90, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 9, 8, 0.94), rgba(24, 59, 49, 0.9)),
    radial-gradient(circle at 50% 0%, rgba(199, 167, 90, 0.16), transparent 14rem);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  max-width: 100%;
  margin-bottom: 16px;
  font-size: 4rem;
  white-space: nowrap;
}

.login-copy {
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.65;
}

.login-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.96rem;
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.login-form label {
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form button {
  margin-top: 8px;
}

.logout-form {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
}

.logout-form button {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(199, 167, 90, 0.28);
  color: var(--paper);
  background: rgba(8, 9, 8, 0.58);
  backdrop-filter: blur(12px);
}

.hero {
  position: relative;
  display: grid;
  min-height: 92vh;
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.hero__backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 5, 5, 0.88) 0%, rgba(4, 5, 5, 0.64) 42%, rgba(4, 5, 5, 0.18) 100%),
    linear-gradient(0deg, rgba(8, 9, 8, 0.88) 0%, transparent 35%),
    url("assets/trial-chamber.png") center / cover;
}

.hero__content {
  position: relative;
  width: min(760px, 100%);
}

.kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 9ch;
  margin-bottom: 22px;
  font-size: clamp(3.7rem, 11vw, 8.5rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.4vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.lead {
  width: min(650px, 100%);
  color: var(--paper);
  font-size: clamp(1.1rem, 2.1vw, 1.45rem);
  line-height: 1.55;
}

.scroll-cue {
  display: inline-grid;
  width: 46px;
  height: 46px;
  margin-top: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 9, 8, 0.36);
  transition: transform 180ms ease, border-color 180ms ease;
}

.scroll-cue:hover {
  transform: translateY(3px);
  border-color: rgba(199, 167, 90, 0.72);
}

.scroll-cue span {
  width: 11px;
  height: 11px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg) translate(-2px, -2px);
}

.trial-panel,
.rites {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.trial-panel {
  padding: clamp(56px, 8vw, 104px) 0;
}

.panel-heading {
  width: min(760px, 100%);
  margin-bottom: 28px;
}

.panel-heading p:not(.kicker),
.rites p,
#answer-hint,
.state {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.7;
}

.cipher-card {
  position: relative;
  padding: clamp(24px, 4vw, 44px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(24, 59, 49, 0.86), rgba(8, 9, 8, 0.94)),
    radial-gradient(circle at right top, rgba(199, 167, 90, 0.12), transparent 24rem);
  box-shadow: var(--shadow);
}

.cipher-card::before {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(199, 167, 90, 0.16);
  border-radius: 4px;
}

.seal {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(199, 167, 90, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.2rem;
}

.task-label {
  margin-bottom: 24px;
  color: var(--gold);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.math-block {
  display: grid;
  gap: 18px;
  padding-right: clamp(0px, 9vw, 88px);
  color: #f2e7cf;
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  line-height: 1.72;
}

.math-block p {
  margin: 0;
}

.formula {
  display: inline;
  color: #fff7e8;
  font-family: Cambria, Georgia, serif;
}

.answer-form {
  margin-top: 28px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(199, 167, 90, 0.18);
  border-radius: 8px;
  background: rgba(8, 9, 8, 0.58);
}

.answer-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.answer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input,
button {
  min-height: 52px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid rgba(199, 167, 90, 0.34);
  color: var(--ink);
  background: rgba(246, 239, 226, 0.08);
  padding: 0 16px;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(199, 167, 90, 0.13);
}

button,
.map-link {
  border: 1px solid rgba(199, 167, 90, 0.42);
  color: #160f05;
  background: linear-gradient(180deg, #e9c86f, #a98235);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

button {
  padding: 0 24px;
}

button:hover,
.map-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

#answer-hint {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.state {
  min-height: 27px;
  margin: 12px 0 0;
  color: #d9c796;
}

.state--error {
  color: #ef9b9b;
}

.reveal {
  margin-top: 28px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid rgba(111, 177, 122, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(25, 93, 63, 0.44), rgba(8, 9, 8, 0.9)),
    radial-gradient(circle at 20% 20%, rgba(128, 190, 120, 0.18), transparent 24rem);
  box-shadow: var(--shadow);
}

.reveal[hidden] {
  display: none;
}

.reveal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}

.reveal-copy {
  width: min(720px, 100%);
  margin: 0;
  color: #cfe2c8;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.65;
}

.reveal-grid div {
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(199, 167, 90, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.reveal-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--subtle);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reveal-grid strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.55vw, 1.52rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.map-link {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 6px;
  text-decoration: none;
}

.rites {
  position: relative;
  padding: 0 0 clamp(56px, 8vw, 96px);
}

.rite-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.rites--locked {
  min-height: 360px;
}

.rites--locked .rite-list {
  filter: blur(10px);
  opacity: 0.34;
  pointer-events: none;
  user-select: none;
}

.rites-lock {
  position: absolute;
  left: 50%;
  top: calc(50% + 24px);
  z-index: 2;
  display: grid;
  width: min(320px, calc(100% - 32px));
  min-height: 184px;
  padding: 28px;
  place-items: center;
  text-align: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(199, 167, 90, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 9, 8, 0.94), rgba(24, 59, 49, 0.9)),
    radial-gradient(circle at 50% 0%, rgba(199, 167, 90, 0.16), transparent 12rem);
  box-shadow: var(--shadow);
}

.rites-lock p {
  margin: 12px 0 0;
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.45;
}

.lock-mark {
  position: relative;
  display: block;
  width: 72px;
  height: 58px;
  border: 2px solid rgba(199, 167, 90, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(233, 200, 111, 0.2), rgba(128, 99, 38, 0.14)),
    rgba(8, 9, 8, 0.62);
  box-shadow: inset 0 0 0 1px rgba(246, 239, 226, 0.08);
}

.lock-mark::before {
  position: absolute;
  left: 50%;
  bottom: 45px;
  width: 42px;
  height: 40px;
  content: "";
  transform: translateX(-50%);
  border: 2px solid rgba(199, 167, 90, 0.82);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
}

.lock-mark::after {
  position: absolute;
  left: 50%;
  top: 21px;
  width: 8px;
  height: 20px;
  content: "";
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(199, 167, 90, 0.34);
}

.rite-list article {
  min-height: 210px;
  padding: 22px;
  border: 1px solid rgba(199, 167, 90, 0.2);
  border-radius: 8px;
  background: rgba(246, 239, 226, 0.055);
}

.rite-list span {
  display: block;
  margin-bottom: 22px;
  color: var(--gold);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

@media (max-width: 760px) {
  .login-panel h1 {
    font-size: 2.7rem;
  }

  .logout-form {
    top: 12px;
    right: 12px;
  }

  .hero {
    min-height: 88vh;
    align-items: end;
    padding: 28px 20px 56px;
  }

  .hero__backdrop {
    background:
      linear-gradient(0deg, rgba(4, 5, 5, 0.94) 0%, rgba(4, 5, 5, 0.42) 68%, rgba(4, 5, 5, 0.22) 100%),
      url("assets/trial-chamber.png") 58% center / cover;
  }

  h1 {
    max-width: 8ch;
  }

  .answer-row,
  .reveal-grid,
  .rite-list {
    grid-template-columns: 1fr;
  }

  .reveal-grid div {
    min-height: 116px;
  }

  button {
    width: 100%;
  }

  .math-block {
    padding-right: 0;
  }

  .seal {
    position: static;
    margin-bottom: 18px;
  }

  .rites--locked {
    min-height: 520px;
  }

  .rites-lock {
    top: calc(50% + 42px);
  }
}

@media (max-width: 380px) {
  .login-panel h1 {
    font-size: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
