/* Self-hosted Inter (no external Google Fonts request) — avoids the
   fonts.gstatic.com fetch failing under ad blockers / privacy extensions /
   restrictive networks that block third-party font CDNs, which is exactly
   what was showing up as a console error (ERR_ABORTED / 404) for players
   even though the font itself and the @import syntax were both valid. */
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-800.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-900.woff2') format('woff2');
  font-weight: 900; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow: hidden; background: #05060f; color: #eaf6ff; font-family: 'Inter', sans-serif; }

/* Learned lesson from earlier GameCMB games: a utility class setting display
   can beat the UA [hidden] rule on specificity ties. Force it globally. */
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; }

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

/* ---------- Top controls ---------- */
.top-controls {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 70; /* above .overlay (60) — sound/fullscreen
  must stay clickable even while the menu or a modal is open */
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(93,242,255,0.35);
  background: rgba(6,10,24,0.7); color: #bdf0ff; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.icon-btn:active { transform: scale(0.92); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.hud-left { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 2px; }
.hud-right { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 2px; text-align: right; }
.hud-stat { display: flex; flex-direction: column; }
.hud-stat .label { font-size: 10px; letter-spacing: 0.14em; color: #7fb8d8; font-weight: 600; }
.hud-stat .value { font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 0 10px rgba(93,242,255,0.6); }
.hud-stat .value.rank { color: #ffe37a; font-size: 18px; text-shadow: 0 0 10px rgba(255,227,122,0.6); }

.combo-chip {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%);
  background: rgba(255,109,240,0.15); border: 1px solid rgba(255,109,240,0.55);
  color: #ff9ff5; font-weight: 800; padding: 4px 14px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 0 16px rgba(255,109,240,0.35);
}

/* ---------- Announce banner ---------- */
.announce {
  position: absolute; top: 90px; left: 50%; transform: translateX(-50%);
  font-size: 22px; font-weight: 900; letter-spacing: 0.08em; color: #ffcf5d;
  text-shadow: 0 0 18px rgba(255,207,93,0.7); z-index: 35; pointer-events: none;
  animation: announceIn 2.4s ease forwards;
}
@keyframes announceIn {
  0% { opacity: 0; transform: translate(-50%, -10px) scale(0.9); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(0.98); }
}

.countdown-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 45; pointer-events: none;
}
.countdown-overlay span {
  font-size: 96px; font-weight: 900; color: #5df2ff; text-shadow: 0 0 40px rgba(93,242,255,0.8);
  animation: countPop 1s ease;
}
@keyframes countPop { 0% { transform: scale(0.4); opacity: 0; } 40% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Toasts ---------- */
.toast-layer { position: absolute; top: 100px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: flex-end; }
.achievement-toast {
  background: rgba(8,12,28,0.92); border: 1px solid rgba(93,242,255,0.4); border-radius: 10px;
  padding: 8px 12px; max-width: 220px; animation: toastIn 0.3s ease, toastOut 0.4s ease 3.2s forwards;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.achievement-toast .t-title { font-size: 11px; color: #5df2ff; font-weight: 800; letter-spacing: 0.06em; }
.achievement-toast .t-name { font-size: 13px; font-weight: 700; color: #fff; }
.achievement-toast .t-desc { font-size: 11px; color: #9fb8cc; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Mobile controls ---------- */
.mobile-controls { position: absolute; inset: 0; pointer-events: none; z-index: 25; display: none; }
.joystick-base {
  position: absolute; left: 26px; bottom: 26px; width: 110px; height: 110px; border-radius: 50%;
  background: rgba(93,242,255,0.08); border: 2px solid rgba(93,242,255,0.35); pointer-events: auto;
}
.joystick-base.active { border-color: rgba(93,242,255,0.7); }
.joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(93,242,255,0.5); box-shadow: 0 0 16px rgba(93,242,255,0.6);
  transition: transform 0.02s linear;
}
.dash-btn {
  position: absolute; right: 30px; bottom: 34px; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4bd6ff, #1c6ea6); border: 2px solid rgba(255,255,255,0.4);
  color: #fff; font-weight: 900; font-size: 13px; letter-spacing: 0.06em; pointer-events: auto;
  box-shadow: 0 0 24px rgba(75,214,255,0.5); position: absolute;
}
.dash-btn:active { transform: scale(0.94); }
.dash-ring { position: absolute; inset: -4px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.15); pointer-events: none; }

@media (hover: none), (max-width: 820px) {
  .mobile-controls { display: block; }
}

/* ---------- Overlays / modals ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(20,26,54,0.94), rgba(3,4,12,0.96));
  padding: 20px; overflow-y: auto;
}
.menu-card, .modal-card {
  width: 100%; max-width: 420px; background: rgba(8,11,26,0.85); border: 1px solid rgba(93,242,255,0.25);
  border-radius: 18px; padding: 26px 24px; box-shadow: 0 0 60px rgba(30,120,180,0.25); text-align: center;
}
.brand { font-size: 11px; letter-spacing: 0.3em; color: #6fb8d8; font-weight: 700; }
.title { font-size: 34px; font-weight: 900; margin: 6px 0 2px; letter-spacing: 0.02em; }
.title span { color: #5df2ff; text-shadow: 0 0 22px rgba(93,242,255,0.7); }
.tagline { color: #a9c6d8; font-size: 13px; margin: 0 0 16px; }

.nick-label { display: block; font-size: 11px; letter-spacing: 0.12em; color: #7fb8d8; margin-bottom: 6px; }
.nick-input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(93,242,255,0.35);
  background: rgba(255,255,255,0.05); color: #fff; font-size: 16px; text-align: center; font-weight: 700;
}
.nick-input:focus { outline: none; border-color: #5df2ff; box-shadow: 0 0 0 3px rgba(93,242,255,0.2); }
.nick-error { color: #ff8080; font-size: 12px; margin-top: 6px; }

.btn-primary {
  width: 100%; margin-top: 14px; padding: 13px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #5df2ff, #2b8fd6); color: #04121a; font-weight: 900; font-size: 15px;
  letter-spacing: 0.04em; box-shadow: 0 6px 22px rgba(93,242,255,0.35);
}
.btn-primary:active { transform: translateY(1px); }
.btn-secondary {
  padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(93,242,255,0.3); cursor: pointer;
  background: rgba(255,255,255,0.04); color: #cfeeff; font-weight: 700; font-size: 12px; margin-top: 8px;
}
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.best-line { margin-top: 14px; font-size: 12px; color: #8fb4c8; }
.best-line span { color: #ffe37a; font-weight: 800; }

.modal-card h2 { margin: 0 0 12px; font-size: 20px; color: #5df2ff; }
.howto-list { text-align: left; font-size: 13px; line-height: 1.6; color: #cfe6f2; padding-left: 18px; }
.howto-list b { color: #5df2ff; }

.skins-sub { font-size: 12px; color: #8fb4c8; margin: -4px 0 12px; }
.skins-section-title {
  text-align: left; font-size: 11px; letter-spacing: 0.1em; color: #7fb8d8; font-weight: 800;
  margin: 16px 0 8px; text-transform: uppercase;
}
.skins-section-title:first-of-type { margin-top: 0; }
.skins-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.skin-head-preview {
  width: 30px; height: 30px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center;
}
.skin-head-preview svg { width: 100%; height: 100%; overflow: visible; }
.skin-item {
  border: 2px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 10px 6px; cursor: pointer;
  background: rgba(255,255,255,0.03);
}
.skin-item.locked { opacity: 0.4; cursor: not-allowed; }
.skin-item.selected { border-color: #5df2ff; box-shadow: 0 0 14px rgba(93,242,255,0.4); }
.skin-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 6px; }
.skin-dot-rainbow {
  background: conic-gradient(from 0deg, #ff6d6d, #ffcf5d, #c6ff5d, #5df2ff, #b48bff, #ff6df0, #ff6d6d);
}
.skin-color-input {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin: 0 auto 6px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); padding: 0; background: none;
  cursor: pointer; display: block;
}
.skin-color-input::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.skin-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.skin-color-input::-moz-color-swatch { border: none; border-radius: 50%; }
.skin-name { font-size: 10px; color: #cfeeff; }
.skin-req { font-size: 9px; color: #ff9f9f; margin-top: 2px; }

.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; font-size: 14px; }

.lb-tabs { display: flex; gap: 8px; margin-bottom: 10px; justify-content: center; }
.lb-tab { padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(93,242,255,0.25); background: transparent; color: #8fb4c8; font-weight: 700; font-size: 12px; cursor: pointer; }
.lb-tab.active { background: rgba(93,242,255,0.15); color: #5df2ff; border-color: #5df2ff; }
.lb-list { max-height: 280px; overflow-y: auto; margin-bottom: 10px; }
.lb-row { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.lb-row:nth-child(odd) { background: rgba(255,255,255,0.03); }
.lb-row .lb-rank { color: #ffe37a; font-weight: 800; width: 34px; text-align: left; }
.lb-row .lb-name { flex: 1; text-align: left; color: #cfeeff; }
.lb-row .lb-score { font-weight: 800; color: #fff; }
.lb-loading, .lb-empty { color: #8fb4c8; font-size: 13px; padding: 20px 0; }

.go-reason { font-size: 13px; letter-spacing: 0.1em; color: #ff8f6d; font-weight: 800; margin-bottom: 6px; }
.go-score-label { font-size: 11px; color: #8fb4c8; letter-spacing: 0.1em; }
.go-score { font-size: 46px; font-weight: 900; color: #fff; text-shadow: 0 0 24px rgba(93,242,255,0.5); margin-bottom: 10px; }
.go-stats { display: flex; justify-content: space-around; margin-bottom: 12px; }
.go-stats > div { display: flex; flex-direction: column; }
.go-stats .label { font-size: 10px; color: #7fb8d8; }
.go-stats .value { font-size: 16px; font-weight: 800; color: #ffe37a; }
.go-retention { font-size: 13px; color: #9fe6c0; min-height: 18px; margin-bottom: 6px; font-weight: 600; }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.25);
  font-size: 10px; letter-spacing: 0.08em; border: 1px dashed rgba(255,255,255,0.12); border-radius: 8px;
}
.ad-slot-menu { height: 60px; margin-bottom: 16px; }
.ad-slot-gameover { height: 60px; margin: 14px 0; }
.ad-slot-sidebar {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%); width: 160px; height: 480px; z-index: 20;
}
@media (max-width: 1100px) { .ad-slot-sidebar { display: none; } }

.seo-footer { position: absolute; bottom: -9999px; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

body.is-fullscreen .ad-slot-sidebar,
body.is-fullscreen .seo-footer { display: none; }

@media (max-width: 480px) {
  .go-score { font-size: 38px; }
  .menu-card, .modal-card { padding: 20px 16px; }
}
