/* ============================================================
   COLOR STRIKE — Premium Stylesheet
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800;900&family=Baloo+2:wght@700;800&display=swap');

:root {
    --teal:   #60b9bc;
    --orange: #f0b060;
    --purple: #a680b8;
    --red:    #ff7070;
    --bg:     #fdfaf0;
    --text:   #444;
    --card:   #ffffff;
    --shadow: rgba(0,0,0,0.12);
    --radius: 20px;
}

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

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Nunito', 'Arial Rounded MT Bold', sans-serif;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

canvas {
    display: block;
    touch-action: none;
}

/* ── Preloader ──────────────────────────────────────────────── */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
#preloader.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}
.preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.logo-spinner {
    width: 90px;
    height: 90px;
    animation: spinSVG 1.5s linear infinite;
}
.spinner-svg { width: 100%; height: 100%; }
@keyframes spinSVG { to { transform: rotate(360deg); } }

.preloader-title {
    font-family: 'Baloo 2', cursive;
    font-size: 28px;
    font-weight: 800;
    color: var(--teal);
    letter-spacing: 3px;
}
.loading-dots {
    display: flex;
    gap: 8px;
}
.loading-dots span {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--teal);
    animation: dotBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { background: var(--orange); animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { background: var(--purple); animation-delay: 0.4s; }
@keyframes dotBounce {
    0%,80%,100% { transform: scale(0.5); opacity: 0.5; }
    40%          { transform: scale(1.2); opacity: 1; }
}

/* ── Main Menu ──────────────────────────────────────────────── */
#main-menu {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}
#main-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.menu-bg-circles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.12;
    animation: floatCircle 8s ease-in-out infinite;
}
.bg-circle.c1 { width:200px;height:200px;background:var(--teal);  top:-60px;  left:-60px;  animation-delay:0s; }
.bg-circle.c2 { width:150px;height:150px;background:var(--orange);top:30%;    right:-40px; animation-delay:2s; }
.bg-circle.c3 { width:120px;height:120px;background:var(--purple);bottom:20%; left:10%;    animation-delay:4s; }
.bg-circle.c4 { width:180px;height:180px;background:var(--red);   bottom:-50px;right:20%;  animation-delay:1s; }
@keyframes floatCircle {
    0%,100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-20px) rotate(180deg); }
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
    padding: 30px 20px 50px;
    width: 100%;
    max-width: 380px;
    min-height: 100%;
    justify-content: center;
    /* Hide scrollbar visually */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.menu-content::-webkit-scrollbar { display: none; }

.menu-logo {
    font-family: 'Baloo 2', cursive;
    font-size: clamp(36px, 10vw, 60px);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    margin-bottom: -4px;
}
.logo-strike {
    font-size: clamp(18px, 5vw, 28px);
    letter-spacing: 8px;
    color: #888;
    font-weight: 700;
}

.menu-tagline {
    font-size: 15px;
    color: #999;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
}

.menu-stats {
    display: flex;
    gap: 16px;
}
.stat-box {
    background: white;
    border-radius: 14px;
    padding: 9px 20px;
    text-align: center;
    box-shadow: 0 3px 12px var(--shadow);
    min-width: 75px;
}
.stat-val {
    font-family: 'Baloo 2', cursive;
    font-size: 22px;
    font-weight: 800;
    color: var(--teal);
    line-height: 1.2;
}
.stat-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: #aaa;
    font-weight: 700;
}

.btn-play {
    background: linear-gradient(135deg, var(--teal), #4aa8ab);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 56px;
    font-size: 22px;
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 6px 0 #3d8c8f, 0 10px 20px rgba(96,185,188,0.35);
    transition: transform 0.1s, box-shadow 0.1s;
    pointer-events: auto;
}
.btn-play:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #3d8c8f, 0 4px 10px rgba(96,185,188,0.25);
}

.menu-modes {
    display: flex;
    gap: 10px;
}
.btn-mode {
    background: #f0ede4;
    color: #888;
    border: 2px solid transparent;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
}
.btn-mode.active {
    background: white;
    color: var(--teal);
    border-color: var(--teal);
    box-shadow: 0 3px 10px rgba(96,185,188,0.25);
}
.btn-mode:active { transform: scale(0.95); }

.mode-desc {
    font-size: 13px;
    color: #aaa;
    text-align: center;
    font-weight: 700;
    min-height: 18px;
}

/* ── In-Game UI ─────────────────────────────────────────────── */
#ui {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 20px;
    background: linear-gradient(to bottom, rgba(253,250,240,0.92), transparent);
}
.hud-left, .hud-right, .hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}
.hud-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: #bbb;
    font-weight: 800;
    margin-bottom: 2px;
}
.score-box {
    font-family: 'Baloo 2', cursive;
    font-size: 38px;
    font-weight: 800;
    color: #5b9bd5;
    line-height: 1;
}
.score-box.pulse { animation: scorePulse 0.25s ease-out; }
@keyframes scorePulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.22); }
}

.combo-display {
    font-family: 'Baloo 2', cursive;
    font-size: 28px;
    font-weight: 800;
    color: #ccc;
    transition: color 0.3s, transform 0.15s;
}

.lives-container {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 28px;
}
.life-heart {
    font-size: 22px;
    animation: heartPulse 2s ease-in-out infinite;
}
.life-heart:nth-child(2) { animation-delay: 0.3s; }
.life-heart:nth-child(3) { animation-delay: 0.6s; }
@keyframes heartPulse {
    0%,100% { transform: scale(1); }
    10%      { transform: scale(1.15); }
    20%      { transform: scale(1); }
}

/* Timer bar */
.timer-bar-wrap {
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    margin: 0 20px;
    overflow: hidden;
}
.timer-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.1s linear, background 0.3s;
    background: var(--teal);
}

/* Level badge */
.level-badge {
    position: absolute;
    top: 80px;
    right: 20px;
    background: white;
    border: 2px solid var(--orange);
    color: var(--orange);
    font-family: 'Baloo 2', cursive;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 50px;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(240,176,96,0.2);
    transition: transform 0.2s;
}
.level-badge.level-pop { animation: levelPop 0.5s ease-out; }
@keyframes levelPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Power-up indicator */
.powerup-indicator {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--teal);
    color: white;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 50px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.powerup-indicator.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Pause Button ───────────────────────────────────────────── */
#pause-btn {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    color: #888;
    transition: transform 0.1s;
}
#pause-btn:active { transform: translateX(-50%) scale(0.9); }

/* ── Pause Screen ───────────────────────────────────────────── */
#pause-screen {
    position: fixed;
    inset: 0;
    background: rgba(253,250,240,0.9);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
}
.pause-card {
    background: white;
    border-radius: var(--radius);
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 10px 40px var(--shadow);
}
.pause-card h2 {
    font-family: 'Baloo 2', cursive;
    color: #444;
    font-size: 36px;
    margin: 0 0 24px;
    letter-spacing: 3px;
}

/* ── Game Over ──────────────────────────────────────────────── */
#game-over {
    position: fixed;
    inset: 0;
    background: rgba(253,250,240,0.96);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}
#game-over.show { opacity: 1; }

.result-card {
    background: white;
    border-radius: 24px;
    padding: 40px 36px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    max-width: 360px;
    width: 100%;
    animation: cardSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes cardSlideUp {
    from { transform: translateY(40px) scale(0.95); opacity:0; }
    to   { transform: translateY(0)    scale(1);    opacity:1; }
}
.result-icon { font-size: 54px; margin-bottom: 8px; }
.result-title {
    font-family: 'Baloo 2', cursive;
    font-size: 32px;
    font-weight: 800;
    color: #444;
    letter-spacing: 2px;
    margin: 0 0 8px;
}
.result-score {
    font-family: 'Baloo 2', cursive;
    font-size: 64px;
    font-weight: 800;
    color: var(--teal);
    line-height: 1;
    margin: 4px 0 16px;
}
.result-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}
.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.rs-label { font-size: 10px; letter-spacing: 2px; color: #bbb; font-weight: 800; }
.rs-val   { font-family: 'Baloo 2', cursive; font-size: 22px; font-weight: 800; color: #555; }
.new-best-tag {
    background: var(--orange);
    color: white;
    font-size: 12px;
    font-weight: 900;
    padding: 4px 12px;
    border-radius: 50px;
    letter-spacing: 1px;padding-top: 17px;
}
.result-buttons { display: flex; gap: 12px; justify-content: center; }
.btn-retry, .btn-menu {
    padding: 12px 28px;
    font-size: 16px;
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s;
}
.btn-retry {
    background: linear-gradient(135deg, var(--teal), #4aa8ab);
    color: white;
    box-shadow: 0 4px 0 #3d8c8f;
}
.btn-retry:active { transform: translateY(3px); box-shadow: 0 1px 0 #3d8c8f; }
.btn-menu {
    background: #f0ede4;
    color: #888;
    box-shadow: 0 4px 0 #d8d4cb;
}
.btn-menu:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8d4cb; }

/* ── Info Modal ─────────────────────────────────────────────── */
#info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 400;
    opacity: 0;
    transition: opacity 0.25s;
    padding: 20px;
}
#info-modal.show { opacity: 1; }
.modal-card {
    background: white;
    border-radius: 24px;
    padding: 36px 28px;
    max-width: 380px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: cardSlideUp 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.modal-card h2 {
    font-family: 'Baloo 2', cursive;
    color: var(--teal);
    font-size: 26px;
    margin: 0 0 20px;
    text-align: center;
    letter-spacing: 1px;
}
.modal-close {
    position: absolute;
    top: 5px; right: 5px;
    background: #f0ede4;
    border: none;
    width: 32px; height: 32px;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
}
.modal-close:active { transform: scale(0.9); }

.how-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.how-step {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fdfaf0;
    border-radius: 12px;
    padding: 10px 14px;
}
.step-num {
    width: 28px; height: 28px;
    background: var(--teal);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-text { font-size: 13px; color: #666; line-height: 1.4; font-weight: 700; }

.modes-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    padding: 14px;
    background: #fdfaf0;
    border-radius: 12px;
}
.mode-info-item { font-size: 13px; color: #666; font-weight: 700; }
.mode-info-item strong { color: var(--purple); }
.close-btn.btn-play { display: block; width: 100%; text-align: center; pointer-events: auto; }

/* ── Footer Icons ───────────────────────────────────────────── */
.footer-icons {
    display: flex;
    justify-content: center;
    gap: 16px;
}
.menu-footer { margin-top: 4px; }

.icon-btn {
    width: 52px; height: 52px;
    background: white;
    border-radius: 14px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 0 #d8d4cb, 0 6px 16px rgba(0,0,0,0.1);
    color: #888;
    font-size: 20px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s;
    font-weight: 900;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8d4cb; }
.icon-btn.disabled { opacity: 0.4; }

/* ── Shared Button ──────────────────────────────────────────── */
button {
    padding: 13px 40px;
    font-size: 18px;
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--teal), #4aa8ab);
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 0 #3d8c8f;
    transition: transform 0.1s, box-shadow 0.1s;
    pointer-events: auto;
    letter-spacing: 1px;
}
button:active { transform: translateY(3px); box-shadow: 0 2px 0 #3d8c8f; }

/* ── Damage Flash ───────────────────────────────────────────── */
.damage-flash {
    position: fixed;
    inset: 0;
    background: rgba(255,100,100,0.25);
    z-index: 500;
    pointer-events: none;
    animation: flashFade 0.4s ease-out forwards;
}
@keyframes flashFade { to { opacity: 0; } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .hud-top { padding: 8px 12px; }
    .score-box { font-size: 30px; }
    .combo-display { font-size: 22px; }
    .life-heart { font-size: 18px; }
    .level-badge { top: 68px; right: 12px; font-size: 11px; }
    .result-card { padding: 28px 20px; }
    .result-score { font-size: 52px; }
    .result-title { font-size: 26px; }
    .modal-card { padding: 28px 20px; }
    .menu-content { gap: 10px; padding: 20px 16px 40px; }
    .menu-logo { font-size: clamp(30px, 9vw, 48px); }
    .menu-tagline { font-size: 12px; letter-spacing: 1px; }
    .btn-play { padding: 13px 44px; font-size: 19px; }
    .btn-mode { padding: 6px 14px; font-size: 12px; }
    .stat-box { padding: 7px 14px; }
    .stat-val { font-size: 20px; }
}

@media (max-height: 600px) {
    .menu-content { gap: 10px; padding: 16px 20px 30px; }
    .menu-logo { font-size: clamp(28px, 8vw, 44px); }
    .menu-tagline { display: none; }
    .stat-box { padding: 6px 14px; }
    .stat-val { font-size: 18px; }
    .btn-play { padding: 11px 40px; font-size: 18px; }
    .btn-mode { padding: 6px 12px; font-size: 12px; }
    .mode-desc { font-size: 11px; }
    .footer-icons.menu-footer { margin-top: 0; }
    .icon-btn { width: 44px; height: 44px; font-size: 17px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .hud-top { padding: 6px 12px; }
    .score-box { font-size: 26px; }
    .combo-display { font-size: 20px; }
    .life-heart { font-size: 16px; }
    .result-card { padding: 20px; max-height: 80vh; overflow-y: auto; }
    .result-score { font-size: 42px; }
    .modal-card { max-height: 80vh; overflow-y: auto; }
}
