:root {
  --paper: #f8f5ef;
  --ink: #1f1d1a;
  --muted: #6e675d;
  --line: #e4ddd0;
  --glass: rgba(22, 20, 18, .72);
  --accent: #b8573a;
  --serif: Futura, 'Futura PT', 'Jost', 'Century Gothic', 'Trebuchet MS', sans-serif;
  --sans: Futura, 'Futura PT', 'Jost', 'Century Gothic', 'Trebuchet MS', sans-serif;
  --panel-w: min(500px, 46vw);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #14120f; color: var(--ink); font-family: var(--sans); overflow: hidden; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #d9a441; outline-offset: 2px; }

#stage { position: fixed; inset: 0; touch-action: none; cursor: grab; }
#stage.dragging { cursor: grabbing; }
#stage.hover { cursor: pointer; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: #14120f; color: #e8e2d9; font-family: var(--serif); font-size: 1.6rem; transition: opacity .6s; z-index: 30; }
.loading.done { opacity: 0; pointer-events: none; }

/* ---------- markers & tooltip ---------- */
#markers { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.marker { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; background: none; border: 0; pointer-events: auto; opacity: 0; transition: opacity .3s; will-change: transform; }
.marker:not(.show) { pointer-events: none; }
.marker.show { opacity: 1; }
.marker .lbl { font-size: 12px; font-weight: 500; letter-spacing: .02em; color: #fff; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.marker .lbl { border-bottom: 2px solid var(--c, #fff); transition: opacity .2s, transform .2s; }
.marker:hover .lbl, .marker:focus-visible .lbl, .marker.hot .lbl { transform: translateY(-2px); background: rgba(255,255,255,.92); color: #1f1d1a; }

#tooltip { position: fixed; z-index: 6; pointer-events: none; font-size: 13px; color: #fff; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
#tooltip[hidden] { display: none; }
#tooltip span { opacity: .65; }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; padding: 6vw; color: #f1ece3; background: linear-gradient(90deg, rgba(20,18,15,.88) 0%, rgba(20,18,15,.55) 45%, rgba(20,18,15,.1) 100%); transition: opacity .8s; }
.intro.gone { opacity: 0; pointer-events: none; }
.intro-inner { max-width: 520px; }
.intro-role { margin: 0 0 12px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: #d9a441; }
.intro h1 { margin: 0 0 18px; font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; font-size: clamp(3.2rem, 9vw, 5.6rem); line-height: .95; }
.intro-about { margin: 0 0 28px; font-size: 16.5px; line-height: 1.6; color: #d9d3c7; }
.intro-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.btn-primary { background: #f1ece3; color: #1f1d1a; border: 0; border-radius: 999px; padding: 14px 28px; font-weight: 600; font-size: 15px; transition: transform .2s, background .2s; }
.btn-primary:hover { background: #fff; transform: translateY(-1px); }
.btn-link { color: #d9d3c7; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }
.intro-links { margin: 28px 0 0; display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.intro-links a { color: #bdb6a8; }
.intro-links a:hover { color: #fff; }

/* ---------- dock & hint ---------- */
.dock { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; display: flex; gap: 4px; padding: 6px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .3s; max-width: calc(100vw - 16px); }
.dock[hidden] { display: none; }
.dock button { position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: #e8e2d9; display: grid; place-items: center; transition: background .2s; }
.dock button:hover { background: rgba(255,255,255,.12); }
.dock button.active { background: var(--c); color: #fff; }
.dock button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock button::after { content: attr(data-label); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); font-size: 12px; background: var(--glass); color: #fff; padding: 4px 9px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
@media (hover: hover) { .dock button:hover::after { opacity: 1; } }
body.panel-open .dock { transform: translateX(calc(-50% - var(--panel-w) / 2)); }

.hint { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; font-size: 13px; color: #fff; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 8px 16px; border-radius: 999px; white-space: nowrap; transition: opacity .6s; pointer-events: none; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
.hint[hidden] { display: none; }
.hint.fade { opacity: 0; }

/* ---------- panel ---------- */
.panel { --ink: #f3eee5; --muted: #b9b2a4; --line: rgba(255,255,255,.16); --acc: color-mix(in srgb, var(--accent) 45%, #fff); position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 8; background: rgba(20,18,15,.42); backdrop-filter: blur(22px) saturate(1.25); -webkit-backdrop-filter: blur(22px) saturate(1.25); border-left: 1px solid rgba(255,255,255,.12); color: var(--ink); box-shadow: -12px 0 40px rgba(0,0,0,.25); transform: translateX(104%); transition: transform .55s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.panel[hidden] { display: none; }
.panel.open { transform: none; }
.panel-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; }
.panel-close:hover { background: #fff; }
.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 40px 32px 32px; }
.kicker { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.panel h2 { margin: 0 0 18px; font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; font-size: clamp(2.4rem, 5vw, 3.3rem); line-height: 1; }
.panel-body { font-size: 15.5px; line-height: 1.65; }
.panel-body p { margin: 0 0 14px; }
.panel-body .lead { font-size: 17px; color: #3b362f; }
.panel-body h3 { margin: 30px 0 12px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-top: 1px solid var(--line); padding-top: 18px; }
.panel-body a { color: var(--accent); text-underline-offset: 3px; }
.cards { display: grid; gap: 22px; }
.card .media { position: relative; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: #e9e3d6; }
.card .media img, .card .media iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.card .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, #efe9dc), color-mix(in srgb, var(--accent) 8%, #efe9dc) 14px, color-mix(in srgb, var(--accent) 14%, #efe9dc) 14px, color-mix(in srgb, var(--accent) 14%, #efe9dc) 28px); }
.card .yt { position: absolute; inset: 0; border: 0; padding: 0; background: #000; }
.card .yt img { opacity: .85; }
.card .yt::after { content: ''; position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px; border-radius: 50%; background: rgba(255,255,255,.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6.5v11l9-5.5z' fill='%231f1d1a'/%3E%3C/svg%3E") center/60% no-repeat; }
.card h4 { margin: 12px 0 2px; font-size: 17px; font-weight: 600; }
.card .meta { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.card p { margin: 0 0 8px; }
.tags { list-style: none; margin: 0 0 8px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.tags li { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, #fff); color: color-mix(in srgb, var(--accent) 80%, #000); }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery .card .media { aspect-ratio: 4 / 3; border-radius: 10px; }
.gallery .card h4 { font-size: 14px; margin-top: 8px; }
.empty, .note { padding: 16px 18px; border-radius: 12px; background: #efe9dc; color: var(--muted); font-size: 14px; }
.about-portrait { width: 140px; height: 180px; border-radius: 14px; overflow: hidden; margin: 0 0 18px; position: relative; background: #e9e3d6; }
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 18px 0 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.link-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.link-row a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; }
.link-row a:hover { border-color: var(--accent); color: var(--accent); }
.panel-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel-nav button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 14px; }
.panel-nav button:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 760px) {
  .intro { align-items: flex-end; padding: 28px 22px 44px; background: linear-gradient(0deg, rgba(20,18,15,.92) 0%, rgba(20,18,15,.6) 55%, rgba(20,18,15,.05) 100%); }
  .panel { top: auto; left: 0; right: 0; width: auto; height: 74vh; height: 74dvh; border-radius: 18px 18px 0 0; transform: translateY(104%); box-shadow: 0 -10px 40px rgba(0,0,0,.3); }
  .panel.open { transform: none; }
  .panel-scroll { padding: 34px 22px 26px; }
  body.panel-open .dock { transform: translateX(-50%) translateY(140%); opacity: 0; pointer-events: none; }
  .dock { gap: 0; padding: 4px; }
  .dock button { width: 38px; height: 38px; }
  .dock button svg { width: 20px; height: 20px; }
  .hint { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* list layout (publications, awards) */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.row .yr { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.row .sub { color: var(--muted); font-size: 14px; }


/* ---------- glass panel colours ---------- */
.panel-close { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.panel-close:hover { background: rgba(255,255,255,.2); }
.kicker { color: var(--acc); }
.panel-body .lead { color: #e2dccf; }
.panel-body a, .row .yr { color: var(--acc); }
.card .media, .about-portrait { background: rgba(255,255,255,.07); }
.card .ph { color: #cfc8ba; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 16%, transparent) 14px, color-mix(in srgb, var(--accent) 28%, transparent) 14px, color-mix(in srgb, var(--accent) 28%, transparent) 28px); }
.tags li { background: color-mix(in srgb, var(--accent) 35%, transparent); color: #fff; }
.empty, .note { background: rgba(255,255,255,.08); color: #d6cfc1; }
.link-row a { color: #f3eee5; }
.link-row a:hover, .panel-nav button:hover { color: var(--acc); border-color: var(--acc); }
.panel-nav button { color: #f3eee5; }

/* ---------- animated photo slider ---------- */
.slider { position: relative; border-radius: 16px; overflow: hidden; outline-offset: 3px; }
.slides { position: relative; aspect-ratio: 4 / 3; background: rgba(0,0,0,.25); }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1s ease; pointer-events: none; }
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide img, .slide .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); }
.slide.is-active img, .slide.is-active .ph { animation: kenburns 9s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
.slide .ph { display: grid; place-items: center; font-size: 13px; color: rgba(255,255,255,.8); background: linear-gradient(135deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 50) 50% 22%)); }
.slide figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 18px 16px; font-size: 14px; font-weight: 500; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,.6), transparent); opacity: 0; transform: translateY(8px); transition: opacity .6s .3s, transform .6s .3s; }
.slide.is-active figcaption { opacity: 1; transform: none; }
.s-prev, .s-next { position: absolute; top: 50%; width: 38px; height: 38px; margin-top: -19px; border: 0; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; font-size: 24px; line-height: 1; display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s, background .2s; }
.s-prev { left: 10px; } .s-next { right: 10px; }
.slider:hover .s-prev, .slider:hover .s-next, .slider:focus-within .s-prev, .slider:focus-within .s-next { opacity: 1; }
@media (hover: none) { .s-prev, .s-next { opacity: .85; } }
.s-prev:hover, .s-next:hover { background: rgba(0,0,0,.6); }
.dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 99px; background: rgba(255,255,255,.45); transition: width .3s, background .3s; }
.dots button.on { width: 20px; background: #fff; }

.intro[hidden] { display: none; }

@media (max-width: 760px) { .marker:not(.hot) .lbl { opacity: .0; } .marker { padding: 14px; } }
.toast { position: fixed; left: 50%; top: 22px; transform: translate(-50%, -10px); z-index: 12; max-width: min(92vw, 460px); padding: 10px 18px; border-radius: 12px; font-size: 14px; color: #fff; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transition: opacity .35s, transform .35s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }

/* ---------- forms & guestbook ---------- */
.form { display: grid; gap: 14px; margin-top: 22px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field textarea { font: inherit; font-size: 15px; color: #f3eee5; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 11px 13px; width: 100%; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--acc); outline-offset: 1px; background: rgba(255,255,255,.14); }
.field textarea { resize: vertical; min-height: 96px; }
.count { justify-self: end; font-size: 12px; opacity: .7; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ts { min-height: 0; }
.form-status { margin: 0; min-height: 1.2em; font-size: 14px; color: #ffb4a6; }
.form-status.ok { color: #b9e8b0; }
.btn-submit { justify-self: start; border: 0; border-radius: 999px; padding: 12px 26px; font-weight: 600; font-size: 15px; background: #f1ece3; color: #1f1d1a; }
.btn-submit:hover:not(:disabled) { background: #fff; }
.btn-submit:disabled { opacity: .55; cursor: default; }
.gb-list { display: grid; gap: 14px; margin: 6px 0 4px; }
.gb-note { background: #f2e08a; color: #2b2618; border-radius: 4px; padding: 14px 16px 10px; box-shadow: 0 6px 14px rgba(0,0,0,.28); transform: rotate(-.6deg); }
.gb-note.r1 { transform: rotate(.7deg); background: #f4c9d6; }
.gb-note.r2 { transform: rotate(-.3deg); background: #cfe9dc; }
.gb-msg { margin: 0 0 8px !important; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.gb-note footer { font-size: 12.5px; color: #5d553f; font-weight: 600; }

/* ---------- language switch ---------- */
.lang { position: fixed; top: 14px; left: 14px; z-index: 11; display: flex; padding: 3px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lang button { border: 0; background: none; color: #cfc8ba; font-size: 12px; font-weight: 600; letter-spacing: .06em; padding: 6px 11px; border-radius: 999px; }
.lang button[aria-pressed="true"] { background: #f1ece3; color: #1f1d1a; }
.lang button:not([aria-pressed="true"]):hover { color: #fff; }

/* ---------- controls: crosshair (desktop) and joysticks (touch) ---------- */
#crosshair { position: fixed; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 0 0 1.5px rgba(0,0,0,.45); z-index: 4; pointer-events: none; opacity: 0; transition: transform .15s, opacity .2s, background .15s; }
body.locked #crosshair { opacity: 1; }
#crosshair.hot { transform: scale(2.4); background: #ffc531; }
body.locked #stage { cursor: none; }
#sticks { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#sticks[hidden] { display: none; }
.stick { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%; background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.28); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: auto; touch-action: none; display: grid; place-items: center; transition: background .15s; -webkit-user-select: none; user-select: none; }
.stick.left { left: calc(24px + env(safe-area-inset-left)); }
.stick.right { right: calc(24px + env(safe-area-inset-right)); }
.stick.on { background: rgba(255,255,255,.15); }
.knob { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.4); border: 2px solid rgba(255,255,255,.7); pointer-events: none; }
body.touch .dock { bottom: calc(172px + env(safe-area-inset-bottom)); }
body.touch .hint { bottom: calc(228px + env(safe-area-inset-bottom)); }
body.touch.panel-open .dock { bottom: calc(16px + env(safe-area-inset-bottom)); }

/* ---------- VR button ---------- */
.vrbtn { position: fixed; top: 14px; left: 108px; z-index: 11; border: 0; border-radius: 999px; padding: 9px 16px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: #1f1d1a; background: #ffd23f; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.vrbtn[hidden] { display: none; }
.vrbtn:hover { background: #ffe07a; }

/* sideways on a tablet or big phone: dock sits between the two sticks */
@media (orientation: landscape) and (min-width: 721px) {
  body.touch .dock { bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.touch .hint { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
.stick[hidden] { display: none; }
body.touch .marker:not(.hot) .lbl { opacity: 0; }

/* ---------- layout: language top right, icon bar on top for phones and tablets ---------- */
.lang { left: auto; right: 14px; top: calc(12px + env(safe-area-inset-top)); transition: right .55s cubic-bezier(.2,.8,.2,1); }
body.panel-open .lang { right: calc(var(--panel-w) + 14px); }
.vrbtn { left: 14px; top: calc(12px + env(safe-area-inset-top)); }

body.touch .dock, body.touch.panel-open .dock { top: calc(56px + env(safe-area-inset-top)); bottom: auto; }
body.touch .dock button::after, .dock.top button::after { bottom: auto; top: calc(100% + 10px); }
body.touch .hint { bottom: calc(176px + env(safe-area-inset-bottom)); }
body.touch .toast { top: calc(112px + env(safe-area-inset-top)); }
@media (max-width: 760px) {
  body.panel-open .lang { right: 14px; }
  .dock, body.panel-open .dock { top: calc(56px + env(safe-area-inset-top)); bottom: auto; transform: translateX(-50%); opacity: 1; pointer-events: auto; }
  .dock button::after { bottom: auto; top: calc(100% + 10px); }
  .toast { top: calc(112px + env(safe-area-inset-top)); }
}
@media (orientation: landscape) and (min-width: 721px) {
  body.touch .dock, body.touch.panel-open .dock { top: calc(56px + env(safe-area-inset-top)); bottom: auto; }
  body.touch .hint { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ---------- phones and tablets: icon bar at the very top, language switch under it on the right ---------- */
body.touch .dock, body.touch.panel-open .dock { top: calc(12px + env(safe-area-inset-top)); }
body.touch .lang { top: calc(64px + env(safe-area-inset-top)); }
body.touch:has(#intro:not(.gone):not([hidden])) .lang { top: calc(12px + env(safe-area-inset-top)); }
body.touch .toast { top: calc(112px + env(safe-area-inset-top)); }
@media (max-width: 760px) {
  .dock, body.panel-open .dock { top: calc(12px + env(safe-area-inset-top)); }
  .lang { top: calc(64px + env(safe-area-inset-top)); }
  body:has(#intro:not(.gone):not([hidden])) .lang { top: calc(12px + env(safe-area-inset-top)); }
}
@media (orientation: landscape) and (min-width: 721px) {
  body.touch .dock, body.touch.panel-open .dock { top: calc(12px + env(safe-area-inset-top)); }
}
body.touch .hint { white-space: normal; text-align: center; max-width: calc(100vw - 32px); border-radius: 18px; }

/* 11 icons must fit on narrow phones */
.dock { overflow-x: auto; scrollbar-width: none; }
.dock::-webkit-scrollbar { display: none; }
@media (max-width: 430px) {
  .dock { gap: 0; padding: 4px 3px; }
  .dock button { width: 31px; height: 38px; border-radius: 9px; }
  .dock button svg { width: 19px; height: 19px; }
}
@media (max-width: 430px) { .dock button { width: 30px; } .dock button svg { width: 18px; height: 18px; } }

body.editing .dock, body.editing .marker, body.editing .hint, body.editing #markers, body.editing .vrbtn { display: none !important; }

/* ---------- simple mode ---------- */
.zoomctl { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6; display: grid; gap: 6px; }
.zoomctl button { width: 42px; height: 42px; border-radius: 50%; border: 0; font-size: 22px; line-height: 1; color: #fff; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.zoomctl button:hover { background: rgba(60,56,50,.85); }
body.panel-open .zoomctl { right: calc(var(--panel-w) + 14px); }
@media (max-width: 760px) { body.panel-open .zoomctl { display: none; } }
.textver { position: fixed; left: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6; font-size: 12px; color: #d9d3c7; background: var(--glass); padding: 7px 12px; border-radius: 999px; text-decoration: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.textver[hidden] { display: none; }
.textver:hover { color: #fff; }
body.touch .textver { bottom: calc(18px + env(safe-area-inset-bottom)); }

/* ---------- desktop WASD legend (bottom-left, translucent) ---------- */
.keyhelp { position: fixed; left: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 4; display: flex; align-items: flex-end; gap: 12px; color: rgba(255,255,255,.72); pointer-events: none; user-select: none; transition: opacity .3s; }
.keyhelp[hidden] { display: none; }
body.panel-open .keyhelp, body.locked .keyhelp { opacity: .55; }
body.panel-open .keyhelp { display: none; }
.kh-keys { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(2, 34px); gap: 4px; }
.kh-key { display: grid; place-items: center; font: 600 14px/1 Futura, 'Futura PT', 'Jost', system-ui, sans-serif; color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.4); border-radius: 8px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: background .12s, color .12s, transform .12s; }
.kh-w { grid-column: 2; grid-row: 1; }
.kh-a { grid-column: 1; grid-row: 2; }
.kh-s { grid-column: 2; grid-row: 2; }
.kh-d { grid-column: 3; grid-row: 2; }
.kh-key.down { background: rgba(255,255,255,.6); color: #1a1714; transform: translateY(1px); }
.kh-text { font-size: 12px; line-height: 1.6; text-shadow: 0 1px 6px rgba(0,0,0,.55); }
.kh-text b { display: inline-block; min-width: 1em; color: #fff; font-weight: 600; }
.kh-mouse { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
@media (max-width: 760px) { .kh-text { display: none; } }
body.touch .keyhelp, body.editing .keyhelp { display: none !important; }
