:root {
  color-scheme: dark;
  --bg: #141416;
  --panel: #252324;
  --line: #655440;
  --muted: #c5b8a4;
  --fg: #f7ecd9;
  --accent: #f6bf69;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font:
    1rem/1.5 "Segoe UI",
    system-ui,
    sans-serif;
}
header,
main,
footer,
#status {
  width: min(43rem, calc(100% - 2.5rem));
  margin: auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  text-decoration: none;
  color: var(--fg);
  font-weight: 650;
  letter-spacing: 0.015em;
}
.brand img {
  border-radius: 0.65rem;
}
#identity,
footer,
.muted,
small {
  color: var(--muted);
}
main {
  padding: 2rem 0 0.5rem;
}
h1,
h2,
p {
  margin: 0 0 0.85rem;
}
h1 {
  font-family: Georgia, serif;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.04em;
}
h2 {
  font-size: 1.2rem;
}
.panel,
details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  margin: 1.05rem 0;
  padding: 1.2rem;
}
details summary {
  cursor: pointer;
  font-weight: 650;
}
details[open] summary {
  margin-bottom: 0.9rem;
}
a {
  color: var(--accent);
}
label,
legend {
  font-weight: 600;
}
label {
  display: grid;
  gap: 0.3rem;
  margin: 0.65rem 0;
}
.grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
input,
select,
button {
  font: inherit;
  border-radius: 0.55rem;
}
input,
select {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  background: #19181a;
  color: var(--fg);
}
button {
  cursor: pointer;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  padding: 0.55rem 0.95rem;
  background: #37302b;
  color: var(--fg);
  font-weight: 600;
}
button:hover:enabled {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.65;
  cursor: default;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #292215;
}
.actions,
.roles {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}
.roles button {
  border-radius: 2rem;
}
.roles button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #664216;
  color: #fff1d4;
}
.roles button.full {
  background: #302e2c;
}
.gate {
  min-height: 0;
  margin: 0.7rem 0;
}
.danger {
  color: #ffd4c6;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
#status:empty {
  display: none;
}
#status {
  position: sticky;
  bottom: 0.4rem;
  background: #483b2e;
  color: #fff5df;
  border-radius: 0.6rem;
  padding: 0.65rem 0.9rem;
  margin: 0 auto 1rem;
}
footer {
  padding: 1.3rem 0 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.stack {
  display: grid;
  gap: 0.6rem;
}
#passkey-intro {
  width: min(29rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: auto;
  padding: clamp(1.25rem, 5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 1rem 4rem #08070690;
}
#passkey-intro::backdrop {
  background: #0c0b0dd9;
}
#passkey-intro h2 {
  font: 500 2rem/1.15 Georgia, serif;
}
#passkey-intro form {
  margin-top: 1.25rem;
}

body {
  background: radial-gradient(ellipse at 12% 0, #34281d 0, transparent 42rem),
    linear-gradient(155deg, #19191c, var(--bg) 54%);
}
header { border-color: #765b36; }
.brand { color: #f8cc87; font: bold 1.55rem/1.1 Georgia, serif; }
.brand img { border-radius: 50%; border: 1px solid #a87c44; }
#identity { overflow-wrap: anywhere; text-align: right; margin-left: 1rem; }
h1, h2 { color: #f5d5a1; }
.panel, details, #passkey-intro {
  background: linear-gradient(145deg, #302b27, #222123 74%);
  box-shadow: inset 0 1px #ffffff0b, 0 0.35rem 1.2rem #0003;
}
.primary {
  background: linear-gradient(#ffda94, #eab05a);
  border-color: #eab05a;
  color: #281a0c;
}
.primary:hover:enabled { background: #ffdc9a; }
.roles button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.roles button.full { opacity: .88; border-style: dashed; }
#portal-intro {
  width: min(68rem, calc(100% - 1.5rem));
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  overflow: auto;
  background: #191819;
  color: var(--fg);
  border: 1px solid #7b6141;
  border-radius: .8rem;
  box-shadow: 0 1rem 4rem #0009;
}
#portal-intro::backdrop { background: #101012; }
#portal-film {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 8rem);
  object-fit: contain;
  background: #101012;
}
.portal-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem clamp(.9rem, 3vw, 1.6rem);
  border-top: 1px solid var(--line);
}
.portal-controls span { font: 500 clamp(1.15rem, 3vw, 1.7rem)/1.2 Georgia, serif; }
/* Frame the masthead with a narrow band of the same illuminated stone. */
header {
  position: relative;
  isolation: isolate;
  min-height: 5.5rem;
  padding-inline: clamp(.8rem, 3vw, 1.5rem);
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #171619 4%, #171619e8 32%, #17161978 65%, #171619ed),
    url("/media/portal-stone.webp") center 44% / cover;
}

.header-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; column-gap: .8rem; }
.header-links > a { padding-block: .6rem; }
.header-links #identity { margin: 0; }
.header-links #identity:empty, #portal-note:empty { display: none; }
#portal-note { padding: 0 1rem .85rem; margin: 0; color: var(--muted); }
.portal-controls span { flex: 1 1 13rem; }
.guide ol { padding-inline-start: 1.4em; }
.guide li + li { margin-top: .55rem; }
.guide video { display: block; width: 100%; height: auto; background: #101012; border-radius: .65rem; }
