:root {
  --paper: #fbf8f1;
  --wall: #f1eadb;
  --ink: #2b2622;
  --muted: #6b6258;
  --accent: #3f7f96;
  --line: #d9cfbb;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #e9e1d0; color: var(--ink); font-family: var(--sans); }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#scene:active { cursor: grabbing; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Top bar */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none;
}
#nav, .tools { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.tools { flex-wrap: nowrap; flex-shrink: 0; }
#topbar button {
  background: rgba(251, 248, 241, .92); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
#topbar button:hover:not(:disabled) { background: #fff; border-color: var(--accent); }
#topbar button:disabled { color: var(--muted); font-weight: 500; cursor: default; opacity: .8; }

#hint {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
  margin: 0; padding: 7px 16px; max-width: calc(100vw - 24px);
  background: rgba(43, 38, 34, .78); color: #fff; border-radius: 999px;
  font-size: 13.5px; text-align: center; pointer-events: none;
}

/* Exhibit list */
#list {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 3; width: min(360px, 100vw);
  background: var(--paper); border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-head h2 { margin: 0; font: bold 22px var(--serif); }
#list-close, #overlay-close {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: 22px; line-height: 1;
}
#list-body { overflow-y: auto; padding: 4px 16px 24px; }
#list-body h3 { margin: 20px 0 2px; font: bold 19px var(--serif); }
#list-body .sub { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
#list-body ul { list-style: none; margin: 6px 0 0; padding: 0; }
#list-body li button {
  display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 15px;
}
#list-body li button:hover { color: var(--accent); }
#list-body .kind { flex: 0 0 46px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Exhibit pop-up */
#overlay {
  position: fixed; inset: 0; z-index: 4; background: rgba(30, 25, 20, .72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#overlay .card {
  position: relative; width: min(980px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--paper); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
#overlay-close { position: absolute; top: 10px; right: 10px; z-index: 1; }
#overlay .media { display: block; width: 100%; max-height: 68vh; object-fit: contain; background: #1d1915; border-radius: 14px 14px 0 0; }
#overlay .media.video { aspect-ratio: 16 / 9; max-height: none; }
#overlay .media.video iframe { width: 100%; height: 100%; border: 0; display: block; border-radius: 14px 14px 0 0; }
#overlay .text { padding: 22px clamp(18px, 4vw, 40px) 28px; max-width: 760px; }
#overlay .text:first-child { padding-top: 34px; }
#overlay h2 { margin: 0 0 12px; font: bold clamp(24px, 3.4vw, 34px)/1.15 var(--serif); padding-right: 40px; }
#overlay p { margin: 0 0 12px; font-size: 17px; line-height: 1.6; }
.kicker { margin: 0 0 6px !important; font-size: 13px !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
a { color: var(--accent); font-weight: 600; }

/* Start screen */
#start {
  position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(233, 225, 208, .9); backdrop-filter: blur(6px); overflow-y: auto;
}
.start-card {
  width: min(520px, 100%); margin: auto; padding: clamp(22px, 5vw, 40px); text-align: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(60, 40, 20, .25);
}
.start-card .logo { width: clamp(110px, 28vw, 170px); height: auto; mix-blend-mode: multiply; }
.start-card h1 { margin: 4px 0 10px; font: bold clamp(32px, 7vw, 46px)/1.05 var(--serif); }
.start-card h1 span { font-weight: normal; font-style: italic; color: var(--accent); }
.start-card .lead { margin: 0 0 20px; font-size: 17px; line-height: 1.5; color: #3d3732; }
#btn-enter {
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 34px; font-size: 18px; font-weight: 700; box-shadow: 0 4px 14px rgba(63, 127, 150, .4);
}
#btn-enter:hover { background: #33697d; }
.howto { list-style: none; margin: 24px 0 18px; padding: 16px 0 0; border-top: 1px solid var(--line); text-align: left; font-size: 15px; line-height: 1.5; color: #3d3732; }
.howto li { display: flex; gap: 12px; padding: 3px 0; }
.howto b { flex: 0 0 48px; color: var(--ink); }
#nowebgl { color: #a8372a; font-weight: 600; }
.start-card .eu { width: 96px; height: auto; }

@media (max-width: 600px) {
  #topbar button { padding: 6px 11px; font-size: 13px; }
  #hint { font-size: 12px; }
}
