/* ============ ESCAPE THE GLOUAR — HORROR UI v2 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', Courier, monospace;
  color: #d5cec2;
  user-select: none;
}

.hidden { display: none !important; }

#game-container, #game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
}

/* ---------------- MENIU ---------------- */
#menu {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(48,26,14,.65) 0%, rgba(6,4,8,.97) 78%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0px, rgba(255,255,255,.018) 1px, transparent 1px, transparent 3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  overflow-y: auto;
}
.menu-inner {
  width: 100%;
  display: flex; justify-content: center;
  padding: 30px 16px;
}
.menu-card {
  max-width: 660px;
  width: 100%;
  text-align: center;
  padding: 42px 40px 34px;
  background: linear-gradient(180deg, rgba(24,18,16,.92), rgba(10,7,9,.96));
  border: 1px solid #4a3630;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(120,30,10,.25), inset 0 0 80px rgba(0,0,0,.6);
  animation: menuFadeIn 1.4s ease-out;
}
@keyframes menuFadeIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.game-title {
  font-size: clamp(40px, 6vw, 68px);
  letter-spacing: .12em;
  font-weight: 900;
  color: #ddd6ca;
  text-shadow: 0 0 18px rgba(140,20,10,.75), 3px 3px 0 #1a0000;
  line-height: 1.05;
}
.game-title .blood {
  color: #c11717;
  animation: bloodFlicker 4s infinite;
}
@keyframes bloodFlicker {
  0%, 100% { opacity: 1; text-shadow: 0 0 22px rgba(220,30,20,.85), 3px 3px 0 #1a0000; }
  92% { opacity: 1; }
  93% { opacity: .35; text-shadow: none; }
  94% { opacity: 1; }
  96% { opacity: .5; }
  97% { opacity: 1; }
}
.tagline { margin-top: 12px; font-style: italic; color: #97897a; font-size: 14px; }

.menu-map {
  margin-top: 26px;
  padding: 18px 20px;
  text-align: left;
  border: 1px solid #3e4a58;
  background: linear-gradient(180deg, rgba(18,24,32,.85), rgba(8,11,16,.9));
  border-radius: 4px;
}
.menu-map:hover { border-color: #6a7f96; }
.map-name {
  font-weight: bold; font-size: 18px; letter-spacing: .1em;
  color: #ffd27a; margin-bottom: 8px;
}
.map-desc { font-size: 13px; line-height: 1.6; color: #9aa4ae; }
.features { list-style: none; margin-top: 14px; }
.features li {
  font-size: 12.5px; line-height: 1.9; color: #b8ab97;
}
.features li::before { content: ''; }

#btn-start {
  margin-top: 28px;
  padding: 16px 52px;
  font-family: inherit;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: .18em;
  color: #fff2dd;
  background: linear-gradient(180deg, #8a2410, #380c04);
  border: 1px solid #d4552a;
  border-radius: 3px;
  cursor: pointer;
  transition: all .2s;
}
#btn-start:hover {
  background: linear-gradient(180deg, #c23a16, #57150a);
  box-shadow: 0 0 30px rgba(212,85,42,.55);
  transform: translateY(-2px);
}
.controls-hint { margin-top: 20px; font-size: 12px; color: #776e62; letter-spacing: .04em; }
.warning { margin-top: 12px; color: #b33a33; font-size: 12px; letter-spacing: .06em; }

/* dificultate + volum */
.diff-row { margin-top: 22px; display: flex; gap: 10px; justify-content: center; }
.diff-btn {
  padding: 8px 22px;
  font-family: inherit; font-size: 13px; font-weight: bold;
  letter-spacing: .1em; cursor: pointer;
  color: #97897a;
  background: rgba(0,0,0,.4);
  border: 1px solid #3e3630; border-radius: 3px;
  transition: all .15s;
}
.diff-btn:hover { border-color: #6a5a48; color: #cfc2ae; }
.diff-btn.sel {
  color: #ffd27a;
  border-color: #d4552a;
  background: linear-gradient(180deg, rgba(138,36,16,.45), rgba(56,12,4,.45));
  box-shadow: 0 0 14px rgba(212,85,42,.35);
}
#vol-wrap {
  margin-top: 14px;
  font-size: 13px; color: #97897a;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
#volume { width: 200px; accent-color: #d4552a; }

/* ================= MENIU v3 — NEGRU, SÂNGE CARE CURGE, MINIM TEXT ================= */
#menu { background: #030303; }
.drips { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.drip {
  position: absolute; left: var(--x); top: 0;
  width: 5px; height: 0;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #e02020, #6e0a0a);
  box-shadow: 0 0 8px rgba(193,23,23,.4);
  animation: dripGrow var(--t, 10s) ease-in var(--d, 0s) infinite;
}
@keyframes dripGrow {
  0%   { height: 0;    opacity: 0; }
  7%   { height: 14px; opacity: .95; }
  82%  { height: var(--h); opacity: .85; }
  100% { height: var(--h); opacity: 0; }
}

.menu-card {
  max-width: 540px;
  background: #060606;
  border: 1px solid #2b0509;
  box-shadow: none;
  padding: 52px 40px 38px;
  font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
}
.game-title {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(46px, 7vw, 88px);
  letter-spacing: .05em;
  color: #b4b4be;
  text-shadow: 0 0 26px rgba(193,23,23,.22);
  line-height: 1.02;
}
.game-title .blood {
  color: #c11717;
  text-shadow: 0 0 34px rgba(193,23,23,.6);
  animation: none;
}
.tagline {
  margin-top: 18px;
  color: #84848f;
  font-size: 15.5px;
  line-height: 1.55;
}
.mini-hint { margin-top: 20px; color: #55555f; font-size: 11px; letter-spacing: .04em; line-height: 1.7; }

/* butoanele — mai puține și mai curate */
#btn-start {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(180deg, #8a1010, #3d0606);
  border-color: #c11717;
  font-size: 17px;
  padding: 14px 44px;
  display: block;
  margin: 26px auto 0;
}
#btn-start:hover { background: linear-gradient(180deg, #ad1616, #571010); }
.diff-row, #vol-wrap, .fs-row { font-family: 'Segoe UI', Arial, sans-serif; }
.fs-row { margin-top: 14px; }

/* ascunde TOT textul vechi din meniu */
.menu-map, .features, .controls-hint, .warning,
.map-desc, .map-name { display: none !important; }
.fs-row { margin-top: 16px; }
#btn-fullscreen, #btn-fs-paused {
  padding: 8px 24px;
  font-family: inherit; font-size: 13px; font-weight: bold;
  letter-spacing: .08em; cursor: pointer;
  color: #97897a;
  background: rgba(0,0,0,.4);
  border: 1px solid #3e3630; border-radius: 3px;
  transition: all .15s;
}
#btn-fullscreen:hover, #btn-fs-paused:hover {
  border-color: #6a7f96; color: #cfd8e0;
}
#btn-fs-paused { margin-top: 22px; }

/* overlay debug (F10) */
#debug {
  position: fixed; top: 10px; left: 10px; z-index: 90;
  padding: 8px 10px;
  background: rgba(0,20,0,.75);
  border: 1px solid #1a5c1a; border-radius: 3px;
  color: #6dff6d; font-family: 'Courier New', monospace;
  font-size: 11px; line-height: 1.55;
  white-space: pre; pointer-events: none;
}

/* ================= HUD ================= */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  display: none;
  font-family: 'Courier New', monospace;
}
body[data-state="PLAYING"] #hud,
body[data-state="JUMPSCARE"] #hud { display: block; }

#objective {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  color: #ffd54a; font-size: 15px; font-weight: bold;
  text-shadow: 0 0 8px rgba(255,213,74,.6), 0 2px 4px #000;
  letter-spacing: 1px;
}

#stamina-wrap {
  position: absolute; bottom: 22px; left: 24px;
  width: 190px; height: 12px;
  background: rgba(0,0,0,.55);
  border: 1px solid #5a5a6e;
}
#stamina-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #3ddc63, #a8e063);
  transition: width .12s linear;
}
#stamina-bar.low { background: linear-gradient(90deg, #c13636, #ff7a45); }

#keys-hud {
  position: absolute; bottom: 44px; left: 24px;
  color: #ffd54a; font-size: 17px; font-weight: bold;
  text-shadow: 0 0 8px rgba(255,213,74,.5), 0 2px 4px #000;
}

#compass {
  position: absolute; top: 52px; right: 190px;
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 20px solid #ffd54a;
  filter: drop-shadow(0 0 4px rgba(255,213,74,.7));
}

#minimap-wrap {
  position: absolute; top: 18px; right: 18px;
  border: 2px solid #5a5a6e;
  background: rgba(0,0,0,.65);
  box-shadow: 0 0 14px rgba(0,0,0,.7);
}
#minimap { display: block; }
#mm-label {
  position: absolute; bottom: -20px; right: 0;
  color: #8f8fa3; font-size: 10px; letter-spacing: 1px;
}

#proximity-text {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #ff5555; font-size: 16px; font-weight: bold;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(255,42,42,.7), 0 2px 4px #000;
  animation: proxPulse 1.4s infinite;
}
@keyframes proxPulse {
  0%,100% { opacity: .75; } 50% { opacity: 1; }
}

/* ================= SUBTITLES ================= */
#subtitle {
  position: fixed; bottom: 150px; left: 50%; transform: translateX(-50%);
  max-width: 80%;
  padding: 12px 26px;
  background: rgba(0,0,0,.78);
  border-left: 4px solid #fff;
  border-radius: 2px;
  color: #f2ede2; font-size: 21px; line-height: 1.45;
  font-weight: bold;
  letter-spacing: .02em;
  text-shadow: 0 2px 3px #000;
  font-family: 'Courier New', monospace;
  z-index: 20; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
#subtitle.visible, #subtitle.show { opacity: 1; }
#subtitle.glouar { border-left-color: #ff2a2a; color: #ffc9c9; }
#subtitle.pemk   { border-left-color: #c47ae0; color: #eadcff; }

/* ================= VIGNETTES & FX ================= */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 11;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0,0,0,.62) 100%);
}
#danger-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 12;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(160,0,0,.55) 100%);
  transition: opacity .3s;
}
#static-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 13;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 14;
  background: repeating-linear-gradient(
    to bottom, transparent 0 2px, rgba(0,0,0,.09) 2px 4px);
}
#red-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: #ff0000; opacity: 0;
}

/* elemente HUD specifice din HTML */
#stamina-label {
  font-size: 10px; letter-spacing: 2px; color: #8f8fa3; margin-bottom: 4px;
}
#stamina-track {
  width: 190px; height: 12px;
  background: rgba(0,0,0,.55);
  border: 1px solid #5a5a6e;
}
#minimap-label {
  font-size: 10px; letter-spacing: 1px; color: #8f8fa3;
  padding: 3px 6px 1px; text-align: center;
}
#glouar-proximity {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
}

/* hint interacțiune E (Golf) — MAI JOS decât subtitle, să nu se suprapună */
#interact-hint {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  padding: 8px 22px;
  background: rgba(0,0,0,.78);
  border: 1px solid #ffd54a; border-radius: 3px;
  color: #ffd54a; font-size: 15px; font-weight: bold;
  letter-spacing: .08em;
  z-index: 21; pointer-events: none;
}

/* indicatorul „click pentru replica următoare” din dialoguri */
#dlg-next {
  position: fixed; bottom: 112px; left: 50%; transform: translateX(-50%);
  color: #ffd54a; font-size: 13px; font-weight: bold;
  letter-spacing: .14em;
  text-shadow: 0 2px 3px #000;
  font-family: 'Courier New', monospace;
  z-index: 21; pointer-events: none;
  animation: proxPulse 1.2s infinite;
}

/* panoul de sarcini — ghidarea jucătorului */
#task-panel {
  position: absolute; left: 24px; bottom: 96px;
  max-width: 320px;
  padding: 10px 14px;
  background: rgba(0,0,0,.62);
  border-left: 3px solid #ffd54a;
  border-radius: 2px;
}
#task-title {
  color: #ffd54a; font-weight: bold; font-size: 13px;
  letter-spacing: 1px; margin-bottom: 4px;
}
#task-desc { color: #b8b2a4; font-size: 12px; line-height: 1.5; }
#task-dist { color: #ffffff; font-size: 15px; font-weight: bold; margin-top: 4px; }

/* checklist sarcini */
#task-list { list-style: none; margin-top: 8px; padding-top: 6px; border-top: 1px solid #3a3a48; }
#task-list li { font-size: 11.5px; color: #707082; padding: 1.5px 0; letter-spacing: .03em; }
#task-list li::before { content: '○ '; }
#task-list li.current {
  color: #ffd54a;
  font-weight: bold;
  animation: proxPulse 1.4s infinite;
}
#task-list li.current::before { content: '▶ '; }
#task-list li.done { color: #4caf6d; text-decoration: line-through; }
#task-list li.done::before { content: '✓ '; }

/* ================= INTRO ================= */
#intro {
  position: fixed; inset: 0; z-index: 200;   /* peste MENIU (z 100)! */
  background: #000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#intro-text {
  max-width: 720px; padding: 0 30px;
  color: #cfc7b8; font-size: 19px; line-height: 2;
  white-space: pre-wrap;
  text-shadow: 0 0 12px rgba(255,255,255,.15);
}
#intro-text::after {
  content: '\2588';
  animation: caretBlink .9s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
#intro-skip {
  position: absolute; bottom: 40px; left: 0; right: 0;
  text-align: center;
  color: #6a6258; font-size: 13px; letter-spacing: .1em;
  animation: caretBlink 1.6s steps(1) infinite;
}

/* ecranul CLICK-ÎNCEPE-FUGA după cinematic */
#click-go {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
  cursor: pointer;
}
#click-go span {
  font-family: 'Courier New', monospace;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: bold; color: #fff;
  letter-spacing: .15em;
  text-shadow: 0 0 20px rgba(255,42,42,.8);
  animation: proxPulse 1.2s infinite;
}
#click-go small {
  margin-top: 12px;
  color: #9a9aa8; font-size: 13px; letter-spacing: .08em;
}

/* ================= JUMPSCARE ================= */
#jumpscare-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: #1a0000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: jsShake .08s infinite;
}
@keyframes jsShake {
  0% { transform: translate(0,0); }
  25% { transform: translate(-14px,10px) rotate(-1deg); }
  50% { transform: translate(12px,-12px) rotate(1deg); }
  75% { transform: translate(-10px,-8px); }
  100% { transform: translate(0,0); }
}
#jumpscare-face {
  width: 62vmin; height: 62vmin;
  background:
    radial-gradient(circle at 32% 38%, #fff 11%, transparent 13%),
    radial-gradient(circle at 68% 38%, #fff 11%, transparent 13%),
    radial-gradient(circle at 33% 39%, #b30000 5%, transparent 6%),
    radial-gradient(circle at 67% 39%, #b30000 5%, transparent 6%),
    radial-gradient(ellipse at 35% 72%, #d98f2b 15%, transparent 17%),
    radial-gradient(ellipse at 65% 72%, #d98f2b 15%, transparent 17%),
    radial-gradient(circle at 50% 34%, #4a7a2e 42%, transparent 44%),
    linear-gradient(#3f6d26, #2c4e1a);
  border-radius: 46%;
  box-shadow: inset 0 -30px 80px rgba(0,0,0,.7), 0 0 120px rgba(180,0,0,.55);
  animation: jsZoom .45s cubic-bezier(.2,2.2,.4,1) forwards;
}
@keyframes jsZoom { from { transform: scale(.25); } to { transform: scale(1.15); } }
#jumpscare-text {
  position: absolute; bottom: 8%;
  font-size: clamp(40px, 9vw, 110px);
  font-weight: 900; color: #ff1a1a; letter-spacing: .1em;
  text-shadow: 0 0 30px rgba(255,0,0,.9), 4px 4px 0 #400;
}

/* ================= GAME OVER / WIN / PAUZĂ ================= */
#gameover, #win, #paused {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
#gameover {
  background: radial-gradient(ellipse at center, rgba(70,0,0,.92), rgba(8,0,0,.98));
}
.go-title {
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 900; color: #ff2020; letter-spacing: .1em;
  text-shadow: 0 0 40px rgba(255,0,0,.8), 4px 4px 0 #300;
}
.go-sub { margin-top: 18px; color: #e0b8b0; font-size: 16px; line-height: 1.8; }

#win {
  background: radial-gradient(ellipse at center, rgba(0,50,22,.92), rgba(0,10,4,.98));
}
.win-title {
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 900; color: #3ddc63; letter-spacing: .1em;
  text-shadow: 0 0 40px rgba(61,220,99,.8), 4px 4px 0 #032;
}
.win-sub { margin-top: 18px; color: #bfe8cc; font-size: 16px; line-height: 1.8; }
.win-stats { margin-top: 10px; color: #86b899; font-size: 14px; }

.end-buttons { margin-top: 36px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.end-buttons button {
  padding: 14px 36px;
  font-family: inherit; font-size: 16px; font-weight: bold;
  letter-spacing: .12em; cursor: pointer;
  color: #f0ead9;
  background: linear-gradient(180deg, #33333f, #14141c);
  border: 1px solid #5a5a6e; border-radius: 3px;
  transition: all .2s;
}
.end-buttons button:hover {
  background: linear-gradient(180deg, #4a4a5c, #22222c);
  box-shadow: 0 0 20px rgba(255,255,255,.18);
  transform: translateY(-2px);
}
#gameover .end-buttons button:hover { border-color: #ff5050; box-shadow: 0 0 20px rgba(255,60,60,.35); }
#win .end-buttons button:hover { border-color: #3ddc63; box-shadow: 0 0 20px rgba(61,220,99,.35); }

#paused { background: rgba(0,0,0,.85); }
#paused h1 { font-size: clamp(36px, 6vw, 64px); color: #ddd6ca; letter-spacing: .2em; }
#paused p { margin-top: 14px; color: #8f8fa3; }
