/* Troll Rooms — Level Devil Platformer Styles */
:root {
  --bg-dark: #090d16;
  --panel-bg: rgba(15, 23, 42, 0.85);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent-gold: #fbbf24;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-red: #ef4444;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

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

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1e1b4b 0%, #080713 100%);
}

#game-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border-radius: 8px;
}

/* Header HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: 9999px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
  pointer-events: none;
  max-width: 95vw;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-val {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--accent-gold);
}

.hud-deaths .hud-val {
  color: var(--accent-pink);
}

.hud-message {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  padding: 0 12px;
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  white-space: nowrap;
}

/* Death Toast */
.death-toast {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  padding: 8px 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.death-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-12px);
}

/* Mobile Touch Controls */
.touch-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  pointer-events: none;
  z-index: 15;
}

.touch-dpad {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-btn {
  width: 58px;
  height: 58px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: background 0.1s, transform 0.1s;
}

.touch-btn:active, .touch-btn.pressed {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0.92);
}

.touch-jump {
  pointer-events: auto;
  width: 80px;
  height: 58px;
  border-radius: 29px;
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* Hide touch buttons on mouse/desktop fine pointers */
@media (pointer: fine) {
  .touch-controls {
    display: none;
  }
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 20px;
}

.overlay.hidden {
  display: none !important;
}

.menu-card {
  background: #1e1b4b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.menu-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 4px 12px;
  border-radius: 9999px;
  letter-spacing: 0.06em;
}

.menu-title {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(236, 72, 153, 0.4);
}

.menu-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.key-pill {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  color: var(--text-light);
}

.hint-label {
  color: var(--text-muted);
  font-weight: 600;
}

.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
}

.trophy-icon {
  font-size: 3.2rem;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.victory-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
}

.victory-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  margin: 6px 0;
}

.stat-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-name {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.pause-card {
  max-width: 320px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  #hud {
    top: 6px;
    padding: 6px 12px;
    gap: 10px;
  }
  .hud-message {
    font-size: 0.68rem;
    padding: 0 6px;
  }
  .menu-card {
    padding: 20px 16px;
  }
  .menu-title {
    font-size: 1.7rem;
  }
}

