/* Visual composition, shared controls, and responsive/reduced-motion presentation. */
:root {
  color-scheme: dark;
  /* Shared surface, text, border, and accent colours. */
  --ink: #0e0a15;
  --text: #f6eefc;
  --muted: #c1b1cf;
  --accent: #d6b0fc;
  --line: #b58aca45;
  /* Shared control dimensions keep every action compact with a usable target. */
  --control-height: 44px;
  --control-padding: 8px 12px;
  --control-radius: 6px;
  --control-border: #897196;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--ink);
  color: var(--text);
}
* { box-sizing: border-box; }
/* Keep every scrollable surface in the velvet palette, including dialogs and staff tools. */
* { scrollbar-color: #9065aa #160f20; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #160f20; }
::-webkit-scrollbar-thumb { background: #9065aa; border: 2px solid #160f20; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: #160f20; }
/* Size the shell to the window; only main scrolls between the naturally sized bars. */
html { overflow: hidden; }
body { margin: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
body > main { min-height: 0; min-width: 0; overflow: auto; scroll-behavior: smooth; scroll-padding-block: 24px; }
/* Reserve the same content width for short news states and long public pages. */
.public-page > main { scrollbar-gutter: stable; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
button, select { background: transparent; }
/* Native selects retain keyboard/form behavior; popup options share the same dark surface. */
select:not([multiple]) {
  appearance: none;
  padding-right: 38px !important;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%) !important;
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50% !important;
  background-size: 5px 5px !important;
  background-repeat: no-repeat !important;
}
select option, select optgroup { background: #191122; color: var(--text); }
select:disabled { opacity: .6; cursor: not-allowed; }
/* Supporting browsers can also theme the popup itself; others keep their native dark picker. */
@supports (appearance: base-select) {
  select:not([multiple]), select:not([multiple])::picker(select) { appearance: base-select; }
  select:not([multiple])::picker-icon { display: none; }
  select:not([multiple])::picker(select) { background: #191122; color: var(--text); border: 1px solid #897196; border-radius: 8px; padding: 6px; margin-block: 6px; max-height: min(320px, 50dvh); box-shadow: 0 16px 40px #0008; }
  select:not([multiple]) option { padding: 10px 12px; min-height: 44px; border-radius: 5px; overflow-wrap: anywhere; }
  select:not([multiple]) option:checked { background: #442955; color: #f6eefc; }
  select:not([multiple]) option:hover, select:not([multiple]) option:focus { background: #623680; color: #fff; }
}
@media (forced-colors: active) {
  * { scrollbar-color: auto; }
  select:not([multiple]) { appearance: auto; background-image: none !important; }
  select:not([multiple])::picker(select) { appearance: auto; }
}
button { border: 0; }
button, nav a, .panel-links a, summary { min-height: 44px; }
a:hover, button:not(.primary):hover { color: #fff; }
:focus-visible { outline: 2px solid #efd3ff; outline-offset: 5px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 20; padding: 14px; background: var(--ink); }
.skip-link:focus { top: 12px; }
.site-header { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 84px; padding: 15px 4.5%; border-bottom: 1px solid var(--line); background: #110c19; }
.wordmark { display: flex; align-items: center; gap: 14px; font-family: Georgia, serif; font-size: 14px; letter-spacing: 2px; }
.wordmark-light { color: var(--muted); }
.sigil { font-size: 31px; font-style: italic; color: var(--accent); border: 1px solid var(--line); width: 42px; height: 44px; text-align: center; padding-top: 3px; }
nav { display: flex; align-items: center; gap: 30px; color: var(--muted); font-size: 12px; }
nav a { display: flex; align-items: center; }
nav button { padding: 0; }
/* Public navigation has one layout owner across Home, Server news, and Join. */
.public-page .site-header nav a { display: flex; gap: 5px; }
.public-page .site-header nav a[aria-current="page"] { color: var(--text); }
.hero { position: relative; isolation: isolate; min-height: 920px; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: 55px 20px 28px; }
.scene { /* Shared width keeps hand placement and panel clearance on the same scale. */ --character-width: min(40vw, 566.667px); position: absolute; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; background: #170f26; }
.layer { position: absolute; background-repeat: no-repeat; background-position: center; background-size: contain; will-change: transform; }
.backdrop, .ground, .roses { inset: -20px; background-size: cover; }
.backdrop { background-image: url('/art/backdrop.webp'); }
.moon { width: 210px; height: 210px; top: -20px; left: calc(50% - 105px); background-image: url('/art/moon.webp'); }
.clouds { inset: 15% -20px 22%; background-image: url('/art/clouds.webp'); background-size: 100% auto; opacity: .65; animation: mist 18s ease-in-out infinite alternate; }
/* Edge-aligned halves preserve the architecture's scale without cropping out its sconces. */
.ground { container-type: size; }
.architecture { position: absolute; top: 0; bottom: 0; width: 50%; background-image: url('/art/ground.webp'); background-repeat: no-repeat; background-size: auto 100%; }
.architecture-left { left: 0; background-position: left bottom; }
.architecture-right { right: 0; background-position: right bottom; }
/* Sconce rims sit at y=320/941; horizontal anchors use the same image-height scale. */
.flame { position: absolute; width: 14cqh; aspect-ratio: 3 / 2; bottom: 66%; background: url('/art/flames.webp') center / contain no-repeat; }
.flame-left { left: calc(5.8cqh - 7cqh); }
.flame-right { right: calc(5.8cqh - 7cqh); }
/* The character box matches its source canvas, so hand-relative effects cannot drift. */
.character { width: var(--character-width); aspect-ratio: 2 / 3; bottom: 0; background-position: center bottom; }
.magic { position: absolute; width: 32%; aspect-ratio: 1330 / 1182; left: 47%; top: 2%; background: url('/art/magic.webp') center / contain no-repeat; }
/* Keep the magic's right edge (79% of Venom's canvas) clear of the central panel. */
.venom { left: min(clamp(0px, calc(15vw - 157.5px), 90px), calc((100% - 460px) / 2 - var(--character-width) * .79 - 16px)); background-image: url('/art/venom.webp'); }
.drake { right: min(clamp(0px, calc(15vw - 157.5px), 90px), calc((100% - 460px) / 2 - var(--character-width) * .79 - 16px)); background-image: url('/art/drake.webp'); }
.roses { background-image: url('/art/roses.webp'); }
.scene-shade { position: absolute; inset: 0; background: linear-gradient(0deg, var(--ink), transparent 24%, #11092015 70%, #11092055), linear-gradient(90deg, #10091633, transparent 30%, #0e081833 50%, transparent 70%, #10091633); }
.entrance-content { width: min(100%, 460px); text-align: center; }
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 3px; color: var(--accent); line-height: 1.6; }
.welcome-line { margin-bottom: 0; text-shadow: 0 2px 8px #000; }
.brand-art { height: 208px; position: relative; margin: 4px -4px 0; display: grid; place-items: center; }
.brand-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.brand-fallback { font-family: Georgia, serif; font-size: 44px; }
.tagline { font-size: 13px; line-height: 1.8; color: #ebddf6; text-shadow: 0 2px 6px #000; margin: 6px -20px 28px; }
.tagline em { font-style: normal; }
.entrance-panel { background: linear-gradient(145deg, #241732fa, #130e1dfa); border: 1px solid #bd8de15c; border-radius: 8px; padding: 22px 32px 19px; box-shadow: 0 22px 80px #06020cab, inset 0 1px #efcfff19; }
.panel-topline { display: flex; justify-content: center; align-items: center; gap: 14px; font-size: 9px; letter-spacing: 3px; color: var(--accent); }
.diamond { font-size: 22px; }
.progress { display: flex; list-style: none; justify-content: center; margin: 19px 0 25px; padding: 0 0 22px; border-bottom: 1px solid var(--line); gap: 22px; }
.progress li { color: #b3a1c2; font-size: 11px; display: flex; gap: 7px; align-items: center; }
.progress li span { font-size: 10px; border: 1px solid #9071a855; border-radius: 50%; width: 25px; height: 25px; display: grid; place-items: center; }
.progress li[aria-current] { color: #eedaff; }
.progress li[aria-current] span { background: #9b53cf33; border-color: #c487ef; }
h1 { font-size: 28px; line-height: 1.2; margin-bottom: 13px; }
#step-heading:focus { outline: none; }
#step-content > p, #step-content form > p { font-size: 13px; line-height: 1.85; color: var(--muted); margin-bottom: 22px; }
#step-content > .connect-context { font-size: 11px; margin: 13px 0 0; }
/* Native buttons and action links share one component; page layouts own width and margins. */
.primary, .secondary, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; min-height: var(--control-height); padding: var(--control-padding); border: 1px solid var(--control-border); border-radius: var(--control-radius); color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; overflow-wrap: anywhere; vertical-align: middle; }
.primary { background: linear-gradient(110deg, #8042ae, #693096); border-color: #c586f0; box-shadow: inset 0 1px #e3bcff30, 0 5px 20px #8f3bcc22; }
.secondary, .icon-button { background: #30203d; }
.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #432c55; border-color: #c194d8; }
.secondary.danger { background: #512e37; border-color: #ba7888; }
.secondary.danger:hover:not(:disabled) { background: #693744; border-color: #e29aad; }
.icon-button { width: var(--control-height); padding: 4px; flex-shrink: 0; }
.primary:disabled, .secondary:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.primary:focus-visible, .secondary:focus-visible, .icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#step-content .primary { width: 100%; }
#step-content .secondary { margin-top: 8px; }
/* Shared popup geometry is supplied by AnchoredPopover; the top layer escapes overflow clipping. */
.ui-popover { position: fixed; inset: auto; margin: 0; z-index: 30; max-width: none; overflow-y: auto; overscroll-behavior: contain; color: var(--text); border: 1px solid var(--control-border); border-radius: 8px; padding: 10px; background: #130d1c; box-shadow: 0 12px 32px #0008; }
/* Empty decorative masks preserve labels and survive textContent updates. */
[data-icon]::before {
  content: "";
  display: inline-block;
  width: var(--icon-size, 1.15em);
  height: var(--icon-size, 1.15em);
  flex: 0 0 var(--icon-size, 1.15em);
  margin-inline-end: .45em;
  vertical-align: -.18em;
  background-color: currentColor;
  -webkit-mask: var(--icon-image) center / contain no-repeat;
  mask: var(--icon-image) center / contain no-repeat;
  pointer-events: none;
}
.primary[data-icon] { justify-content: center; }
.primary[data-icon]::before, .secondary[data-icon]::before, nav a[data-icon]::before { margin-inline-end: 0; }
/* System colours keep decorative masks visible in high-contrast modes. */
@media (forced-colors: active) {
  [data-icon]::before { background-color: CanvasText; forced-color-adjust: none; }
  button[data-icon]:disabled::before { background-color: GrayText; }
}
.primary:hover:not(:disabled) { background: linear-gradient(110deg, #9553c5, #7e3eac); }
.primary span { font-size: 22px; font-weight: 400; }
.verification-notice { margin: 16px 0 0; font-size: 10px; color: #bdabc9; line-height: 1.6; }
.verification-notice span { margin-right: 4px; }
.panel-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; color: #d6c2e4; font-size: 11px; margin-top: 12px; }
.panel-links .secondary { font-size: 11px; padding-inline: 8px; }
.skip-intro { position: absolute; right: 25px; top: 10px; font-size: 12px; z-index: 2; }
.discover-link { margin-top: auto; padding: 24px 0 12px; font-size: 9px; letter-spacing: 3px; color: #d4bddf; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.discover-link span { font-size: 20px; }
.about-section { max-width: 1140px; margin: auto; padding: 85px 40px 90px; text-align: center; }
h2 { font-size: clamp(30px, 4vw, 42px); line-height: 1.25; margin-bottom: 22px; }
h2 em { color: #c29cde; font-weight: 400; }
.about-heading > p:last-child { color: var(--muted); font-size: 14px; line-height: 1.9; }
.room-notes { display: grid; grid-template-columns: repeat(3, 1fr); margin: 55px 0 35px; text-align: left; }
.room-notes article { padding: 0 30px; border-left: 1px solid var(--line); }
.room-notes article:first-child { padding-left: 0; border: 0; }
.room-notes article:last-child { padding-right: 0; }
.room-notes span { color: #bc8dd9; font-size: 11px; letter-spacing: 2px; }
h3 { font-size: 22px; margin: 14px 0 12px; }
.room-notes p { color: var(--muted); font-size: 13px; line-height: 1.9; }
.text-link { display: inline-block; padding: 12px 0; color: var(--accent); font-size: 13px; border-bottom: 1px solid var(--line); }
.text-link span { margin-left: 30px; }
footer { border-top: 1px solid var(--line); padding: 28px 4.5%; display: flex; align-items: center; gap: 25px; font-size: 10px; letter-spacing: 1px; color: #bda9ca; }
footer p { margin: 0; font-family: Georgia, serif; font-style: italic; font-size: 14px; letter-spacing: 0; }
.footer-note { margin-left: auto; letter-spacing: 0; }
/* Identical footer slots keep the shared bars steady when the page changes. */
.public-page > footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px 25px; padding-block: 16px; background: #110c19; }
.public-page > footer .text-link { min-height: 44px; display: flex; align-items: center; }
.account { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; background: #b377dc10; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 20px; }
.avatar { display: grid; place-items: center; border-radius: 50%; background: #613884; width: 36px; height: 36px; }
.account small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.account strong { font-size: 12px; }
/* Provider account names must wrap even when they contain no spaces. */
.account > div { min-width: 0; overflow-wrap: anywhere; }
.avatar { flex-shrink: 0; }
/* Keep Discord portraits inside the existing circular account badge. */
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
/* Keep the provider widget intact inside a site-styled verification panel. */
#human-check { display: flex; justify-content: center; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #ffffff04; }
#verify-form { display: flex; flex-direction: column; gap: 16px; }
#verify-form .check-row, #verify-form > .primary { margin: 0; }
#verify-form > .secondary { align-self: center; margin: 0; }
/* A native checkbox keeps form validation and keyboard semantics with explicit theme states. */
#rules-accepted { appearance: none; display: grid; place-content: center; width: 22px; height: 22px; margin: 0; border: 1px solid #ad8cc2; border-radius: 5px; background: #150d20; cursor: pointer; }
#rules-accepted::before { content: ''; width: 10px; height: 6px; border-left: 2px solid white; border-bottom: 2px solid white; transform: translateY(-1px) rotate(-45deg); opacity: 0; }
#rules-accepted:checked { background: #8341a6; border-color: #d5a3f2; }
#rules-accepted:checked::before { opacity: 1; }
#rules-accepted:focus-visible { outline: 2px solid #e4c5f6; outline-offset: 4px; }
#rules-accepted:disabled { opacity: .55; cursor: default; }
@media (forced-colors: active) { #rules-accepted { appearance: auto; } #rules-accepted::before { content: none; } }
.check-row small { display: block; color: var(--muted); }
.check-row { display: flex; gap: 12px; align-items: center; text-align: left; min-height: 48px; font-size: 12px; line-height: 1.6; margin: 10px 0; }
input[type='checkbox'] { flex-shrink: 0; width: 19px; height: 19px; accent-color: #b574e0; }
.check-row a { text-decoration: underline; text-underline-offset: 3px; }
.check-row:last-of-type { border: 1px solid var(--line); border-radius: 4px; padding: 12px 9px; margin: 15px 0 20px; background: #ffffff04; }
.feedback { text-align: left; padding: 12px; background: #e99e7d12; border-left: 2px solid #e4b397; color: #f2c7b3; font-size: 12px; line-height: 1.7; margin: 15px 0 0; }
.completion-mark { color: #d8b5f3; font-size: 36px; margin-bottom: 16px; }
dialog { background: #1a1225; color: var(--text); width: min(540px, calc(100% - 32px)); max-height: 85dvh; border: 1px solid #ae76d579; border-radius: 8px; padding: 38px 32px; box-shadow: 0 20px 90px #0009; }
dialog::backdrop { background: #08050ec9; }
dialog h2 { font-size: 30px; padding-right: 20px; }
dialog p, dialog li { font-size: 14px; line-height: 1.9; color: #d0bfdc; }
dialog ul { padding-left: 20px; }
.house-rules { list-style: none; padding: 0; margin-bottom: 0; }
.house-rules li { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.house-rules h3 { font-size: 20px; line-height: 1.5; margin: 0 0 8px; }
.house-rules p { margin-bottom: 0; }
.close-dialog { position: absolute; right: 14px; top: 10px; width: 44px; font-size: 26px; }
.intro-playing .character, .intro-playing .roses { animation: arrive 1.6s both; }
.intro-playing .brand-art { animation: arrive 1.2s both; }
.motion-paused .layer, .motion-paused .brand-art { animation: none !important; transform: none !important; }
@keyframes arrive { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes mist { from { translate: -5px 0; } to { translate: 5px 3px; } }
@media (min-width: 1600px) { .hero { min-height: 960px; } .scene { --character-width: 600px; } }
@media (max-width: 1050px) {
  .wordmark-light { display: block; font-size: 10px; margin-top: 4px; }
  nav { gap: 18px; }
  .scene { --character-width: 47vw; }
  .scene-shade { background: linear-gradient(0deg, var(--ink), transparent 45%), #10091830; }
}
@media (max-width: 700px) {
  .public-page .site-header { flex-direction: column; gap: 8px; padding: 12px 18px; }
  .public-page .site-header nav { justify-content: center; flex-wrap: wrap; gap: 8px 18px; }
  .public-page > footer { grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 18px; }
  .public-page > footer > p { grid-column: 1; font-size: 13px; }
  .public-page > footer > .text-link { grid-column: 2; grid-row: 1 / 3; }
  .public-page > footer > .footer-note { grid-column: 1 / -1; margin: 0; width: auto; }
}
@media (max-width: 650px) {
  .site-header { padding: 12px 18px; min-height: 74px; gap: 12px; }
  .wordmark { gap: 8px; font-size: 11px; letter-spacing: 1px; }
  .wordmark-light { font-size: 8px; }
  .sigil { font-size: 26px; width: 33px; height: 36px; }
  nav { gap: 0; }
  nav > a, nav > button[data-dialog] { display: none; }
  .hero { padding: 40px 18px 24px; min-height: 800px; }
  .welcome-line { font-size: 8px; letter-spacing: 2px; }
  .brand-art { height: 180px; margin-top: 8px; }
  .tagline { margin: 5px 0 25px; font-size: 12px; }
  .tagline em { display: block; }
  .backdrop { background-image: url('/art/backdrop-mobile.webp'); background-position: 62% top; }
  .moon { width: 150px; height: 150px; left: calc(50% - 75px); top: 0; }
  /* Hidden decorative layers have no background URL, avoiding mobile downloads. */
  .ground, .character, .roses, .architecture, .flame, .magic { display: none; background-image: none; }
  .clouds { inset: 18% -20px 28%; background-size: auto 100%; }
  .scene-shade { background: linear-gradient(0deg, var(--ink), #12092044 70%); }
  .entrance-panel { padding: 19px 22px 18px; }
  h1 { font-size: 26px; }
  .progress { gap: 16px; }
  .about-section { padding: 58px 24px; }
  .room-notes { grid-template-columns: 1fr; margin-top: 38px; gap: 23px; }
  .room-notes article, .room-notes article:first-child { padding: 0 0 16px; border-left: none; border-bottom: 1px solid var(--line); }
  footer { flex-wrap: wrap; padding: 25px; gap: 14px; }
  .footer-note { margin: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body > main { scroll-behavior: auto; }
  body:not(.home-page):not(.join-page), body:not(.home-page):not(.join-page) *, body:not(.home-page):not(.join-page) *::before, body:not(.home-page):not(.join-page) *::after { animation: none !important; transition: none !important; }
}
/* Saved public notices preserve staff-authored paragraphs without interpreting HTML. */
.saved-house-rules, .saved-privacy, .saved-help { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Shared dashboard and Help Desk account disclosure, including Discord decoration. */
.account-toggle { display: flex; align-items: center; gap: 10px; padding: 4px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-avatar { position: relative; display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: #623280; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
/* Decoration artwork extends beyond the circular avatar without clipping its edges. */
.account-avatar .account-avatar-decoration { inset: -4px; width: 48px; height: 48px; object-fit: contain; border-radius: 0; pointer-events: none; }
.account-identity { margin: 0 0 12px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.account-menu > .secondary { width: 100%; }
.account-menu > .secondary + .secondary { margin-top: 8px; }
@media (max-width: 560px) { .account-name { display: none; } }
