/* style.css — Minigolf 3D styling */

:root {
  --bg: #1a1a2e;
  --hud-bg: rgba(18, 20, 38, 0.82);
  --hud-border: rgba(120, 140, 200, 0.25);
  --text: #e8ecf5;
  --text-dim: #9aa3bd;
  --accent: #ffdd44;
  --accent-2: #5fd0a0;
  --power-low: #44ff88;
  --power-high: #ff4d4d;
  --won: #ffd24a;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #e9eef7;
  --hud-bg: rgba(255, 255, 255, 0.86);
  --hud-border: rgba(60, 80, 140, 0.22);
  --text: #1c2233;
  --text-dim: #5a6580;
  --accent: #d99100;
  --accent-2: #2a9d6a;
  --power-low: #1faf5a;
  --power-high: #d83a3a;
  --won: #d99100;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #e9eef7;
    --hud-bg: rgba(255, 255, 255, 0.86);
    --hud-border: rgba(60, 80, 140, 0.22);
    --text: #1c2233;
    --text-dim: #5a6580;
    --accent: #d99100;
    --accent-2: #2a9d6a;
    --power-low: #1faf5a;
    --power-high: #d83a3a;
    --won: #d99100;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  touch-action: manipulation;
  position: fixed;
  inset: 0;
}

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

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
  max-width: 520px;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hud-level {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.hud-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  letter-spacing: 0.01em;
}

.hud-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  padding: 6px 12px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}

.hud-stat .val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 1.2em;
  text-align: right;
}

.power-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  padding: 8px 12px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: 320px;
}

.power-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
}

.power-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

html[data-theme="light"] .power-bar {
  background: rgba(0, 0, 0, 0.12);
}

.power-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--power-low) 0%, var(--accent) 55%, var(--power-high) 100%);
  transition: width 0.08s linear;
  box-shadow: 0 0 8px rgba(255, 221, 68, 0.4);
}

.hud-won {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--won);
  text-shadow: 0 0 12px rgba(255, 210, 74, 0.6), 0 1px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.05em;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

.hud-hint {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  line-height: 1.5;
  max-width: 100%;
}

.victory {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(20, 22, 45, 0.78) 0%, rgba(20, 22, 45, 0.92) 70%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: victoryFade 0.35s ease-out;
}

html[data-theme="light"] .victory {
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.78) 0%, rgba(235, 240, 250, 0.92) 70%);
}

.victory > div:first-child {
  font-size: clamp(28px, 7vw, 48px);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(255, 221, 68, 0.55), 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.03em;
  animation: victoryPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.victory-sub {
  font-size: 15px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.05em;
}

@keyframes victoryFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes victoryPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
  #hud {
    padding: 10px 10px;
    gap: 8px;
  }
  .hud-name { font-size: 14px; }
  .hud-level { font-size: 11px; padding: 5px 10px; }
  .hud-stat { padding: 5px 10px; }
  .hud-stat .val { font-size: 16px; }
  .hud-hint { font-size: 10px; }
  .power-container { max-width: 100%; }
}

@media (max-height: 420px) {
  .hud-hint { display: none; }
  #hud { padding: 8px 12px; gap: 6px; }
}

