:root {
  --fog: #98a0a5;
  --mist: rgba(220, 226, 230, 0.18);
  --ground-dark: #1e2424;
  --ground-light: #40494a;
  --tree-dark: #171a1b;
  --tree-light: #475051;
  --panel-bg: rgba(14, 18, 20, 0.78);
  --panel-border: rgba(188, 196, 198, 0.18);
  --accent: #d2d8db;
  --warning: #eef4f8;
  --danger: #c1cad1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  color: #f4f6f7;
  background:
    radial-gradient(circle at top, rgba(160, 170, 176, 0.18), transparent 48%),
    linear-gradient(180deg, #6a7277 0%, #2d3436 34%, #141819 100%);
}

body {
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 9, 0.48);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(92vw, 520px);
  padding: 28px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(64, 70, 72, 0.22), rgba(16, 19, 20, 0.78)),
    var(--panel-bg);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.45);
}

.panel.compact {
  width: min(92vw, 420px);
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(240, 244, 245, 0.7);
  font-size: 0.75rem;
}

h1,
h2,
.lead,
.hint,
.difficulty,
button,
#hud,
#messageBar {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

h1,
h2 {
  margin: 0 0 12px;
  font-weight: 400;
}

.lead {
  margin: 0 0 18px;
  line-height: 1.5;
  color: rgba(235, 239, 241, 0.88);
}

.difficulty {
  display: grid;
  gap: 10px;
  margin: 22px 0 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.difficulty label {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f7f9fa;
  background:
    linear-gradient(180deg, rgba(216, 225, 229, 0.18), rgba(80, 90, 94, 0.08)),
    rgba(255, 255, 255, 0.06);
  font: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
}

button:hover {
  background:
    linear-gradient(180deg, rgba(230, 236, 240, 0.24), rgba(96, 106, 112, 0.12)),
    rgba(255, 255, 255, 0.12);
}

.hint {
  margin: 16px 0 0;
  color: rgba(238, 242, 243, 0.72);
  font-size: 0.95rem;
}

#hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  color: var(--warning);
  opacity: 0;
  transition: opacity 160ms ease;
}

#hud.visible {
  opacity: 1;
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(8, 12, 14, 0.35);
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.72);
}

#crosshair::before {
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 1px;
  transform: translateX(-50%);
}

#crosshair::after {
  top: 50%;
  left: 2px;
  right: 2px;
  height: 1px;
  transform: translateY(-50%);
}

#crosshair.visible {
  opacity: 0.9;
}

#lightning {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, transparent 30%, rgba(244, 248, 252, 0.85) 48%, transparent 62%),
    linear-gradient(20deg, transparent 42%, rgba(228, 235, 240, 0.72) 54%, transparent 68%);
  opacity: 0;
  pointer-events: none;
}

#lightning.active {
  animation: lightningFlash 320ms ease-out;
}

@keyframes lightningFlash {
  0% { opacity: 0; }
  18% { opacity: 0.85; }
  40% { opacity: 0.16; }
  60% { opacity: 0.75; }
  100% { opacity: 0; }
}

#messageBar {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: rgba(8, 12, 14, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(240, 244, 246, 0.92);
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

#messageBar.visible {
  opacity: 1;
}

@media (max-width: 720px) {
  #hud {
    flex-direction: column;
  }

  .panel {
    padding: 22px;
  }
}
