/* NOIR — visual layer (scene.js): drawn rooms, portraits, interrogation table, case folder */

/* ---------- rooms ---------- */
.rscene { position: relative; overflow-x: auto; overflow-y: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: #000;
  box-shadow: var(--shadow); margin: 6px 0 14px; scrollbar-width: thin; animation: rs-enter .7s ease-out; }
@keyframes rs-enter { from { filter: brightness(0); transform: scale(1.03); } to { filter: none; transform: none; } }
.rscene-in { position: relative; width: 100%; min-width: 640px; aspect-ratio: 16 / 9; }
.rscene-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.torch { position: absolute; inset: 0; pointer-events: none; --x: 50%; --y: 60%; --r: 180px;
  background: radial-gradient(circle var(--r) at var(--x) var(--y), rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .05) 45%, rgba(0, 0, 0, .8) 100%);
  transition: opacity .8s; }
.rscene.lit .torch { opacity: .25; }
.rscene .rain-lines { animation: rs-rain .6s linear infinite; }
@keyframes rs-rain { from { transform: translateY(-20px); } to { transform: translateY(20px); } }
.rscene .glow { animation: rs-glow 3s ease-in-out infinite; }
@keyframes rs-glow { 50% { opacity: .55; } }

.obj { cursor: pointer; outline: none; }
.obj > g:first-child { transition: filter .25s; }
.obj:hover > g:first-child, .obj:focus-visible > g:first-child { filter: brightness(1.45) drop-shadow(0 0 6px rgba(224, 169, 67, .7)); }
.obj .lbl rect { fill: rgba(10, 10, 12, .82); stroke: rgba(224, 169, 67, .45); }
.obj .lbl text { fill: #e9e3d3; font: 600 11px var(--f-body); }
.obj .lbl { opacity: 0; transition: opacity .2s; pointer-events: none; }
.obj:hover .lbl, .obj:focus-visible .lbl, .obj.hit .lbl, .obj.empty .lbl { opacity: 1; }
.obj.empty > g:first-child { filter: grayscale(.7) brightness(.7); }
.obj.empty .lbl text { fill: #8d93a0; }
.obj.hit .lbl rect { stroke: var(--amber); fill: rgba(42, 30, 10, .9); }
.obj.hit .lbl text { fill: #f3cf7e; }
.obj.hit > g:first-child { filter: drop-shadow(0 0 8px rgba(224, 169, 67, .55)); }
.obj.searching > g:first-child { animation: rs-search .5s ease-in-out infinite; }
@keyframes rs-search { 50% { filter: brightness(1.8) drop-shadow(0 0 10px #e0a943); } }
@media (hover: none) { .obj .lbl { opacity: .85; } }

.rs-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 8px; }
.rs-tip { color: var(--fog); font-size: .9rem; }
.rs-list summary { cursor: pointer; color: var(--fog); font-size: .9rem; margin: 6px 0; }

/* found something: the reveal card */
.reveal-ev { display: grid; gap: 10px; margin: 12px 0; }
.reveal-card { background: var(--paper); color: var(--paper-ink); border-radius: 6px; padding: 12px 14px; position: relative; transform: rotate(-.6deg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: rv-in .5s cubic-bezier(.2, 1.3, .4, 1) both; }
.reveal-card:nth-child(2) { transform: rotate(.8deg); animation-delay: .12s; }
.reveal-card b { display: block; font-family: var(--f-head); font-size: 1.1rem; }
.reveal-card .meta { color: #5b5242; font-size: .9rem; }
.reveal-card::before { content: ""; position: absolute; top: -7px; right: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--blood); box-shadow: 0 2px 3px rgba(0,0,0,.5); }
@keyframes rv-in { from { opacity: 0; transform: translateY(18px) scale(.94); } }

/* ---------- portraits ---------- */
.avatar.drawn { padding: 0; overflow: hidden; background: radial-gradient(circle at 50% 35%, #2a2d33, #121317); }
.avatar.drawn { width: 62px; height: 62px; flex: none; border: 1px solid var(--line-2); box-shadow: inset 0 0 14px #000; }
.avatar.drawn svg.portrait { width: 100%; height: 110%; display: block; }
.portrait .sweat { animation: pt-sweat 2.4s ease-in infinite; }
@keyframes pt-sweat { 0% { transform: translateY(-4px); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(18px); opacity: 0; } }
.portrait .eyes { transform-origin: 100px 110px; animation: pt-blink 5.5s infinite; }
@keyframes pt-blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }

/* ---------- interrogation table ---------- */
.i-stage { position: relative; display: grid; grid-template-columns: minmax(150px, 240px) minmax(0, 1fr); align-items: end; gap: 0 18px;
  min-height: 250px; margin-bottom: 14px; padding: 18px 18px 0; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(ellipse 45% 75% at 22% 0%, rgba(255, 213, 138, .17), transparent 70%), linear-gradient(#111216, #08090b); }
html[dir="rtl"] .i-stage { background: radial-gradient(ellipse 45% 75% at 78% 0%, rgba(255, 213, 138, .17), transparent 70%), linear-gradient(#111216, #08090b); }
.i-lamp { position: absolute; top: 0; inset-inline-start: calc(18px + 95px); width: 46px; height: 22px; border-radius: 0 0 46px 46px; background: #2a2a26;
  box-shadow: 0 6px 40px 10px rgba(255, 213, 138, .25); animation: i-flick 9s infinite; }
@keyframes i-flick { 0%, 60%, 63%, 100% { opacity: 1; } 61% { opacity: .4; } 62% { opacity: .9; } }
.i-who { position: relative; align-self: end; }
.i-who svg.portrait { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); transition: transform .5s; }
.i-stage.mood-angry .i-who svg.portrait, .i-stage.mood-hostile .i-who svg.portrait { transform: translateY(-4px) scale(1.04); }
.i-stage.mood-broken .i-who svg.portrait { transform: translateY(8px); filter: drop-shadow(0 10px 18px rgba(0,0,0,.6)) saturate(.6); }
.i-table { position: absolute; left: -40px; right: -40px; bottom: -2px; height: 30px; background: linear-gradient(#4a3322, #21170f); border-top: 2px solid #6b4b33; }
.i-bubble { align-self: center; margin-bottom: 26px; background: rgba(233, 227, 211, .96); color: var(--paper-ink); border-radius: 14px; padding: 12px 16px; position: relative;
  max-height: 210px; overflow: auto; box-shadow: var(--shadow); font-family: var(--f-quote); font-size: 1.08rem; line-height: 1.8; cursor: pointer; }
.i-bubble::before { content: ""; position: absolute; top: 46%; inset-inline-start: -10px; border: 10px solid transparent; border-inline-end-color: rgba(233, 227, 211, .96); border-inline-start: 0; }
.i-bubble.intro { background: rgba(29, 32, 38, .9); color: var(--smoke); }
.i-bubble.intro::before { border-inline-end-color: rgba(29, 32, 38, .9); }
.i-name { font-family: var(--f-head); font-weight: 700; font-size: 1rem; }
.i-name small { font-family: var(--f-body); font-weight: 400; color: #6d6455; font-size: .8rem; margin-inline-start: 6px; }
.i-bubble.intro .i-name small { color: var(--fog); }
.i-tell { font-style: italic; color: #7a6c55; font-size: .9rem; }
.i-stage.mood-angry .i-bubble, .i-stage.mood-hostile .i-bubble { box-shadow: 0 0 0 2px rgba(192, 57, 43, .55), var(--shadow); }
.i-stage.waiting .i-says::after { content: " …"; animation: rs-glow 1s infinite; }
@media (max-width: 720px) {
  .i-stage { grid-template-columns: 120px minmax(0, 1fr); min-height: 0; padding: 12px 12px 0; gap: 0 10px; }
  .i-bubble { font-size: .98rem; max-height: 170px; margin-bottom: 18px; }
  .i-lamp { inset-inline-start: calc(12px + 37px); }
}

/* ---------- the case file as a folder ---------- */
.case-folder { position: relative; perspective: 1800px; }
.cf-cover { position: absolute; inset: 0; z-index: 4; border-radius: 4px 10px 10px 4px; cursor: pointer; transform-origin: right center; transition: transform .85s cubic-bezier(.6, 0, .3, 1), opacity .85s;
  background: linear-gradient(135deg, rgba(255,255,255,.08), transparent 40%), repeating-linear-gradient(0deg, rgba(0,0,0,.025) 0 2px, transparent 2px 5px), #c4a46a;
  color: #3b2c14; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 30px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(0,0,0,.08); min-height: 360px; }
html[dir="ltr"] .cf-cover { transform-origin: left center; }
.cf-cover.opening { transform: rotateY(-165deg); opacity: .0; }
html[dir="ltr"] .cf-cover.opening { transform: rotateY(165deg); }
.cf-cover.gone { display: none; }
.cf-tab { position: absolute; top: -22px; inset-inline-end: 40px; background: #b8975c; padding: 4px 18px; border-radius: 8px 8px 0 0; font: 700 .85rem var(--f-head); letter-spacing: .05em; }
.cf-dept { font: 600 .9rem var(--f-head); opacity: .75; }
.cf-title { font: 800 clamp(1.4rem, 3.4vw, 2.1rem) var(--f-head); max-width: 560px; line-height: 1.4; }
.cf-meta { font-family: var(--f-type); opacity: .7; font-size: .9rem; }
.cf-stamp { border: 4px solid var(--blood); color: var(--blood); font: 800 1.5rem var(--f-head); padding: 2px 18px; transform: rotate(-9deg); opacity: .85; border-radius: 4px; margin-top: 6px; }
.cf-open { margin-top: 14px; font-weight: 700; background: #3b2c14; color: #f0e2bf; padding: 8px 20px; border-radius: 30px; animation: cf-pulse 1.8s infinite; }
@keyframes cf-pulse { 50% { box-shadow: 0 0 0 8px rgba(59, 44, 20, .15); } }
.case-folder .file { animation: none; }
.case-folder.just-opened .file { animation: cf-paper .6s ease-out; }
@keyframes cf-paper { from { transform: translateY(10px); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  .rscene, .reveal-card, .cf-cover, .portrait .eyes, .portrait .sweat, .i-lamp { animation: none !important; transition: none !important; }
}

/* how the person across the table feels right now */
.i-mood { position: absolute; bottom: 36px; inset-inline-start: 4px; z-index: 2; font: 700 .78rem var(--f-head); padding: 2px 10px; border-radius: 20px;
  background: rgba(10, 10, 12, .8); border: 1px solid var(--line-2); color: var(--smoke); }
.mood-relaxed .i-mood { color: #8fd19a; border-color: #3d6b45; }
.mood-nervous .i-mood { color: var(--amber); border-color: #6b5324; }
.mood-angry .i-mood, .mood-hostile .i-mood { color: #ff8a7a; border-color: var(--blood-2); }
.mood-broken .i-mood { color: #9fc4e8; border-color: #35506b; }
.i-who svg.portrait { animation: i-shift .5s ease-out; }
@keyframes i-shift { from { filter: brightness(1.5) drop-shadow(0 10px 18px rgba(0,0,0,.6)); } }
.i-stage.mood-nervous .i-who svg.portrait { animation: i-shift .5s ease-out, i-fidget 2.6s ease-in-out .5s infinite; }
@keyframes i-fidget { 0%, 100% { transform: none; } 30% { transform: translateX(-1.5px) rotate(-.5deg); } 65% { transform: translateX(1.5px) rotate(.4deg); } }
.i-stage.mood-relaxed .i-who svg.portrait { transform: translateY(3px); }

/* the room around the suspect: window-blind light on the wall, drifting haze, a dark frame */
.i-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(170deg, transparent 0 16px, rgba(255, 221, 160, .07) 16px 30px);
  -webkit-mask-image: linear-gradient(100deg, transparent 5%, #000 40%, transparent 85%); mask-image: linear-gradient(100deg, transparent 5%, #000 40%, transparent 85%);
  animation: i-blinds 11s ease-in-out infinite; }
@keyframes i-blinds { 0%, 100% { opacity: .9; } 47% { opacity: .9; } 50% { opacity: .35; } 53% { opacity: 1; } }
.i-stage::after { content: ""; position: absolute; inset: -20%; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse 30% 18% at 30% 40%, rgba(200, 205, 215, .07), transparent 70%), radial-gradient(ellipse 26% 14% at 65% 60%, rgba(200, 205, 215, .06), transparent 70%);
  animation: i-haze 16s ease-in-out infinite alternate; box-shadow: inset 0 0 120px 60px rgba(0, 0, 0, .55); }
@keyframes i-haze { from { transform: translate(-4%, 2%); } to { transform: translate(5%, -3%); } }
.i-who { z-index: 1; } .i-bubble { z-index: 4; }
@media (max-width: 720px) { .i-mood { bottom: auto; top: 0; font-size: .72rem; } }
/* the film look is done once in CSS (cheap) instead of an SVG noise filter per face */
svg.portrait { filter: saturate(.86) contrast(1.04); }
.i-who svg.portrait { filter: saturate(.86) contrast(1.04) drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); }
.i-stage::after { will-change: transform; }
