*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #fff;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.lobby-header {
  text-align: center;
  padding: 40px 20px 20px;
}
.lobby-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.lobby-header p {
  color: #888;
  margin-top: 6px;
  font-size: 0.95rem;
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
  max-width: 720px;
  margin: 0 auto;
}
@media (min-width: 520px) {
  .games-grid { grid-template-columns: 1fr 1fr; }
}

.game-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.2);
}

.card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.card-desc {
  font-size: 0.85rem;
  color: #aaa;
  line-height: 1.4;
  margin-bottom: 12px;
}
.card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #666;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }

.screen { display: none; flex-direction: column; align-items: center; min-height: 100vh; }
.screen.active { display: flex; }

.menu-screen {
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.menu-screen h1 { font-size: 1.8rem; margin-bottom: 8px; }
.menu-screen .menu-desc { color: #aaa; margin-bottom: 32px; font-size: 0.95rem; }
.level-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.level-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.level-btn:hover { background: rgba(255,255,255,0.1); }
.back-link {
  margin-top: 24px;
  color: #666;
  font-size: 0.85rem;
  text-decoration: none;
}
.back-link:hover { color: #aaa; }

.game-screen { padding: 0; }
.game-hud {
  width: 100%;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #aaa;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hud-score { font-weight: 600; color: #fff; font-size: 0.9rem; }
.hud-timer {
  font-weight: 700;
  font-size: 1rem;
  color: #ff6b6b;
  display: none;
}
.hud-timer.visible { display: block; }

.game-body {
  flex: 1;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.round-instruction {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.4;
}

.feedback-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 2000;
}
.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.feedback-toast.correct { background: #2ecc71; color: #fff; }
.feedback-toast.wrong { background: #e74c3c; color: #fff; }

.hint-bar {
  width: 100%;
  text-align: center;
  padding: 10px;
  font-size: 0.85rem;
  color: #ffd700;
  background: rgba(255,215,0,0.08);
  border-radius: 8px;
  margin-top: 12px;
  display: none;
}
.hint-bar.visible { display: block; }

.explanation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 24px;
}
.explanation-overlay.show { display: flex; }
.explanation-box {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 380px;
  text-align: center;
}
.explanation-box p { color: #ccc; line-height: 1.5; margin-bottom: 20px; font-size: 0.95rem; }
.explanation-box button {
  background: #fff;
  color: #0f0f1a;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.summary-screen {
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.summary-screen h1 { font-size: 1.6rem; margin-bottom: 12px; }
.summary-stars { font-size: 2.5rem; margin-bottom: 16px; }
.summary-score { font-size: 1.1rem; color: #aaa; margin-bottom: 8px; }
.summary-message { color: #ccc; margin-bottom: 32px; font-size: 0.95rem; }
.summary-btns { display: flex; gap: 12px; }
.summary-btns button {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
}
.btn-primary { background: #fff; color: #0f0f1a; }
.btn-secondary { background: rgba(255,255,255,0.08); color: #fff; }

.drag-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
  min-height: 60px;
}
.drag-item {
  padding: 12px 18px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.1s, opacity 0.2s;
}
.drag-item:active { cursor: grabbing; }
.drag-item.dragging { opacity: 0.4; }
.drag-item.placed {
  opacity: 0.3;
  pointer-events: none;
}
.drag-item.correct-placed { border-color: #2ecc71; background: rgba(46,204,113,0.15); opacity: 1; }
.drag-item.wrong-placed { border-color: #e74c3c; background: rgba(231,76,60,0.15); opacity: 1; }

.drop-targets {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.drop-target {
  min-height: 70px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.drop-target .target-label {
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
}
.drop-target.highlight {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.04);
}
.drop-target .dropped-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.dropped-chip {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.dropped-chip.correct { background: rgba(46,204,113,0.2); color: #2ecc71; }
.dropped-chip.wrong { background: rgba(231,76,60,0.2); color: #e74c3c; }

.drag-ghost {
  position: fixed;
  z-index: 5000;
  pointer-events: none;
  padding: 12px 18px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.option-btn {
  width: 100%;
  padding: 16px 20px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.option-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.option-btn.selected { border-color: #3498db; background: rgba(52,152,219,0.15); }
.option-btn.correct { border-color: #2ecc71; background: rgba(46,204,113,0.2); color: #2ecc71; }
.option-btn.wrong { border-color: #e74c3c; background: rgba(231,76,60,0.2); color: #e74c3c; }
.option-btn.disabled { pointer-events: none; opacity: 0.5; }
.option-btn.reveal-correct { border-color: #2ecc71; background: rgba(46,204,113,0.1); }

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #666;
  font-size: 0.95rem;
}
