@font-face { font-family: "Nunito Sans"; src: url("vendor/fonts/NunitoSans-var.woff") format("woff"); font-weight: 400 800; font-display: swap; }
:root { --purple: #431551; --purple-2: #5d2a6e; --gold: #AC8100; --gold-dark: #7a5c00; --ink: #1f1a24; --paper: #ffffff; --line: #d9d2de;
  --font: "Nunito Sans", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --hud-h: 84px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c1c1e; color: var(--ink); font-family: var(--font); font-size: 18px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, select, input, a { font: inherit; }
button { cursor: pointer; }
svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 4px solid #ffbf00; outline-offset: 2px; box-shadow: 0 0 0 7px #000; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; -webkit-user-select: none; user-select: none; }
#view.dragging { cursor: grabbing; }
#fade { position: fixed; inset: 0; background: #17101c; opacity: 0; pointer-events: none; transition: opacity .28s ease; z-index: 4; }
#fade.on { opacity: 1; }

/* ---------- main controls ---------- */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; gap: 6px; padding: 8px calc(8px + env(safe-area-inset-right)) 8px calc(8px + env(safe-area-inset-left)); padding-top: calc(8px + env(safe-area-inset-top)); background: linear-gradient(rgba(20,10,26,.55), rgba(20,10,26,0)); pointer-events: none; }
.hb { pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 104px; min-height: 66px; padding: 6px 10px; border: 2px solid #fff; border-radius: 12px; background: var(--purple); color: #fff; font-size: 16px; font-weight: 700; line-height: 1.15; text-align: center; }
.hb:hover { background: var(--purple-2); }
.hb[aria-pressed="false"] { background: #fff; color: var(--purple); border-color: var(--purple); }
body.mode-welcome #hud, body.mode-welcome #touchui, body.mode-welcome #aerialui, body.mode-welcome #partload, body.mode-welcome #markers { display: none; }
body.mode-tour #btn-places, body.mode-tour #btn-aerial, body.mode-tour #btn-tour { display: none; }
body.shot #hud, body.shot #welcome, body.shot #partload, body.shot #touchui { display: none; }

#partload { position: fixed; left: 12px; bottom: 12px; z-index: 5; background: rgba(255,255,255,.94); border-radius: 10px; padding: 8px 12px; font-size: 16px; min-width: 220px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
body.is-touch #partload, body.mode-tour #partload, body.mode-aerial #partload { left: auto; right: 12px; bottom: auto; top: calc(var(--hud-h) + 8px); }
.pbar, #progress { height: 8px; background: #e4dde8; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.pbar > div, #bar { height: 100%; width: 0; background: var(--purple); transition: width .2s linear; }
#toast { position: fixed; left: 50%; top: calc(var(--hud-h) + 16px); transform: translateX(-50%); z-index: 7; background: rgba(31,26,36,.92); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 18px; max-width: 90vw; text-align: center; }

/* ---------- joystick ---------- */
#touchui { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#stick { position: absolute; left: calc(22px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; background: rgba(67,21,81,.35); border: 3px solid rgba(255,255,255,.85); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: 36px; top: 36px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid var(--purple); }
body.mode-tour #touchui, body.mode-aerial #touchui, body.no-joystick #touchui { display: none; }

/* ---------- shared buttons ---------- */
.big, .tb, .choice { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--purple); background: #fff; color: var(--purple); font-weight: 700; font-size: 18px; text-decoration: none; text-align: center; }
.big:hover, .tb:hover { background: #f3ecf6; }
.primary { background: var(--purple); color: #fff; }
.primary:hover { background: var(--purple-2); }
button:disabled { opacity: .45; cursor: default; }
.rb { width: 56px; height: 56px; border-radius: 50%; border: 2px solid #fff; background: var(--purple); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }

/* ---------- aerial ---------- */
#aerialui { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 5; text-align: center; pointer-events: none; padding: 0 10px; }
#aerialui .row > * { pointer-events: auto; }
#aerial-hint { display: inline-block; margin: 0 0 8px; background: rgba(31,26,36,.85); color: #fff; padding: 6px 14px; border-radius: 10px; font-size: 16px; }
#markers { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.marker { position: absolute; left: 0; top: 0; pointer-events: auto; background: #fff; color: var(--purple); border: 3px solid var(--purple); border-radius: 12px; padding: 6px 14px; font-family: var(--font); font-weight: 800; font-size: 18px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.4); text-align: center; }
.marker::after { content: ""; position: absolute; left: 50%; bottom: -13px; margin-left: -8px; border: 8px solid transparent; border-top: 10px solid var(--purple); border-bottom: 0; }
.marker.enter { background: var(--purple); color: #fff; border-color: #fff; }
.marker.enter::after { border-top-color: #fff; }
.marker small { display: block; font-size: 16px; font-weight: 600; }
div.marker, body.mode-tour .marker { pointer-events: none; }

/* ---------- tour ---------- */
#tourui { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(980px, calc(100% - 24px)); z-index: 6; background: rgba(255,255,255,.96); border-radius: 16px; border-top: 6px solid var(--gold); padding: 12px 18px 14px; box-shadow: 0 6px 30px rgba(0,0,0,.45); }
#tour-head { display: flex; gap: 12px; align-items: baseline; color: var(--gold-dark); font-weight: 800; font-size: 17px; }
#tour-place { color: var(--purple); font-size: 20px; }
#tour-caption { margin: 4px 0 12px; font-size: clamp(20px, 2.3vw, 28px); line-height: 1.35; font-weight: 600; color: var(--ink); min-height: 2.7em; }
.tb { min-height: 50px; padding: 8px 14px; }

/* ---------- side panels ---------- */
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 24; background: var(--paper); box-shadow: -6px 0 30px rgba(0,0,0,.4); padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -16px; background: var(--paper); padding: 8px 0; margin-top: -8px; z-index: 1; }
.sheet h2 { margin: 0; font-size: 28px; color: var(--purple); }
.sheet h3 { margin: 22px 0 8px; font-size: 21px; color: var(--purple); }
.x { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--purple); background: #fff; color: var(--purple); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.lead { margin: 4px 0 12px; }
#places-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#places-list button { width: 100%; text-align: left; display: block; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); }
#places-list button:hover { border-color: var(--purple); background: #f7f2f9; }
#places-list b { display: block; font-size: 20px; color: var(--purple); }
#places-list span { display: block; font-size: 16px; color: #3d3542; }
.field { margin: 14px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field select { width: 100%; min-height: 52px; font-size: 18px; padding: 8px 10px; border: 2px solid var(--purple); border-radius: 10px; background: #fff; color: var(--ink); }
.field input[type=range] { width: 100%; height: 36px; accent-color: var(--purple); }
.field.check { display: flex; gap: 12px; align-items: flex-start; }
.field.check input { width: 28px; height: 28px; flex: none; accent-color: var(--purple); margin: 2px 0 0; }
.field.check label { font-weight: 600; margin: 0; }
body.is-touch .desktop-only, body:not(.is-touch) .touch-only { display: none; }
.note { font-size: 16px; color: #4a4250; margin: 6px 0 0; }
.contact { display: grid; gap: 8px; margin-bottom: 18px; }
#btn-home { width: 100%; }
.howto { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.howto li { display: flex; gap: 12px; align-items: center; font-size: 18px; }
.howto svg { width: 40px; height: 40px; padding: 7px; border-radius: 50%; background: #f1e9f4; color: var(--purple); }
#panel-help .big { width: 100%; margin-top: 16px; }

/* ---------- welcome ---------- */
#welcome, #fatal, #ctxlost, #noscript { position: fixed; inset: 0; z-index: 20; display: flex; overflow-y: auto; padding: 16px; background: rgba(38,14,46,.62); }
#fatal, #noscript { background: #2a1033; z-index: 40; } #ctxlost { z-index: 30; }
.card { background: var(--paper); border-radius: 18px; padding: 22px 28px 20px; width: min(760px, 100%); box-shadow: 0 12px 50px rgba(0,0,0,.45); margin: auto; text-align: center; }
#logo { width: min(380px, 78%); height: auto; display: block; margin: 0 auto 6px; }
.card h1 { margin: 4px 0 4px; font-size: clamp(24px, 3.2vw, 32px); color: var(--purple); line-height: 1.2; }
.card h2 { margin: 18px 0 4px; font-size: 20px; color: var(--purple); }
.card .sub { margin: 0 0 12px; font-size: 18px; }
.langs { display: inline-flex; gap: 0; border: 2px solid var(--purple); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.lang { min-width: 130px; min-height: 48px; border: 0; background: #fff; color: var(--purple); font-weight: 700; font-size: 18px; }
.lang[aria-pressed="true"] { background: var(--purple); color: #fff; }
.lang:focus-visible { outline-offset: -4px; box-shadow: none; }
#loadbox { max-width: 420px; margin: 0 auto 12px; }
#loadbox.done #progress { visibility: hidden; }
#status { font-size: 16px; color: #4a4250; margin: 0; min-height: 22px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 4px; }
.choice { flex-direction: column; gap: 2px; min-height: 124px; padding: 14px; border-width: 3px; }
.choice svg { width: 40px; height: 40px; }
.choice b { font-size: 24px; }
.choice small { font-size: 16px; font-weight: 600; }
.choice:not(.primary):hover { background: #f3ecf6; }
#welcome .howto { text-align: left; max-width: 560px; margin: 8px auto 4px; }
.card footer { display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 16px; }
.card footer a { color: var(--purple); font-weight: 700; padding: 6px 2px; }
#preview-note:empty { display: none; }
#fatal .card { text-align: left; } #fatal h1 { color: #8a0018; }
#fatal li { margin: 8px 0; } #fatal code { background: #f1e9f4; padding: 1px 6px; border-radius: 5px; font-size: 16px; word-break: break-word; }

/* ---------- small screens ---------- */
@media (max-width: 920px) {
  :root { --hud-h: 136px; }
  #hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding-left: calc(6px + env(safe-area-inset-left)); padding-right: calc(6px + env(safe-area-inset-right)); }
  .hb { min-width: 0; min-height: 58px; padding: 4px 2px; border-radius: 10px; }
  .hb svg { width: 24px; height: 24px; }
  body.mode-tour { --hud-h: 72px; }
}
@media (max-width: 420px) { .hb { letter-spacing: -.3px; } }
@media (max-width: 640px) {
  .card { padding: 16px 16px 14px; }
  .choices { grid-template-columns: 1fr; gap: 10px; }
  .choice { min-height: 0; flex-direction: row; flex-wrap: wrap; text-align: left; justify-content: flex-start; gap: 4px 12px; padding: 12px 14px; }
  .choice small { flex-basis: 100%; padding-left: 52px; margin-top: -8px; }
  .tb span { font-size: 16px; } .tb { padding: 6px 10px; min-height: 48px; }
  #tourui { padding: 10px 12px 12px; }
  #tour-caption { font-size: 20px; }
}
@media (max-width: 920px) { body.mode-tour #btn-fs { display: none; } }
@media (max-width: 640px) {
  #tourui .row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
  #tourui .tb { grid-column: span 2; flex-direction: column; gap: 0; padding: 4px 2px; line-height: 1.15; }
  #tourui .tb svg { width: 24px; height: 24px; }
  #tour-explore, #tour-exit { grid-column: span 3 !important; flex-direction: row !important; gap: 6px !important; }
}
@media (max-height: 820px) and (min-width: 641px) {
  #logo { width: min(290px, 60%); } .card { padding-top: 14px; padding-bottom: 12px; } .choice { min-height: 104px; padding: 10px; }
  .card h2 { margin-top: 10px; } .card footer { margin-top: 8px; padding-top: 8px; } #welcome .howto { gap: 6px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #tour-caption { font-size: 18px; min-height: 0; margin-bottom: 8px; }
  #stick { width: 104px; height: 104px; } #knob { left: 27px; top: 27px; }
}
@media (prefers-reduced-motion: reduce) { #fade, .pbar > div, #bar { transition: none; } }
@media (forced-colors: active) { .hb, .big, .tb, .choice, .rb, .x { border: 2px solid ButtonText; } }

/* credits and licences */
.sheet.wide { width: min(620px, 100%); }
#credits-body p { font-size: 17px; line-height: 1.45; margin: 6px 0 10px; }
ul.credits { list-style: none; margin: 0 0 6px; padding: 0; }
ul.credits li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.4; }
ul.credits li b { display: block; color: var(--ink, #222); }
ul.credits li span { display: block; }
ul.credits li span.notice { font-weight: 700; }
ul.credits li a { color: var(--purple); font-weight: 700; overflow-wrap: anywhere; display: inline-block; padding: 6px 0; margin-right: 16px; }
button.linkish { background: none; border: 0; padding: 6px 0; font: inherit; font-weight: 700; color: var(--purple); text-decoration: underline; cursor: pointer; min-height: 44px; }
ul.credits pre { white-space: pre-wrap; font: 14px/1.4 ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 320px; overflow: auto; margin: 4px 0 0; }
#panel-credits > .big { margin-top: 14px; }
.marker.go { cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hb.attn { border-style: dashed; }
#toast { max-width: min(92vw, 560px); }

#preview-note { display: none !important; }
