/* ==========================================================================
   Design Tokens & Modern Minimalist Dark Theme
   ========================================================================== */
:root {
  --bg-main: #090a0f;
  --bg-card: rgba(18, 22, 31, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-hover: rgba(26, 32, 45, 0.85);

  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.35);
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --key-bg: #1e2433;
  --key-border: rgba(255, 255, 255, 0.06);
  --key-hover: #2a3347;
  --key-used: #0f121a;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Grotesk', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 20px 50px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--bg-card-border);
  --shadow-glow: 0 0 35px var(--accent-rose-glow);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient glow background blobs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  transition: opacity 1s ease;
}

.glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-rose) 0%, transparent 70%);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  opacity: 0.25;
}

/* Sound toggle button */
.sound-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
}

.sound-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.06);
}

.sound-btn .icon {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Layout & Screens
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 620px;
  padding: 20px;
  position: relative;
  z-index: 10;
}

.screen {
  opacity: 0;
  transform: scale(0.97) translateY(8px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: none;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

/* ==========================================================================
   Gatekeeper / Lock Screen
   ========================================================================== */
.gate-card {
  text-align: center;
  max-width: 460px;
  margin: 0 auto;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

.card-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}

.code-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.access-input {
  width: 100%;
  background: rgba(8, 10, 15, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--text-primary);
  text-transform: uppercase;
  outline: none;
  transition: all 0.25s ease;
}

.access-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.2em;
  opacity: 0.4;
}

.access-input:focus {
  border-color: var(--accent-rose);
  box-shadow: 0 0 20px var(--accent-rose-glow);
  background: rgba(14, 17, 26, 0.8);
}

.error-text {
  font-size: 13px;
  color: var(--accent-rose);
  font-weight: 500;
  margin-top: -6px;
  transition: opacity 0.2s ease;
}

.card-footer {
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #fff;
  box-shadow: 0 8px 25px -4px rgba(244, 63, 94, 0.5);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -4px rgba(244, 63, 94, 0.65);
}

.primary-btn:active {
  transform: translateY(0);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.btn-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* Shake animation for errors */
.shake {
  animation: shakeKeyframe 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeKeyframe {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ==========================================================================
   Hangman Game Screen
   ========================================================================== */
.game-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.clue-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-full);
  font-size: 13px;
}

.pill-sparkle {
  color: var(--accent-rose);
  font-size: 12px;
}

.clue-label {
  color: var(--text-muted);
  font-weight: 500;
}

.clue-value {
  color: #fda4af;
  font-weight: 700;
}

.lives-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--bg-card-border);
}

.lives-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.lives-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.life-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-rose);
  box-shadow: 0 0 6px var(--accent-rose-glow);
  transition: all 0.3s ease;
}

.life-dot.lost {
  background: #272d3d;
  box-shadow: none;
  transform: scale(0.8);
}

/* Visual Container & SVG */
.visual-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  min-height: 170px;
}

.hangman-svg {
  width: 170px;
  height: 185px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.4));
}

.scaffold {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 4;
  stroke-linecap: round;
}

.scaffold-brace {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 3;
  stroke-linecap: round;
}

.rope {
  stroke: #e2e8f0;
  stroke-width: 2.5;
  stroke-dasharray: 2, 2;
  opacity: 0.75;
}

.body-part {
  stroke: var(--accent-rose);
  stroke-width: 3.5;
  stroke-linecap: round;
  fill: none;
  transition: stroke 0.3s ease, opacity 0.3s ease;
  filter: drop-shadow(0 0 6px var(--accent-rose-glow));
}

circle.body-part {
  fill: rgba(244, 63, 94, 0.15);
}

/* Word Slots */
.word-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px 0;
  flex-wrap: nowrap;
}

.letter-slot {
  width: 44px;
  height: 54px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(14, 18, 26, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.letter-slot.filled {
  border-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.12);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--accent-rose-glow);
  animation: slotPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slotPop {
  0% { transform: scale(0.8) translateY(4px); opacity: 0; }
  70% { transform: scale(1.1) translateY(-3px); }
  100% { transform: scale(1) translateY(-2px); opacity: 1; }
}

/* Hint / Tease bar */
.hint-status-bar {
  text-align: center;
  min-height: 24px;
}

.tease-inline {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

/* Keyboard */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.key-btn {
  height: 44px;
  min-width: 34px;
  flex: 1;
  max-width: 44px;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.key-btn:hover:not(:disabled) {
  background: var(--key-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1.5px);
}

.key-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.key-btn.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: #34d399;
  box-shadow: 0 0 10px var(--accent-emerald-glow);
}

.key-btn.wrong {
  background: rgba(15, 18, 26, 0.5);
  border-color: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.18);
  text-decoration: line-through;
  cursor: not-allowed;
}

.key-btn:disabled {
  pointer-events: none;
}

/* ==========================================================================
   Modals (Loss Tease & Win Reveal)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
  padding: 36px 30px;
  animation: modalScaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalScaleUp {
  0% { transform: scale(0.9) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.roast-badge {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

.win-badge {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #ff758f;
  box-shadow: 0 0 15px var(--accent-rose-glow);
}

.heart-pulse {
  animation: heartBeat 1.2s infinite ease-in-out;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.25); }
  40% { transform: scale(1.05); }
  60% { transform: scale(1.25); }
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.modal-msg {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
}

.attempt-counter-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  flex: 1;
}

.lowkey-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Victory specifics */
.reveal-word-box {
  margin: 16px 0 20px 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border: 1.5px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px -5px var(--accent-rose-glow);
}

.revealed-word {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(244, 63, 94, 0.6);
}

.love-quote {
  font-style: italic;
  font-size: 13px;
  color: #fda4af;
  margin-bottom: 24px;
  opacity: 0.85;
}

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

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

/* Responsive adjustments */
@media (max-width: 480px) {
  .glass-card {
    padding: 24px 18px;
  }
  
  .card-title {
    font-size: 22px;
  }
  
  .access-input {
    font-size: 18px;
    letter-spacing: 0.25em;
    padding: 14px 16px;
  }
  
  .hangman-svg {
    width: 140px;
    height: 155px;
  }
  
  .visual-container {
    min-height: 145px;
  }

  .letter-slot {
    width: 36px;
    height: 46px;
    font-size: 20px;
  }

  .key-btn {
    height: 40px;
    min-width: 28px;
    font-size: 14px;
  }

  .revealed-word {
    font-size: 26px;
    letter-spacing: 0.18em;
  }
}
