:root {
  --bg: #0f1220;
  --panel: #16192b;
  --accent: #70f7d0;
  --accent2: #8ab4ff;
  --text: #e8ebff;
  --muted: #99a1c2;
  --danger: #ff6b81;
  --good: #6bff95;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 800px at 50% -20%, #1b1f36 0%, var(--bg) 50%, #0b0e19 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
  overflow: hidden;
}

.wrap {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 16px;
}

canvas {
  width: 100%;
  max-width: 640px;
  height: auto;
  aspect-ratio: 9/16;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.0));
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.06);
  touch-action: none;
}

/* HUD */
.hud {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 640px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
}

.chip {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.hearts {
  display: flex;
  gap: 4px;
}

.heart {
  font-size: 18px;
}

/* Exit Button */
.exit-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  background: linear-gradient(180deg, var(--danger), #b94656);
  border: none;
  color: white;
  font-weight: 900;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 16px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 20;
  display: none; /* hidden until game starts */
}
.exit-btn:active {
  transform: translateY(2px);
}

/* Controls */
.controls {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 640px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 10px;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  user-select: none;
}
.btn:active {
  transform: translateY(2px);
}

/* Overlay / Menu */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(1000px 700px at 50% -10%, rgba(112,247,208,0.04), rgba(0,0,0,0.65));
  z-index: 10;
}

.panel {
  width: min(92vw, 560px);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.title {
  font-size: 32px;
  font-weight: 900;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 16px;
}

/* Instructions */
.instructions {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: left;
  margin: 12px 0 18px 0;
  font-size: 15px;
  line-height: 1.5;
}
.instructions strong {
  color: var(--accent);
}

/* Mode Select */
.mode-select {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mode-btn {
  padding: 12px 20px;
  font-size: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
}
.mode-btn.selected {
  background: var(--accent);
  color: #061018;
  font-weight: 900;
}

.start {
  margin-top: 10px;
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 900;
  color: #061018;
  background: linear-gradient(180deg, var(--accent), #3ddcab);
  border: none;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(61,220,171,0.45);
  cursor: pointer;
}
.start:active {
  transform: translateY(2px);
}

/* Responsive */
@media (max-width: 600px) {
  .title { font-size: 26px; }
  .btn { font-size: 18px; padding: 14px 16px; }
  .exit-btn { font-size: 14px; padding: 6px 12px; }
  .instructions { font-size: 14px; }
}
