:root {
  --deep: #012a4a;
  --mid: #023e5c;
  --accent: #00d4ff;
  --accent2: #ffcf33;
  --danger: #ff5470;
  --panel: rgba(3, 30, 51, 0.82);
  --text: #eaf6ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #001220;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  color: var(--text);
  user-select: none;
  touch-action: none;
}

#game-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 22px;
  pointer-events: none;
  z-index: 5;
}

#hud.hidden { display: none; }

.hud-left, .hud-right { display: flex; gap: 14px; }
.hud-right { pointer-events: auto; }

.hud-item {
  background: var(--panel);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 12px;
  padding: 6px 14px;
  min-width: 74px;
  backdrop-filter: blur(6px);
}
.hud-label {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.6;
}
.hud-item span:last-child, .hud-item #hud-name { font-size: 20px; font-weight: 700; }

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lives { display: flex; gap: 6px; font-size: 24px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }

.grow-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.grow-bar {
  width: 180px;
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}
#grow-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.15s ease;
}
.grow-bar.nitro { border-color: rgba(255,207,51,0.4); }
#nitro-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffcf33, #ff8c42);
  transition: width 0.08s linear;
}
#nitro-fill.empty { background: linear-gradient(90deg, #ff5470, #b0002a); }
.grow-label { font-size: 10px; opacity: 0.6; letter-spacing: 1px; text-transform: uppercase; }

.icon-btn {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 12px;
  color: var(--text);
  font-size: 20px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  transition: transform .1s, background .2s;
}
.icon-btn:hover { background: rgba(0, 212, 255, 0.25); transform: translateY(-2px); }
.icon-btn:active { transform: scale(.94); }

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(2,62,92,0.55), rgba(0,10,20,0.9));
  backdrop-filter: blur(3px);
  z-index: 10;
}
.overlay.hidden { display: none; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 22px;
  padding: 34px 40px;
  width: min(460px, 92vw);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: pop .35s ease;
}
.panel.small { width: min(380px, 90vw); }

@keyframes pop {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: 28px; margin-bottom: 18px; }
.subtitle { opacity: 0.75; margin-bottom: 22px; font-size: 14px; }

.field { display: block; text-align: left; margin-bottom: 18px; }
.field > span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-bottom: 6px;
}
#input-name {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0,212,255,0.35);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
#input-name:focus { border-color: var(--accent); }

.difficulty { display: flex; gap: 10px; }
.diff-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: 12px;
  border: 1px solid rgba(0,212,255,0.3);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all .18s;
}
.diff-btn:hover { background: rgba(0,212,255,0.15); }
.diff-btn.active {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #012a4a;
  font-weight: 700;
  border-color: transparent;
}

.primary-btn {
  width: 100%;
  padding: 15px 0;
  margin-top: 6px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #012a4a;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s;
  box-shadow: 0 8px 24px rgba(0,212,255,0.35);
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,212,255,0.5); }
.primary-btn:active { transform: scale(.97); }

.ghost-btn {
  width: 100%;
  padding: 12px 0;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .18s;
}
.ghost-btn:hover { background: rgba(255,255,255,0.1); }

.highscores { margin-top: 24px; text-align: left; }
.highscores h3 { font-size: 14px; margin-bottom: 10px; opacity: 0.85; }
#highscore-list { list-style: none; counter-reset: hs; }
#highscore-list li {
  counter-increment: hs;
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 4px;
}
#highscore-list li::before { content: counter(hs) ". " attr(data-name); font-weight: 600; }
#highscore-list li.empty { justify-content: center; opacity: 0.5; }
#highscore-list li.empty::before { content: ""; }

.controls-hint { margin-top: 20px; font-size: 11px; opacity: 0.55; line-height: 1.6; }

.result { margin-bottom: 18px; }
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 16px;
}
.result-row b { font-size: 18px; color: var(--accent2); }
.new-record { margin-top: 14px; font-size: 18px; color: var(--accent2); font-weight: 700; animation: pulse 1s infinite; }
.new-record.hidden { display: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Mobil nitro butonu */
.nitro-btn {
  position: absolute;
  right: 22px;
  bottom: 26px;
  z-index: 6;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(255,207,51,0.6);
  background: radial-gradient(circle at 50% 35%, rgba(255,207,51,0.9), rgba(255,140,66,0.85));
  color: #3a2400;
  font-size: 30px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4);
  touch-action: none;
  user-select: none;
}
.nitro-btn span { font-size: 12px; letter-spacing: 1px; }
.nitro-btn:active { transform: scale(0.92); filter: brightness(1.15); }

/* Dokunmatik cihaz düzenlemeleri */
body.touch #game-canvas { cursor: auto; }

@media (max-width: 720px) {
  #hud { padding: 8px 10px; }
  .hud-item { min-width: 52px; padding: 4px 8px; }
  .hud-item span:last-child, .hud-item #hud-name { font-size: 15px; }
  .hud-label { font-size: 8px; }
  .lives { font-size: 18px; }
  .grow-bar { width: 120px; height: 8px; }
  .icon-btn { width: 40px; height: 40px; font-size: 17px; }
  .hud-left, .hud-right { gap: 7px; }
  .panel { padding: 22px 20px; border-radius: 18px; }
  h1 { font-size: 26px; }
  .nitro-btn { width: 84px; height: 84px; right: 16px; bottom: 20px; }
}

@media (max-width: 720px) and (orientation: landscape) {
  .grow-wrap:nth-child(2) { display: none; } /* dar ekranda büyüme çubuğunu gizle */
}

.hidden { display: none !important; }
