:root {
  --bg: #211813;
  --page: #2d221b;
  --panel: #f0dfc0;
  --panel-soft: #ead5ad;
  --ink: #211813;
  --ink-soft: #5d4a3d;
  --line: #b99d6e;
  --line-dark: #6f553b;
  --accent: #8f3e2f;
  --accent-hover: #723126;
  --cream: #fff7e7;
  --gold: #d8b679;
  --shadow: rgba(21, 14, 10, .34);
  --max: 1080px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(216, 182, 121, .12), transparent 30rem),
    linear-gradient(180deg, #1c1410, var(--bg));
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
figure { margin: 0; }

.site-bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--cream);
}
.site-brand {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .03em;
}
.site-bar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
  font-size: .93rem;
}
.site-bar nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  color: rgba(255,247,231,.78);
  text-decoration: none;
}
.site-bar nav a:hover,
.site-bar nav a:focus-visible { color: #fff; text-decoration: underline; }

.page {
  max-width: var(--max);
  margin: 0 auto 28px;
  padding: 0 16px 36px;
  background: var(--page);
  border: 1px solid rgba(255,247,231,.13);
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
}
.title-block {
  padding: 34px 0 20px;
  color: var(--cream);
}
.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: .8rem;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; line-height: 1.12; }
h1 {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  letter-spacing: -.05em;
}
h2, h3 { font-family: var(--serif); letter-spacing: -.02em; }
.subtitle { margin: 10px 0 0; color: rgba(255,247,231,.72); font-size: 1.06rem; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.main-column, .side-column { min-width: 0; }

.media-box,
.copy-section,
.access-box,
.interactive-demo,
.info-card,
.download-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.38) inset, 0 10px 28px rgba(0,0,0,.08);
}
.media-box { padding: 10px; }
.cover-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border: 1px solid var(--line-dark);
  background: #18100c;
}
.caption {
  margin: 9px 2px 0;
  color: var(--ink-soft);
  font-size: .93rem;
}
.copy-section,
.access-box,
.interactive-demo { margin-top: 14px; padding: 18px; }
.copy-section h2,
.access-box h2,
.info-card h2,
.interactive-demo h2 {
  margin-bottom: 10px;
  font-size: 1.56rem;
}
.copy-section p,
.access-box p,
.info-card p,
.interactive-demo p,
.info-card li,
.section-note {
  color: var(--ink-soft);
  line-height: 1.58;
}
.copy-section p { max-width: 72ch; }
.copy-section p:first-of-type { margin-top: 0; }
.copy-section p:last-child { margin-bottom: 0; }
.section-note { margin: -2px 0 14px; }
.feature-list { margin: 14px 0 0; padding-left: 1.2rem; color: var(--ink-soft); line-height: 1.58; }
.feature-list li + li { margin-top: 6px; }

.primary-button,
.secondary-button,
.small-button,
.text-button,
.screenshot-grid button,
.map-list button,
.door-hotspot {
  min-height: 42px;
  border: 1px solid var(--line-dark);
  background: #e8d0a5;
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
}
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 15px;
  font-weight: 750;
}
.primary-button {
  background: var(--accent);
  border-color: #5f261d;
  color: #fff7e7;
}
.primary-button:hover,
.primary-button:focus-visible { background: var(--accent-hover); }
.secondary-button:hover,
.secondary-button:focus-visible,
.small-button:hover,
.small-button:focus-visible,
.screenshot-grid button:hover,
.screenshot-grid button:focus-visible,
.map-list button:hover,
.map-list button:focus-visible { background: #f7e7c7; }
.primary-button.wide { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.text-button {
  padding: 8px 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 750;
}
.text-button:hover,
.text-button:focus-visible { text-decoration: underline; }
.small-button {
  padding: 7px 9px;
  font-size: .88rem;
}
:focus-visible {
  outline: 3px solid rgba(143, 62, 47, .35);
  outline-offset: 2px;
}

.side-column {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 14px;
}
.download-card, .info-card { padding: 14px; }
.side-note { margin: 9px 0 0; color: var(--ink-soft); font-size: .9rem; text-align: center; }
.info-table { margin: 0; font-size: .94rem; }
.info-table div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(111,85,59,.34);
}
.info-table div:first-child { border-top: 0; }
.info-table dt { font-weight: 750; color: var(--ink); }
.info-table dd { margin: 0; color: var(--ink-soft); }
.info-card.compact ul { margin: 0; padding-left: 1.2rem; }
.info-card.compact li + li { margin-top: 7px; }

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.screenshot-grid button {
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: #e6d0a9;
}
.screenshot-grid img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-bottom: 1px solid var(--line-dark); }
.screenshot-grid span { display: block; padding: 9px 8px; font-weight: 750; font-size: .9rem; }

.log-entry {
  padding: 12px 0;
  border-top: 1px solid rgba(111,85,59,.34);
}
.log-entry:first-of-type { border-top: 0; padding-top: 0; }
.log-entry h3 { font-size: 1.05rem; }
.log-entry time { display: block; margin: 4px 0 7px; color: var(--ink-soft); font-size: .85rem; }
.log-entry p { margin: 0; }

.interactive-demo { border-color: #8b563a; }
.demo-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 12px;
}
.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 14px;
}
.game-frame {
  overflow: hidden;
  border: 1px solid var(--line-dark);
  background: #1c1511;
  color: var(--cream);
}
.game-toolbar {
  min-height: 50px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,247,231,.18);
}
.game-toolbar strong { line-height: 1.2; }
.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.scene {
  position: relative;
  overflow: hidden;
  height: clamp(330px, 48vw, 520px);
  background-image: url('assets/rooms/entrance.webp');
  background-size: cover;
  background-position: center;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.04), transparent 45%, rgba(0,0,0,.23));
}
.player {
  position: absolute;
  width: clamp(62px, 9vw, 86px);
  left: 50%;
  top: 82%;
  transform: translate(-50%, -100%) scale(var(--actor-scale, 1));
  transform-origin: 50% 100%;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 10px 8px rgba(0,0,0,.45));
}
.door-hotspot {
  position: absolute;
  z-index: 9;
  transform: translate(-50%, -50%);
  min-height: 34px;
  padding: 6px 9px;
  border-color: rgba(255,247,231,.72);
  background: rgba(28,21,17,.84);
  color: var(--cream);
  font-size: .82rem;
  font-weight: 750;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.door-hotspot:hover,
.door-hotspot:focus-visible { background: rgba(143,62,47,.94); }
.click-ring {
  position: absolute;
  z-index: 11;
  width: 34px;
  height: 34px;
  border: 2px solid #f2d190;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}
.click-ring.show { animation: clickPulse .45s ease-out; }
.hint {
  margin: 0;
  padding: 9px 10px;
  color: rgba(255,247,231,.73);
  font-size: .88rem;
  border-top: 1px solid rgba(255,247,231,.14);
}
.demo-notes {
  border: 1px solid var(--line-dark);
  background: var(--panel-soft);
  padding: 12px;
}
.demo-notes h3 { margin-bottom: 7px; font-size: 1.22rem; }
.demo-notes p { margin: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { border: 1px solid rgba(111,85,59,.45); padding: 4px 6px; background: rgba(255,255,255,.22); color: var(--ink-soft); font-size: .8rem; }
.map-details { margin-top: 14px; color: var(--ink-soft); }
.map-details summary { cursor: pointer; color: var(--accent); font-weight: 750; min-height: 34px; display: flex; align-items: center; }
.map-list { display: grid; gap: 6px; margin-top: 9px; max-height: 290px; overflow: auto; padding-right: 2px; }
.map-list button { width: 100%; padding: 8px; text-align: left; font-size: .88rem; }
.map-list button.active { background: var(--accent); color: #fff7e7; border-color: #5f261d; }
.map-list button.exit { border-color: #8f3e2f; }

.footer {
  max-width: var(--max);
  margin: 0 auto 28px;
  padding: 0 16px calc(8px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255,247,231,.68);
  font-size: .92rem;
}
.footer p { margin: 0; }
.footer a { color: var(--gold); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes clickPulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

@media (min-width: 881px) {
  .site-bar, .page, .footer { width: calc(100% - 28px); }
}

@media (max-width: 880px) {
  .content-grid { grid-template-columns: 1fr; }
  .side-column { position: static; }
  .demo-layout { grid-template-columns: 1fr; }
  .demo-notes { order: -1; }
  .screenshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-list { max-height: 220px; }
}

@media (max-width: 600px) {
  body { background: var(--bg); }
  .site-bar { display: block; padding-left: 12px; padding-right: 12px; }
  .site-bar nav { justify-content: flex-start; margin-top: 8px; gap: 2px 10px; }
  .page { border-left: 0; border-right: 0; padding-left: 12px; padding-right: 12px; }
  .title-block { padding-top: 26px; }
  h1 { font-size: clamp(2.7rem, 16vw, 4.2rem); }
  .copy-section, .access-box, .interactive-demo { padding: 15px; }
  .button-row { display: grid; }
  .primary-button, .secondary-button { width: 100%; }
  .screenshot-grid { grid-template-columns: 1fr; }
  .demo-header { align-items: stretch; flex-direction: column; }
  .text-button { align-self: flex-start; }
  .game-toolbar { align-items: start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
  .small-button { min-height: 40px; }
  .scene { height: min(430px, 72vh); min-height: 330px; }
  .door-hotspot { font-size: .76rem; max-width: 118px; white-space: normal; }
  .info-table div { grid-template-columns: 1fr; gap: 2px; }
  .footer { display: block; }
  .footer a { display: inline-flex; margin-top: 8px; min-height: 34px; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
