/* Escape rooms (rooms/engine.js + rooms/*.js): the scene with its views,
   close-ups, lock widgets, the bag and the detective notebook. */

.rm { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; background: #fff1e0; }
.rm-scene { position: relative; min-height: 0; overflow: hidden; isolation: isolate; touch-action: manipulation; }
.rm-view { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: block; }
.rm-view.rm-leaving { pointer-events: none; }

/* hotspots: tap feedback, keyboard focus, the easy-mode twinkle and the hint glow */
.rm-spot { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: 50% 90%; -webkit-tap-highlight-color: transparent; }
.rm-hit { fill: #fff; fill-opacity: 0; stroke: none; }
.rm-spot:focus-visible .rm-hit { stroke: #ff7a9a; stroke-width: 5; stroke-dasharray: 14 10; stroke-opacity: 1; fill-opacity: 0.08; }
.rm-spot.rm-poke { animation: rm-poke 0.4s cubic-bezier(.3,.7,.4,1.4); }
.rm-spot.rm-tw .rm-hit { stroke: #ffe27a; stroke-width: 6; fill: #fff7c8; animation: rm-twinkle 2.2s ease-in-out infinite; }
.rm-spot.rm-hinted .rm-hit { stroke: #ffcf5a; stroke-width: 8; fill: #fff3b0; animation: rm-glow 0.9s ease-in-out infinite; }
@keyframes rm-poke { 0% { transform: scale(1); } 30% { transform: scale(1.06, 0.94); } 60% { transform: scale(0.97, 1.04); } 100% { transform: scale(1); } }
@keyframes rm-twinkle { 0%, 100% { stroke-opacity: 0; fill-opacity: 0; } 50% { stroke-opacity: 0.85; fill-opacity: 0.18; } }
@keyframes rm-glow { 0%, 100% { stroke-opacity: 0.55; fill-opacity: 0.12; } 50% { stroke-opacity: 1; fill-opacity: 0.32; } }

/* the visiting couple in the front corner */
.rm-couple { position: absolute; left: 1%; bottom: 2px; height: var(--ch, 110px); width: auto; aspect-ratio: 236 / 158; overflow: visible; pointer-events: none; z-index: 3; filter: drop-shadow(0 6px 8px rgba(60, 30, 40, 0.18)); }
.rm-couple-hit { position: absolute; left: 1%; bottom: 2px; height: var(--ch, 110px); aspect-ratio: 236 / 158; z-index: 4; border: 0; padding: 0; background: none; border-radius: 40% 40% 12px 12px; cursor: pointer; }
.rm-couple-hit:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; }

/* turning round */
.rm-arrow {
  position: absolute; top: 50%; z-index: 5; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; border: 2px solid rgba(75, 51, 40, 0.18);
  background: rgba(255, 255, 255, 0.82); color: #4b3328; display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 6px 14px -6px rgba(75, 51, 40, 0.5); transition: transform 0.15s ease, background 0.15s; backdrop-filter: blur(3px);
}
.rm-arrow svg { width: 24px; height: 24px; }
.rm-arrow.l { left: 8px; }
.rm-arrow.r { right: 8px; }
/* tall screens: both arrows sit in the bottom-right corner, out of the picture's way */
.rm-portrait .rm-arrow { top: auto; bottom: 10px; margin-top: 0; }
.rm-portrait .rm-arrow.l { left: auto; right: 66px; }
.rm-arrow:hover { background: #fff; }
.rm-arrow:active { transform: scale(0.9); }
.rm-arrow.rm-tw { animation: rm-arrow-tw 1.6s ease-in-out infinite; }
.rm-arrow.rm-hinted { animation: rm-arrow-tw 0.8s ease-in-out infinite; background: #fff6c8; }
@keyframes rm-arrow-tw { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 90, 0.7), 0 6px 14px -6px rgba(75, 51, 40, 0.5); } 50% { box-shadow: 0 0 0 10px rgba(255, 207, 90, 0), 0 6px 14px -6px rgba(75, 51, 40, 0.5); } }
.rm-dots { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 7px; padding: 6px 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.6); pointer-events: none; }
.rm-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(75, 51, 40, 0.28); transition: background 0.2s, transform 0.2s; }
.rm-dots i.on { background: #ff7a9a; transform: scale(1.25); }

/* the detective's notebook button */
.rm-note {
  position: absolute; top: 8px; left: 8px; z-index: 6; height: 48px; min-width: 48px; padding: 0 10px 0 6px; border-radius: 24px; border: 2px solid rgba(75, 51, 40, 0.18);
  background: rgba(255, 255, 255, 0.88); color: #4b3328; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 800; font-size: 14px;
  box-shadow: 0 6px 14px -6px rgba(75, 51, 40, 0.5); font-variant-numeric: tabular-nums;
}
.rm-note svg { width: 34px; height: 34px; }
.rm-note.rm-bump { animation: rm-bump 0.6s cubic-bezier(.3,.7,.4,1.5); }
@keyframes rm-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-6deg); } }

/* close-ups */
.rm-zoom { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 10px; background: rgba(40, 24, 30, 0.38); backdrop-filter: blur(2px); }
.rm-card {
  position: relative; width: min(100%, 760px); max-height: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden auto; overscroll-behavior: contain;
  background: #fff8ef; box-shadow: 0 24px 50px -20px rgba(40, 20, 30, 0.6), 0 0 0 3px #4b3328; color: #3b2a2f;
}
.rm-zart { flex: 1 1 auto; min-height: 96px; width: 100%; display: block; }
.rm-x {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(75, 51, 40, 0.2); background: #fff; color: #4b3328;
  display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: 0 4px 10px -4px rgba(75, 51, 40, 0.5);
}
.rm-x svg { width: 24px; height: 24px; }
.rm-x.rm-tw, .rm-x.rm-hinted { animation: rm-arrow-tw 1s ease-in-out infinite; }
.rm-widget { flex: none; padding: 10px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-top: 2px dashed rgba(75, 51, 40, 0.16); background: #fff3e6; }
.rm-widget.rm-tw, .rm-widget.rm-hinted { animation: rm-widget-glow 1.2s ease-in-out infinite; }
@keyframes rm-widget-glow { 0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 207, 90, 0); } 50% { box-shadow: inset 0 0 0 5px rgba(255, 207, 90, 0.85); } }
.rm-anchor { position: absolute; left: 40%; top: 92px; width: 1px; height: 1px; pointer-events: none; }
.rm-iname { margin: 0; font-size: 19px; font-weight: 900; }
.rm-idesc { margin: 0; text-align: center; font-size: 15px; color: #6b5560; max-width: 420px; }
.rm-end .rm-card { background: #fff6ee; }

/* lock widgets */
.rm-lock { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.rm-dial-row { display: flex; gap: clamp(6px, 2.4vw, 14px); justify-content: center; }
.rm-dial { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rm-dial-icon { width: 34px; height: 34px; }
.rm-dial-btn {
  width: 52px; height: 40px; border-radius: 14px; border: 2px solid #4b3328; background: #ffe3a3; color: #4b3328; display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 3px 0 #c99a43; transition: transform 0.1s;
}
.rm-dial-btn svg { width: 22px; height: 22px; }
.rm-dial-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c99a43; }
.rm-dial-face {
  width: 52px; height: 56px; border-radius: 12px; border: 3px solid #4b3328; background: #fffdf8; display: grid; place-items: center; overflow: hidden;
  font-size: 32px; font-weight: 900; color: #3b2a2f; font-variant-numeric: tabular-nums; box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, 0.3);
}
.rm-dial-sym { width: 40px; height: 40px; }
.rm-try { min-height: 46px; }
.rm-seq { gap: 12px; }
.rm-slots { display: flex; gap: 8px; }
.rm-slot { width: 44px; height: 44px; border-radius: 12px; border: 3px dashed rgba(75, 51, 40, 0.35); display: grid; place-items: center; background: #fffdf8; }
.rm-slot.on { border-style: solid; border-color: #4b3328; animation: pop-in 0.25s cubic-bezier(.2,.9,.3,1.4) both; }
.rm-key-sym { width: 34px; height: 34px; }
.rm-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.rm-key {
  width: 50px; height: 50px; border-radius: 50%; border: 3px solid #4b3328; background: #e8f4fb; display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 4px 0 #9ab7c9; transition: transform 0.1s;
}
.rm-key:active { transform: translateY(3px); box-shadow: 0 1px 0 #9ab7c9; }
.rm-key.lit { animation: rm-lit 0.4s ease-out; }
@keyframes rm-lit { 0% { background: #fff6b0; } 100% { background: #e8f4fb; } }
.rm-slide { gap: 6px; }
.rm-track { position: relative; width: min(100%, 300px); height: 56px; border-radius: 28px; background: #e9d8c6; border: 3px solid #4b3328; box-shadow: inset 0 4px 6px -3px rgba(0, 0, 0, 0.3); --p: 0; }
.rm-track-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(52px + (100% - 52px) * var(--p)); border-radius: 28px; background: #bfe6c9; }
.rm-track-end { position: absolute; right: 10px; top: 50%; width: 30px; height: 30px; margin-top: -15px; opacity: 0.7; }
.rm-knob {
  position: absolute; top: 2px; left: calc((100% - 50px) * var(--p) + 1px); width: 46px; height: 46px; border-radius: 50%; border: 3px solid #4b3328; background: #ffd769; color: #4b3328;
  display: grid; place-items: center; cursor: grab; padding: 0; touch-action: none; box-shadow: 0 3px 0 #c99a43;
}
.rm-knob svg { width: 22px; height: 22px; }
.rm-track.rm-anim .rm-knob, .rm-track.rm-anim .rm-track-fill { transition: left 0.25s cubic-bezier(.3,.7,.4,1.2), width 0.25s cubic-bezier(.3,.7,.4,1.2); }
.rm-slide-tip { margin: 0; font-size: 13px; color: #86707a; font-weight: 700; }
.rm-shake { animation: rm-shake 0.45s ease-in-out; }
@keyframes rm-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }

/* the bag */
.rm-bag {
  display: flex; align-items: center; gap: 8px; min-height: 72px; padding: 8px 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  background: #f6e3cf; border-top: 3px solid #4b3328; box-shadow: inset 0 6px 10px -8px rgba(75, 51, 40, 0.5);
}
.rm-bag::-webkit-scrollbar { display: none; }
.rm-bag-empty { color: #8b6f5f; font-size: 14px; font-weight: 700; padding-left: 4px; white-space: nowrap; }
.rm-item {
  flex: none; width: 56px; height: 56px; border-radius: 16px; border: 3px solid rgba(75, 51, 40, 0.35); background: #fffaf3; display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 4px 0 -1px rgba(75, 51, 40, 0.25); transition: transform 0.15s cubic-bezier(.3,.7,.4,1.4), border-color 0.15s, background 0.15s;
}
.rm-item-art { width: 46px; height: 46px; overflow: visible; }
.rm-item.sel { border-color: #ff7a9a; background: #ffe6ec; transform: translateY(-5px) scale(1.06); box-shadow: 0 8px 0 -2px #ff7a9a, 0 0 0 4px rgba(255, 122, 154, 0.25); }
.rm-item.rm-arriving { opacity: 0; }
.rm-item.rm-new { animation: rm-new 0.45s cubic-bezier(.3,.7,.4,1.5); }
.rm-item.rm-merge { animation: rm-merge 0.65s ease-in forwards; }
.rm-item.rm-tw { animation: rm-item-tw 1.6s ease-in-out infinite; }
.rm-item.rm-hinted { animation: rm-item-tw 0.8s ease-in-out infinite; border-color: #ffcf5a; }
@keyframes rm-new { 0% { transform: scale(0.4); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes rm-merge { 0% { transform: scale(1); } 40% { transform: scale(1.15) rotate(-8deg); } 100% { transform: scale(0.2) rotate(20deg); opacity: 0; } }
@keyframes rm-item-tw { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 90, 0.8); } 50% { box-shadow: 0 0 0 8px rgba(255, 207, 90, 0); } }
.rm-fly { position: absolute; left: 0; top: 0; width: 56px; height: 56px; z-index: 30; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(60, 30, 40, 0.35)); }
.rm-fly svg { width: 100%; height: 100%; overflow: visible; }
.rm-fly-clue { width: 80px; height: 60px; }

/* the notebook */
.rm-card[data-z="@note"] .rm-zart { display: none; }
.rm-card[data-z="@note"] .rm-widget { flex: 1; overflow: auto; border-top: 0; justify-content: flex-start; background: #fffbe9; }
.rm-nb-head { margin: 4px 56px 0 0; font-size: 20px; font-weight: 900; align-self: flex-start; }
.rm-nb { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; width: 100%; }
.rm-nb-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px; background: #fff; border: 2px dashed rgba(75, 51, 40, 0.25); text-align: center; font-size: 13px; font-weight: 800; color: #9a8790; }
.rm-nb-card.found { border-style: solid; border-color: #4b3328; color: #3b2a2f; box-shadow: 0 4px 0 -1px rgba(75, 51, 40, 0.25); transform: rotate(-1deg); }
.rm-nb-card.found:nth-child(2n) { transform: rotate(1.2deg); }
.rm-nb-pic { width: 100%; height: 72px; }
.rm-nb-go { margin-top: 4px; }

/* dark theme: the pictures keep their colours, the frames follow */
:root[data-theme="dark"] .rm, :root.dark-auto .rm { background: #2a2237; }
:root[data-theme="dark"] .rm-bag, :root.dark-auto .rm-bag { background-color: #3a2c3a; border-top-color: #120c14; }
:root[data-theme="dark"] .rm-bag-empty, :root.dark-auto .rm-bag-empty { color: #d9c3cd; }
:root[data-theme="dark"] .rm-zoom, :root.dark-auto .rm-zoom { background: rgba(10, 6, 16, 0.55); }

/* small phones: tighter widgets */
@media (max-width: 420px) {
  .rm-keys { grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
}
@media (max-width: 380px) {
  .rm-dial-btn { width: 46px; height: 38px; }
  .rm-dial-face { width: 46px; height: 50px; font-size: 28px; }
  .rm-key { width: 46px; height: 46px; }
  .rm-arrow { width: 44px; height: 44px; margin-top: -22px; }
}
@media (max-height: 560px) {
  .rm-widget { padding: 6px 10px 8px; gap: 6px; }
  .rm-seq { gap: 6px; }
  .rm-slot { width: 36px; height: 36px; }
  .rm-key { width: 42px; height: 42px; }
  .rm-key-sym { width: 30px; height: 30px; }
  .rm-keys { gap: 6px 12px; }
  .lt-turn { width: 48px; height: 48px; }
  .rm-dial-btn { height: 34px; }
  .rm-dial-face { height: 46px; }
  .rm-bag { min-height: 64px; padding: 4px 10px; }
  .rm-item { width: 50px; height: 50px; }
}

/* less motion */
.reduce .rm-spot.rm-poke, .reduce .rm-item.rm-new, .reduce .rm-item.rm-merge, .reduce .rm-shake, .reduce .rm-note.rm-bump { animation: none !important; }
.reduce .rm-spot.rm-tw .rm-hit, .reduce .rm-spot.rm-hinted .rm-hit { animation: none; stroke-opacity: 0.9; fill-opacity: 0.2; }
.reduce .rm-arrow.rm-tw, .reduce .rm-arrow.rm-hinted, .reduce .rm-item.rm-tw, .reduce .rm-item.rm-hinted, .reduce .rm-x.rm-tw, .reduce .rm-x.rm-hinted, .reduce .rm-widget.rm-tw, .reduce .rm-widget.rm-hinted { animation: none; box-shadow: 0 0 0 5px rgba(255, 207, 90, 0.85); }
.reduce .rm-track.rm-anim .rm-knob, .reduce .rm-track.rm-anim .rm-track-fill, .reduce .rm-dots i { transition: none; }

/* "Who Ate the Cake?": the line-up's clue chips and the suspects' cards */
.rm-cake .rm-suspect .rm-hit { rx: 30; }
.ck-lineup { gap: 8px; }
.ck-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.ck-chip { width: 64px; height: 48px; background: #fff; border-radius: 10px; border: 2px solid #4b3328; }
.ck-body { width: 100%; display: flex; flex-direction: column; align-items: center; min-height: 40px; }
.ck-tip { margin: 6px 0; font-weight: 800; color: #6b5560; text-align: center; }
.ck-card { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; animation: pop-in 0.3s cubic-bezier(.2,.9,.3,1.3) both; }
.ck-card h3 { margin: 0; font-size: 18px; font-weight: 900; }
.ck-traits { display: flex; gap: 8px; justify-content: center; }
.ck-trait { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; padding: 4px 2px; border-radius: 12px; background: #fff; border: 2px solid rgba(75, 51, 40, 0.25); font-size: 11px; font-weight: 800; color: #6b5560; }
.ck-trait svg { width: 40px; height: 40px; }
.ck-trait.match { border-color: #2f8a4a; background: #e6f7ea; box-shadow: 0 0 0 3px rgba(47, 138, 74, 0.2); }
.ck-trait.match figcaption::after { content: " ✓"; color: #2f8a4a; }
.ck-accuse { min-height: 44px; }
.reduce .ck-card { animation: none; }

/* "The Secret Love Letter": turning the cipher wheel */
.lt-wheel { gap: 6px; }
.lt-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.lt-turn {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid #4b3328; background: #ffd1dc; color: #4b3328; display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 4px 0 #e7799a; transition: transform 0.1s;
}
.lt-turn svg { width: 28px; height: 28px; }
.lt-turn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e7799a; }
.lt-count { min-height: 18px; font-size: 13px; font-weight: 800; color: #86707a; font-variant-numeric: tabular-nums; }
