html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #060a1a;
  color: #cfe9ff;
  font-family: system-ui, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

#hud {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 26px;
  border: 2px solid #22e6ff;
  border-radius: 14px;
  background: rgba(10, 18, 48, 0.85);
  box-shadow: 0 0 18px rgba(34, 230, 255, 0.45), inset 0 0 12px rgba(34, 230, 255, 0.15);
  pointer-events: none;
}

#hud .team {
  display: flex;
  align-items: center;
  gap: 14px;
}

#hud .name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2px;
}

#hud .score {
  font-weight: 900;
  font-size: 34px;
  min-width: 28px;
  text-align: center;
}

#hud .orange { color: #ff8a1f; text-shadow: 0 0 12px rgba(255, 138, 31, 0.8); }
#hud .purple { color: #a24bff; text-shadow: 0 0 12px rgba(162, 75, 255, 0.8); }

#hud .sep {
  font-size: 28px;
  font-weight: 900;
  color: #22e6ff;
  text-shadow: 0 0 10px rgba(34, 230, 255, 0.8);
}

#help {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: rgba(207, 233, 255, 0.6);
  pointer-events: none;
}

#help b {
  color: #22e6ff;
  font-weight: 700;
}

.hidden { display: none !important; }

/* --- Takım bildirimi --------------------------------------------------- */
#toast {
  position: fixed;
  top: 156px;
  left: 50%;
  transform: translate(-50%, -10px);
  padding: 10px 22px;
  border-radius: 12px;
  border: 2px solid currentColor;
  background: rgba(10, 18, 48, 0.9);
  font-size: 18px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.orange { color: #ff8a1f; box-shadow: 0 0 18px rgba(255, 138, 31, 0.5); }
#toast.purple { color: #a24bff; box-shadow: 0 0 18px rgba(162, 75, 255, 0.5); }
#toast b { font-weight: 900; letter-spacing: 2px; }
#toast span { margin-left: 10px; opacity: 0.8; font-weight: 600; }

/* --- Menü ------------------------------------------------------------- */
#menu {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  background: rgba(6, 10, 26, 0.88);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  touch-action: pan-y;
}
/* Ekrana sığmazsa üstten kesilmesin, kaydırılabilsin */
#menu > :first-child { margin-top: auto; }
#menu > :last-child { margin-bottom: auto; }

.logo {
  margin: 0;
  font-size: clamp(44px, 9vw, 96px);
  font-weight: 900;
  letter-spacing: 0.12em;
}
.logo .o { color: #ff8a1f; text-shadow: 0 0 24px rgba(255, 138, 31, 0.8); }
.logo .p { color: #a24bff; text-shadow: 0 0 24px rgba(162, 75, 255, 0.8); }

.sub {
  margin: 6px 0 34px;
  color: #22e6ff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(34, 230, 255, 0.7);
}

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.card {
  position: relative;
  width: 200px;
  padding: 18px 18px 22px;
  border: 2px solid rgba(34, 230, 255, 0.5);
  border-radius: 18px;
  background: rgba(12, 23, 56, 0.85);
  color: #cfe9ff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(34, 230, 255, 0.2);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card:hover, .card:focus-visible {
  outline: none;
  transform: translateY(-6px);
  border-color: #22e6ff;
  box-shadow: 0 0 28px rgba(34, 230, 255, 0.6), inset 0 0 16px rgba(34, 230, 255, 0.15);
}

.mini {
  position: relative;
  width: 90px;
  height: 140px;
  margin: 0 auto;
  border: 2px solid #22e6ff;
  border-radius: 6px;
  background: #0c1738;
  box-shadow: 0 0 8px rgba(34, 230, 255, 0.5);
}
.mini .mid {
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 2px solid rgba(34, 230, 255, 0.7);
}
.mini .circle {
  position: absolute;
  left: 50%; top: 50%;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(34, 230, 255, 0.7);
  border-radius: 50%;
}
.mini .dot {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: 12px; height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.mini .dot.orange { background: #ff8a1f; box-shadow: 0 0 8px #ff8a1f; }
.mini .dot.purple { background: #a24bff; box-shadow: 0 0 8px #a24bff; }

.card .label {
  margin-top: 16px;
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 14px rgba(34, 230, 255, 0.8);
}
.card .desc {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(207, 233, 255, 0.7);
}
.card kbd {
  position: absolute;
  top: 10px; right: 12px;
  font: 700 11px system-ui, sans-serif;
  color: rgba(34, 230, 255, 0.8);
  border: 1px solid rgba(34, 230, 255, 0.5);
  border-radius: 5px;
  padding: 1px 6px;
  display: none;
}
.card:hover kbd { display: block; }

.hint {
  margin-top: 34px;
  font-size: 13px;
  color: rgba(207, 233, 255, 0.55);
  text-align: center;
}

/* --- Saat (skorun altında) ---------------------------------------------- */
#clock {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 14px;
  border: 1.5px solid rgba(34, 230, 255, 0.6);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: rgba(10, 18, 48, 0.85);
  color: #22e6ff;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(34, 230, 255, 0.7);
  pointer-events: none;
}
#clock.low {
  color: #ff3b3b;
  border-color: rgba(255, 59, 59, 0.7);
  text-shadow: 0 0 10px rgba(255, 59, 59, 0.9);
  animation: blink 1s steps(2, start) infinite;
}
#clock.overtime { color: #ffe14f; border-color: rgba(255, 225, 79, 0.7); text-shadow: 0 0 10px rgba(255, 225, 79, 0.8); }
#clock .ot { font-size: 12px; letter-spacing: 3px; margin-right: 6px; vertical-align: 2px; }
@keyframes blink { to { opacity: 0.45; } }

/* --- Boost / Stamina Göstergesi ----------------------------------------- */
#boost-meter {
  position: fixed;
  top: 118px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 18, 48, 0.85);
  border: 1.5px solid rgba(34, 230, 255, 0.4);
  box-shadow: 0 0 10px rgba(34, 230, 255, 0.25);
  pointer-events: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#boost-meter.boosting {
  border-color: #22e6ff;
  box-shadow: 0 0 16px rgba(34, 230, 255, 0.7);
}
#boost-meter.exhausted {
  border-color: #ff3b3b;
  box-shadow: 0 0 16px rgba(255, 59, 59, 0.7);
}
.boost-track {
  width: 140px;
  height: 8px;
  border-radius: 4px;
  background: rgba(124, 255, 79, 0.15);
  overflow: hidden;
  position: relative;
}
#boost-fill {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: #7cff4f;
  box-shadow: 0 0 8px #7cff4f;
  transition: width 0.08s linear, background 0.2s;
}
#boost-meter.boosting #boost-fill {
  background: #22e6ff;
  box-shadow: 0 0 12px #22e6ff;
}
#boost-meter.low #boost-fill {
  background: #ffe14f;
  box-shadow: 0 0 10px #ffe14f;
}
#boost-meter.exhausted #boost-fill {
  background: #ff3b3b;
  box-shadow: 0 0 10px #ff3b3b;
}
.boost-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #22e6ff;
  text-shadow: 0 0 6px rgba(34, 230, 255, 0.8);
}

#toast.neutral { color: #ffe14f; box-shadow: 0 0 18px rgba(255, 225, 79, 0.45); }

/* --- Menü ayarları (neon hap butonlar) --------------------------------- */
.settings {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.settings .row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.settings .key {
  width: 110px;
  text-align: right;
  margin-right: 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  color: rgba(207, 233, 255, 0.7);
}
.pill {
  min-width: 62px;
  padding: 7px 16px;
  border: 1.5px solid rgba(34, 230, 255, 0.35);
  border-radius: 999px;
  background: rgba(12, 23, 56, 0.85);
  color: rgba(207, 233, 255, 0.75);
  font: 700 14px system-ui, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.pill:hover { border-color: rgba(34, 230, 255, 0.8); color: #fff; }
.pill.on {
  border-color: #22e6ff;
  color: #ffffff;
  background: rgba(34, 230, 255, 0.15);
  box-shadow: 0 0 14px rgba(34, 230, 255, 0.6), inset 0 0 8px rgba(34, 230, 255, 0.25);
}

/* --- Duraklatma ve maç sonu panelleri ---------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 10, 26, 0.7);
  backdrop-filter: blur(4px);
}
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(340px, 100%);
  padding: 28px 28px 20px;
  border: 2px solid #22e6ff;
  border-radius: 18px;
  background: rgba(12, 23, 56, 0.95);
  box-shadow: 0 0 30px rgba(34, 230, 255, 0.45), inset 0 0 18px rgba(34, 230, 255, 0.12);
}
.panel.wide { width: min(620px, 100%); }
.panel h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #22e6ff;
  text-shadow: 0 0 12px rgba(34, 230, 255, 0.8);
  text-align: center;
}
.panel .title { font-size: clamp(26px, 5vw, 40px); margin: 0; }
.panel .title.orange { color: #ff8a1f; text-shadow: 0 0 18px rgba(255, 138, 31, 0.8); }
.panel .title.purple { color: #a24bff; text-shadow: 0 0 18px rgba(162, 75, 255, 0.8); }
.subtitle { margin: 0; font-size: 16px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.bigscore {
  font-size: 64px;
  font-weight: 900;
  color: #22e6ff;
  font-variant-numeric: tabular-nums;
}
.bigscore .orange { color: #ff8a1f; text-shadow: 0 0 16px rgba(255, 138, 31, 0.8); }
.bigscore .purple { color: #a24bff; text-shadow: 0 0 16px rgba(162, 75, 255, 0.8); }

.stats {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 8px 18px;
  width: 100%;
  padding: 14px 0;
  border-top: 1px solid rgba(34, 230, 255, 0.25);
  border-bottom: 1px solid rgba(34, 230, 255, 0.25);
  font-size: 15px;
}
.stats .lbl { color: rgba(207, 233, 255, 0.6); font-weight: 700; letter-spacing: 1px; }
.stats .orange { color: #ffb36b; text-align: center; }
.stats .purple { color: #c99bff; text-align: center; }
.stats b { color: #fff; }
.stats b.me { color: #7cff4f; }

.buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.btn {
  min-width: 180px;
  padding: 11px 20px;
  border: 1.5px solid rgba(34, 230, 255, 0.5);
  border-radius: 12px;
  background: rgba(10, 18, 48, 0.9);
  color: #cfe9ff;
  font: 800 16px system-ui, "Segoe UI", sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover, .btn:focus-visible {
  outline: none;
  border-color: #22e6ff;
  box-shadow: 0 0 16px rgba(34, 230, 255, 0.55);
  transform: translateY(-2px);
}
.btn.primary { border-color: #22e6ff; color: #fff; background: rgba(34, 230, 255, 0.15); }
.panel .tip { margin: 6px 0 0; font-size: 12px; color: rgba(207, 233, 255, 0.5); }
.panel .tip b { color: #22e6ff; }

/* --- Zorluk hapları: seçili olan seviyesinin renginde parlar ------------ */
.pill.lv-easy.on {
  border-color: #7cff4f;
  background: rgba(124, 255, 79, 0.14);
  box-shadow: 0 0 14px rgba(124, 255, 79, 0.6), inset 0 0 8px rgba(124, 255, 79, 0.25);
}
.pill.lv-hard.on {
  border-color: #ff3b3b;
  background: rgba(255, 59, 59, 0.14);
  box-shadow: 0 0 14px rgba(255, 59, 59, 0.65), inset 0 0 8px rgba(255, 59, 59, 0.25);
}
.pill.lv-easy:hover { border-color: rgba(124, 255, 79, 0.8); }
.pill.lv-hard:hover { border-color: rgba(255, 59, 59, 0.8); }

/* Yatay ekranda saha döner (turuncu sağa hücum eder), minyatür de döner */
@media (orientation: landscape) {
  .mini { width: 140px; height: 90px; }
  .mini .mid { left: 50%; right: auto; top: 0; bottom: 0; border-top: none; border-left: 2px solid rgba(34, 230, 255, 0.7); }
  .mini .dot { left: calc((1 - var(--y)) * 100%); top: calc(var(--x) * 100%); }
}

/* Alçak ekran (yatay telefon): skor tabelası küçülür, boost barı alta iner */
@media (max-height: 500px) {
  .logo { font-size: 44px; }
  .sub { margin-bottom: 14px; }
  .settings { margin-top: 16px; gap: 8px; }
  .hint { margin-top: 16px; }
  #hud { top: 6px; padding: 3px 16px; gap: 10px; border-radius: 10px; }
  #hud .team { gap: 8px; }
  #hud .name { font-size: 11px; letter-spacing: 1px; }
  #hud .score { font-size: 22px; min-width: 18px; }
  #hud .sep { font-size: 18px; }
  #clock { top: 46px; font-size: 13px; padding: 1px 10px; }
  #boost-meter { top: auto; bottom: max(6px, env(safe-area-inset-bottom)); padding: 2px 10px; }
  .boost-track { width: 110px; height: 6px; }
  #toast { top: 70px; font-size: 15px; }
  .touch-pause-btn { top: 6px; width: 36px; height: 36px; }
}

/* Dokunmatikte klavye yardımı gösterilmez */
@media (pointer: coarse), (hover: none) {
  #help { display: none !important; }
}
body.has-touch #help { display: none !important; }

/* --- Mobil Dokunmatik Kontroller -------------------------------------- */
#touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  display: none;
}

/* Sadece dokunmatik ekranlı / mobil cihazlarda gösterilir */
@media (pointer: coarse), (hover: none) {
  #touch-controls:not(.hidden) {
    display: block;
  }
}
body.has-touch #touch-controls:not(.hidden) {
  display: block;
}

#joystick-zone {
  position: fixed;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#joystick-base {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 230, 255, 0.08) 0%, rgba(10, 18, 48, 0.65) 75%);
  border: 2px solid rgba(34, 230, 255, 0.35);
  box-shadow: 0 0 18px rgba(34, 230, 255, 0.25), inset 0 0 12px rgba(34, 230, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

#joystick-knob {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #22e6ff 0%, rgba(34, 230, 255, 0.4) 60%, rgba(10, 18, 48, 0.85) 100%);
  border: 2px solid #22e6ff;
  box-shadow: 0 0 16px rgba(34, 230, 255, 0.7);
  transform: translate(0, 0);
  will-change: transform;
  pointer-events: none;
}

#touch-actions {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-btn {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.1s;
}

.touch-btn-boost {
  width: 62px;
  height: 62px;
  background: rgba(34, 230, 255, 0.18);
  border: 2px solid #22e6ff;
  color: #22e6ff;
  box-shadow: 0 0 14px rgba(34, 230, 255, 0.4), inset 0 0 8px rgba(34, 230, 255, 0.2);
  font-size: 13px;
  letter-spacing: 1.5px;
}

.touch-btn-boost.active, .touch-btn-boost:active {
  background: rgba(34, 230, 255, 0.45);
  box-shadow: 0 0 24px rgba(34, 230, 255, 0.9), inset 0 0 12px rgba(34, 230, 255, 0.4);
  transform: scale(0.92);
}

.touch-btn-shoot {
  width: 74px;
  height: 74px;
  background: rgba(255, 138, 31, 0.22);
  border: 2.5px solid #ff8a1f;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 138, 31, 0.5), inset 0 0 10px rgba(255, 138, 31, 0.25);
  font-size: 16px;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(255, 138, 31, 0.8);
}

.touch-btn-shoot.active, .touch-btn-shoot:active {
  background: rgba(255, 138, 31, 0.5);
  box-shadow: 0 0 30px rgba(255, 138, 31, 0.95), inset 0 0 14px rgba(255, 138, 31, 0.5);
  transform: scale(0.92);
}

.touch-pause-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(10, 18, 48, 0.85);
  border: 1.5px solid rgba(34, 230, 255, 0.5);
  color: #22e6ff;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 45;
  touch-action: none;
  box-shadow: 0 0 12px rgba(34, 230, 255, 0.35);
}
.touch-pause-btn i {
  width: 4px;
  height: 14px;
  margin: 0 2.5px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 0 6px rgba(34, 230, 255, 0.8);
}
@media (pointer: coarse), (hover: none) {
  .touch-pause-btn:not(.hidden) { display: flex; }
}
body.has-touch .touch-pause-btn:not(.hidden) {
  display: flex;
}

/* Mobil Ekranlar İçin Ekstra Uyumluluk (küçük ekran optimizasyonu) */
@media (max-width: 520px) {
  #hud {
    padding: 6px 16px;
    gap: 12px;
  }
  #hud .name { font-size: 12px; letter-spacing: 1px; }
  #hud .score { font-size: 26px; min-width: 20px; }
  #hud .sep { font-size: 22px; }
  #clock { font-size: 15px; top: 72px; padding: 2px 10px; }
  #boost-meter { top: 104px; padding: 3px 10px; gap: 6px; }
  .boost-track { width: 100px; height: 6px; }
  .boost-label { font-size: 9px; }
  .sub { margin-bottom: 20px; }
  .cards { gap: 10px; flex-wrap: nowrap; }
  .card { width: calc((100vw - 52px) / 3); padding: 10px 6px 12px; border-radius: 14px; }
  .mini { width: 56px; height: 88px; }
  .mini .dot { width: 9px; height: 9px; }
  .card .label { font-size: 24px; margin-top: 8px; }
  .card .desc { font-size: 10px; }
  .settings { margin-top: 20px; gap: 10px; }
  .settings .row { gap: 6px; }
  .settings .key { width: 100%; text-align: center; margin: 0; font-size: 11px; }
  .pill { min-width: 48px; padding: 6px 12px; font-size: 13px; }
  .hint { margin-top: 20px; font-size: 12px; }
  #help { font-size: 11px; bottom: 6px; }
}
