/* MAXEUM - the MDT look (near-black glass, gold for the main actions) with a
   museum's serif titles; each wing's accent (--acc) colours its cards */
:root {
  --ink: #f6efe2; --mute: #b3a892; --faint: #6f6656; --bg: #0b0a09; --glass: rgba(18, 15, 12, 0.88); --glass2: rgba(30, 26, 21, 0.78);
  --line: rgba(255, 240, 210, 0.1); --line2: rgba(255, 240, 210, 0.2);
  --gold: #f0c868; --gold2: #ffd98a; --goldInk: #2a1c04; --acc: #7fd1b9; --good: #46e39a; --bad: #ff6a6a;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif; --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
svg { flex: none; }
#buildTag { position: fixed; right: 6px; bottom: calc(4px + var(--safe-b)); font: 10px system-ui, sans-serif; color: rgba(255, 255, 255, 0.35); z-index: 95; pointer-events: none; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.kick { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--acc); }
.kick.gold { color: var(--gold); }
h2 { font: 700 24px/1.15 var(--serif); margin: 4px 0 6px; }
h3 { font: 700 17px/1.2 var(--serif); margin: 18px 0 4px; color: var(--gold2); }
p { margin: 6px 0; }

/* --- loading */
#loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: radial-gradient(circle at 50% 42%, #2a2218, var(--bg) 68%); transition: opacity 0.5s; }
#loading.gone { opacity: 0; pointer-events: none; }
.ld { text-align: center; width: 270px; }
.ld b { display: block; font: 800 38px var(--serif); letter-spacing: 6px; background: linear-gradient(180deg, #fff6d8, #f0c868 55%, #b8862e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld .bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); margin: 16px 0 10px; overflow: hidden; }
.ld .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fd1b9, var(--gold)); transition: width 0.3s; }
.ld span { color: var(--mute); font-size: 13.5px; }

/* --- buttons and form bits */
.btn { flex: 1; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.07); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: transform 0.12s, background 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #d9a640); border-color: rgba(255, 230, 160, 0.7); color: var(--goldInk); box-shadow: 0 6px 20px rgba(240, 200, 104, 0.2); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn.sm { flex: none; min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 106, 106, 0.16); border-color: rgba(255, 106, 106, 0.5); color: #ffb8b8; }
.btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.link { background: none; border: 0; color: var(--gold); padding: 10px 0; font-weight: 600; }
.err { color: var(--bad); min-height: 18px; font-size: 13px; margin: 4px 0; }
.card input:not([type=range]) { width: 100%; height: 48px; border-radius: 13px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.35); color: var(--ink); padding: 0 14px; font: inherit; margin-bottom: 8px; }
form { margin: 0; }

/* --- the title card */
#title { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-start; padding: calc(var(--mdts-h, 52px) + 20px) 6vw calc(24px + var(--safe-b)); background: linear-gradient(90deg, rgba(11, 10, 9, 0.92), rgba(11, 10, 9, 0.55) 46%, rgba(11, 10, 9, 0) 72%); }
.tCard { max-width: 470px; }
.tKick { font-size: 12px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase; color: #7fd1b9; }
.tLogo { margin: 4px 0 8px; font: 800 clamp(52px, 11vw, 92px)/0.95 var(--serif); letter-spacing: 6px; background: linear-gradient(180deg, #fff6d8, #f0c868 55%, #b8862e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 22px rgba(240, 200, 104, 0.25)); }
.tTag { font-size: 16.5px; color: #e8dcc4; margin: 0 0 16px; }
.tWings { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.tWings span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.tWings i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
.tStats { color: var(--mute); font-size: 13.5px; }
.tStats b { color: var(--gold); }
#title .btns { max-width: 340px; }
@media (max-width: 640px) {
  #title { align-items: flex-end; background: linear-gradient(0deg, rgba(11, 10, 9, 0.95), rgba(11, 10, 9, 0.6) 55%, rgba(11, 10, 9, 0)); }
  .tTag { font-size: 15px; }
}

/* --- the HUD */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: auto; }
#roomPill { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line2); font-weight: 700; font-size: 13.5px; white-space: nowrap; pointer-events: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#roomPill i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
#roomPill em { font-style: normal; font-size: 11.5px; color: #0b0a09; background: #7fd1b9; border-radius: 99px; padding: 2px 8px; }
.hRight { position: fixed; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); display: flex; gap: 6px; }
.hb { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(219, 166, 60, 0.45); background: rgba(11, 10, 9, 0.78); display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.hb svg { width: 21px; height: 21px; fill: #f8e3a8; }
.hb b { position: absolute; right: -4px; bottom: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--goldInk); font-size: 11px; display: grid; place-items: center; }
.hb.sm { width: 48px; height: 48px; }
.hb.dim { opacity: 0.45; }
.hEmotes { position: fixed; right: calc(12px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; }
body.touch .hEmotes { bottom: calc(112px + var(--safe-b)); }
#useBtn { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 150px); padding: 0 18px; height: 52px; border-radius: 99px; border: 1px solid rgba(255, 230, 160, 0.7); background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #d9a640); color: var(--goldInk); font-weight: 750; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: pop 0.25s; }
#useBtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#useBtn svg { width: 20px; height: 20px; fill: currentColor; }
#useBtn kbd { font: 700 11px var(--font); border: 1px solid rgba(42, 28, 4, 0.4); border-radius: 5px; padding: 1px 5px; }
body.touch #useBtn kbd { display: none; }
@keyframes pop { from { transform: translateX(-50%) scale(0.85); opacity: 0; } }
body[data-ui=card] #useBtn, body[data-ui=quiz] #useBtn { display: none; }

@media (max-width: 560px) {
  #roomPill { top: calc(62px + var(--safe-t)); font-size: 12.5px; padding: 6px 12px; }
  .hb { width: 40px; height: 40px; }
  .hRight { gap: 5px; }
}

/* --- the touch stick */
#controls { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#stickZone { position: absolute; left: 0; bottom: 0; width: 45vw; height: 55vh; pointer-events: auto; }
body:not(.touch) #stickZone, body:not(.touch) #jumpBtn { display: none; }
#stick { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.2); opacity: 0; transition: opacity 0.15s; pointer-events: none; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
#jumpBtn { position: fixed; right: calc(80px + var(--safe-r)); bottom: calc(30px + var(--safe-b)); width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(11, 10, 9, 0.6); pointer-events: auto; display: grid; place-items: center; }
#jumpBtn svg { width: 26px; height: 26px; fill: #fff; }

/* --- the exhibit card / quiz panel: a bottom sheet on a phone, a side panel on a wide screen */
.panel { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 62vh; overflow: auto; padding: 8px 18px calc(18px + var(--safe-b)); background: var(--glass); border-top: 1px solid var(--line2); border-radius: 22px 22px 0 0; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); animation: up 0.28s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.panel .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); margin: 0 auto 10px; }
@media (min-width: 820px) and (min-aspect-ratio: 1/1) {
  .panel { left: auto; top: 76px; bottom: 16px; right: 16px; width: 400px; max-height: none; border-radius: 22px; border: 1px solid var(--line2); animation: side 0.28s ease-out; }
  .panel .grab { display: none; }
  @keyframes side { from { transform: translateX(40px); opacity: 0; } }
}
.cHead { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; border-bottom: 2px solid var(--acc); padding-bottom: 10px; margin-bottom: 8px; }
.cHead .sub { color: var(--mute); font-size: 13.5px; margin: 0; }
.cBody p { color: #ece2cf; }
.facts { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.facts b { display: block; font: 700 15px var(--serif); color: var(--gold2); margin-bottom: 4px; }
.facts p { position: relative; padding-left: 16px; font-size: 14px; }
.facts p::before { content: ''; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--acc); }
.stampMark { flex: none; width: 62px; height: 62px; border-radius: 50%; border: 3px double var(--acc); display: grid; place-items: center; transform: rotate(-12deg); color: var(--acc); font: 800 19px var(--serif); background: radial-gradient(circle, rgba(255, 255, 255, 0.06), transparent 70%); }
.stampMark.fresh { animation: stamp 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: rotate(-30deg) scale(2.2); opacity: 0; } }
.stampRow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stampRow .st { width: 38px; height: 38px; border-radius: 50%; border: 2px dashed var(--line2); display: grid; place-items: center; font: 800 12px var(--serif); color: var(--faint); }
.stampRow .st.on { border: 2px solid var(--acc); color: var(--acc); }
.answers { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ans { text-align: left; min-height: 50px; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.06); font-weight: 600; }
.ans.right { background: rgba(70, 227, 154, 0.2); border-color: var(--good); }
.ans.wrong { background: rgba(255, 106, 106, 0.18); border-color: var(--bad); }
.qMsg { min-height: 22px; margin-top: 10px; font-weight: 650; }
.qMsg.good { color: var(--good); } .qMsg.bad { color: #ffb0a0; }
.score { display: flex; align-items: baseline; gap: 10px; margin: 8px 0; }
.score b { font: 800 54px var(--serif); color: var(--gold); }
.mxcBox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 10px; border-radius: 14px; background: rgba(240, 200, 104, 0.1); border: 1px solid rgba(240, 200, 104, 0.35); }
.mxcBox span { flex: 1; } .mxcBox.paid { border-color: var(--good); }
.mxc-coin { width: 20px; height: 20px; }

/* --- sheets */
body[data-phase=museum] .screen { padding-top: calc(62px + var(--safe-t)); }
.screen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 14px calc(16px + var(--safe-b)); background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.screen .card { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; padding: 18px 20px 20px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line2); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); animation: up 0.25s ease-out; }
.screen .card.wide { max-width: 560px; }
.shHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.06); }
.pBar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 4px 0 10px; }
.pBar i { display: block; height: 100%; background: linear-gradient(90deg, #7fd1b9, var(--gold)); }
.pWing { margin-top: 14px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-left: 3px solid var(--acc); }
.pwHead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pwHead b { font: 700 16px var(--serif); }
.pwHead em { font-style: normal; color: var(--mute); font-size: 13px; }
.qTag { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--mute); }
.qTag.on { background: var(--acc); color: #0b0a09; border-color: var(--acc); }
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.stamp { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.stamp span { width: 48px; height: 48px; border-radius: 50%; border: 2px dashed var(--line2); display: grid; place-items: center; font: 800 15px var(--serif); color: var(--faint); }
.stamp.on span { border: 3px double var(--acc); color: var(--acc); transform: rotate(-10deg); background: radial-gradient(circle, rgba(255, 255, 255, 0.07), transparent 70%); }
.stamp small { font-size: 11px; line-height: 1.2; color: var(--mute); }
.stamp.on small { color: var(--ink); }
.pFoot { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line2); display: flex; flex-direction: column; gap: 2px; }
.pFoot span { color: var(--mute); font-size: 13px; }
.pFoot.on { border: 1px solid var(--gold); background: rgba(240, 200, 104, 0.1); }
#mapCv { width: 100%; height: auto; aspect-ratio: 1; border-radius: 16px; margin-top: 10px; background: #100e0c; }
.mapList { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.mRow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); text-align: left; }
.mRow i { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
.mRow b { flex: 1; } .mRow em { font-style: normal; color: var(--mute); font-size: 13px; }
.mRow span { color: var(--gold); font-weight: 700; font-size: 13px; }
.tourBox { margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: rgba(127, 209, 185, 0.1); border: 1px solid rgba(127, 209, 185, 0.4); }
.tourBox b { display: block; } .tourBox span { color: var(--mute); font-size: 13.5px; }
.tourBox .btns { margin-top: 10px; }
.pSec { margin: 16px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute); }
.pRow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pRow > i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pRow > i.on { background: var(--good); box-shadow: 0 0 8px var(--good); }
.pRow > div { flex: 1; min-width: 0; }
.pRow b { display: block; overflow: hidden; text-overflow: ellipsis; }
.pRow span { display: block; color: var(--mute); font-size: 12.5px; }

/* --- toasts and notes */
#toast { position: fixed; left: 50%; top: calc(104px + var(--safe-t)); transform: translate(-50%, -12px); z-index: 70; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 14px; background: var(--glass); border: 1px solid rgba(240, 200, 104, 0.45); font-weight: 600; font-size: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#note { position: fixed; left: 50%; top: calc(104px + var(--safe-t)); transform: translateX(-50%); z-index: 71; width: min(420px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid rgba(127, 209, 185, 0.6); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); animation: up 0.25s ease-out; }
.nTxt span { color: var(--mute); font-size: 13px; margin-left: 4px; }
.nBtns { display: flex; gap: 8px; margin-top: 10px; }

/* --- exhibit actions (Watch the impact, Erupt...) */
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn.act { flex: 1 1 auto; border-color: var(--acc); background: color-mix(in srgb, var(--acc) 16%, transparent); }
.btn.act svg { width: 15px; height: 15px; fill: var(--acc); }
