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

body {
  background: #1a1a2e;
  color: #eee;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  height: 100vh;
}

/* ── Menu ── */

#menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1.5rem;
}

/* ── Menu bubbles ── */

#menu-bubbles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

#menu {
  position: relative;
  z-index: 1;
}

.bubble {
  position: absolute;
  bottom: -80px;
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(1px);
  animation: bubble-rise linear forwards, bubble-hue 6s linear infinite;
}

@keyframes bubble-rise {
  to { transform: translateY(-110vh); }
}

@keyframes bubble-hue {
  0%   { background: hsl(0, 80%, 65%); }
  33%  { background: hsl(120, 80%, 65%); }
  66%  { background: hsl(240, 80%, 65%); }
  100% { background: hsl(360, 80%, 65%); }
}

#menu h1 {
  font-size: 2.5rem;
  letter-spacing: 0.05em;
}

#menu p.subtitle {
  color: #aaa;
  font-size: 1rem;
  max-width: 420px;
  text-align: center;
  line-height: 1.5;
}

#room-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.room-btn {
  background: #16213e;
  border: 2px solid #0f3460;
  color: #e0e0e0;
  padding: 1rem 2.5rem;
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-btn:hover {
  background: #0f3460;
  border-color: #e94560;
}

.room-stats {
  font-size: 0.85rem;
  color: #aaa;
}

/* ── Settings ── */

#settings-toggle {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  padding: 0.4rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

#settings-toggle:hover {
  border-color: #e94560;
  color: #eee;
}

#settings-panel {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-width: 420px;
  width: 90%;
}

.setting-group {
  margin-bottom: 1rem;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group label {
  display: block;
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 0.5rem;
}

.option-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.option-btn {
  background: #1a1a2e;
  border: 1px solid #333;
  color: #ccc;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

.option-btn:hover {
  border-color: #e94560;
}

.option-btn.active {
  background: #0f3460;
  border-color: #e94560;
  color: #fff;
}

/* ── Game container ── */

#game-container {
  display: none;
  position: relative;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
}

/* ── Crosshair ���─ */

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 10;
}

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

#crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 0;
  height: 100%;
  width: 2px;
  transform: translateX(-50%);
}

/* ── HUD ── */

#hud {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  display: flex;
  gap: 1.5rem;
  font-size: 1.1rem;
}

#hud .hud-item {
  background: rgba(0, 0, 0, 0.55);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}

#timer {
  font-variant-numeric: tabular-nums;
}

#ready-hint {
  cursor: pointer;
}

#hud kbd {
  display: inline-block;
  background: #e94560;
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: inherit;
  margin-right: 0.3rem;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 4px rgba(233, 69, 96, 0.4); }
  50% { box-shadow: 0 0 12px rgba(233, 69, 96, 0.9); }
}

/* ── Too-big flash ── */

#too-big-flash {
  display: none;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: bold;
  color: #ef5350;
  text-shadow: 0 0 8px rgba(239, 83, 80, 0.7);
  pointer-events: none;
  z-index: 15;
}

#too-big-flash.visible {
  display: block;
  animation: flash-fade 0.6s ease-out forwards;
}

@keyframes flash-fade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

/* ── Inventory ── */

#inventory {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

.inv-slot {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  position: relative;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.inv-slot.active {
  border-color: #e94560;
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.6);
}

.inv-slot.occupied {
  border-color: rgba(255, 255, 255, 0.5);
}

.inv-hint {
  display: none;
  text-align: center;
  font-size: 0.8rem;
  color: #ccc;
  padding-bottom: 0.25rem;
}

.inv-hint.visible {
  display: block;
}

.inv-hint kbd {
  display: inline-block;
  background: #e94560;
  color: #fff;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-family: inherit;
  margin-right: 0.2rem;
}

.inv-key {
  position: absolute;
  top: 2px;
  left: 5px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

/* ── Equipped card ── */

#equipped-card {
  display: none;
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  min-width: 140px;
}

#equipped-card .serbian {
  font-size: 1.4rem;
  font-weight: bold;
  display: block;
  margin-bottom: 0.25rem;
}

#equipped-card .english {
  font-size: 0.9rem;
  color: #aaa;
}

/* ── Label bubble ── */

#label-bubble {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  display: none;
  min-width: 160px;
}

#label-bubble .serbian {
  font-size: 1.6rem;
  font-weight: bold;
  display: block;
  margin-bottom: 0.25rem;
}

#label-bubble .english {
  font-size: 0.95rem;
  color: #aaa;
}

/* ── Pause overlay ── */

#pause-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 30, 0.85);
  z-index: 90;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

#pause-overlay.active {
  display: flex;
}

#pause-overlay h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.pause-btn {
  background: #16213e;
  border: 2px solid #0f3460;
  color: #e0e0e0;
  padding: 0.75rem 2.5rem;
  font-size: 1.15rem;
  cursor: pointer;
  border-radius: 6px;
  min-width: 200px;
  transition: background 0.2s, border-color 0.2s;
}

.pause-btn:hover {
  background: #0f3460;
  border-color: #e94560;
}

/* ── Quiz overlay ── */

#quiz-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 30, 0.92);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

#quiz-overlay.active {
  display: flex;
}

#quiz-overlay h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

#quiz-prompt {
  font-size: 1.8rem;
  font-weight: bold;
}

#quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 500px;
  width: 90%;
}

.quiz-choice {
  background: #16213e;
  border: 2px solid #0f3460;
  color: #eee;
  padding: 1rem;
  font-size: 1.15rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s;
}

.quiz-choice:hover {
  background: #0f3460;
  border-color: #e94560;
}

.quiz-choice.correct {
  background: #1b5e20;
  border-color: #4caf50;
}

.quiz-choice.wrong {
  background: #b71c1c;
  border-color: #ef5350;
}

#quiz-score {
  font-size: 1.2rem;
  color: #aaa;
}

#quiz-next-btn,
#quiz-done-btn {
  background: #e94560;
  border: none;
  color: #fff;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 6px;
  display: none;
}

#quiz-next-btn:hover,
#quiz-done-btn:hover {
  background: #c73651;
}

/* ── Instructions toast ��─ */

#instructions {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #ccc;
  z-index: 10;
  transition: opacity 1s;
  text-align: center;
}
