:root {
  color-scheme: dark;
  font: 100%/1.5 system-ui, sans-serif;
  color: #e6eee7;
  background: #101814;
  --paper: #18231d;
  --line: #53675a;
  --muted: #bac9be;
  --accent: #ffb49c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 90% 0%, #324439, transparent 52rem);
}
main { max-width: 61rem; margin: auto; padding: 2.5rem 1rem 4rem; }
header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 1.3rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
header p { max-width: 32rem; color: var(--muted); }
.series { color: var(--accent); font: 0.875rem/1.5 ui-monospace, monospace; letter-spacing: 0.16em; }
h1 { margin: 0.4rem 0; font: 700 clamp(3rem, 8.4vw, 5.6rem)/0.88 Georgia, serif; letter-spacing: -0.055em; }
.sighting { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 0.35rem; overflow: hidden; background: #090e0a; }
.sighting img { display: block; width: 100%; height: auto; }
.sighting figcaption { position: absolute; inset: auto 0 0; padding: 0.9rem 0.65rem 0.4rem; background: linear-gradient(transparent, #070b08ed); color: #fff; font: 0.875rem/1.4 ui-monospace, monospace; }
.reveal-sighting { max-width: 29rem; margin-bottom: 0.8rem; }
.join-page { max-width: 58rem; }
.join-home { display: inline-block; color: var(--muted); margin-bottom: 1.2rem; }
.join-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.1rem, 4vw, 2.75rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: clamp(1.15rem, 4vw, 2.3rem);
}
.join-title, .join-recipient { margin: .4rem 0 .75rem; line-height: 1; overflow-wrap: anywhere; }
.join-title { font-size: clamp(2.3rem, 5vw, 4rem); }
.join-recipient { color: var(--accent); font-size: clamp(2.8rem, 6.5vw, 5rem); overflow: hidden; }
.join-name-line { display: block; width: max-content; white-space: nowrap; }
.join-label, .join-message { margin: 0; color: var(--muted); }
.join-label { font-weight: 700; }
@media (max-width: 44rem) { .join-card { grid-template-columns: 1fr; } }
.field-record { max-width: 35rem; }
.field-record .cabin-window { margin-top: 0.75rem; }
.cabin-window {
  position: relative;
  isolation: isolate;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  margin: 0;
  border: 0.65rem solid #261f19;
  border-radius: 0.4rem;
  background: #101914;
  box-shadow: 0 0 0 1px #776655, 0 0.45rem 0 #100d0b, 0 1rem 2rem #080b08c9;
}
.window-world, .window-glass, .window-crossbar, .window-wildlife, .glass-sightings, .forest-occluder { position: absolute; inset: 0; }
.window-world { inset: -0.85rem; transform: translate(var(--window-x, 0px), var(--window-y, 0px)); }
.window-forest, .forest-occluder { display: block; width: 100%; height: 100%; }
.forest-occluder { pointer-events: none; }
.tree-left {
  clip-path: polygon(13% 0, 20% 0, 22% 16%, 21% 32%, 21.5% 55%, 19.7% 69%, 22% 83%, 14% 85%, 12% 80%, 13% 70%, 13% 48%, 14.5% 29%, 14% 18%);
}
.tree-center {
  clip-path: polygon(56.7% 0, 59% 0, 59.3% 17%, 58.9% 30%, 59.4% 49%, 59.3% 61%, 60.7% 66%, 57.1% 67%, 56.9% 64%, 57.8% 58%, 57.4% 41%, 57.8% 19%);
}
.tree-right {
  clip-path: polygon(82.5% 0, 87.1% 0, 87.6% 17%, 89.5% 32%, 91.1% 45%, 93.5% 49%, 91.1% 51%, 91.6% 66%, 91.7% 76%, 93.5% 81%, 84% 86%, 82.4% 82%, 83% 72%, 82% 60%, 83% 47%, 82.5% 25%);
}
.window-wildlife { pointer-events: none; }
.wildlife-far { opacity: .48; filter: blur(.6px) saturate(.48) contrast(.84); }
.wildlife-middle { opacity: .72; filter: saturate(.66); }
.wildlife-near { opacity: .91; }
.window-glass {
  pointer-events: none;
  background: radial-gradient(ellipse at 49% 60%, transparent 42%, #c9eddf42 100%),
    linear-gradient(122deg, transparent 42%, #d0eee81a 43%, transparent 47%);
  box-shadow: inset 0 0 1.25rem 0.45rem #080a09cc;
}
.window-crossbar {
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(50% - 4px), #090b08 0, #403429 calc(50% - 2px), #292119 calc(50% + 3px), transparent calc(50% + 4px)),
    linear-gradient(to bottom, transparent calc(56% - 3px), #0e100b 0, #423428 calc(56% - 1px), #282018 calc(56% + 2px), transparent calc(56% + 3px));
  transform: translate(var(--frame-x, 0px), var(--frame-y, 0px));
}
.window-creature {
  position: absolute;
  opacity: 0;
  width: var(--creature-size);
  left: var(--creature-left);
  bottom: var(--creature-bottom);
  height: auto;
  filter: brightness(.63) contrast(1.15) drop-shadow(0 4px 4px #080b08aa);
}
.window-creature.is-crossing { animation: window-crossing var(--crossing-time) linear both; }
@keyframes window-crossing {
  0% { opacity: 0; }
  15% { opacity: .82; }
  46% { opacity: .96; }
  79% { opacity: .8; }
  100% { opacity: 0; }
}
.window-creature.is-crossing {
  transform: translateX(var(--step-offset, 0%)) scaleX(var(--facing));
}
.glass-sightings { pointer-events: none; overflow: hidden; }
.glass-encounter {
  position: absolute;
  left: var(--encounter-x);
  bottom: -11%;
  width: 77%;
  opacity: 0;
  animation: window-prowl var(--encounter-time) ease-in-out both;
}
.glass-encounter img {
  display: block;
  width: 100%;
  height: auto;
  transform: scaleX(var(--encounter-facing));
  filter: saturate(.73) brightness(.85);
  mask-image: linear-gradient(#000 82%, transparent);
}
@keyframes window-prowl {
  0% { opacity: 0; transform: translate(10%, 38%) rotate(-4deg) scale(.78); }
  26% { opacity: .93; transform: translate(-2%, -4%) rotate(1deg) scale(1); }
  43% { opacity: .96; transform: translate(0, -5%) rotate(-1deg) scale(1.02); }
  58% { opacity: .91; transform: translate(3%, 0) rotate(2deg) scale(1.01); }
  74% { opacity: .84; transform: translate(3%, 3%) rotate(1deg) scale(1); }
  100% { opacity: 0; transform: translate(-9%, 27%) rotate(4deg) scale(.84); }
}
.glass-scratches {
  position: absolute;
  left: var(--scratch-x);
  top: 32%;
  width: 12%;
  height: 34%;
  opacity: 0;
  background: repeating-linear-gradient(90deg, transparent 0 20%, #dceceaab 21% 23%, transparent 24% 28%);
  transform: skewX(-17deg);
  animation: leave-scratches var(--encounter-time) linear both;
}
@keyframes leave-scratches {
  0%, 48% { opacity: 0; clip-path: inset(0 0 100% 0); }
  59% { opacity: .45; clip-path: inset(0); }
  75% { opacity: .32; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .window-world, .window-crossbar { transform: none; }
  .window-creature, .glass-encounter, .glass-scratches { display: none; }
}
.soundscape { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.sound-mute { min-height: 3.25rem; min-width: 10.5rem; padding: 0.65rem 1.15rem; font-size: 1.125rem; font-weight: 700; border-color: var(--accent); }
.soundscape .sound-track { margin: 0; color: var(--muted); }
.soundscape .sound-volume { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--muted); }
.sound-volume input[type="range"] { width: 6rem; margin: 0; accent-color: var(--accent); }
.sound-track select {
  appearance: none;
  color: #e6eee7;
  font: inherit;
  background: #18231d;
  border: 1px solid var(--line);
  border-radius: .25rem;
  padding: .45rem 1.7rem .45rem .55rem;
  background-image: linear-gradient(45deg, transparent 45%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 55%);
  background-position: right .72rem center, right .42rem center;
  background-repeat: no-repeat;
  background-size: .3rem .3rem;
}
@media (max-width: 44rem) {
  header { grid-template-columns: 1fr; gap: 0.45rem; }
  main { padding-top: 1.3rem; }
  h1 { font-size: clamp(3rem, 11vw, 4.8rem); }
}
h2 { margin: 0 0 1rem; font: 700 1.6rem/1.2 Georgia, serif; }
nav, .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
nav { margin: 1rem 0; }
button, input, textarea { font: inherit; }
button { border: 1px solid var(--line); border-radius: 0.25rem; background: #25372c; color: inherit; padding: 0.55rem 0.8rem; cursor: pointer; }
button:hover { border-color: var(--accent); }
button[disabled] { opacity: 0.6; cursor: wait; }
.primary, button[aria-pressed="true"] { color: #23130d; background: var(--accent); border-color: var(--accent); font-weight: 700; }
form, #exchange, details, .exchange-card { background: var(--paper); border: 1px solid var(--line); border-radius: 0.4rem; padding: 1rem; margin-bottom: 0.8rem; }
.exchange-card form { border: 0; margin: 0; padding: 1rem 0; }
.exchange-card select { color: inherit; background: #18231d; border: 1px solid var(--line); font: inherit; max-width: 100%; padding: .45rem; margin-bottom: .85rem; }
.office-gallery-link { color: var(--accent); }
#office-email-schedule { max-width: 26rem; }
#office-matches { color: var(--accent); margin-inline-start: .75rem; }
.match-sheet table { width: 100%; margin-top: 1rem; table-layout: fixed; border-collapse: collapse; }
.match-sheet th, .match-sheet td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: .55rem .65rem;
  overflow-wrap: anywhere;
}
@media print {
  :root:has(.match-sheet), body:has(.match-sheet) { color-scheme: light; color: #000; background: #fff; }
  .match-sheet { padding: 0; }
  .match-sheet .match-controls { display: none; }
  .match-sheet tr { break-inside: avoid; }
}
.art-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.art-gallery img { aspect-ratio: 3 / 2; object-fit: cover; }
details form { border: 0; padding: 1rem 0 0; margin: 0; }
summary { cursor: pointer; }
label, small { display: block; margin-bottom: 0.3rem; }
small, #invite-note { color: var(--muted); }
input:not([type="checkbox"]), textarea { display: block; width: 100%; margin: 0 0 0.75rem; padding: 0.55rem; border: 1px solid var(--line); border-radius: 0.2rem; background: #101814; color: inherit; }
textarea { resize: vertical; }
.check { margin: 0.8rem 0; }
.check input { accent-color: var(--accent); }
output { display: block; color: var(--accent); overflow-wrap: anywhere; }
output:not(:empty) { margin-top: 0.8rem; }
#invites { padding-left: 1.3rem; }
#invites li { padding-block: 0.3rem; overflow-wrap: anywhere; }
#invites button { margin-inline-start: 0.5rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cursor-spark {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  color: #ff6654;
  text-shadow: 0 0 7px #bd1c16;
  font: 0.85rem/1 system-ui, sans-serif;
  animation: cursor-spark-fall 680ms ease-out both;
}
.cursor-frost { color: #d4eee9; text-shadow: 0 0 6px #88bdb1; }
@keyframes cursor-spark-fall {
  from { transform: translate(-50%, -50%) scale(0.9); opacity: 0.82; }
  to { transform: translate(var(--drift), 22px) rotate(30deg) scale(0.3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-spark { display: none; }
}
