:root {
  --ink: #f4efe6;
  --muted: #c9bfae;
  --stone: #e7d6ae;
  --accent: #ffd23f;
  --known: #8fe3b0;
  --guessed: #ffc07a;
  --glass: rgba(18, 16, 13, 0.82);
  --line: rgba(255, 255, 255, 0.16);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fb3d9; color: var(--ink); touch-action: none;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.title { position: fixed; left: 0; top: 0; padding: 22px 60px 40px 28px; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  background: radial-gradient(ellipse at top left, rgba(10, 9, 7, 0.55), rgba(10, 9, 7, 0) 70%); }
.title h1 { margin: 0; font: 600 40px/1.05 Georgia, "Times New Roman", serif; color: #fff; }
.title h1 span { color: var(--accent); }
.title p { margin: 4px 0 0; font-size: 17px; color: #f2ede4; }

/* numbered markers on the model */
.spots { position: fixed; inset: 0; pointer-events: none; }
.spot { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; pointer-events: auto;
  transform: translate(-19px, -19px); border: 0; padding: 0; background: none; }
.spot b { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: #1b1600; font-weight: 700; font-size: 18px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4); }
.spot span { padding: 3px 10px; border-radius: 999px; background: var(--glass); font-size: 15px; white-space: nowrap;
  opacity: 0; transform: translateX(-6px); transition: opacity 0.15s, transform 0.15s; }
.spot:hover span, .spot:focus-visible span, .spot.on span { opacity: 1; transform: none; }
.spot.on b { background: #fff; }
.spot.behind { opacity: 0.4; }
/* no hover on a touch screen: the names show with the numbers (copy review 1), except the dimmed ones behind */
@media (hover: none) { .spot:not(.behind):not(.crowded) span { opacity: 1; transform: none; } }
.spot.flip { flex-direction: row-reverse; }   /* its name on the left, near the right edge (display.js spaceLabels) */
.spot.behind b { transform: scale(0.8); }

/* the side panel */
.panel { position: fixed; right: 20px; top: 20px; max-height: calc(100% - var(--bar-h, 74px) - 30px); width: min(420px, 40vw);
  overflow: auto; touch-action: pan-y; overscroll-behavior: contain;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 22px 26px 0;
  backdrop-filter: blur(6px); }
/* the foot's padding on the body, not the scroller, so the fade below reaches the panel's edge (copy review 3) */
#panel-body { padding-bottom: 24px; }
.panel h2 { margin: 0 34px 12px 0; font: 600 28px/1.15 Georgia, "Times New Roman", serif; color: var(--stone); }
.panel p { margin: 0 0 12px; }
.panel h3 { margin: 18px 0 6px; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
/* more below: a fade at the foot of a panel that scrolls (display.js moreBelow) */
.panel.more::after { content: ""; position: sticky; bottom: 0; display: block; height: 56px; margin-top: -56px;
  background: linear-gradient(rgba(18, 16, 13, 0), var(--glass) 75%); pointer-events: none; }
.panel h3.known { color: var(--known); }
.panel h3.guessed { color: var(--guessed); }
.panel h3.made { color: var(--muted); }
.panel ul { margin: 0; padding-left: 20px; }
.panel li { margin: 0 0 8px; }
.panel .close { position: absolute; right: 14px; top: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); font-size: 26px; line-height: 1; }

/* the bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 24px 18px; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55)); }
.bar button { border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; padding: 10px 18px;
  background: rgba(20, 18, 15, 0.7); font-weight: 600; }
.bar button:hover { background: rgba(40, 36, 30, 0.85); }
.bar button[aria-pressed="true"] { background: var(--accent); color: #1b1600; border-color: var(--accent); }
.bar .icon-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; margin-left: auto; }
/* how to move round: above the bar on the right, out of the way of the time slider; hidden while a panel is open */
.hint { position: fixed; right: 24px; bottom: calc(var(--bar-h, 74px) + 6px); margin: 0; max-width: calc(100vw - 640px);
  font-size: 14px; color: #eee8dc; text-shadow: 0 1px 4px #000; text-align: right; pointer-events: none; }
body.panel-open .hint { display: none; }

.idle { position: fixed; left: 50%; bottom: calc(var(--bar-h, 74px) + 100px); transform: translateX(-50%);   /* above the slider, clear of the QR card */ padding: 12px 22px; border-radius: 999px;
  background: var(--glass); font-size: 20px; pointer-events: none; }
/* the QR code to the phone page: small in the top right, big while nobody's there (the attract mode) */
.qr { position: fixed; right: 20px; top: 20px; display: flex; gap: 12px; align-items: center; width: 250px; padding: 10px;
  border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(6px);
  transition: width .6s, padding .6s; pointer-events: none; }
.qr img { flex: none; width: 76px; height: 76px; border-radius: 6px; background: #fff; transition: width .6s, height .6s; }
.qr p { margin: 0; font-size: 14px; line-height: 1.35; }
.qr .qr-big { display: none; }
.qr .qr-url { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }   /* breaks after demo/ */
body.idle-now .title p { font-size: 21px; max-width: 34em; }   /* the story line, read from a step back */
body.idle-now .qr { width: 400px; padding: 16px; }
body.idle-now .qr img { width: 150px; height: 150px; }
body.idle-now .qr p { font-size: 17px; }
body.idle-now .qr .qr-big { display: inline; }
body.idle-now .qr .qr-small { display: none; }
body.idle-now .qr b.qr-big { display: block; margin-bottom: 4px; font: 600 24px/1.15 Georgia, "Times New Roman", serif; color: var(--accent); }
body.panel-open .qr { display: none; }
@media (max-width: 760px), (max-height: 520px) { .qr { display: none; } }
/* kiosk mode (?kiosk): no selecting text, no page zoom or pull-to-refresh, no cursor while it plays to itself */
.kiosk, .kiosk body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.kiosk body { touch-action: none; }
.kiosk .panel { touch-action: pan-y; }
.kiosk body.idle-now, .kiosk body.idle-now * { cursor: none; }

.quality { position: fixed; left: 28px; top: 134px; margin: 0; font-size: 13px; color: #ffe08a;
  text-shadow: 0 1px 4px #000; pointer-events: none; }

/* the time slider, above the bottom bar */
.time { position: fixed; left: 24px; bottom: calc(var(--bar-h, 74px) + 4px); width: min(560px, 50vw);   /* clear of the panel on the right */
  padding: 10px 18px 8px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); }
.time { display: flex; align-items: center; gap: 14px; }
.time .track { flex: 1; min-width: 0; }
.time .play { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(20, 18, 15, 0.7); color: var(--ink); }
.time .play:hover { background: rgba(40, 36, 30, 0.85); }
.time .play[aria-pressed="true"] { background: var(--accent); color: #1b1600; border-color: var(--accent); }
.time input { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ticks { position: relative; height: 24px; margin: 2px 8px 0; }   /* labels under the slider's stops */
.ticks button { position: absolute; top: 0; transform: translateX(-50%); border: 0; background: none; padding: 2px 0;
  font-size: 14px; color: var(--muted); white-space: nowrap; }
.ticks button:first-child { transform: translateX(-8px); }
.ticks button:last-child { transform: translateX(calc(-100% + 8px)); }
.ticks button.on { color: var(--accent); font-weight: 700; }
.ticks .short { display: none; }
@media (max-width: 480px) { .ticks .long { display: none; } .ticks .short { display: inline; } }   /* a phone */
.caption { position: fixed; left: 50%; top: 26px; transform: translateX(-50%); padding: 8px 20px; border-radius: 999px;
  background: var(--glass); font: 600 22px/1.2 Georgia, "Times New Roman", serif; color: var(--stone);
  pointer-events: none; }
.panel p.small { margin-top: 20px; font-size: 12px; color: var(--muted); }
.panel ul.facts li { margin-bottom: 14px; }
.panel ul.facts small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.panel .fact p { margin: 0 0 6px; font-size: 18px; line-height: 1.45; }
.panel .fact small { display: block; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.bar button:disabled { opacity: 0.4; cursor: default; }

.loading { position: fixed; inset: 0; display: grid; place-items: end center; padding-bottom: 13vh; z-index: 10; font-size: 22px; color: var(--stone);
  background: linear-gradient(rgba(14, 12, 10, 0.25), rgba(14, 12, 10, 0.82)), url(tex/loading.jpg) center / cover, #141210; }
.loading .load-title { font: 600 56px/1.05 Georgia, "Times New Roman", serif; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.loading .load-title span { color: var(--accent); }
.loading .load-sub { margin: 8px 0 26px; font-size: 18px; color: #eee8dc; text-shadow: 0 1px 6px #000; }
.loading { overflow: auto; }
@media (max-height: 560px) {                      /* a short screen: centred and smaller, so an error still fits */
  .loading { place-items: center; padding-bottom: 0; }
  .loading .load-title { font-size: 36px; }
  .loading .load-sub { margin-bottom: 12px; }
}
.loading p { margin: 0; text-align: center; }
.loading .load-step { margin-top: 10px; font-size: 15px; color: var(--muted); }
.loading .load-error { margin: 14px auto 0; max-width: 520px; font-size: 15px; color: #ffb4a8; }
.osm-credit { position: fixed; right: 16px; bottom: calc(var(--bar-h, 74px) - 10px); margin: 0; font-size: 12px; color: #eee8dc;
  text-shadow: 0 1px 4px #000; pointer-events: none; }
/* a tablet or a small laptop: a narrower, smaller panel, so more of the castle shows, and buttons that fit
   on one row */
@media (max-width: 1300px), (max-height: 800px) {
  .bar { gap: 8px; padding: 12px 16px 14px; }
  .bar button { padding: 9px 14px; font-size: 15px; }
  .bar .icon-btn { width: 40px; height: 40px; padding: 0; }
  .hint { font-size: 13px; max-width: calc(100vw - 600px); }
  .panel { width: min(360px, 34vw); padding: 16px 20px 0; font-size: 15px; line-height: 1.45; right: 14px; top: 14px; }
  #panel-body { padding-bottom: 18px; }
  .panel h2 { font-size: 23px; }
  .panel h3 { margin-top: 12px; font-size: 15px; }
  .panel li { margin-bottom: 5px; }
}
/* upright (an iPad held portrait): the panel as a sheet above the time slider, the slider full width */
@media (max-aspect-ratio: 1/1) {
  .hint { display: none; }
  .panel { left: 14px; right: 14px; top: auto; bottom: calc(var(--bar-h, 74px) + 92px); width: auto; max-height: 40vh; }
  .time { width: calc(100vw - 48px); }
}

/* a phone held upright: while a panel is open the row of buttons steps aside (its close button brings them back), the
   slider drops to the foot and the panel sits on it, so the castle gets the rest of the screen (Ben, 28 Oct: on a
   phone the keep was under the panel) */
@media (max-width: 520px) and (max-aspect-ratio: 1/1) {
  body.panel-open .bar { display: none; }
  body.panel-open .time { bottom: 12px; }
  body.panel-open .panel { bottom: 96px; max-height: 44vh; }
  body.panel-open .title p { display: none; }        /* the picture's top for what the panel is about (the dig's flags) */
}

/* Look inside: the rooms to stand in */
.panel .rooms { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.panel .rooms h3 { width: 100%; margin: 0 0 2px; color: var(--accent); }
.panel .rooms button { border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; padding: 8px 14px; background: rgba(255, 255, 255, 0.08);
  color: inherit; font: inherit; font-size: 15px; cursor: pointer; }
.panel .rooms button.on { background: var(--accent); color: #1b1600; border-color: var(--accent); }
.panel .rooms button.ghost { background: none; }
/* (copy review 5: a 12 px grey hint and 40 px buttons were small for a kiosk) */
.panel .rooms button { min-height: 44px; }
.panel .rooms .room-hint { width: 100%; margin: 4px 0 0; font-size: 16px; }
.panel .room-caption { margin-top: 0; }

/* "What was dug up": the finds' flags (display.js loadTrench) and their panels: the report's words and figure */
.spot.find b { width: 30px; height: 30px; font-size: 17px; background: #ff6a1a; color: #fff; }
.spot.find.seen b { background: #f4b48c; color: rgba(255, 255, 255, 0.85); }   /* looked at already */
.spot b svg { display: block; }
.panel blockquote { margin: 4px 0 14px; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent); font-style: italic; }
.panel blockquote cite { display: block; margin-top: 4px; font-style: normal; font-size: 12px; color: var(--muted); }
.panel figure { margin: 6px 0 14px; }
.panel figure img { display: block; width: 100%; height: auto; border-radius: 6px; }
/* the report's photographs, blurred until we're allowed to show them (tools/blur-figs.mjs, dig.json figsWithheld) */
.panel figure .pic { position: relative; }
.panel figure .withheld { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 14px;
  border-radius: 999px; background: rgba(18, 16, 13, 0.82); color: #f1e6c8; font-size: 14px; white-space: nowrap; pointer-events: none; }
.panel figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }
.panel > div > button.ghost, .panel button.ghost { margin-top: 14px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px;
  padding: 8px 14px; min-height: 44px; background: none; color: inherit; font: inherit; cursor: pointer; }

/* in a room (body.in-room): a row of the rooms and the way out above the buttons, and on a touch screen a stick to walk
   with, bottom right; the time slider steps aside (a room is in 1138). On a phone with a panel open, the panel's own
   room buttons do instead */
body.in-room .time { display: none; }
.roombar { position: fixed; left: 24px; right: 24px; bottom: calc(var(--bar-h, 74px) + 8px); display: flex; flex-wrap: wrap; gap: 8px;
  pointer-events: none; }
.roombar button { pointer-events: auto; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; padding: 9px 16px;
  background: rgba(20, 18, 15, 0.72); font-weight: 600; }
.roombar button.on { background: var(--accent); color: #1b1600; border-color: var(--accent); }
.roombar .leave { background: rgba(255, 255, 255, 0.12); }
.stick { position: fixed; right: 28px; bottom: calc(var(--bar-h, 74px) + 70px); width: 120px; height: 120px; border-radius: 50%;
  background: rgba(20, 18, 15, 0.38); border: 2px solid rgba(255, 255, 255, 0.45); touch-action: none; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: rgba(243, 239, 230, 0.85); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); transform: translate(var(--sx, 0px), var(--sy, 0px)); }
@media (max-width: 520px) and (max-aspect-ratio: 1/1) {
  body.panel-open .roombar, body.panel-open .stick { display: none; }
  .roombar { left: 12px; right: 136px; }            /* clear of the stick, bottom right */
  body.in-room .bar { display: none; }             /* in a room, its own row (Leave the room brings these back) */
  body.in-room .roombar { bottom: 16px; }
  body.in-room .stick { bottom: 24px; }
  .roombar button { padding: 8px 12px; font-size: 14px; }
  .stick { right: 18px; width: 108px; height: 108px; bottom: calc(var(--bar-h, 74px) + 64px); }
}

/* a find's model in its panel (findViewer) */
.panel .find-3d { margin: 4px 0 14px; }
.panel .find-3d canvas { display: block; width: 100%; height: 220px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.25)); touch-action: none; }
.panel .find-3d .small { margin: 4px 0 0; }
body.dug-on .time { display: none; }                /* What was dug up: no time slider (the dig is today's) */
