/* Escape the Tomb of Nefertari — Developed by Slyness */
:root {
  --gold: #e2bc6b;
  --gold-2: #f6dc9a;
  --gold-d: #8a6a2c;
  --ink: #0b0805;
  --stone: #2a2016;
  --lapis: #1e3c7d;
  --turq: #42b9a9;
  --text: #f3e6c8;
  --frame: 7px;
  --inv-h: 96px;
  --top-h: 46px;
  --eg: "Noto Sans Egyptian Hieroglyphs", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.eg { font-family: var(--eg); }
.hidden { display: none !important; }

/* ---------- Frame (always visible, full width) ---------- */
#frame {
  position: fixed; inset: 0; pointer-events: none; z-index: 2147483600;
  border: var(--frame) solid transparent;
  border-image: linear-gradient(135deg, #6b4e1c, var(--gold-2) 20%, #a57a2e 40%, var(--gold) 60%, #6b4e1c 80%, var(--gold-2)) 1;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.8), inset 0 0 0 4px rgba(226,188,107,.35), inset 0 0 40px rgba(0,0,0,.6);
}

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

.btn {
  display: block; width: 100%; min-width: 240px; padding: 13px 28px; margin: 10px auto;
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: .12em; font-size: 15px; text-transform: uppercase;
  color: #2a1a05; border: 0; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 50%, #b48838);
  box-shadow: 0 0 0 1px #3a2708, 0 0 0 3px rgba(226,188,107,.35), 0 8px 24px rgba(0,0,0,.5);
  transition: transform .2s, filter .2s, box-shadow .2s;
}
.btn[hidden] { display: none; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 0 0 1px #3a2708, 0 0 0 3px rgba(226,188,107,.6), 0 0 30px rgba(226,188,107,.4); }
.btn.ghost { background: rgba(10,7,3,.55); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(226,188,107,.6); backdrop-filter: blur(4px); }
.btn.ghost:hover { background: rgba(40,28,10,.7); }

/* ---------- Loader ---------- */
#loader {
  display: none; background: radial-gradient(ellipse at center, #241a0e 0%, #0b0805 70%);
  text-align: center;
}
#loader.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loader-glyph {
  font-family: var(--eg); font-size: 84px; line-height: 1; color: var(--gold);
  text-shadow: 0 0 30px rgba(226,188,107,.7); animation: pulse 2s ease-in-out infinite;
}
.loader-pct { font-family: "Cinzel", serif; font-size: 44px; font-weight: 700; color: var(--gold-2); margin: 18px 0 14px; letter-spacing: .05em; }
.loader-bar { width: min(340px, 70vw); height: 4px; background: rgba(226,188,107,.15); border-radius: 2px; overflow: hidden; }
#loaderFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-d), var(--gold-2)); box-shadow: 0 0 12px var(--gold); transition: width .25s; }
.loader-label { margin-top: 16px; font-style: italic; opacity: .7; font-size: 18px; }
@keyframes pulse { 50% { transform: scale(1.06); text-shadow: 0 0 50px rgba(226,188,107,1); } }

/* ---------- Menu ---------- */
#menu, #ending { overflow: hidden; }
.menu-bg, .end-bg {
  position: absolute; inset: -4%; background: #0b0805 url(../img/menu.webp) center/cover;
}
.end-bg { background-image: url(../img/fin.webp); }
.menu-bg::after, .end-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,.15), rgba(0,0,0,.75)); }
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.menu-content, .end-content {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.menu-sub { font-family: "Cinzel", serif; letter-spacing: .3em; font-size: 13px; color: var(--gold); text-transform: uppercase; opacity: .9; }
.menu-sub, .menu-title { animation: rise 1.6s cubic-bezier(.2,.7,.2,1) both; }
.menu-title {
  font-family: "Cinzel", serif; font-weight: 900; margin: 14px 0 28px; line-height: .95;
  font-size: clamp(38px, 8vw, 96px); letter-spacing: .04em; text-wrap: balance;
  background: linear-gradient(180deg, #fff3cf, var(--gold) 55%, #8a6326);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,.8)) drop-shadow(0 0 30px rgba(226,188,107,.25));
}
.menu-title span { font-size: .62em; letter-spacing: .12em; }
.menu-buttons { width: min(320px, 80vw); animation: rise 1.6s .4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Intro ---------- */
#intro { background: #000; cursor: pointer; }
#intro.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.intro-text {
  max-width: 680px; padding: 0 32px; font-size: clamp(19px, 2.6vw, 27px); line-height: 1.55; text-align: center;
  font-style: italic; color: var(--text);
}
.intro-text p { opacity: 0; animation: introIn 1.2s forwards; margin: 0 0 18px; }
@keyframes introIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.intro-hint { position: absolute; bottom: 40px; font-family: "Cinzel", serif; letter-spacing: .25em; font-size: 12px; text-transform: uppercase; color: var(--gold); opacity: .6; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Game layout ---------- */
#game.active { display: flex; flex-direction: column; padding: var(--frame) 0; }
#play { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--top-h); display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 10px; padding: 0 22px;
  background: linear-gradient(180deg, rgba(11,8,5,.75), rgba(11,8,5,0)); z-index: 5; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#btnPause { justify-self: start; }
.top-right { justify-self: end; display: flex; gap: 8px; }
#btnSound .snd-off, #btnSound.off .snd-on { display: none; }
#btnSound.off .snd-off { display: inline; }
#btnSound.off { opacity: .6; }
#roomName { text-shadow: 0 1px 6px #000, 0 0 2px #000; font-family: "Cinzel", serif; letter-spacing: .22em; font-size: 14px; color: var(--gold-2); text-transform: uppercase; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  height: 32px; min-width: 36px; padding: 0 12px; border-radius: 3px; display: flex; align-items: center; gap: 8px;
  background: rgba(226,188,107,.08); border: 1px solid rgba(226,188,107,.35); color: var(--gold-2); font-size: 17px;
  transition: background .2s;
}
.icon-btn:hover { background: rgba(226,188,107,.2); }
.icon-btn b { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: .15em; text-transform: uppercase; font-weight: 700; }
.icon-btn .eg { font-size: 18px; }

#stageWrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; }
#stageFill { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(22px) brightness(.5) saturate(1.2); transition: background-image .6s; }
#stage { position: relative; overflow: hidden; box-shadow: 0 0 0 1px rgba(226,188,107,.4), 0 0 60px rgba(0,0,0,.9); cursor: default; }
#sceneBg { position: absolute; inset: 0; background-size: 100% 100%; }
#sceneLayer { position: absolute; inset: 0; }
#fx, #dark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#dark { transition: opacity 2.5s; }
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
  animation: flicker 3.2s infinite;
}
@keyframes flicker { 0%,100% { opacity: 1; } 22% { opacity: .86; } 40% { opacity: 1; } 63% { opacity: .9; } 78% { opacity: .97; } }

#sunbeam {
  position: absolute; left: 30%; top: 3%; width: 40%; height: 76%; pointer-events: none; display: none;
  background: linear-gradient(180deg, rgba(255,236,170,.55), rgba(255,220,140,.08) 85%, transparent);
  clip-path: polygon(28% 0, 72% 0, 100% 100%, 0 100%); mix-blend-mode: screen; filter: blur(6px);
  animation: beam 5s ease-in-out infinite alternate;
}
@keyframes beam { from { opacity: .55; } to { opacity: .9; } }

/* Scene elements */
.hs { position: absolute; cursor: pointer; border-radius: 6px; }
.hs:hover, .hs.hint-flash { background: radial-gradient(ellipse, rgba(246,220,154,.10), transparent 70%); }
.sprite {
  position: absolute; cursor: pointer; transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 6px rgba(0,0,0,.6)) brightness(.92) sepia(.15);
  transition: filter .25s, transform .25s;
}
.sprite img { width: 100%; display: block; }
.sprite:hover { filter: drop-shadow(0 0 10px rgba(246,220,154,.9)) brightness(1.1); }
.sprite::after {
  content: ""; position: absolute; inset: -10%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,240,190,.5), transparent 60%); opacity: 0; animation: glint 4.5s infinite;
}
@keyframes glint { 0%, 85%, 100% { opacity: 0; } 92% { opacity: .9; } }
.ov { position: absolute; pointer-events: none; }
/* Door openings (js/doors.js) */
.portal { position: absolute; pointer-events: none; overflow: hidden; background: #050302; }
.portal .beyond, .portal .depth, .portal .glow, .portal .steps { position: absolute; inset: 0; }
.portal .beyond { background-repeat: no-repeat; filter: brightness(.62) saturate(.9) blur(.6px); transform: scale(1.04); }
.portal .depth { box-shadow: inset 0 0 50px 18px rgba(0,0,0,.92); background: linear-gradient(180deg, rgba(0,0,0,.75), transparent 28%, transparent 80%, rgba(0,0,0,.35)); }
.portal .leaf, .portal .chunk { position: absolute; inset: 0; }
.portal.anim .beyond { animation: reveal 3.2s ease-out .4s both; }
@keyframes reveal { from { filter: brightness(0) blur(2px); } }

.portal.sink.anim .leaf { animation: sink 4.2s cubic-bezier(.55,.05,.75,.6) .25s both; }
@keyframes sink {
  0% { transform: translate(0,0); } 4% { transform: translate(-1px,1px); } 8% { transform: translate(1px,0); }
  100% { transform: translate(0,101%); filter: brightness(.5); }
}
.portal.sink:not(.anim) .leaf { display: none; }

.portal.swing { perspective: 900px; }
.portal.swing .leaf { inset: auto; transform-style: preserve-3d; box-shadow: 0 0 0 1px rgba(60,35,5,.6); transition: none; }
.portal.swing .leaf.l { transform-origin: 0 50%; transform: rotateY(76deg); filter: brightness(.45); }
.portal.swing .leaf.r { transform-origin: 100% 50%; transform: rotateY(-76deg); filter: brightness(.45); }
.portal.swing.anim .leaf.l { animation: swingL 3.6s cubic-bezier(.45,0,.25,1) .5s both; }
.portal.swing.anim .leaf.r { animation: swingR 3.6s cubic-bezier(.45,0,.25,1) .5s both; }
@keyframes swingL { from { transform: rotateY(0); filter: brightness(1); } }
@keyframes swingR { from { transform: rotateY(0); filter: brightness(1); } }
.portal .stud { position: absolute; transform: translate(-50%,-50%); filter: drop-shadow(0 0 6px rgba(255,220,140,.9)); }
.portal .glow { background: radial-gradient(ellipse at 50% 60%, rgba(255,214,130,.55), transparent 65%); mix-blend-mode: screen; opacity: .35; }
.portal.anim .glow { animation: glowIn 4.5s ease-out both; }
@keyframes glowIn { 0% { opacity: 0; } 45% { opacity: .9; } 100% { opacity: .35; } }

.portal.collapse .beyond { filter: brightness(.38) saturate(.8) blur(1px); }
.portal.collapse .depth { box-shadow: inset 0 0 40px 22px rgba(0,0,0,.95); background: radial-gradient(ellipse at 55% 60%, transparent 30%, rgba(0,0,0,.7) 75%); }
.portal.collapse { -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent); mask-image: linear-gradient(180deg, #000 82%, transparent); }
.portal.collapse .chunk { display: none; }
.portal.collapse.anim .chunk { display: block; animation: tumble 1.5s cubic-bezier(.5,0,.9,.5) var(--d) both; filter: drop-shadow(0 4px 6px rgba(0,0,0,.7)); }
@keyframes tumble {
  0% { transform: none; } 12% { transform: translate(0, 1%) rotate(calc(var(--r) * .05)); }
  100% { transform: translate(var(--x), 130%) rotate(var(--r)); filter: brightness(.4); }
}

.portal.stairs .beyond { display: none; }
.portal.stairs .depth { box-shadow: inset 0 0 30px 10px rgba(0,0,0,.85); background: linear-gradient(180deg, #000 0%, rgba(0,0,0,.85) 25%, rgba(0,0,0,.25) 75%, transparent); }
.portal.stairs .leaf { display: none; }
.portal.stairs.anim .leaf { display: block; animation: slide 3.4s cubic-bezier(.5,.05,.4,1) .3s both; }
@keyframes slide { 0% { transform: none; } 6% { transform: translateX(-.4%); } 100% { transform: translateX(104%); filter: brightness(.6); } }
.portal.stairs.anim .steps { animation: reveal 3.8s ease-out both; }
.ov.socket { transform: translate(-50%,-50%); filter: drop-shadow(0 0 8px rgba(255,220,140,.9)); }
@keyframes fadeIn { from { opacity: 0; } }

#tooltip {
  position: absolute; pointer-events: none; padding: 5px 12px; border-radius: 3px; white-space: nowrap;
  background: rgba(8,5,2,.85); border: 1px solid rgba(226,188,107,.5); color: var(--gold-2);
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: .12em; transform: translate(-50%, -150%);
  opacity: 0; transition: opacity .15s; z-index: 4;
}
#tooltip.show { opacity: 1; }

#nav { position: absolute; inset: 0; pointer-events: none; }
.nav-btn {
  position: absolute; pointer-events: auto; display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 30px; background: rgba(8,5,2,.6); border: 1px solid rgba(226,188,107,.5);
  color: var(--gold-2); font-family: "Cinzel", serif; font-size: 12px; letter-spacing: .1em; backdrop-filter: blur(3px);
  transition: background .2s, transform .2s;
}
.nav-btn:hover { background: rgba(60,40,12,.8); transform: translateY(-2px); }
.nav-btn.back { left: 50%; bottom: 3%; transform: translateX(-50%); }
.nav-btn.back:hover { transform: translateX(-50%) translateY(-2px); }

#say {
  position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 20px); z-index: 7; pointer-events: none;
  max-width: min(760px, 92%); padding: 12px 22px; text-align: center; font-size: clamp(16px, 1.9vw, 20px); line-height: 1.35;
  background: linear-gradient(180deg, rgba(20,13,5,.94), rgba(10,6,2,.94)); border: 1px solid rgba(226,188,107,.55);
  box-shadow: 0 10px 40px rgba(0,0,0,.6); border-radius: 3px; opacity: 0; transition: opacity .3s, transform .3s;
}
#say.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Inventory ---------- */
#inventory {
  height: var(--inv-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: linear-gradient(180deg, #19110a, #0b0805); border-top: 1px solid rgba(226,188,107,.4);
  box-shadow: 0 -10px 30px rgba(0,0,0,.6); position: relative; z-index: 6;
}
.inv-label { font-family: "Cinzel", serif; font-size: 11px; letter-spacing: .25em; color: var(--gold); writing-mode: vertical-rl; transform: rotate(180deg); opacity: .7; text-transform: uppercase; }
#invSlots { flex: 1; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px; scrollbar-width: none; scroll-behavior: smooth; }
#invSlots::-webkit-scrollbar { display: none; }
.inv-arrow {
  flex: none; width: 34px; height: calc(var(--inv-h) - 30px); border: 0; border-radius: 4px; cursor: pointer;
  font: 700 30px/1 "Cinzel", serif; color: var(--gold-2); background: rgba(226,188,107,.1); box-shadow: inset 0 0 0 1px rgba(226,188,107,.45);
  transition: background .2s, opacity .2s, transform .15s;
}
.inv-arrow:hover:not(:disabled) { background: rgba(226,188,107,.25); box-shadow: inset 0 0 0 1px var(--gold-2), 0 0 14px rgba(226,188,107,.35); }
.inv-arrow:active:not(:disabled) { transform: scale(.94); }
.inv-arrow:disabled { opacity: .25; cursor: default; }
.inv-arrow[hidden] { display: none; }
.slot {
  flex: none; width: calc(var(--inv-h) - 22px); height: calc(var(--inv-h) - 22px); border-radius: 4px; position: relative; padding: 5px;
  background: radial-gradient(circle at 50% 40%, rgba(226,188,107,.14), rgba(0,0,0,.4) 75%);
  box-shadow: inset 0 0 0 1px rgba(226,188,107,.35), inset 0 0 14px rgba(0,0,0,.8); transition: transform .15s, box-shadow .2s; cursor: pointer;
}
.slot img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.7)); }
.slot:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--gold), 0 0 16px rgba(226,188,107,.35); }
.slot.sel { box-shadow: inset 0 0 0 2px var(--gold-2), 0 0 22px rgba(246,220,154,.7); background: radial-gradient(circle, rgba(246,220,154,.35), rgba(0,0,0,.3) 75%); }
.slot.new { animation: newItem 1s ease-out; }
@keyframes newItem { 0% { transform: scale(.4); } 60% { transform: scale(1.15); } }
.slot.empty { cursor: default; opacity: .35; }
.slot.empty:hover { transform: none; }

#ghost { position: fixed; width: 56px; height: 56px; pointer-events: none; z-index: 50; transform: translate(-30%, -30%); display: none; filter: drop-shadow(0 0 8px rgba(246,220,154,.8)); }
#ghost img { width: 100%; }
.flyer { position: fixed; z-index: 60; pointer-events: none; transition: all .8s cubic-bezier(.5,-0.2,.4,1.1); filter: drop-shadow(0 0 16px rgba(246,220,154,.9)); }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .45s; z-index: 40; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- Panels (puzzles, documents) ---------- */
#panel { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(0,0,0,.72); backdrop-filter: blur(3px); animation: fadeIn .3s; }
.panel-box {
  position: relative; width: min(900px, 100%); max-height: 100%; overflow: auto; padding: 30px 30px 26px;
  background: url(../img/tex_pierre.webp) center/cover; color: #2b1d0c; border-radius: 4px;
  box-shadow: 0 0 0 2px #2a1c08, 0 0 0 5px var(--gold), 0 0 0 7px #2a1c08, 0 30px 80px rgba(0,0,0,.8);
  animation: panelIn .4s cubic-bezier(.2,.8,.2,1.1);
}
.panel-box.papyrus { background-image: url(../img/tex_papyrus.webp); }
.panel-box.dark { background: radial-gradient(ellipse at center, #2a1e10, #120c05); color: var(--text); }
@keyframes panelIn { from { opacity: 0; transform: scale(.92) translateY(14px); } }
.panel-close {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; z-index: 2;
  background: #2a1c08; color: var(--gold-2); font-size: 16px; box-shadow: 0 0 0 2px var(--gold);
}
.panel-close:hover { background: #4a3210; }
.p-title { font-family: "Cinzel", serif; font-weight: 700; text-align: center; font-size: clamp(21px, 2.8vw, 28px); letter-spacing: .12em; margin: 0 0 6px; color: #3a250a; }
.panel-box.dark .p-title { color: var(--gold-2); }
.p-sub { text-align: center; font-style: italic; font-size: clamp(18px, 2.4vw, 22px); margin: 0 0 18px; opacity: .85; }
.p-row { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.p-btn {
  padding: 10px 20px; border-radius: 3px; border: 0; font-family: "Cinzel", serif; font-size: 16px; letter-spacing: .12em; font-weight: 700;
  background: #2a1c08; color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold); text-transform: uppercase;
}
.p-btn:hover { background: #4a3210; }
.carved { color: #3b2710; text-shadow: 1px 1px 0 rgba(255,240,210,.55), -1px -1px 0 rgba(0,0,0,.35); }

/* Examine */
.exam { display: flex; gap: 26px; align-items: center; }
.exam img { width: min(260px, 38vw); filter: drop-shadow(0 10px 20px rgba(0,0,0,.8)); animation: float 4s ease-in-out infinite; }
.exam .exam-text h3 { font-family: "Cinzel", serif; color: var(--gold-2); margin: 0 0 10px; letter-spacing: .08em; font-size: 22px; }
.exam .exam-text p { font-size: 19px; line-height: 1.45; margin: 0 0 14px; }
@keyframes float { 50% { transform: translateY(-8px) rotate(1deg); } }

/* Documents */
.doc { font-size: clamp(19px, 2.4vw, 23px); line-height: 1.5; color: #2b1a08; }
.doc h3 { font-family: "Cinzel", serif; text-align: center; margin: 0 0 14px; letter-spacing: .1em; }
.doc p { margin: 0 0 12px; }
.doc .sign { text-align: right; font-style: italic; }
.doc-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.doc-nav span { font-family: "Cinzel", serif; font-size: 16px; letter-spacing: .1em; }
.alpha { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.alpha div { text-align: center; padding: 6px 0; border: 1px solid rgba(60,35,10,.3); border-radius: 3px; background: rgba(255,240,200,.25); }
.alpha .eg { display: block; font-size: 34px; line-height: 1.2; }
.alpha b { font-family: "Cinzel", serif; font-size: 18px; }
.alpha .torn { opacity: .25; filter: blur(1.5px); }

/* Fresco */
.fresco { display: flex; justify-content: center; gap: clamp(14px, 4vw, 44px); padding: 20px 10px 6px; background: linear-gradient(180deg, #c99a5e, #a4713c); border-radius: 4px; box-shadow: inset 0 0 30px rgba(60,30,5,.6); }
.fresco .priest { display: flex; flex-direction: column; align-items: center; }
.fresco .held { font-family: var(--eg); font-size: clamp(30px, 5vw, 50px); color: #1e3c7d; text-shadow: 0 0 1px #fff3; }
.fresco .fig { font-family: var(--eg); font-size: clamp(60px, 10vw, 104px); line-height: 1; color: #6e1f12; transform: scaleX(-1); }
.fresco .border { width: 100%; }

/* Dial lock */
.dials { display: grid; grid-template-columns: repeat(2, auto); gap: clamp(16px, 4vw, 36px); justify-content: center; margin: 10px 0; }
.dial {
  width: clamp(110px, 22vw, 160px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative; border: 0;
  background: radial-gradient(circle at 40% 35%, #d9bf93, #a88b5f 55%, #6d5534); box-shadow: inset 0 0 0 8px rgba(0,0,0,.15), inset 0 0 0 10px rgba(255,255,255,.15), inset 0 -10px 30px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.5);
}
.dial .g { font-family: var(--eg); font-size: clamp(46px, 9vw, 70px); color: #3b2710; text-shadow: 1px 1px 0 rgba(255,240,210,.5); transition: transform .35s; }
.dial .n { position: absolute; top: 6px; font-family: var(--eg); font-size: 22px; color: #3b2710; }
.dial.turn .g { animation: spinIn .35s; }
@keyframes spinIn { from { transform: rotate(-90deg) scale(.6); opacity: 0; } }

/* Cipher chest */
.slots9 { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.slots9 span { width: clamp(34px, 7vw, 50px); height: clamp(44px, 8vw, 60px); display: grid; place-items: center; font-family: var(--eg); font-size: clamp(24px, 4.4vw, 34px); background: rgba(40,22,6,.25); border-radius: 3px; box-shadow: inset 0 2px 6px rgba(0,0,0,.5); color: #2b1a08; }
.keypad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 520px; margin: 0 auto 14px; }
.key { aspect-ratio: 1; border: 0; border-radius: 4px; font-family: var(--eg); font-size: clamp(26px, 5vw, 38px); color: #3b2710; background: linear-gradient(180deg, #e3c99a, #b99560); box-shadow: 0 4px 0 #6d5534, 0 6px 10px rgba(0,0,0,.4); transition: transform .08s; }
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #6d5534; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* Canopic niches */
.niches { display: grid; grid-template-columns: repeat(3, clamp(90px, 18vw, 140px)); grid-template-rows: repeat(3, clamp(90px, 18vw, 140px)); gap: 8px; justify-content: center; }
.niche { border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; border: 0; background: radial-gradient(circle, #2a1c0e 35%, #4b3720 70%, #8e7550); box-shadow: inset 0 8px 20px rgba(0,0,0,.9), 0 0 0 2px rgba(60,35,10,.5); color: var(--gold-2); }
.niche img { width: 70%; height: 70%; object-fit: contain; filter: drop-shadow(0 4px 6px #000); animation: rise .5s; }
.niche .lab { position: absolute; bottom: 4px; font-family: "Cinzel", serif; font-size: 15px; font-weight: 700; letter-spacing: .15em; }
.niches .center { grid-column: 2; grid-row: 2; display: grid; place-items: center; font-family: var(--eg); font-size: 60px; color: #3b2710; text-shadow: 1px 1px 0 rgba(255,240,210,.5); }

/* Golden door sockets */
.sockets { display: grid; grid-template-columns: repeat(2, clamp(120px, min(26vw, 28vh), 200px)); gap: clamp(18px, 4vw, 34px) clamp(30px, 8vw, 70px); justify-content: center; padding: clamp(18px, 4vw, 34px); border-radius: 6px; background: linear-gradient(135deg, #f6dc9a, #c8973f 40%, #f1d38a 60%, #9a6f28); box-shadow: inset 0 0 30px rgba(80,50,10,.6); }
.sockets .socket { aspect-ratio: 1; border-radius: 50%; border: 0; position: relative; display: grid; place-items: center; cursor: pointer; background: radial-gradient(circle, #1a1208 50%, #3a2708 68%, #c8973f 72%, #6b4a14); box-shadow: 0 0 0 4px #7a5518, 0 6px 14px rgba(0,0,0,.45); transition: box-shadow .25s, transform .2s; }
.sockets .socket .lab { font-family: var(--eg); font-size: clamp(48px, min(11vw, 12vh), 84px); line-height: 1; color: #f6dc9a; opacity: .55; text-shadow: 0 0 12px rgba(246,220,154,.6); }
.sockets .socket.filled .lab { display: none; }
.sockets .socket.match { box-shadow: 0 0 0 4px #fff3c4, 0 0 30px 8px rgba(255,225,140,.95); transform: scale(1.05); }
.sockets .socket.match .lab { opacity: 1; }
.sockets .socket img { position: absolute; width: 76%; filter: drop-shadow(0 0 10px rgba(255,220,140,.8)); animation: rise .5s; }

/* Jugs */
.jugs { display: flex; justify-content: center; align-items: flex-end; gap: clamp(14px, 4vw, 40px); margin: 6px 0 16px; }
.jug { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 8px; border-radius: 6px; transition: transform .2s, background .2s; }
.jug.sel { background: rgba(255,240,200,.3); transform: translateY(-8px); box-shadow: 0 0 0 2px #2a1c08; }
.jug .vis { display: flex; align-items: flex-end; gap: 6px; }
.jug img { filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.gauge { width: 18px; background: rgba(40,22,6,.35); border-radius: 3px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(40,22,6,.6); }
.gauge i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #6fc6d9, #1e5d8a); transition: height .6s; }
.gauge b { position: absolute; left: 0; right: 0; height: 1px; background: rgba(40,22,6,.6); }
.jug .cap { font-family: var(--eg); font-size: 28px; color: #3b2710; letter-spacing: -2px; }

/* Balance */
/* .fit: the scales shrink so the panel fits without scrolling */
.panel-box.fit { display: flex; flex-direction: column; }
.panel-box.fit .panel-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.panel-box.fit .panel-body > * { flex-shrink: 0; }
.panel-box.fit .panel-body > .balance { flex: 1 1 300px; min-height: 70px; max-height: 378px; }
.balance svg { width: 100%; height: 100%; max-width: 560px; display: block; margin: 0 auto; }
.weights { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.weight { min-width: 76px; padding: 10px 10px 8px; border: 0; border-radius: 6px 6px 10px 10px; font-family: var(--eg); font-size: 48px; line-height: 1.05; color: #fff3d0; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0,0,0,.6); background: linear-gradient(180deg, #5d5853, #34302b); box-shadow: inset 0 2px 0 rgba(255,255,255,.22), inset 0 0 0 1px rgba(246,220,154,.35), 0 4px 8px rgba(0,0,0,.45); transition: transform .2s, opacity .2s; word-break: break-all; max-width: 190px; cursor: pointer; }
.weight:hover { box-shadow: inset 0 2px 0 rgba(255,255,255,.22), inset 0 0 0 1px var(--gold-2), 0 0 14px rgba(246,220,154,.4); }
.plume-val { display: flex; align-items: center; justify-content: center; gap: 14px; width: fit-content; max-width: 100%; margin: 4px auto 14px; padding: 8px 20px; border-radius: 40px; background: linear-gradient(180deg, #2a1c0c, #140d05); box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(0,0,0,.5); }
.plume-val .f { font-size: 50px; color: #9cc3ff; line-height: 1; }
.plume-val .n { font-size: 50px; line-height: 1; color: #ffe9b0; letter-spacing: 1px; word-break: break-all; }
@media (max-width: 720px) { .weight { min-width: 54px; font-size: 32px; padding: 6px 8px 4px; max-width: 130px; } .weights { gap: 8px; margin: 6px 0 12px; } .plume-val { padding: 4px 14px; margin-bottom: 10px; } .plume-val .n { font-size: 32px; } .plume-val .f { font-size: 32px; } }
/* Short screens (phone in landscape): scales on the left, text and controls on the right */
@media (max-height: 520px) and (orientation: landscape) {
  .panel-box.fit { padding: 16px 22px 14px; }
  .panel-box.fit .panel-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 22px; align-content: center; }
  .panel-box.fit .p-title { grid-column: 1 / -1; font-size: 20px; margin-bottom: 10px; }
  .panel-box.fit .panel-body > .balance { grid-column: 1; grid-row: 2 / -1; contain: size; min-height: 0; max-height: none; align-self: stretch; }
  .panel-box.fit .p-sub, .panel-box.fit .plume-val, .panel-box.fit .weights, .panel-box.fit .p-row { grid-column: 2; }
  .panel-box.fit .p-sub { font-size: 16px; margin: 0 0 10px; }
  .panel-box.fit .plume-val { margin: 0 auto 10px; padding: 4px 14px; }
  .panel-box.fit .plume-val .n, .panel-box.fit .plume-val .f { font-size: 26px; }
  .panel-box.fit .weights { gap: 6px; margin: 0 0 10px; }
  .panel-box.fit .weight { font-size: 24px; min-width: 44px; padding: 4px 6px 2px; }
  .panel-box.fit .p-btn { padding: 6px 16px; font-size: 13px; }
  .panel-box.fit .p-row { align-self: start; }
}
.weight.on { opacity: .35; transform: translateY(4px); }

/* Mirrors */
.mgrid { position: relative; margin: 0 auto; width: min(600px, 100%); aspect-ratio: 6/4.6; }
.mgrid svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mcell { cursor: pointer; }

/* Rings */
.rings { position: relative; width: min(440px, 80vw); aspect-ratio: 1; margin: 0 auto; }
.rings svg { width: 100%; height: 100%; }
.ring-g { transition: transform .5s cubic-bezier(.3,.8,.3,1.2); transform-origin: 200px 200px; cursor: pointer; }
.ring-ctrl { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Pause */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; animation: fadeIn .3s; }
.pause-box { width: min(360px, 86vw); text-align: center; }
.pause-box h2 { font-family: "Cinzel", serif; font-size: 38px; letter-spacing: .2em; color: var(--gold-2); margin: 0; }
.pause-time { font-style: italic; opacity: .75; margin: 6px 0 20px; font-size: 18px; }

/* Ending */
.end-text { max-width: 560px; font-size: clamp(19px, 2.4vw, 24px); font-style: italic; line-height: 1.5; text-shadow: 0 2px 10px #000; animation: rise 1.6s .3s both; }
.end-time { font-family: "Cinzel", serif; color: var(--gold-2); letter-spacing: .15em; margin: 6px 0 26px; animation: rise 1.6s .6s both; }
#btnReplay { width: min(300px, 80vw); animation: rise 1.6s .9s both; }
#flash { position: fixed; inset: 0; background: #fff8e0; z-index: 95; pointer-events: none; opacity: 0; transition: opacity 1.8s; }

.quake { animation: quake .6s linear 3; }
@keyframes quake { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-4px,2px); } 40% { transform: translate(3px,-3px); } 60% { transform: translate(-2px,3px); } 80% { transform: translate(4px,-1px); } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  :root { --inv-h: 74px; --top-h: 42px; --frame: 5px; }
  #topbar { padding: 0 14px; }
  #roomName { font-size: 11px; letter-spacing: .14em; }
  .icon-btn b { display: none; }
  #inventory { padding: 0 12px; gap: 8px; }
  .inv-label { display: none; }
  .panel-box { padding: 26px 14px 18px; }
  .exam { flex-direction: column; text-align: center; gap: 10px; }
  .exam img { width: 150px; }
  .nav-btn { font-size: 10px; padding: 4px 10px; }
  .keypad { grid-template-columns: repeat(4, 1fr); }
}
/* short embeds (e.g. an iframe on a site): a slimmer inventory leaves more room for the scene */
@media (max-height: 760px) {
  :root { --inv-h: 80px; }
}
@media (max-height: 480px) {
  :root { --inv-h: 64px; --top-h: 36px; }
}
