@font-face {
  font-family: 'Pusab';
  src: url('assets/pusab.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-dark: #07030a;
  --romantic-pink: #ff2a7a;
  --romantic-pink-glow: rgba(255, 42, 122, 0.6);
  --romantic-rose: #ff4d8d;
  --romantic-green: #00ff88;
  --romantic-green-glow: rgba(0, 255, 136, 0.7);
  --romantic-sad: #a39bb8;
  --font-gd: 'Pusab', 'Impact', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: #fff;
  font-family: var(--font-gd);
}

/* Background Canvas */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* Ambient Romantic Radial Lighting */
.ambient-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120vw;
  height: 120vh;
  background: radial-gradient(circle at center, rgba(140, 15, 60, 0.15) 0%, rgba(35, 5, 25, 0.35) 45%, rgba(7, 3, 10, 0.95) 80%);
  z-index: 2;
  pointer-events: none;
}

/* Main Container */
.game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

/* Minimal Top Bar */
.hud-header {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  z-index: 30;
}

.minimal-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.minimal-btn:hover {
  background: rgba(255, 42, 122, 0.2);
  border-color: var(--romantic-pink);
  transform: scale(1.08);
  box-shadow: 0 0 15px var(--romantic-pink-glow);
}

/* Center Stage */
.center-stage {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 3vh;
  min-height: 130px;
  z-index: 25;
}

/* In-game Question: "idziemy do kina?" */
.cinema-question {
  font-size: clamp(2rem, 5vw, 3.8rem);
  color: #fff;
  text-transform: lowercase;
  letter-spacing: 2px;
  text-shadow: 
    0 0 15px var(--romantic-pink),
    0 0 35px var(--romantic-pink-glow),
    0 0 60px rgba(255, 42, 122, 0.4);
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.6s ease, filter 0.6s ease;
  animation: floatQuestion 3.5s ease-in-out infinite alternate;
}

@keyframes floatQuestion {
  0% { transform: translateY(0); }
  100% { transform: translateY(-7px); }
}

/* Disappearing animation */
.cinema-question.fade-out {
  opacity: 0;
  transform: translateY(-40px) scale(1.1);
  filter: blur(14px);
  pointer-events: none;
}

/* Minimal Pick Prompt */
.pick-prompt {
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  color: #ffffff;
  text-transform: lowercase;
  letter-spacing: 3px;
  text-shadow:
    0 0 12px #ffffff,
    0 0 25px var(--romantic-pink),
    0 0 45px var(--romantic-pink-glow);
  animation: pulsePick 0.8s infinite alternate ease-in-out;
}

@keyframes pulsePick {
  0% { transform: scale(0.96); opacity: 0.85; }
  100% { transform: scale(1.04); opacity: 1; }
}

/* Result Area */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-title {
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  text-transform: lowercase;
  letter-spacing: 2px;
}

/* Correct Key -> "idziemy do kina" */
.result-title.win {
  color: #fff;
  text-shadow: 
    0 0 15px var(--romantic-pink),
    0 0 35px var(--romantic-pink),
    0 0 70px rgba(255, 42, 122, 0.8);
  animation: winGlow 1.5s infinite alternate ease-in-out;
}

@keyframes winGlow {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); text-shadow: 0 0 25px var(--romantic-pink), 0 0 55px #ff669d, 0 0 90px rgba(255, 42, 122, 0.9); }
}

/* Wrong Key -> " nie idziemy do kina:(" */
.result-title.lose {
  color: #e5e0f0;
  text-shadow: 
    0 0 15px var(--romantic-sad),
    0 0 35px rgba(163, 155, 184, 0.6);
}

.result-buttons {
  display: flex;
  gap: 14px;
}

/* Romantic Button */
.romantic-btn {
  font-family: var(--font-gd);
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 44px;
  font-size: clamp(1rem, 2vw, 1.3rem);
  letter-spacing: 2px;
  text-transform: lowercase;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff2a7a 0%, #db0054 100%);
  color: #ffffff;
  box-shadow: 
    0 6px 25px rgba(255, 42, 122, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.romantic-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 10px 35px rgba(255, 42, 122, 0.75),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.romantic-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* Keys Arena */
.keys-arena {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 15;
}

/* Individual Key Node with Tight Circular Hitbox */
.key-node {
  position: absolute;
  top: 0;
  left: 0;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: filter 0.25s ease;
  pointer-events: none; /* Only enabled when pickable */
}

.key-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(255, 42, 105, 0.7));
  transition: filter 0.3s ease, transform 0.2s ease;
}

/* Green Highlight when flashed */
.key-node.green-highlight .key-img {
  filter: drop-shadow(0 0 25px var(--romantic-green)) drop-shadow(0 0 50px var(--romantic-green-glow));
  animation: keyPulse 0.4s infinite alternate ease-in-out;
}

@keyframes keyPulse {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.15); }
}

/* Pickable state */
.key-node.pickable {
  cursor: pointer;
  pointer-events: auto !important;
}

.key-node.pickable:hover {
  z-index: 50;
}

.key-node.pickable:hover .key-img {
  transform: scale(1.22);
  filter: drop-shadow(0 0 25px #ffffff) drop-shadow(0 0 45px var(--romantic-pink));
}

/* Winning key reaction */
.key-node.winner-key .key-img {
  filter: drop-shadow(0 0 35px var(--romantic-pink)) drop-shadow(0 0 70px var(--romantic-pink));
  animation: winFloat 0.7s infinite alternate ease-in-out;
}

@keyframes winFloat {
  0% { transform: scale(1.1) translateY(0); }
  100% { transform: scale(1.28) translateY(-8px); }
}

/* Loser key */
.key-node.loser-key .key-img {
  filter: grayscale(0.6) brightness(0.7) drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

.key-node.revealed-correct .key-img {
  filter: drop-shadow(0 0 25px var(--romantic-green));
}

.key-node.faded-out {
  opacity: 0.15;
  transition: opacity 0.5s ease;
}

/* =========================================================================
   CLEAN MINIMALIST START SCREEN & DIFFICULTY SELECTOR
   ========================================================================= */
.start-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(20, 8, 24, 0.94) 0%, rgba(6, 2, 8, 0.98) 100%);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.start-overlay.hidden-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.clean-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}

.start-question {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  color: #ffffff;
  text-transform: lowercase;
  letter-spacing: 2px;
  text-shadow: 
    0 0 15px var(--romantic-pink),
    0 0 35px var(--romantic-pink-glow),
    0 0 70px rgba(255, 42, 122, 0.4);
  animation: floatQuestion 3.5s ease-in-out infinite alternate;
}

.start-btn {
  padding: 16px 56px;
  font-size: clamp(1.15rem, 2.3vw, 1.45rem);
  box-shadow: 
    0 0 30px rgba(255, 42, 122, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
  animation: pulseStart 1.8s infinite alternate ease-in-out;
}

@keyframes pulseStart {
  0% { transform: scale(1); box-shadow: 0 0 25px rgba(255, 42, 122, 0.4); }
  100% { transform: scale(1.06); box-shadow: 0 0 45px rgba(255, 42, 122, 0.85); }
}

/* Utilities */
.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .key-node {
    width: 70px;
    height: 70px;
  }
}
