/* ---------- shared ---------- */
.stone-panel {
  background: url(../assets/img/stone_tex.webp) center / 260px, #2b2620;
  background-blend-mode: multiply;
  border: 2px solid #6d5a3c; border-radius: 10px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.85), 0 8px 24px rgba(0,0,0,.6);
}
.wrong { animation: shake .5s; }

/* stele */
.stele-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(10px, 3vw, 28px); padding: clamp(14px, 3vw, 30px); }
.stele-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stele-cell img { width: clamp(64px, 13vw, 120px); filter: drop-shadow(0 4px 6px #000) sepia(.3); }

/* dials */
.dials { display: flex; gap: clamp(8px, 2.5vw, 26px); padding: 10px; }
.dial { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dial-img {
  width: clamp(66px, 16vw, 140px); aspect-ratio: 1; border-radius: 50%;
  padding: 6%; background: radial-gradient(circle, #3a2f22, #120d08);
  border: 3px solid var(--gold-2); box-shadow: 0 0 0 3px #120d08, 0 0 18px rgba(224,180,90,.3);
}
.dial-img img { width: 100%; height: 100%; object-fit: contain; }
.dial:hover .dial-img { border-color: var(--gold); }

/* lights out */
.lo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(380px, 78vw); padding: 12px; border-radius: 12px; background: #120d08; box-shadow: inset 0 0 20px #000; }
.lo-tile {
  aspect-ratio: 1; border-radius: 8px;
  background: url(../assets/img/stone_tex.webp) center / 200px, #3b342c; background-blend-mode: multiply;
  border: 1px solid #5a4a36; box-shadow: inset 0 -4px 8px rgba(0,0,0,.6);
  transition: box-shadow .25s, filter .25s; display: grid; place-items: center;
}
.lo-tile svg { width: 70%; fill: #4a4036; stroke: #4a4036; transition: fill .25s, stroke .25s, filter .25s; }
.lo-tile.lit { box-shadow: inset 0 0 24px rgba(255, 190, 80, .55), 0 0 12px rgba(255, 190, 80, .35); }
.lo-tile.lit svg { fill: #ffd56b; stroke: #ffd56b; filter: drop-shadow(0 0 6px #ffb53b); }

/* simon */
.simon { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 2vw, 20px); width: min(640px, 88vw); }
.drum { position: relative; display: grid; place-items: center; padding-bottom: 14px; touch-action: manipulation; }
.drum img { width: 100%; max-height: 220px; object-fit: contain; filter: drop-shadow(0 8px 10px #000); transition: transform .1s; }
.drum span { position: absolute; bottom: 0; width: 60%; height: 8px; border-radius: 6px; background: var(--c); opacity: .5; box-shadow: 0 0 10px var(--c); }
.drum.hit img { animation: drumHit .35s ease; }
.drum.hit span { animation: drumGlow .45s ease; }
.drum.hit::before { content: ""; position: absolute; top: 2%; left: 10%; right: 10%; height: 30%; border-radius: 50%; background: radial-gradient(circle, var(--c), transparent 70%); opacity: 0; animation: drumRing .5s ease; mix-blend-mode: screen; }
@keyframes drumHit { 30% { transform: scale(.94, .9) translateY(4%); } }
@keyframes drumGlow { 20% { opacity: 1; transform: scaleX(1.3); } }
@keyframes drumRing { 20% { opacity: .9; } }
.simon-status { display: flex; gap: 10px; }
.simon-status i, .bg-score i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold-2); display: block; }
.simon-status i.ok, .bg-score i.ok { background: var(--jade); border-color: var(--jade); box-shadow: 0 0 10px var(--jade); }
.pz-btn:disabled { opacity: .5; }

/* pipes */
.pipes-wrap { display: flex; align-items: stretch; gap: 0; width: min(620px, 90vw); }
.pipes { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 6px; background: #0f0b07; border-radius: 8px; box-shadow: inset 0 0 18px #000; }
.pipe { aspect-ratio: 1; background: url(../assets/img/stone_tex.webp) center / 160px, #4a4238; background-blend-mode: multiply; border-radius: 4px; }
.pipe svg { width: 100%; height: 100%; display: block; }
.ch-out { stroke: #1a140e; stroke-width: 15; fill: none; stroke-linecap: square; }
.ch-in { stroke: #3a3128; stroke-width: 9; fill: none; stroke-linecap: square; transition: stroke .3s; }
.ch-hub { fill: #3a3128; transition: fill .3s; }
.ch-in.wet { stroke: #4fd8e0; filter: drop-shadow(0 0 3px #4fd8e0); }
.ch-hub.wet { fill: #4fd8e0; }
.pipe-src, .pipe-dst { width: 12%; display: flex; }
.pipe-src { align-items: flex-start; padding-top: 1%; }
.pipe-src img { width: 100%; filter: drop-shadow(0 0 8px rgba(79, 216, 224, .7)); }
.pipe-dst { align-items: flex-end; }
.pipe-dst::after { content: ""; width: 100%; aspect-ratio: 1.1; margin-bottom: 2%; border-radius: 0 0 40% 40%; border: 3px solid #6d5a3c; border-top: 0; background: linear-gradient(transparent 40%, rgba(79,216,224,.25)); }

/* sky */
.sky { width: min(520px, 84vw, 62dvh); aspect-ratio: 1; border-radius: 50%; background-size: 178% auto; background-position: center; box-shadow: 0 0 0 6px #2a2622, 0 0 0 9px #6d5a3c, 0 0 40px rgba(90, 130, 255, .35), inset 0 0 50px #000; }
.sky svg { width: 100%; height: 100%; }
.sky .lines line { stroke: #ffe3a0; stroke-width: .7; filter: drop-shadow(0 0 1.5px #ffd26b); stroke-linecap: round; }
.star { cursor: pointer; }
.star .hit { fill: transparent; }
.star .core { fill: #fff; filter: drop-shadow(0 0 1.6px #bcd4ff); transition: r .2s; }
.star:hover .core { fill: #ffe7a8; }
.star.sel .core { fill: #ffd26b; r: 2.6; filter: drop-shadow(0 0 3px #ffd26b); }

/* calendar */
.cal { width: min(540px, 88vw, 64dvh); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cal svg { width: 100%; cursor: pointer; }
.cal .ring { transform-origin: 0 0; transform-box: view-box; }
.ring-band { fill: none; stroke: #3d342a; }
.ring0 .ring-band { stroke: #4a3f32; }
.ring2 .ring-band { stroke: #342c23; }
.ring-sep { stroke: #1a140e; stroke-width: 2; }
.ring-txt { fill: #f0d9a0; font-family: 'Cinzel', serif; font-weight: 700; font-size: 12px; text-anchor: middle; }
.ring1 .ring-txt { font-size: 11px; }
.ring2 .ring-txt { font-size: 12px; }
.cal-core { fill: #1a140e; stroke: #8a6a35; stroke-width: 3; }
.cal-pointer { fill: #ffd26b; filter: drop-shadow(0 0 4px #ffb53b); }
.cal-read { display: flex; align-items: center; gap: 12px; font-family: 'Cinzel', serif; font-size: clamp(16px, 2.6vw, 22px); color: var(--gold); min-height: 36px; }
.cal-read .sep { opacity: .5; }
.cal-read > span { display: flex; transition: color .3s; }
.cal-read .ok { color: #8fe0b0; text-shadow: 0 0 10px rgba(120,230,170,.6); }
.ring.ok .ring-band { stroke: #2f5a44; transition: stroke .3s; }
.ring.ok .ring-txt { fill: #c8ffe0; }
.ring.ok svg { fill: #c8ffe0; }

/* numeral lock */
.numlock { padding: clamp(16px, 3vw, 30px); display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(420px, 86vw); }
.lock-q { font-style: italic; color: #f0d9a0; text-align: center; font-size: clamp(14px, 2vw, 18px); }
.levels { display: flex; flex-direction: column; gap: 10px; }
.level { display: grid; grid-template-columns: 40px 96px 40px; grid-template-rows: auto auto; align-items: center; justify-items: center; }
.level .arr { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold-2); color: var(--gold); font-size: 22px; line-height: 1; }
.level .cart { width: 96px; height: 80px; display: grid; place-items: center; border-radius: 10px; background: #15100b; box-shadow: inset 0 0 16px #000; border: 1px solid #6d5a3c; }
.lvl-name { grid-column: 1 / 4; font-family: 'Cinzel', serif; font-size: 12px; color: var(--muted); letter-spacing: .15em; }

/* jigsaw */
.jig { position: relative; touch-action: none; }
.jig-board { position: absolute; background: rgba(0,0,0,.45); border: 2px dashed rgba(224,180,90,.4); box-shadow: inset 0 0 30px #000;
  background-image: linear-gradient(rgba(224,180,90,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(224,180,90,.15) 1px, transparent 1px);
  background-size: 33.333% 33.333%; }
.jig-pc { position: absolute; border-radius: 3px; box-shadow: 0 6px 14px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,240,200,.25); cursor: grab; touch-action: none; transition: left .35s, top .35s, transform .35s; }
.jig-pc.drag { z-index: 10; cursor: grabbing; box-shadow: 0 14px 30px rgba(0,0,0,.8); transition: none; }
.jig-pc.locked { cursor: default; box-shadow: none; z-index: 0; }

.mural-view { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: center; }
.mural-view > img { width: min(340px, 70vw); border-radius: 6px; box-shadow: 0 0 40px rgba(79, 209, 165, .35); }
.tally { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.tally div { display: flex; align-items: center; gap: 10px; font-size: 26px; color: var(--gold); font-family: 'Cinzel', serif; }
.tally img { width: 48px; height: 48px; object-fit: contain; }

/* balance */
.bal { position: relative; width: min(560px, 88vw); aspect-ratio: 1.55; }
.bal-post { position: absolute; left: 50%; top: 14%; bottom: 0; width: 6%; transform: translateX(-50%); background: linear-gradient(90deg, #4a3b2a, #a58a62, #4a3b2a); border-radius: 6px 6px 0 0; }
.bal-post::after { content: ""; position: absolute; bottom: 0; left: -160%; right: -160%; height: 10%; background: linear-gradient(#8a7252, #3a2e20); border-radius: 6px; }
.bal-beam { position: absolute; left: 10%; right: 10%; top: 12%; height: 5%; transition: transform .8s cubic-bezier(.3,1.5,.5,1); }
.bal-arm { position: absolute; inset: 0; background: linear-gradient(#e0b45a, #7d5618); border-radius: 8px; box-shadow: 0 3px 8px #000; }
.bal-arm::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); border-radius: 50%; background: #ffd26b; box-shadow: 0 0 8px #ffb53b; }
.bal-pan { position: absolute; top: 50%; width: 36%; height: 0; transform-origin: 50% 0; transition: transform .8s cubic-bezier(.3,1.5,.5,1); }
.bal-pan.left { left: -18%; } .bal-pan.right { right: -18%; }
.bal-pan::before { content: ""; position: absolute; left: 50%; top: 0; width: 76%; height: calc(min(560px, 88vw) / 1.55 * .42); transform: translateX(-50%); background: linear-gradient(115deg, transparent 49%, #c89b4a 49.5%, #c89b4a 50.5%, transparent 51%), linear-gradient(65deg, transparent 49%, #c89b4a 49.5%, #c89b4a 50.5%, transparent 51%); }
.pan-dish { position: absolute; left: 0; right: 0; top: calc(min(560px, 88vw) / 1.55 * .42); height: 14px; border-radius: 0 0 50% 50% / 0 0 100% 100%; background: linear-gradient(#e0b45a, #6d4a14); box-shadow: 0 4px 8px #000; }
.pan-load { position: absolute; left: 4%; right: 4%; bottom: calc(-1 * min(560px, 88vw) / 1.55 * .42); display: flex; flex-wrap: wrap-reverse; justify-content: center; align-items: flex-end; gap: 2px; }
.pan-load > img { height: calc(min(560px, 88vw) / 1.55 * .34); filter: drop-shadow(0 4px 6px #000); }
.idol-n { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); background: rgba(10,6,3,.8); border-radius: 6px; padding: 0 2px; }
.off img { width: clamp(26px, 5vw, 44px); height: clamp(26px, 5vw, 44px); object-fit: contain; filter: drop-shadow(0 3px 4px #000); }
.bal-tray { display: flex; gap: 12px; }
.tray-it { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--gold-2); background: rgba(0,0,0,.3); font-family: 'Cinzel', serif; font-size: 13px; color: var(--gold); }
.tray-it img { width: clamp(38px, 7vw, 56px); height: clamp(38px, 7vw, 56px); object-fit: contain; }
.tray-it:disabled { opacity: .35; }

/* directions */
.dirs { position: relative; width: min(420px, 84vw, 56dvh); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #2f281f, #120d08 70%); box-shadow: inset 0 0 40px #000, 0 0 0 3px #6d5a3c; }
.dirs-center { position: absolute; left: 50%; top: 50%; width: 28%; transform: translate(-50%, -50%); }
.dirs-center img { width: 100%; filter: drop-shadow(0 0 14px rgba(255, 200, 90, .5)); }
.pillar { position: absolute; width: 20%; display: flex; flex-direction: column; align-items: center; gap: 2px; transform: translate(-50%, -50%); }
.pillar span { font-family: 'Cinzel', serif; font-size: 12px; color: var(--gold); letter-spacing: .1em; }
.pil { width: 70%; aspect-ratio: .5; border-radius: 6px 6px 3px 3px; background: url(../assets/img/stone_tex.webp) center / 120px, var(--pc); background-blend-mode: multiply; box-shadow: inset 0 -10px 20px rgba(0,0,0,.5), 0 6px 12px #000; transition: background-color .3s; border: 1px solid rgba(0,0,0,.5); }
.pillar.pN { left: 50%; top: 18%; } .pillar.pS { left: 50%; top: 82%; }
.pillar.pE { left: 82%; top: 50%; } .pillar.pW { left: 18%; top: 50%; }

/* memory */
.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 1.5vw, 12px); width: min(460px, 86vw, 62dvh); }
.card { aspect-ratio: 1; perspective: 600px; }
.card .inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.card.up .inner { transform: rotateY(180deg); }
.card .back, .card .face { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card .back { background: radial-gradient(circle, rgba(224,180,90,.35) 0 18%, transparent 20%), url(../assets/img/stone_tex.webp) center / 140px, #3b2a18; background-blend-mode: normal, multiply; border: 2px solid var(--gold-2); box-shadow: inset 0 0 14px #000; }
.card .face { transform: rotateY(180deg); background: radial-gradient(circle, #3a2a18, #120c07); border: 2px solid var(--gold); display: grid; place-items: center; }
.card .face img { width: 82%; height: 82%; object-fit: contain; }
.card.match .face { border-color: var(--jade); box-shadow: 0 0 14px var(--jade); }

/* ball game */
.ballgame { position: relative; width: min(640px, 90vw); }
.ballgame canvas { width: 100%; display: block; border-radius: 10px; box-shadow: 0 0 0 2px #6d5a3c, 0 10px 30px #000; cursor: pointer; touch-action: none; }
.bg-score { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }

/* mirrors */
.mirrors { width: min(520px, 86vw, 60dvh); }
.mirrors svg { width: 100%; display: block; }
.mg-floor { fill: #1d1812; stroke: #6d5a3c; stroke-width: .6; }
.mg-line { stroke: rgba(224, 180, 90, .12); stroke-width: .25; }
.mg-src { fill: #fff3c4; filter: drop-shadow(0 0 2px #ffd26b); }
.mg-beam { fill: none; stroke: rgba(255, 210, 110, .5); stroke-width: 2.4; stroke-linejoin: round; filter: blur(.6px); }
.mg-beam.hit { stroke: rgba(255, 240, 170, .9); }
.mg-beam-core { fill: none; stroke: #fff8dc; stroke-width: .6; stroke-linejoin: round; }
.mg-block { fill: #4a4036; stroke: #1a140e; stroke-width: .5; }
.mg-mirror { cursor: pointer; }
.mg-hit { fill: transparent; }
.mg-mirror:hover .mg-hit { fill: rgba(224, 180, 90, .08); }
.mg-m-out { stroke: #c8913c; stroke-width: 2.2; stroke-linecap: round; }
.mg-m-in { stroke: #0a0a0c; stroke-width: 1.2; stroke-linecap: round; }
.mg-target { opacity: .7; }
.mg-target.hit { opacity: 1; filter: drop-shadow(0 0 3px #ffd26b); }

/* phones held sideways: wheel and date side by side so the whole calendar fits without scrolling */
@media (orientation: landscape) and (max-height: 500px) {
  .cal { flex-direction: row; width: auto; gap: 18px; }
  .cal svg { width: auto; height: min(66dvh, 300px); }
  .cal-read { flex-direction: column; gap: 6px; }
  .cal-read .sep { display: none; }
}
