:root {
  --ink: #f3e9d6;
  --ink-dim: #c9b99c;
  --accent: #b3261e;
  --gold: #d6a84a;
  --panel: rgba(18, 12, 8, 0.88);
  --panel-border: rgba(214, 168, 74, 0.45);
  --serif: "Cormorant Garamond", Georgia, serif;
  --type: "Special Elite", "Courier New", monospace;
  --sans: "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; font-family: var(--sans); user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* La scène garde toujours le format 16:9, centrée dans la fenêtre */
#stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100vw, 177.78vh); height: min(56.25vw, 100vh); overflow: hidden; background: #050403; container-type: size; }

#scene { position: absolute; }
#bg { position: absolute; inset: 0; background-size: 100% 100%; background-position: center; transition: filter .8s; }
#bg.placeholder { background-size: cover; filter: blur(14px) brightness(.38) saturate(.7); transform: scale(1.08); }
#tint { position: absolute; inset: 0; pointer-events: none; transition: background .8s; }
#tint.evening { background: linear-gradient(rgba(10, 20, 55, .55), rgba(5, 8, 25, .62)); mix-blend-mode: multiply; }
#placeholder-label { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); text-align: center; pointer-events: none; font-family: var(--serif); }
#placeholder-label .t { font-size: 3.4cqh; letter-spacing: .25em; text-transform: uppercase; color: var(--ink); text-shadow: 0 2px 8px #000; }
#placeholder-label .s { font-size: 1.7cqh; font-style: italic; color: var(--ink-dim); margin-top: .5cqh; }

#actors, #hotspots, #nav { position: absolute; inset: 0; }
#actors { pointer-events: none; }
/* Personnage dans un décor provisoire : portrait encadré (les images source sont en pose de référence) */
.actor { position: absolute; top: 20%; height: 52%; aspect-ratio: 3/4; pointer-events: auto; cursor: pointer; overflow: hidden; border: 3px solid #e9dcc0; border-radius: 4px; box-shadow: 0 12px 40px rgba(0, 0, 0, .7); background: #3a3530; }
.actor img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; transform: scale(2.1); transform-origin: 50% 3%; filter: brightness(.95) contrast(1.05); transition: filter .2s; }
.actor:hover img { filter: brightness(1.12) contrast(1.05); }
.actor::after { content: attr(data-name); position: absolute; left: 0; right: 0; bottom: 0; padding: .6cqh; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); font-family: var(--serif); font-size: 2.2cqh; color: var(--ink); }

.hs { position: absolute; cursor: pointer; border-radius: 6px; }
.hs:not(.card):hover { background: none; }
body.debug .hs { outline: 1px dashed #0ff; background: rgba(0, 255, 255, .08); }
body.debug .hs::after { content: attr(data-id); position: absolute; left: 2px; top: 2px; font-size: 11px; color: #0ff; background: #000a; padding: 0 3px; }
/* Dans un décor provisoire, les points d'intérêt sont affichés comme des étiquettes */
.hs.card { display: flex; align-items: center; justify-content: center; text-align: center; padding: .6cqh 1cqh; background: rgba(30, 20, 12, .55); border: 1px solid var(--panel-border); font-family: var(--serif); font-size: 2.1cqh; color: var(--ink); text-shadow: 0 1px 3px #000; }
.hs.card:hover { background: rgba(70, 45, 20, .75); }
.hs.locked { opacity: .55; }

.nav-arrow { position: absolute; display: flex; align-items: center; justify-content: center; gap: .6cqh; padding: .8cqh 1.6cqh; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .18); border-radius: 30px; font-size: 1.9cqh; color: var(--ink); cursor: pointer; backdrop-filter: blur(3px); }
.nav-arrow:hover { background: rgba(80, 50, 20, .7); }

#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 1.2cqh 1.6cqh; pointer-events: none; z-index: 20; }
#hud-left { display: flex; gap: 1.4cqh; align-items: center; font-family: var(--serif); font-size: 2.2cqh; text-shadow: 0 1px 4px #000; }
#hud-day { font-weight: 700; color: var(--gold); letter-spacing: .1em; text-transform: uppercase; }
#hud-place { color: var(--ink-dim); font-style: italic; }
#hud-right { display: flex; gap: 1cqh; pointer-events: auto; }
.hud-btn { background: rgba(0, 0, 0, .5); border: 1px solid var(--panel-border); border-radius: 6px; padding: .6cqh 1.4cqh; font-size: 1.8cqh; }
.hud-btn:hover { background: rgba(90, 55, 20, .8); }
.hud-btn.pulse { animation: pulse 1.2s ease-in-out 4; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(214, 168, 74, .55); } }

#inventory { position: absolute; left: 1.6cqh; bottom: 1.6cqh; display: flex; gap: 1cqh; z-index: 20; }
.inv-item { width: 7.5cqh; height: 7.5cqh; border-radius: 8px; background: var(--panel); border: 1px solid var(--panel-border); display: flex; align-items: center; justify-content: center; font-size: 3.6cqh; cursor: pointer; position: relative; }
.inv-item:hover, .inv-item.selected { border-color: var(--gold); background: rgba(80, 50, 20, .9); }
.inv-item.selected { box-shadow: 0 0 0 2px var(--gold); }
body.using, body.using .hs, body.using .actor { cursor: var(--item-cursor, crosshair); }

#hover-label { position: absolute; z-index: 30; pointer-events: none; padding: .4cqh 1cqh; background: rgba(0, 0, 0, .75); border-radius: 4px; font-size: 1.8cqh; white-space: nowrap; display: none; }
#hover-label small { color: var(--ink-dim); margin-left: .8cqh; }
#toast { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); z-index: 40; padding: 1cqh 2.2cqh; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 6px; font-size: 2cqh; opacity: 0; transition: opacity .4s; pointer-events: none; }
#toast.show { opacity: 1; }

#dialogue { position: absolute; left: 3%; right: 3%; bottom: 2.5%; z-index: 48; display: flex; gap: 2cqh; min-height: 21%; padding: 1.8cqh 2.4cqh; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); cursor: pointer; }
#dlg-portrait { flex: 0 0 auto; width: 15cqh; height: 17cqh; border-radius: 8px; overflow: hidden; border: 1px solid var(--panel-border); background: #2a2622; }
#dlg-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 4%; transform: scale(2.3); transform-origin: 50% 0%; }
#dlg-portrait.none { display: none; }
#dlg-body { flex: 1; display: flex; flex-direction: column; }
#dlg-name { font-family: var(--serif); font-weight: 700; font-size: 2.5cqh; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .6cqh; }
#dlg-text { font-family: var(--serif); font-size: 3cqh; line-height: 1.35; }
#dlg-text.narration { font-style: italic; color: var(--ink-dim); }
#dlg-text.thought { font-style: italic; }
#dlg-choices { display: flex; flex-direction: column; gap: .5cqh; margin-top: .4cqh; }
.choice { text-align: left; background: none; border: none; padding: .4cqh 1cqh; font-family: var(--serif); font-size: 2.7cqh; color: var(--ink); border-left: 3px solid transparent; }
.choice:hover { border-left-color: var(--accent); background: rgba(255, 255, 255, .05); }
.choice.seen { color: var(--ink-dim); }

#overlay { position: absolute; inset: 0; z-index: 22; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; }
.close-x { position: absolute; top: 2cqh; right: 2.4cqh; font-size: 3cqh; background: none; border: none; color: var(--ink); z-index: 2; }

/* Carte */
.map-wrap { position: relative; height: 92%; aspect-ratio: 1536/1024; }
.map-wrap > img { width: 100%; height: 100%; border-radius: 6px; box-shadow: 0 10px 50px #000; }
.map-pin { position: absolute; border-radius: 6px; cursor: pointer; }
.map-pin.open { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(214, 168, 74, .7); animation: glow 2s infinite; }
.map-pin.closed { background: rgba(10, 8, 6, .62); cursor: not-allowed; }
.map-pin.here::after { content: "● Vous êtes ici"; position: absolute; left: 0; top: -2.6cqh; font-size: 1.6cqh; color: #fff; background: var(--accent); padding: 0 .6cqh; border-radius: 3px; white-space: nowrap; }
.map-pin.hidden-pin { background: rgba(20, 16, 10, .9); border: 1px dashed rgba(255, 255, 255, .15); cursor: default; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 4px rgba(214, 168, 74, .3); } }

/* Carnet */
.notebook { width: 70%; height: 86%; background: #efe4cc url() ; color: #2a1d10; border-radius: 4px 10px 10px 4px; box-shadow: 0 10px 60px #000, inset 18px 0 30px -18px rgba(0, 0, 0, .5); padding: 4cqh 6cqh; overflow-y: auto; font-family: var(--type); position: relative;
  background-image: repeating-linear-gradient(transparent 0 3.6cqh, rgba(60, 90, 150, .18) 3.6cqh calc(3.6cqh + 1px)); }
.notebook h2 { font-family: var(--serif); font-size: 4cqh; margin: 0 0 2cqh; color: #5a1a12; }
.notebook h3 { font-size: 2.4cqh; margin: 2.4cqh 0 .6cqh; color: #3b2a14; text-decoration: underline; }
.notebook p, .notebook li { font-size: 2.1cqh; line-height: 3.6cqh; margin: 0; }
.notebook ul { list-style: none; padding: 0; margin: 0; }
.notebook li::before { content: "• "; }
.notebook .q { color: #8a2a1a; }
.notebook .close-x { color: #2a1d10; }

/* Images en gros plan (photos, tableau, téléphone) */
.inspect { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1.6cqh; margin-bottom: 24cqh; }
.inspect .caption { font-family: var(--serif); font-size: 2.6cqh; color: var(--ink); text-align: center; max-width: 80cqh; }
.frame-gold { padding: 2.4cqh; background: linear-gradient(135deg, #7a5a22, #d6a84a 30%, #6b4a18 60%, #c9973e); box-shadow: 0 10px 40px #000, inset 0 0 12px #0008; }
.frame-gold img { display: block; height: 52cqh; }
.plaque { margin-top: 1cqh; padding: .6cqh 2.4cqh; background: linear-gradient(#d9b866, #a7822f); color: #2b1b06; font-family: var(--serif); font-weight: 700; letter-spacing: .14em; font-size: 2.2cqh; text-align: center; border-radius: 2px; }
.old-photo { position: relative; background: #f1e8d6; padding: 1.6cqh 1.6cqh 5cqh; box-shadow: 0 8px 30px #000; transform: rotate(var(--rot, 0deg)); }
.old-photo .pic { position: relative; width: 56cqh; aspect-ratio: 16/10; overflow: hidden; background: #333; }
.old-photo .pic > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.old-photo .figure { position: absolute; bottom: -6%; height: 78%; aspect-ratio: 2/3; overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 22% 52% at 50% 48%, #000 60%, transparent 100%); mask-image: radial-gradient(ellipse 22% 52% at 50% 48%, #000 60%, transparent 100%); }
.old-photo .figure img { width: 100%; height: 100%; object-fit: cover; }
.old-photo .sepia { filter: grayscale(1) sepia(.75) contrast(1.15) brightness(.95); }
.old-photo .bw { filter: grayscale(1) contrast(1.2) brightness(.95); }
.old-photo .faded { filter: saturate(.55) sepia(.3) contrast(.95) brightness(1.05); }
.old-photo .legend { position: absolute; left: 0; right: 0; bottom: 1.2cqh; text-align: center; font-family: var(--type); color: #3a2a18; font-size: 2.2cqh; }
.old-photo.small .pic { width: 38cqh; }
.photo-row { display: flex; gap: 3cqh; align-items: center; }
.face-row { display: flex; gap: 3cqh; }
.face { width: 19cqh; height: 22cqh; overflow: hidden; border: 6px solid #f1e8d6; box-shadow: 0 6px 20px #000; position: relative; }
.face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 3%; transform: scale(3.2); transform-origin: 50% 2%; }
.face span { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; background: #f1e8d6; color: #3a2a18; font-family: var(--type); font-size: 2cqh; }

/* Téléphone */
.phone { width: 44cqh; height: 82cqh; border-radius: 5cqh; background: #0d0d0f; padding: 2cqh 1.6cqh; box-shadow: 0 0 0 2px #444, 0 20px 60px #000; display: flex; flex-direction: column; }
.phone-screen { flex: 1; border-radius: 3.4cqh; background: linear-gradient(#1c2333, #0d1018); overflow: hidden; display: flex; flex-direction: column; font-family: var(--sans); }
.phone-top { text-align: center; font-size: 1.6cqh; color: #aaa; padding: 1.2cqh 0; }
.sms { margin: 1cqh 2cqh; padding: 1.4cqh 1.8cqh; border-radius: 2cqh; background: #2c3445; font-size: 2.2cqh; line-height: 1.4; }
.sms-from { margin: 2cqh 2cqh 0; font-size: 1.7cqh; color: #9fb0d0; font-weight: 600; }
.phone-photo { flex: 1; display: flex; align-items: center; justify-content: center; }
.phone-search { margin: 2cqh; padding: 1.4cqh; border-radius: 3cqh; background: #fff; color: #222; font-size: 1.8cqh; }

/* Écrans plein cadre */
.screen { position: absolute; inset: 0; z-index: 50; background: #000; }
#menu-screen img { width: 100%; height: 100%; display: block; }
.menu-hit { position: absolute; background: transparent; border: none; border-radius: 4px; }
.menu-hit:hover { background: rgba(179, 38, 30, .18); box-shadow: inset 3px 0 0 var(--accent); }
.menu-hit.disabled { cursor: not-allowed; }
.menu-hit.disabled:hover { background: rgba(0, 0, 0, .3); box-shadow: none; }
#video-screen video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#skip-video { position: absolute; right: 2.4cqh; bottom: 2.4cqh; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .3); border-radius: 20px; padding: .8cqh 2cqh; font-size: 1.9cqh; }

.panel { width: 60%; padding: 4cqh; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; position: relative; font-size: 2.2cqh; line-height: 1.6; }
.panel h2 { font-family: var(--serif); color: var(--gold); margin-top: 0; font-size: 3.6cqh; }
.panel label { display: flex; justify-content: space-between; align-items: center; margin: 1.4cqh 0; }
.panel .row { display: flex; gap: 1.4cqh; flex-wrap: wrap; margin-top: 2cqh; }
.panel .btn { background: rgba(90, 55, 20, .6); border: 1px solid var(--panel-border); border-radius: 6px; padding: .8cqh 2cqh; }

#fader { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 45; transition: opacity .6s; }
#fader.on { opacity: 1; pointer-events: auto; }

.title-card { position: absolute; inset: 0; z-index: 46; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity 1.2s; font-family: var(--serif); text-shadow: 0 3px 16px #000; }
.title-card.show { opacity: 1; }
.title-card .big { font-size: 7cqh; letter-spacing: .18em; font-weight: 700; }
.title-card .small { font-size: 3cqh; letter-spacing: .3em; color: var(--ink-dim); margin-top: 1cqh; }
.title-card.sign .big { font-family: var(--serif); background: #1d3a26; color: #f4f0e2; padding: 2cqh 5cqh 1cqh; border: 6px solid #f4f0e2; border-radius: 8px; font-size: 5.4cqh; }
.title-card.sign .small { background: #1d3a26; color: #f4f0e2; padding: .6cqh 3cqh 1.4cqh; border: 6px solid #f4f0e2; border-top: none; border-radius: 0 0 8px 8px; margin-top: 0; letter-spacing: .2em; }
#dialogue::after { content: "▼ cliquer"; position: absolute; right: 2.4cqh; bottom: 1.4cqh; font-size: 1.6cqh; color: var(--gold); opacity: .7; animation: blink 1.4s infinite; }
#dialogue.choosing::after { content: none; }
@keyframes blink { 50% { opacity: .15; } }
/* Les calques plein cadre laissent passer les clics ; seuls leurs éléments sont cliquables */
#hotspots, #nav, #actors { pointer-events: none; }
.hs, .nav-arrow, .actor { pointer-events: auto; }

.nav-zone { position: absolute; pointer-events: auto; }
body.debug .nav-zone { outline: 1px dashed #f0f; background: rgba(255, 0, 255, .08); }
#hover-label { background: none; font-family: var(--serif); font-size: 2.3cqh; font-style: italic; color: #fff; text-shadow: 0 0 4px #000, 0 1px 3px #000, 0 0 10px #000; }
body.using, body.using * { cursor: var(--item-cursor, crosshair) !important; }
/* Vraies photographies B17 : l'image contient déjà le papier et la date */
.old-photo.real { padding: 0; background: none; box-shadow: 0 10px 34px rgba(0, 0, 0, .8); }
.old-photo.real img { display: block; height: 52cqh; width: auto; }
.old-photo.real.small img { height: 26cqh; }
.phone .old-photo.real.small img { height: auto; width: 38cqh; }
.face.real img { transform: none; object-position: 50% 30%; }
/* Vignettes personnalisées : portrait déjà cadré, dans son décor */
#dlg-portrait.vig { width: 16cqh; height: 19cqh; margin-top: -5cqh; border: 3px solid #c9973e; border-radius: 6px; box-shadow: 0 0 0 1px #3a2610, 0 8px 22px rgba(0, 0, 0, .7), inset 0 0 18px rgba(0, 0, 0, .6); background: #1a120a; }
#dlg-portrait.vig img { transform: none; object-position: 50% 20%; }
#hud { background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); padding-bottom: 3cqh; }
.inv-item { width: 9cqh; height: 9cqh; background: radial-gradient(circle at 50% 40%, rgba(60, 40, 20, .85), rgba(18, 12, 8, .9)); }
.inv-item img { width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .7)); transition: transform .15s; }
.inv-item:hover img { transform: scale(1.08); }
#video-screen video { object-fit: cover; }

/* Écrans de sauvegarde / chargement */
.panel.saves { width: 78%; max-height: 86%; overflow-y: auto; }
.save-list { display: flex; flex-direction: column; gap: 1.2cqh; margin-top: 1.6cqh; }
.save-card { display: flex; gap: 1.8cqh; align-items: center; padding: 1.2cqh; background: rgba(255, 240, 210, .05); border: 1px solid var(--panel-border); border-radius: 8px; }
.save-card.auto { border-style: dashed; }
.save-thumb { flex: 0 0 auto; width: 22cqh; aspect-ratio: 16/9; border-radius: 5px; background-size: cover; background-position: center; box-shadow: 0 4px 12px #000; }
.save-meta { flex: 1; min-width: 0; line-height: 1.35; }
.save-name { font-family: var(--serif); font-size: 2.6cqh; color: var(--gold); font-weight: 700; }
.save-when { font-size: 1.9cqh; }
.save-progress { font-size: 1.8cqh; color: var(--ink-dim); font-style: italic; }
.save-date { font-size: 1.6cqh; color: var(--ink-dim); margin-top: .4cqh; }
.save-actions { display: flex; flex-direction: column; gap: .8cqh; }
.panel .btn.danger { background: rgba(120, 30, 20, .55); }
.panel .btn:disabled { opacity: .4; cursor: not-allowed; }
.save-new { display: flex; gap: 1.2cqh; }
.save-new input { flex: 1; font: inherit; font-size: 2.2cqh; padding: .8cqh 1.2cqh; background: rgba(0, 0, 0, .4); color: var(--ink); border: 1px solid var(--panel-border); border-radius: 6px; }
/* personnages au-dessus des zones du décor (ex. Paul au Diner, Bennett au Murphy's) */
#actors { z-index: 2; }
#hotspots { z-index: 1; }
#nav { z-index: 3; }
