/* Pair Quest — Bright Kid-Friendly Theme */
:root {
  --bg: #e8f4ff;
  --sky1: #a8e6ff;
  --sky2: #fff5e1;
  --glass: rgba(255, 255, 255, 0.85);
  --accent: #ff6b35;
  --accent2: #4ecdc4;
  --success: #2ecc71;
  --error: #e74c3c;
  --text: #2c3e50;
  --touch: 60px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky1), var(--sky2));
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}
/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: env(safe-area-inset-top, 12px) 12px 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.target-wrap {
  text-align: center;
  background: var(--glass);
  border-radius: 20px;
  padding: 8px 16px;
  margin: 0 auto;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
#target {
  font-size: clamp(2.6rem, 9vw, 4rem);
  font-weight: 900;
  color: #e74c3c;
  margin: 0;
  text-shadow: 0 2px 0 #fff;
}
.target-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #34495e;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stats {
  display: flex;
  justify-content: space-around;
  align-items: center;
  pointer-events: auto;
  gap: 8px;
  flex-wrap: wrap;
}
.stat {
  background: var(--glass);
  border: 2px solid #3498db;
  border-radius: 16px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  color: #2c3e50;
}
#combo {
  color: #f39c12;
  background: #fff9e6;
  border-color: #f39c12;
}
.controls-top {
  position: absolute;
  top: env(safe-area-inset-top, 10px);
  right: 10px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.controls-top button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #3498db;
  background: #fff;
  color: #2c3e50;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Operation selector */
#opsBar {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
  pointer-events: auto;
  padding: 10px;
  background: #fff;
  border: 3px solid #3498db;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
#opsBar[hidden] { display: none !important; }
.op-btn {
  min-width: 70px;
  min-height: var(--touch);
  font-size: 2.2rem;
  font-weight: 900;
  border-radius: 18px;
  border: 3px solid #2c3e50;
  background: #fff;
  color: #2c3e50;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 0 #bdc3c7;
}
.op-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #bdc3c7;
}
.op-btn[data-op="+"] { background: #2ecc71; color: #fff; border-color: #27ae60; }
.op-btn[data-op="-"] { background: #3498db; color: #fff; border-color: #2980b9; }
.op-btn[data-op="*"] { background: #9b59b6; color: #fff; border-color: #8e44ad; }
.op-btn[data-op="/"] { background: #e67e22; color: #fff; border-color: #d35400; }
.op-preview {
  font-size: 1rem;
  font-weight: 800;
  color: #2c3e50;
  text-align: center;
  width: 100%;
  position: absolute;
  top: -32px;
  left: 0;
  pointer-events: none;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  z-index: 30;
  padding: 16px;
}
.overlay[hidden] { display: none !important; }
.panel {
  background: #fff;
  border: 4px solid #3498db;
  border-radius: 28px;
  padding: clamp(20px, 4vw, 36px);
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(52,152,219,0.25);
}
.panel h1, .panel h2 { margin: 0 0 12px; font-size: clamp(1.7rem, 5vw, 2.2rem); color: #2c3e50; }
.panel p { color: #34495e; line-height: 1.5; }
.primary, .secondary {
  min-height: var(--touch);
  border-radius: 18px;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
  margin: 6px 4px;
}
.primary {
  background: #2ecc71;
  color: #fff;
  box-shadow: 0 4px 0 #27ae60;
}
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #27ae60; }
.secondary {
  background: #ecf0f1;
  color: #2c3e50;
  border: 2px solid #bdc3c7;
}
.level-btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  min-height: 56px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1.05rem;
  border: 3px solid #3498db;
  background: #fff;
  color: #2c3e50;
}
.level-btn:active { background: #eaf6ff; }
.stats-row { display: flex; justify-content: center; gap: 20px; margin: 12px 0; }
.stars { font-size: 1.8rem; margin: 8px 0; }
/* Mobile */
@media (max-width: 600px) {
  #target { font-size: 2.8rem; }
  .stat { font-size: 0.85rem; padding: 5px 10px; }
  .op-btn { min-width: 64px; font-size: 1.9rem; }
}
.score-pop {
  position: absolute;
  pointer-events: none;
  font-weight: 900;
  font-size: 1.5rem;
  color: #2ecc71;
  text-shadow: 0 2px 0 #fff;
  animation: floatUp 0.8s ease-out forwards;
  z-index: 25;
}
@keyframes floatUp {
  to { transform: translateY(-50px); opacity: 0; }
}


/* DOM orbs — reliable mobile taps */
#orbLayer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-family: system-ui, sans-serif;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  min-width: 72px;
  min-height: 72px;
  z-index: 16;
}
.orb.selected {
  outline: 5px solid #2c3e50;
  outline-offset: 3px;
  transform: scale(1.08);
}
.orb:active {
  transform: scale(0.95);
}
