:root {
  --bg1: #0b0f1e;
  --bg2: #131a33;
  --accent: #5ce1ff;
  --accent2: #ffd23f;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 70% 20%, var(--bg2) 0%, var(--bg1) 60%, #060913 100%);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: #eaf4ff;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  pointer-events: none;
  z-index: 5;
  gap: 8px;
}

.hud-left, .hud-right, .hud-mid { display: flex; align-items: center; gap: 6px; }

.hud-chip {
  background: rgba(10, 16, 34, 0.55);
  border: 1px solid rgba(92, 225, 255, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #dff4ff;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.hud-chip#chipCombo.lit { color: #ffd23f; border-color: rgba(255, 210, 63, 0.6); text-shadow: 0 0 8px rgba(255, 210, 63, 0.7); }

.hud-btn {
  pointer-events: auto;
  background: rgba(10, 16, 34, 0.55);
  border: 1px solid rgba(92, 225, 255, 0.25);
  border-radius: 999px;
  color: #dff4ff;
  font-weight: 700;
  font-size: 14px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.hud-btn:active { background: rgba(92, 225, 255, 0.25); }
.hud-btn.muted { opacity: 0.45; }

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(4, 8, 18, 0.55);
  backdrop-filter: blur(2px);
  padding: 20px;
}
#overlay.hidden { display: none; }

#overlayCard {
  max-width: 480px;
  width: 100%;
  background: linear-gradient(180deg, rgba(23, 33, 64, 0.92), rgba(12, 18, 38, 0.92));
  border: 1px solid rgba(92, 225, 255, 0.3);
  border-radius: 20px;
  padding: 26px 26px 22px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6), inset 0 0 40px rgba(92,225,255,0.05);
}

#overlayCard h1 {
  font-size: 42px;
  letter-spacing: 3px;
  font-weight: 900;
  background: linear-gradient(90deg, #5ce1ff, #ffd23f, #ff7de3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
  text-shadow: 0 0 30px rgba(92,225,255,0.45);
}
#overlayCard .subtitle {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 18px;
}

.rule-list { text-align: left; font-size: 13.5px; line-height: 1.65; opacity: 0.92; margin: 14px auto 18px; max-width: 360px; }
.rule-list li { margin-bottom: 6px; }

#overlayCard .big {
  font-size: 34px; font-weight: 900; margin: 4px 0 2px;
  text-shadow: 0 0 18px rgba(255,210,63,0.5);
}
#overlayCard .result-sub { opacity: 0.75; font-size: 13px; margin-bottom: 14px; }

.btn {
  pointer-events: auto;
  background: linear-gradient(180deg, #5ce1ff, #2aa8e0);
  border: none;
  border-radius: 14px;
  color: #06131f;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 1px;
  padding: 13px 34px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 10px 26px rgba(92,225,255,0.35);
  transition: transform 0.06s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,0.3); }
.btn.secondary {
  background: linear-gradient(180deg, rgba(92,225,255,0.18), rgba(92,225,255,0.08));
  color: #dff4ff;
  border: 1px solid rgba(92,225,255,0.4);
  box-shadow: none;
  font-size: 14px;
  padding: 10px 22px;
}

.hint { font-size: 12.5px; opacity: 0.6; margin-top: 14px; line-height: 1.5; }

#fpwarn {
  position: absolute;
  left: 0; right: 0;
  bottom: 8px;
  text-align: center;
  font-size: 13px;
  opacity: 0.85;
  color: #ffd23f;
  pointer-events: none;
  z-index: 20;
}
#fpwarn.hidden { display: none; }
