:root {
  --gold: #c9a24a;
  --gold-2: #e8c877;
  --ember: #e2662a;
  --ink: #0c0a09;
  --panel: rgba(16, 13, 11, 0.86);
  --text: #ece6da;
  --muted: #a49a8b;
  --line: rgba(201, 162, 74, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font-family: Inter, system-ui, sans-serif; overflow: hidden; }
#app { position: fixed; inset: 0; }
canvas#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; }

/* Titre */
.game-title { font-family: Cinzel, Georgia, serif; font-weight: 900; letter-spacing: 0.18em; margin: 0; font-size: clamp(34px, 5.4vw, 76px);
  background: linear-gradient(180deg, #f6e3a8 0%, #c9a24a 45%, #8a6424 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.6)); }
.game-sub { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: clamp(16px, 1.6vw, 22px); color: #d8cbb2; letter-spacing: 0.04em; margin-top: 6px; }

/* Chargement */
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, #241a12 0%, #0c0a09 70%); z-index: 50; transition: opacity 0.9s; }
#loading.out { opacity: 0; pointer-events: none; }
.load-inner { text-align: center; width: min(560px, 86vw); position: relative; z-index: 2; }
.emblem svg { width: 84px; height: 84px; fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; opacity: 0.9; filter: drop-shadow(0 0 12px rgba(226, 102, 42, 0.45)); }
.load-bar { margin: 34px auto 12px; height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
#loadFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ember), var(--gold-2)); transition: width 0.3s; box-shadow: 0 0 12px var(--ember); }
#loadText { font-size: 13px; color: var(--muted); letter-spacing: 0.06em; }
.load-tip { margin-top: 28px; font-family: 'Cormorant Garamond', serif; font-size: 18px; color: #b9ad97; font-style: italic; min-height: 26px; }
.embers { position: absolute; inset: 0; overflow: hidden; z-index: 1; }
.embers i { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%; background: #ff9a4a; box-shadow: 0 0 8px #ff7a2a; animation: rise linear infinite; opacity: 0; }
@keyframes rise { 0% { transform: translateY(0) translateX(0); opacity: 0; } 10% { opacity: 0.9; } 100% { transform: translateY(-105vh) translateX(40px); opacity: 0; } }

/* Menu */
#menu { position: absolute; inset: 0; z-index: 30; background: linear-gradient(90deg, rgba(8, 6, 5, 0.86) 0%, rgba(8, 6, 5, 0.55) 38%, rgba(8, 6, 5, 0) 70%); }
.menu-col { position: absolute; left: clamp(24px, 7vw, 120px); top: 50%; transform: translateY(-50%); width: min(520px, 86vw); }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 38px; }
.mbtn { appearance: none; text-align: left; border: 1px solid var(--line); background: rgba(20, 16, 12, 0.6); color: var(--text); padding: 13px 18px; border-radius: 3px; cursor: pointer; font-size: 17px; letter-spacing: 0.03em; transition: background 0.2s, border-color 0.2s, transform 0.15s; display: block; width: 100%; }
.mbtn:hover:not(:disabled), .mbtn:focus-visible { background: rgba(201, 162, 74, 0.16); border-color: var(--gold); transform: translateX(4px); outline: none; }
.mbtn.primary { border-color: var(--gold); background: linear-gradient(90deg, rgba(201, 162, 74, 0.22), rgba(20, 16, 12, 0.6)); font-family: Cinzel, serif; font-size: 22px; font-weight: 700; }
.mbtn small { display: block; font-family: Inter, sans-serif; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 3px; letter-spacing: 0.02em; }
.mb-kicker { display: block; font-family: Inter, sans-serif; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--gold); font-weight: 600; margin-bottom: 4px; }
.mbtn.locked { opacity: 0.55; cursor: not-allowed; }
.disclaimer { margin-top: 30px; font-size: 11.5px; color: #8d8475; line-height: 1.5; max-width: 440px; }

/* Panneaux */
.overlay { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 4, 3, 0.55); backdrop-filter: blur(3px); }
.panel { width: min(880px, 92vw); max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 26px 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.panel.small { width: min(420px, 92vw); display: flex; flex-direction: column; gap: 10px; }
.panel h2 { font-family: Cinzel, serif; color: var(--gold-2); margin: 0 0 16px; letter-spacing: 0.12em; font-size: 24px; }
.panel h3 { font-family: Cinzel, serif; color: var(--gold); font-size: 14px; letter-spacing: 0.16em; margin: 0 0 12px; text-transform: uppercase; }
.panel p { line-height: 1.6; color: #d4ccbd; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 34px; }
.opt { display: flex; flex-direction: column; gap: 6px; font-size: 14px; margin-bottom: 14px; color: #ddd4c4; }
.opt.check { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.opt .val { float: right; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.opt select, .opt input[type=range] { width: 100%; accent-color: var(--gold); }
.opt select { background: #1b1612; color: var(--text); border: 1px solid var(--line); padding: 7px 8px; border-radius: 3px; }
.opt input[type=checkbox] { accent-color: var(--gold); width: 17px; height: 17px; }
.opt-note { font-size: 12px !important; color: var(--muted) !important; margin: -6px 0 14px; line-height: 1.45 !important; }
.panel-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.panel-actions .mbtn { width: auto; }
.controls-help { margin-top: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.8; border-top: 1px solid var(--line); padding-top: 12px; }
.controls-help b { color: var(--text); }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#objective { position: absolute; left: 34px; top: 30px; max-width: 360px; padding-left: 14px; border-left: 2px solid var(--gold); text-shadow: 0 2px 8px #000; animation: slideIn 0.6s ease; }
.obj-label { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
#objText { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 600; margin-top: 2px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
#prompt { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: rgba(10, 8, 6, 0.6); border: 1px solid var(--line); padding: 8px 16px 8px 8px; border-radius: 30px; font-size: 15px; text-shadow: 0 1px 4px #000; }
.key { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px; background: var(--gold); color: #1a1209; font-weight: 700; font-size: 14px; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%); }
#crosshair span { position: absolute; inset: 0; border: 1.5px solid rgba(255, 255, 255, 0.8); border-radius: 50%; }
#crosshair span::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: #fff; border-radius: 50%; }
#qte { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); text-align: center; }
#qte svg { width: 110px; height: 110px; transform: rotate(-90deg); }
#qte .track { fill: none; stroke: rgba(255, 255, 255, 0.15); stroke-width: 6; }
#qte .fill { fill: none; stroke: var(--ember); stroke-width: 6; stroke-dasharray: 264; stroke-dashoffset: 264; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--ember)); }
#qteKey { position: absolute; left: 50%; top: 55px; transform: translate(-50%, -50%); font-family: Oswald, sans-serif; font-size: 34px; color: #fff; text-shadow: 0 0 10px var(--ember); }
#qteText { margin-top: 8px; font-family: Cinzel, serif; font-weight: 700; letter-spacing: 0.12em; font-size: 18px; text-shadow: 0 2px 8px #000; }
#qte.pulse #qteKey { animation: pulse 0.5s infinite alternate; }
@keyframes pulse { to { transform: translate(-50%, -50%) scale(1.15); } }
#toast { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); background: rgba(10, 8, 6, 0.7); border: 1px solid var(--line); padding: 10px 18px; border-radius: 3px; font-size: 14px; color: #e8dcc4; animation: slideIn 0.4s; }
#fps { position: absolute; right: 10px; top: 8px; font: 12px/1 monospace; color: #9f9; text-shadow: 0 1px 2px #000; }

/* Sous-titres */
#subtitles { position: absolute; left: 50%; bottom: 7.5%; transform: translateX(-50%); width: min(900px, 86vw); text-align: center; z-index: 40; pointer-events: none; text-shadow: 0 2px 6px #000, 0 0 20px rgba(0, 0, 0, 0.8); }
#subName { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; }
#subText { font-size: clamp(17px, 1.6vw, 23px); line-height: 1.4; font-weight: 500; color: #fff; }
#subText i { color: #d9cfbd; }
#skipHint { position: absolute; right: 26px; bottom: 22px; font-size: 12px; color: rgba(255, 255, 255, 0.55); z-index: 41; letter-spacing: 0.06em; }
#lockHint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.6); padding: 10px 16px; border-radius: 4px; z-index: 45; font-size: 14px; }

/* Cinéma */
#letterbox .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 15; transition: height 0.8s ease; }
#letterbox .bar.top { top: 0; } #letterbox .bar.bottom { bottom: 0; }
#letterbox.on .bar { height: 10.5vh; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 35; transition: opacity 1s ease; }
#titleCard { position: absolute; inset: 0; display: grid; place-items: center; z-index: 38; pointer-events: none; }
.tc-inner { text-align: center; animation: tcIn 1.6s ease; }
.tc-kicker { font-size: 12px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.tc-title { font-family: Cinzel, serif; font-size: clamp(30px, 4.6vw, 64px); font-weight: 700; letter-spacing: 0.12em; color: #f1e6cd; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.8); }
.tc-sub { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: clamp(16px, 1.6vw, 22px); color: #cfc3ab; margin-top: 10px; max-width: 760px; line-height: 1.5; }
@keyframes tcIn { from { opacity: 0; letter-spacing: 0.3em; } to { opacity: 1; } }

@media (max-width: 760px) { .opt-grid { grid-template-columns: 1fr; } }

/* message d'erreur de chargement */
#loadText.load-error { color: #f0b27a; max-width: 34em; margin-inline: auto; line-height: 1.45; }

/* numéro de version et historique */
.ver-line { margin-top: 10px; }
.ver-badge { display: inline-block; font-family: Inter, sans-serif; font-size: 11.5px; font-weight: 600; letter-spacing: 0.12em; color: var(--gold-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; background: rgba(20, 16, 12, 0.55); font-variant-numeric: tabular-nums; }
.pause-ver { margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; letter-spacing: 0.04em; }
#changelog { display: grid; gap: 18px; }
#changelog .cl-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#changelog .cl-v { font-family: Cinzel, serif; font-weight: 700; color: var(--gold-2); font-size: 18px; letter-spacing: 0.08em; }
#changelog .cl-d { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
#changelog .cl-now { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--gold); font-weight: 600; }
#changelog ul { margin: 8px 0 0; padding-left: 20px; color: #d4ccbd; line-height: 1.55; font-size: 14px; }
#changelog li + li { margin-top: 3px; }
