/* Hoop Shot — styles. GameCMB (gamecmb.com) */

:root {
    --navy-950: #04060f;
    --navy-900: #0a0f22;
    --navy-800: #141c33;
    --orange: #ff7a2e;
    --orange-bright: #ffab5c;
    --gold: #ffd23c;
    --cyan: #5adcff;
    --white: #f4f7ff;
    --danger: #ff4d4d;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--navy-950);
    color: var(--white);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

a { color: var(--cyan); }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.site-header .brand {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--white);
}
.site-header .brand span { color: var(--orange); }
.site-header nav a {
    color: rgba(244,247,255,0.75);
    text-decoration: none;
    margin-left: 18px;
    font-size: 0.92rem;
}

#gameWrap {
    max-width: 920px;
    margin: 0 auto;
    padding: 18px 14px 0;
}

h1.game-title {
    text-align: center;
    font-size: 1.7rem;
    font-weight: 800;
    margin: 6px 0 14px;
    letter-spacing: 0.01em;
}
h1.game-title .ball-emoji { filter: drop-shadow(0 0 8px rgba(255,122,46,0.6)); }

#gameRoot {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 82vh;
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    background: #04060f;
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
    touch-action: none;
    user-select: none;
}

#gameCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block;
}

/* --- HUD --- */
#hud {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    z-index: 15;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.hud-block {
    background: rgba(6,10,22,0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 8px 14px;
    text-align: center;
    min-width: 84px;
}

/* Combo sits in its own row below the top controls so it never overlaps
   the mute/motion/fullscreen cluster, which is also horizontally centered. */
#comboBlock {
    position: absolute;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 14;
    pointer-events: none;
}
.hud-label { font-size: 0.62rem; letter-spacing: 0.08em; opacity: 0.65; text-transform: uppercase; }
.hud-value { font-size: 1.25rem; font-weight: 800; }
#hudCombo.hot { color: var(--gold); text-shadow: 0 0 12px rgba(255,210,60,0.7); }
#hudLevel { font-size: 0.7rem; opacity: 0.8; margin-top: 2px; display: block; }

#hudLives { display: flex; gap: 5px; justify-content: center; margin-top: 4px; }
.life-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
}
.life-dot.full { background: var(--orange); border-color: var(--orange-bright); box-shadow: 0 0 6px rgba(255,122,46,0.8); }

/* --- Top controls (must stay above every overlay — z-index 45) --- */
#topControls {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 45;
}
#topControls button {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(6,10,22,0.6);
    color: var(--white);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
#topControls button[aria-pressed="true"] { border-color: var(--cyan); box-shadow: 0 0 8px rgba(90,220,255,0.5); }

/* --- Tutorial hint --- */
#tutorialHint {
    position: absolute;
    left: 50%; bottom: 130px;
    transform: translateX(-50%);
    text-align: center;
    z-index: 12;
    pointer-events: none;
    animation: pulse 1.6s ease-in-out infinite;
}
#tutorialHint .th-line { font-weight: 800; font-size: 1.1rem; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#tutorialHint .th-arrow { font-size: 1.4rem; margin: 2px 0; }
@keyframes pulse { 0%,100% { opacity: 0.75; } 50% { opacity: 1; } }

/* --- Toasts / banners --- */
#milestoneToast, #streakBanner {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}
#milestoneToast {
    top: 132px;
    background: linear-gradient(90deg, #ffd23c, #ff9a3c);
    color: #241300;
}
#streakBanner {
    top: 178px;
    font-size: 1.3rem;
    background: rgba(6,10,22,0.55);
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255,180,40,0.7);
}
.toast-anim { animation: toastPop 2.2s ease forwards; }
.banner-anim { animation: toastPop 1.3s ease forwards; }
@keyframes toastPop {
    0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
    12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.05); }
    20% { transform: translateX(-50%) translateY(0) scale(1); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.97); }
}

/* --- Overlays --- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px 20px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 20%, rgba(20,28,55,0.96), rgba(4,6,15,0.98));
    backdrop-filter: blur(3px);
    overflow-y: auto;
}
.overlay h2 { font-size: 1.6rem; margin: 0; font-weight: 900; letter-spacing: 0.02em; }
.overlay .sub { opacity: 0.75; font-size: 0.9rem; margin-top: -8px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: 14px;
    border: none;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    min-height: 48px;
    min-width: 180px;
}
.btn-primary { background: linear-gradient(90deg, var(--orange), var(--gold)); color: #241300; box-shadow: 0 8px 22px rgba(255,140,40,0.35); }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--white); border: 1px solid rgba(255,255,255,0.18); }
.btn-ghost { background: transparent; color: rgba(244,247,255,0.75); border: 1px solid rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }

.logo-mark { font-size: 3.4rem; filter: drop-shadow(0 6px 16px rgba(255,122,46,0.5)); }
.stat-row { display: flex; gap: 28px; justify-content: center; }
.stat-pill { display: flex; flex-direction: column; }
.stat-pill .n { font-size: 1.6rem; font-weight: 900; }
.stat-pill .l { font-size: 0.68rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.08em; }

#goNewBest {
    background: linear-gradient(90deg, var(--gold), var(--orange));
    color: #241300;
    font-weight: 900;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
}

#nicknameForm { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }
#nicknameInput {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: var(--white);
    font-size: 1rem;
    text-align: center;
}
#nicknameError { color: var(--danger); font-size: 0.82rem; min-height: 1.1em; }
#submitConfirm { color: #7dffb0; font-weight: 700; }
#rankBanner { color: var(--gold); font-weight: 800; }

.go-actions, .menu-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

.lb-tabs { display: flex; gap: 8px; margin-bottom: 6px; }
.lb-tab {
    padding: 8px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05); color: var(--white); font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.lb-tab.active { background: var(--orange); color: #241300; border-color: var(--orange); }

#lbList {
    list-style: none; margin: 0; padding: 0;
    width: 100%; max-width: 380px;
    max-height: 46vh; overflow-y: auto;
}
.lb-row {
    display: grid; grid-template-columns: 40px 1fr auto;
    gap: 10px; padding: 8px 10px; border-radius: 10px;
    align-items: center;
}
.lb-row:nth-child(odd) { background: rgba(255,255,255,0.04); }
.lb-rank { color: var(--orange-bright); font-weight: 800; text-align: left; }
.lb-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; }
.lb-empty { opacity: 0.6; padding: 20px; }
#lbMe {
    margin-top: 8px; padding: 8px 14px; border-radius: 10px;
    background: rgba(90,220,255,0.12); border: 1px solid rgba(90,220,255,0.3);
    font-weight: 700; font-size: 0.85rem;
}

/* --- Ad slots --- */
.ad-slot {
    max-width: 920px;
    margin: 16px auto;
    min-height: 90px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 10px;
    color: rgba(244,247,255,0.35);
    font-size: 0.78rem;
}

/* --- SEO content --- */
.seo-content {
    max-width: 820px;
    margin: 10px auto 40px;
    padding: 0 18px;
    line-height: 1.65;
    color: rgba(244,247,255,0.85);
}
.seo-content h2 { font-size: 1.25rem; margin-top: 34px; color: var(--white); }
.seo-content ul { padding-left: 20px; }
.faq-item summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.faq-item { border-bottom: 1px solid rgba(255,255,255,0.08); }

.site-footer {
    text-align: center;
    padding: 24px;
    color: rgba(244,247,255,0.4);
    font-size: 0.8rem;
}

@media (min-width: 700px) {
    #gameRoot { max-height: 78vh; }
    h1.game-title { font-size: 2.1rem; }
}
