/* ── VENOM — style.css ───────────────────────────── */

:root {
  --bg:          #0a0508;
  --gold:        #d4a853;
  --gold-dim:    #7a5c28;
  --rose:        #c4687a;
  --lavender:    #a78bca;
  --cream:       #f0e8d8;
  --cream-dim:   #8a7d6a;
  --mint:        #5bbf9a;
  --blood:       #8b0000;
  --blood-bright:#cc1a1a;
  --border:      rgba(212,168,83,0.18);
  --border-s:    rgba(167,139,202,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Cormorant Garamond', Georgia, serif;
  overflow: hidden;
}

/* ── SCREEN SYSTEM ───────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: flex; overflow: hidden;
}

/* ── WELCOME SCREEN ──────────────────────────────── */
.welcome-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 16px 20px;
  background:
    radial-gradient(ellipse at 50% 0%,   rgba(139,0,0,0.5)  0%, transparent 60%),
    radial-gradient(ellipse at 20% 100%, rgba(80,0,0,0.25)  0%, transparent 50%),
    radial-gradient(ellipse at 80% 60%,  rgba(60,0,20,0.3)  0%, transparent 50%),
    #080305;
}

/* Full-screen canvas — jungle/cinematic background */
.hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
  opacity: 0.45;
}

/* Dark overlay so text stays readable over the canvas */
.welcome-screen::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: rgba(8,3,5,0.55);
  pointer-events: none;
}

/* Blood drip top */
.blood-drip {
  position: absolute; top: 0; left: 0; right: 0;
  height: 70px; z-index: 2;
  background: linear-gradient(180deg, rgba(139,0,0,0.85), transparent);
  clip-path: polygon(
    0 0, 5% 0, 4% 60%, 6% 100%, 8% 60%, 10% 0,
    15% 0, 14% 40%, 16% 80%, 18% 40%, 20% 0,
    28% 0, 27% 55%, 29% 90%, 31% 55%, 33% 0,
    40% 0, 39% 35%, 41% 70%, 43% 35%, 45% 0,
    55% 0, 54% 50%, 56% 85%, 58% 50%, 60% 0,
    68% 0, 67% 45%, 69% 75%, 71% 45%, 73% 0,
    82% 0, 81% 60%, 83% 95%, 85% 60%, 87% 0,
    94% 0, 93% 40%, 95% 65%, 97% 40%, 100% 0
  );
}

.welcome-content {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  max-width: 480px; width: 100%;
  gap: 10px; position: relative; z-index: 3;
}

.skull {
  font-size: 56px;
  animation: skull-float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(139,0,0,0.9));
}
@keyframes skull-float {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-10px) rotate(3deg); }
}

.welcome-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(54px, 15vw, 96px);
  font-weight: 700; letter-spacing: 10px; line-height: 1;
  background: linear-gradient(180deg, #ff5555 0%, #cc1a1a 40%, #8b0000 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 32px rgba(139,0,0,0.7));
  animation: title-flicker 6s ease-in-out infinite;
}
@keyframes title-flicker {
  0%,89%,100%{opacity:1;} 91%{opacity:0.6;} 93%{opacity:1;} 95%{opacity:0.25;} 97%{opacity:1;}
}

.welcome-tagline {
  font-size: 13px; letter-spacing: 4px;
  color: var(--cream-dim); font-style: italic; text-transform: uppercase;
}

.welcome-divider {
  font-size: 11px; letter-spacing: 6px;
  color: var(--blood-bright); opacity: 0.7;
}

.challenge-box {
  border: 1px solid rgba(139,0,0,0.35);
  border-left: 3px solid var(--blood-bright);
  background: rgba(8,3,5,0.7);
  backdrop-filter: blur(4px);
  padding: 16px 24px; max-width: 380px; width: 100%;
}
.challenge-text {
  font-size: 14px; line-height: 2;
  color: var(--cream-dim); font-style: italic;
}
.highlight-gold { color: var(--gold); font-style: normal; font-weight: 600; }
.highlight-rose  { color: var(--rose); font-style: normal; font-weight: 600; }

.name-input-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%;
}
.name-input-label {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 4px;
  color: #fff; text-transform: uppercase; opacity: 0.9;
}
.name-input {
  font-family: 'Cinzel', serif; font-size: 16px; letter-spacing: 4px;
  padding: 12px 20px; width: min(260px, 85vw);
  background: rgba(255,255,255,0.08);
  border: 2px solid #fff;
  color: #fff; text-align: center; text-transform: uppercase; outline: none;
  transition: all 0.2s;
  box-shadow: 0 0 16px rgba(255,255,255,0.25);
  /* Prevent iOS rounding corners */
  -webkit-appearance: none; border-radius: 0;
}
.name-input::placeholder { color: rgba(255,255,255,0.45); font-size: 16px; }
.name-input:focus {
  border-color: #28cc0f;
  box-shadow: 0 0 10px rgba(40,204,15,0.25);
  background: rgba(40,204,15,0.04);
  color: #28cc0f;
}

.welcome-buttons {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.btn-yes {
  font-family: 'Cinzel', serif; font-size: 12px; font-weight: 600;
  letter-spacing: 3px; padding: 13px 32px;
  background: linear-gradient(135deg, #8b0000, #cc1a1a);
  border: 1px solid rgba(204,26,26,0.5); color: #fff;
  cursor: pointer; transition: all 0.25s; text-transform: uppercase;
}
.btn-yes:hover { background: linear-gradient(135deg,#cc1a1a,#ff2222); transform: scale(1.04); box-shadow: 0 4px 24px rgba(139,0,0,0.5); }

.btn-no {
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: 3px; padding: 13px 28px;
  background: rgba(8,3,5,0.6); backdrop-filter: blur(4px);
  border: 1px solid rgba(138,125,106,0.3); color: var(--cream-dim);
  cursor: pointer; transition: all 0.25s; text-transform: uppercase;
}
.btn-no:hover { border-color: var(--cream-dim); color: var(--cream); }

.welcome-footer {
  position: absolute; bottom: 16px; z-index: 3;
  font-size: 10px; letter-spacing: 5px;
  color: rgba(139,0,0,0.5); font-style: italic;
  animation: gentle-pulse 2s ease-in-out infinite alternate;
}
@keyframes gentle-pulse { from{opacity:0.3;} to{opacity:0.8;} }

/* ── SCREEN SYSTEM ───────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: flex; overflow: hidden;
}

.game-screen {
  background: #0e0b14; flex-direction: row;
  align-items: stretch; justify-content: center;
}
.game-screen::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--lavender), var(--gold), transparent);
  opacity: 0.4; z-index: 5; pointer-events: none;
}

/* ── SIDE PANELS ─────────────────────────────────── */
.side-panel {
  flex-shrink: 0;
  /* Width = everything outside the 680px wrapper */
  width: calc((100vw - 680px) / 2);
  min-width: 0;
  height: 100%;
  display: block;
  background: transparent;
  pointer-events: none;
  /* Hide on small screens where there's no space */
  visibility: visible;
}
/* When viewport is 680px or narrower the side panels collapse to zero */
@media (max-width: 680px) {
  .side-panel { width: 0; }
}

/* Wrapper — fits exactly inside the fixed screen, no scrolling */
.wrapper {
  width: 100%; max-width: 680px; height: 100%;
  padding: max(6px, env(safe-area-inset-top)) 16px max(6px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

/* HEADER — always visible */
header {
  width: 100%; text-align: center;
  padding-bottom: 3px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.title-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.title-bracket { font-family: 'Cinzel', serif; font-size: 14px; color: var(--gold-dim); }
.game-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(16px, 4vw, 26px); font-weight: 700; letter-spacing: 8px;
  background: linear-gradient(180deg, #f0d080 0%, #d4a853 60%, #a07030 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.game-subtitle {
  font-size: 7px; letter-spacing: 3px; color: var(--cream-dim);
  font-style: italic; margin-top: 1px;
}

/* STATS BAR — always visible */
.stats-bar {
  width: 100%; flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  padding: 4px 14px;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 0; }
.stat-label { font-size: 6px; letter-spacing: 2px; color: var(--cream-dim); text-transform: uppercase; font-style: italic; }
.stat-value { font-family: 'Cinzel', serif; font-size: 15px; font-weight: 600; color: var(--gold); letter-spacing: 1px; }
.stat-value.danger { color: var(--rose); }
.stat-value.active { color: var(--lavender); animation: gpulse 1.2s ease-in-out infinite alternate; }
@keyframes gpulse { from{opacity:0.6;} to{opacity:1;} }

/* HUNTER BAR — always visible */
.ai-bar {
  width: 100%; flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.015); border: 1px solid var(--border-s);
  padding: 3px 10px;
}
.ai-label { color: var(--rose); white-space: nowrap; font-size: 10px; letter-spacing: 2px; font-style: italic; }
.ai-threat-track { flex: 1; height: 2px; background: rgba(196,104,122,0.1); }
.ai-threat-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--lavender), var(--rose), var(--gold)); transition: width 0.6s ease; }
.ai-threat-text { color: var(--cream-dim); font-size: 8px; white-space: nowrap; min-width: 80px; text-align: right; letter-spacing: 1px; font-style: italic; }

/* CANVAS — fills available space, animated VENOM border */
.canvas-wrapper {
  position: relative;
  flex: 1; min-height: 0; min-width: 0;
  width: 100%;
  align-self: stretch;
  background: #090710; overflow: visible;
  /* Padding so the SVG border sits outside the play area */
  outline: none;
}

/* The game canvas itself sits inset so the animated border is outside it */
#game-canvas {
  display: block; width: 100%; height: 100%;
  position: relative; z-index: 1;
  box-shadow: 0 0 18px rgba(40,204,15,0.07);
}

/* Animated VENOM border — SVG overlay */
.venom-border {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px); height: calc(100% + 6px);
  pointer-events: none; z-index: 2; overflow: visible;
}
.venom-border rect {
  fill: none;
  stroke: #28cc0f;
  stroke-width: 2;
  filter: drop-shadow(0 0 3px #28cc0f) drop-shadow(0 0 7px rgba(40,204,15,0.2));
}
/* Dashed text-like effect — repeating VENOM · letters march around the border */
.venom-border .march {
  fill: none;
  stroke: #28cc0f;
  stroke-width: 0;
}
.venom-border textPath {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  fill: #28cc0f;
  filter: drop-shadow(0 0 2px rgba(40,204,15,0.5));
}
.canvas-wrapper::before, .canvas-wrapper::after { display: none; }
#game-canvas { display: block; width: 100%; height: 100%; }

/* POWERUP TOAST */
.powerup-msg {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: 3px; color: var(--gold);
  background: rgba(9,7,16,0.95); border: 1px solid var(--gold); padding: 8px 18px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; z-index: 5;
}
.powerup-msg.show { opacity: 1; }

/* OVERLAY */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(9,7,16,0.93); backdrop-filter: blur(3px);
  z-index: 10;
}
.overlay-box {
  text-align: center; padding: 18px 20px; border: 1px solid var(--border);
  background: rgba(19,13,24,0.98); max-width: 260px; width: 88%;
  position: relative; animation: fadeUp 0.35s ease;
}
.overlay-box::before, .overlay-box::after {
  content: ''; position: absolute; width: 8px; height: 8px;
  border-color: var(--gold-dim); border-style: solid;
}
.overlay-box::before { top:-1px; left:-1px; border-width: 2px 0 0 2px; }
.overlay-box::after  { bottom:-1px; right:-1px; border-width: 0 2px 2px 0; }
@keyframes fadeUp { from{opacity:0;transform:translateY(10px);} to{opacity:1;transform:translateY(0);} }
.overlay-tag { font-size: 7px; letter-spacing: 5px; color: var(--gold-dim); margin-bottom: 5px; font-style: italic; text-transform: uppercase; }
.overlay-box h2 {
  font-family: 'Cinzel', serif; font-size: 19px; font-weight: 700; letter-spacing: 5px; margin-bottom: 6px;
  background: linear-gradient(180deg, #f0d080, #d4a853);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.overlay-box p { font-size: 11px; color: var(--cream-dim); line-height: 1.7; margin-bottom: 10px; font-style: italic; }
#gameover-msg {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.5;
  color: #f0e8d8;
  background: rgba(196,104,122,0.18);
  border: 1px solid rgba(196,104,122,0.5);
  border-left: 4px solid var(--rose);
  padding: 10px 14px;
  margin-bottom: 10px;
  text-align: left;
}
.final-score-row { display: flex; justify-content: center; gap: 22px; margin-bottom: 8px; }
.final-stat { text-align: center; }
.gameover-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* LEADERBOARD */
.leaderboard { width: 100%; margin: 4px 0; }
.lb-title { font-family: 'Cinzel', serif; font-size: 7px; letter-spacing: 4px; color: var(--gold-dim); margin-bottom: 3px; text-transform: uppercase; }
.lb-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--cream-dim); font-style: italic; padding: 1px 0; border-bottom: 1px solid rgba(212,168,83,0.07); }
.lb-row.lb-top { color: var(--gold); font-style: normal; font-weight: 600; }

/* BUTTONS */
.btn-primary {
  font-family: 'Cinzel', serif; font-size: 10px; font-weight: 600; letter-spacing: 4px; padding: 10px 26px;
  background: transparent; border: 1px solid var(--gold-dim); color: var(--gold);
  cursor: pointer; transition: all 0.25s; text-transform: uppercase;
}
.btn-primary:hover { border-color: var(--gold); color: #f0d080; }
.btn-ghost {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 3px; padding: 10px 22px;
  background: transparent; border: 1px solid rgba(138,125,106,0.25); color: var(--cream-dim);
  cursor: pointer; transition: all 0.25s; text-transform: uppercase;
}
.btn-ghost:hover { border-color: var(--cream-dim); color: var(--cream); }

/* LEGEND — always visible, compact */
.legend {
  flex-shrink: 0; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  font-size: 12px; letter-spacing: 1px; color: var(--cream); font-style: italic;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-icon { font-size: 13px; line-height: 1; }

/* FOOTER — always visible */
footer {
  flex-shrink: 0;
  font-size: 8px; letter-spacing: 2px; color: rgba(138,125,106,0.25); font-style: italic;
}

/* SCORE POP */
@keyframes scorePop { 0%{transform:scale(1);} 50%{transform:scale(1.25);} 100%{transform:scale(1);} }
.score-pop { animation: scorePop 0.25s ease; }

/* GOODBYE */
.goodbye-screen { background: #080508; align-items: center; justify-content: center; }
.goodbye-content { text-align: center; padding: 40px 20px; }
.candle { font-size: 44px; margin-bottom: 16px; animation: cf 1.5s ease-in-out infinite alternate; }
@keyframes cf { from{opacity:0.6;transform:scale(0.97);} to{opacity:1;transform:scale(1.03);} }
.goodbye-title { font-family: 'Cinzel Decorative', serif; font-size: 32px; letter-spacing: 6px; color: var(--cream-dim); margin-bottom: 10px; }
.goodbye-text { font-size: 14px; color: var(--cream-dim); line-height: 2; font-style: italic; margin-bottom: 28px; }
.btn-ghost-light {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 4px; padding: 10px 24px;
  background: transparent; border: 1px solid rgba(138,125,106,0.3); color: var(--cream-dim);
  cursor: pointer; transition: all 0.25s; text-transform: uppercase;
}
.btn-ghost-light:hover { border-color: var(--cream-dim); color: var(--cream); }

/* RESPONSIVE — scale text only, never hide anything */
@media (max-width: 400px) {
  .game-title { font-size: 14px; letter-spacing: 5px; }
  .stat-value { font-size: 13px; }
  .stats-bar { padding: 3px 8px; }
  .ai-threat-text { min-width: 65px; font-size: 7px; }
  .legend { gap: 7px; font-size: 8px; }
}
@media (max-height: 700px) {
  .skull { font-size: 36px; }
  .welcome-title { font-size: clamp(42px, 13vw, 72px); }
  .challenge-box { padding: 10px 18px; }
  .challenge-text { font-size: 12px; line-height: 1.7; }
  .welcome-tagline { font-size: 11px; }
  .welcome-buttons { gap: 8px; }
  .btn-yes, .btn-no { padding: 10px 24px; }
  .welcome-footer { display: none; }
}
@media (max-height: 580px) {
  .welcome-divider { display: none; }
  .skull { display: none; }
  .welcome-content { gap: 7px; }
}
@media (max-height: 650px) {
  .game-subtitle { display: none; }
  .wrapper { gap: 2px; }
}