/* style.css — Plunder */
:root {
  --bg: #072a3e;
  --glass: rgba(16, 38, 54, 0.55);
  --glass-strong: rgba(16, 38, 54, 0.78);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-dim: rgba(245, 245, 247, 0.62);
  --accent: #ffb340;
  --accent-2: #ff8a1e;
  --danger: #ff3b30;
  --good: #34c759;
  --radius: 20px;
  --radius-sm: 12px;
  --display-font: Georgia, 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
  color-scheme: dark;
}
html[data-theme="light"] {
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(0, 0, 0, 0.1);
  --text: #1c1c1e;
  --text-dim: rgba(28, 28, 30, 0.55);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; display: block; }

.hidden { display: none !important; }

/* Glass */
.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
}

/* HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
  z-index: 10; pointer-events: none;
}
.hud-row {
  display: flex; gap: 8px; justify-content: space-between; align-items: center;
}
.glass-pill {
  display: flex; flex-direction: column; align-items: center;
  padding: 7px 14px; border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  min-width: 84px;
}
.pill-center { order: 0; }
.pill-label {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; line-height: 1;
}
.pill-value {
  font-size: 18px; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.glass-pill:last-child { flex-direction: column-reverse; }
.glass-pill:last-child .pill-value { margin-top: 0; margin-bottom: 2px; }

.health-row {
  margin-top: 10px; display: flex; justify-content: center;
}
.health-track {
  width: min(78%, 320px); height: 10px; border-radius: 6px;
  overflow: hidden; padding: 0;
}
.health-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #34c759, #5ad07a);
  border-radius: 6px;
  transition: width 0.25s ease, background 0.3s ease;
}
.health-fill.low {
  background: linear-gradient(90deg, #ff3b30, #ff6b5e);
}

/* Controls */
.controls {
  position: absolute; inset: 0; z-index: 9; pointer-events: none;
}
.joystick {
  position: absolute; left: 24px; bottom: max(28px, env(safe-area-inset-bottom));
  width: 132px; height: 132px; border-radius: 50%;
  pointer-events: auto; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.joy-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(20, 44, 62, 0.4);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.3);
}
.joystick.active .joy-base { border-color: rgba(255, 179, 64, 0.5); }
.joy-stick {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(160deg, #ffb340, #d9821a);
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.3);
  transition: transform 0.05s linear;
  pointer-events: none;
}

.fire-button {
  position: absolute; right: 24px; bottom: max(36px, env(safe-area-inset-bottom));
  width: 104px; height: 104px; border-radius: 50%;
  pointer-events: auto; touch-action: none;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at 35% 30%, #ff5a4d, #c01f15);
  color: #fff; font-family: inherit; font-weight: 800;
  font-size: 15px; letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(192, 31, 21, 0.5), inset 0 3px 6px rgba(255,255,255,0.25);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: flex; align-items: center; justify-content: center;
}
.fire-button.active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(192, 31, 21, 0.4), inset 0 2px 8px rgba(0,0,0,0.3);
}
.fire-label { text-shadow: 0 1px 2px rgba(0,0,0,0.4); }

/* Wave banner */
.wave-banner {
  position: absolute; top: 38%; left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  font-family: var(--display-font);
  font-size: clamp(28px, 7vw, 52px); font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.6), 0 0 30px rgba(255,179,64,0.4);
  opacity: 0; pointer-events: none; z-index: 8;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(.2,.9,.3,1.2);
  white-space: nowrap;
}
.wave-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* Overlays */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at center, rgba(7,42,62,0.35), rgba(4,20,32,0.7));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.menu-card {
  width: min(92%, 380px);
  border-radius: 28px;
  padding: 30px 26px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: cardIn 0.4s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.emblem {
  width: 64px; height: 64px; color: var(--accent);
  margin: 0 auto 6px; display: block;
  filter: drop-shadow(0 2px 8px rgba(255,179,64,0.35));
}
.title {
  font-family: var(--display-font);
  font-size: 42px; font-weight: 800; letter-spacing: 0.14em;
  margin: 4px 0 2px;
  background: linear-gradient(180deg, #fff, #ffd9a0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 20px rgba(255,179,64,0.25);
}
html[data-theme="light"] .title {
  background: linear-gradient(180deg, #1c1c1e, #8a5a1a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); margin: 0 0 18px; font-weight: 600;
}
.menu-best {
  font-size: 14px; color: var(--text-dim); margin-bottom: 22px;
  font-variant-numeric: tabular-nums;
}
.menu-best span { color: var(--accent); font-weight: 700; }

.primary-btn {
  width: 100%; padding: 16px; border: none; border-radius: 16px;
  background: linear-gradient(180deg, #ffb340, #e88a1a);
  color: #1a1208; font-family: inherit; font-size: 17px; font-weight: 800;
  letter-spacing: 0.04em; cursor: pointer;
  box-shadow: 0 8px 22px rgba(232, 138, 26, 0.4), inset 0 1px 2px rgba(255,255,255,0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.primary-btn:active { transform: scale(0.97); box-shadow: 0 3px 10px rgba(232,138,26,0.4); }

.menu-hint {
  margin: 18px 0 14px; font-size: 12px; line-height: 1.6;
  color: var(--text-dim);
}
.menu-hint p { margin: 2px 0; }

.mute-btn {
    background: none; border: 1px solid var(--glass-border);
    color: var(--text-dim); font-family: inherit; font-size: 12px;
    padding: 7px 16px; border-radius: 20px; cursor: pointer;
    letter-spacing: 0.06em; font-weight: 600;
    transition: color 0.15s, border-color 0.15s;
}
.mute-btn:active { transform: scale(0.96); }

/* Game over */
.go-title {
  font-family: var(--display-font);
  font-size: 38px; font-weight: 800; letter-spacing: 0.1em;
  margin: 0 0 4px; color: var(--danger);
  text-shadow: 0 2px 16px rgba(255,59,48,0.3);
}
.go-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 22px; }
.stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 22px;
}
.stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center;
}
html[data-theme="light"] .stat { background: rgba(0,0,0,0.04); }
.stat-label {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
}
.stat-value {
  font-size: 22px; font-weight: 800; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-best .stat-value { color: var(--accent); }
.secondary-btn {
  width: 100%; padding: 13px; margin-top: 10px;
  background: none; border: 1px solid var(--glass-border);
  color: var(--text); font-family: inherit; font-size: 15px; font-weight: 600;
  border-radius: 14px; cursor: pointer;
  transition: transform 0.1s ease, background 0.15s;
}
.secondary-btn:active { transform: scale(0.97); background: rgba(255,255,255,0.05); }

@media (max-width: 360px) {
  .joystick { width: 116px; height: 116px; left: 16px; }
  .joy-stick { width: 50px; height: 50px; }
  .fire-button { width: 92px; height: 92px; right: 16px; }
  .glass-pill { min-width: 72px; padding: 6px 10px; }
  .pill-value { font-size: 16px; }
}
@media (min-width: 700px) {
  .joystick { width: 150px; height: 150px; left: 32px; }
  .joy-stick { width: 64px; height: 64px; }
  .fire-button { width: 120px; height: 120px; right: 32px; }
}

