* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0a051a 0%, #0f0a25 50%, #150f33 100%);
    overflow: hidden;
}

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

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
}

.ui-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.ui-coins {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(15, 10, 40, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(10px);
}

.ui-coins-icon {
    font-size: 20px;
    animation: coinBounce 2s ease-in-out infinite;
}

@keyframes coinBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.ui-coins-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    min-width: 40px;
}

.ui-level {
    padding: 8px 16px;
    background: rgba(15, 10, 40, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(100, 200, 255, 0.3);
    backdrop-filter: blur(10px);
}

.ui-level-text {
    font-size: 14px;
    color: #64c8ff;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.4);
}

.ui-target {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: rgba(15, 10, 40, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(150, 100, 255, 0.3);
    backdrop-filter: blur(8px);
}

.ui-target-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.ui-target-value {
    font-size: 14px;
    font-weight: bold;
    color: #9664ff;
    text-shadow: 0 0 10px rgba(150, 100, 255, 0.5);
}

.ui-progress-bar {
    position: absolute;
    top: 95px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.ui-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9664ff, #ff6496);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(150, 100, 255, 0.5);
}

.ui-auto-drop {
    position: absolute;
    top: 115px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ui-auto-drop-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 100, 100, 0.6);
    border-radius: 50%;
    animation: dropPulse 1s ease-in-out infinite;
}

@keyframes dropPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.ui-auto-drop-bar {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.ui-auto-drop-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6464, #ffd700);
    border-radius: 2px;
    transition: width 0.05s linear;
}

.ui-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    pointer-events: auto;
}

.ui-btn {
    padding: 10px 18px;
    border-radius: 16px;
    border: 2px solid;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.ui-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.ui-btn:hover::before {
    left: 100%;
}

.ui-btn-coins {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.ui-btn-coins:hover {
    background: rgba(255, 215, 0, 0.25);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.ui-btn-wand {
    background: rgba(100, 200, 255, 0.15);
    border-color: rgba(100, 200, 255, 0.5);
    color: #64c8ff;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.4);
}

.ui-btn-wand:hover {
    background: rgba(100, 200, 255, 0.25);
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.3);
    transform: translateY(-2px);
}

.ui-btn-bomb {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff6464;
    text-shadow: 0 0 10px rgba(255, 100, 100, 0.4);
}

.ui-btn-bomb:hover {
    background: rgba(255, 100, 100, 0.25);
    box-shadow: 0 0 20px rgba(255, 100, 100, 0.3);
    transform: translateY(-2px);
}

.ui-btn-revive {
    background: rgba(50, 200, 100, 0.15);
    border-color: rgba(50, 200, 100, 0.5);
    color: #32c864;
    text-shadow: 0 0 10px rgba(50, 200, 100, 0.4);
    animation: revivePulse 2s ease-in-out infinite;
}

@keyframes revivePulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(0, 180, 80, 0.25); }
    50% { box-shadow: 0 4px 35px rgba(40, 255, 130, 0.5), 0 0 50px rgba(40, 255, 130, 0.15); }
}

.ui-btn-revive:hover {
    background: rgba(50, 200, 100, 0.25);
    box-shadow: 0 0 25px rgba(50, 200, 100, 0.4);
    transform: translateY(-2px);
}

.ui-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.ui-btn:disabled:hover {
    box-shadow: none;
}

.ui-btn-icon {
    font-size: 16px;
}

.hidden {
    display: none !important;
}

.popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    animation: popupIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.popup.hidden {
    display: none;
}

.popup-content {
    text-align: center;
    padding: 22px 32px;
    background: rgba(10, 5, 25, 0.92);
    border-radius: 22px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2), 0 0 100px rgba(255, 215, 0, 0.08), inset 0 0 30px rgba(255, 215, 0, 0.03);
    backdrop-filter: blur(15px);
}

.popup-content.jackpot {
    border-color: rgba(255, 50, 50, 0.6);
    box-shadow: 0 0 70px rgba(255, 50, 50, 0.3), 0 0 120px rgba(255, 215, 0, 0.2), inset 0 0 40px rgba(255, 50, 50, 0.05);
    animation: jackpotShake 0.08s ease-in-out infinite;
}

@keyframes jackpotShake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-4px, 3px) rotate(-1.5deg); }
    50% { transform: translate(4px, -3px) rotate(1.5deg); }
    75% { transform: translate(-3px, -2px) rotate(-0.8deg); }
}

.popup-title {
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
    margin-bottom: 8px;
}

.popup-amount {
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.8), 0 0 50px rgba(255, 215, 0, 0.4);
}

.popup-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

@keyframes popupIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    60% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal.hidden {
    display: none;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, rgba(21, 16, 42, 0.85), rgba(13, 8, 32, 0.9), rgba(18, 10, 37, 0.85));
    border-radius: 24px;
    padding: 28px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), 0 0 60px rgba(0, 0, 0, 0.2), inset 0 0 40px rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(15px);
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.modal-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.modal-btn {
    padding: 14px 24px;
    border-radius: 16px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #ff6464, #ff8c64);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255, 100, 100, 0.35);
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 100, 100, 0.45);
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.modal-btn-icon {
    font-size: 18px;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-stat-item {
    text-align: center;
}

.modal-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.modal-stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    letter-spacing: 1px;
}

.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0a051a 0%, #0f0a25 50%, #150f33 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 3px;
}

.gameover-panel {
    border-color: rgba(255, 40, 40, 0.4);
    box-shadow: 0 0 60px rgba(255, 40, 40, 0.15), 0 0 100px rgba(255, 40, 40, 0.05), inset 0 0 30px rgba(255, 40, 40, 0.02);
}

.gameover-icon {
    font-size: 60px;
    margin-bottom: 8px;
    animation: gameoverShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    filter: drop-shadow(0 0 20px rgba(255, 50, 50, 0.5));
}

@keyframes gameoverShake {
    0%, 100% { transform: scale(1) rotate(0); }
    15% { transform: scale(1.4) rotate(-12deg); }
    30% { transform: scale(1.15) rotate(10deg); }
    45% { transform: scale(1.3) rotate(-8deg); }
    60% { transform: scale(1.1) rotate(5deg); }
    75% { transform: scale(1.2) rotate(-3deg); }
    90% { transform: scale(1.05) rotate(2deg); }
}

.gameover-title {
    color: #ff3333;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 25px rgba(255, 50, 50, 0.6), 0 0 50px rgba(255, 50, 50, 0.2);
    margin-bottom: 4px;
}

.gameover-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-bottom: 14px;
}

.gameover-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 18px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gameover-stat-item {
    text-align: center;
}

.gameover-stat-value {
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.15);
}

.gameover-stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    letter-spacing: 2px;
}

.gameover-buttons {
    flex-direction: row !important;
    gap: 10px !important;
}

.revive-action {
    background: linear-gradient(135deg, rgba(40, 200, 100, 0.2), rgba(40, 200, 100, 0.1));
    border-color: rgba(40, 200, 100, 0.5);
    color: #28c864;
    text-shadow: 0 0 15px rgba(40, 200, 100, 0.5);
}

.revive-action:hover {
    background: linear-gradient(135deg, rgba(40, 200, 100, 0.3), rgba(40, 200, 100, 0.15));
    box-shadow: 0 0 30px rgba(40, 200, 100, 0.3);
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0f051f 50%, #05020a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    overflow-y: auto;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(100, 200, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 100, 50, 0.04) 0%, transparent 50%);
    animation: startBgPulse 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes startBgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#start-screen.hidden {
    display: none;
}

.start-content {
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.start-title {
    font-size: 36px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4), 0 0 100px rgba(255, 215, 0, 0.2);
    margin-bottom: 8px;
    letter-spacing: 3px;
    animation: titleGlow 2.5s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4), 0 0 100px rgba(255, 215, 0, 0.2); }
    50% { text-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 80px rgba(255, 215, 0, 0.6), 0 0 120px rgba(255, 215, 0, 0.3); }
}

.start-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 32px;
    letter-spacing: 4px;
}

.start-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.feature-item {
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.05), transparent);
    transition: left 0.6s ease;
}

.feature-item:hover::after {
    left: 100%;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 215, 0, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.feature-item:nth-child(1) { border-color: rgba(100, 200, 255, 0.1); }
.feature-item:nth-child(1):hover { border-color: rgba(100, 200, 255, 0.3); }
.feature-item:nth-child(2) { border-color: rgba(255, 215, 0, 0.1); }
.feature-item:nth-child(2):hover { border-color: rgba(255, 215, 0, 0.3); }
.feature-item:nth-child(3) { border-color: rgba(255, 100, 50, 0.1); }
.feature-item:nth-child(3):hover { border-color: rgba(255, 100, 50, 0.3); }
.feature-item:nth-child(4) { border-color: rgba(255, 105, 180, 0.1); }
.feature-item:nth-child(4):hover { border-color: rgba(255, 105, 180, 0.3); }

.feature-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.feature-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.start-instructions {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 32px;
}

.instruction-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 12px;
}

.instruction-list {
    text-align: left;
}

.instruction-item {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 2;
    padding-left: 8px;
}

.start-btn {
    background: linear-gradient(135deg, #5a0dad, #8b2ff0, #5a0dad);
    border: 2px solid rgba(140, 47, 240, 0.6);
    border-radius: 50px;
    padding: 16px 48px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 30px rgba(140, 47, 240, 0.4), 0 0 60px rgba(140, 47, 240, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 6px 30px rgba(140, 47, 240, 0.4), 0 0 60px rgba(140, 47, 240, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.1); }
    50% { box-shadow: 0 8px 40px rgba(140, 47, 240, 0.6), 0 0 80px rgba(140, 47, 240, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.15); }
}

.start-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(140, 47, 240, 0.5), 0 0 100px rgba(140, 47, 240, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.15);
}

.start-btn:active {
    transform: translateY(-2px);
}

.start-btn-text {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(140, 47, 240, 0.8);
    letter-spacing: 2px;
}

.start-btn-sub {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.ad-modal-content {
    padding: 20px;
    max-width: 300px;
}

.ad-modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 8px;
}

.ad-modal-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
}

.ad-modal-buttons {
    gap: 10px;
}

.ad-modal-btn {
    padding: 12px 20px;
    font-size: 14px;
}

.ad-modal-btn.watch {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.ad-modal-btn.watch:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.4);
}

.ad-modal-btn.close {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ad-modal-btn.close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.level-up-panel {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 80px rgba(255, 215, 0, 0.25), 0 0 150px rgba(255, 215, 0, 0.1), inset 0 0 50px rgba(255, 215, 0, 0.03);
}

.level-up-icon {
    font-size: 50px;
    margin-bottom: 8px;
    animation: levelUpBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes levelUpBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.level-up-title {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 215, 0, 0.2);
    margin-bottom: 4px;
}

.level-up-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-bottom: 14px;
}

.level-up-next-btn {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
}

.level-up-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.45);
}

@media (max-width: 480px) {
    .start-title {
        font-size: 28px;
    }

    .start-content {
        padding: 20px;
    }

    .start-btn {
        padding: 14px 32px;
    }

    .modal-content {
        padding: 20px;
        margin: 16px;
    }
}

#game-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    z-index: 11;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 10, 40, 0.6);
    backdrop-filter: blur(10px);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(30, 20, 60, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.level-badge {
    padding: 6px 16px;
    background: rgba(15, 10, 40, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(100, 200, 255, 0.3);
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: bold;
    color: #64c8ff;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.4);
}

#bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    gap: 8px;
    pointer-events: auto;
    z-index: 11;
    background: linear-gradient(0deg, rgba(5, 2, 15, 0.85) 0%, rgba(5, 2, 15, 0.4) 70%, transparent 100%);
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 12, 50, 0.65);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 60px;
    position: relative;
    overflow: hidden;
}

.tool-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.5s ease;
}

.tool-btn:hover::before {
    left: 100%;
}

.tool-btn:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tool-btn:active {
    transform: translateY(-1px) scale(0.97);
}

.tool-icon {
    font-size: 20px;
    line-height: 1;
}

.tool-name {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
}

.tool-count {
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
}

.tool-btn.has-wand {
    border-color: rgba(100, 200, 255, 0.5);
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.2);
}

.tool-btn.has-wand .tool-count {
    color: #64c8ff;
    text-shadow: 0 0 8px rgba(100, 200, 255, 0.5);
}

.tool-btn.has-bomb {
    border-color: rgba(255, 100, 50, 0.5);
    box-shadow: 0 0 15px rgba(255, 100, 50, 0.2);
    animation: bombPulse 2s ease-in-out infinite;
}

.tool-btn.has-bomb .tool-count {
    color: #ff6432;
    text-shadow: 0 0 8px rgba(255, 100, 50, 0.5);
}

@keyframes bombPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 100, 50, 0.2); }
    50% { box-shadow: 0 0 25px rgba(255, 100, 50, 0.4); }
}

.tool-btn.has-undo {
    border-color: rgba(100, 255, 150, 0.4);
}

.tool-btn.has-undo .tool-count {
    color: #64ff96;
}

.ad-btn {
    border-color: rgba(255, 215, 0, 0.3);
}

.ad-btn:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.ad-btn .tool-icon {
    animation: adGlow 2.5s ease-in-out infinite;
}

@keyframes adGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.revive-btn {
    border-color: rgba(50, 200, 100, 0.5);
    background: rgba(50, 200, 100, 0.15);
    animation: revivePulseBtn 2s ease-in-out infinite;
}

@keyframes revivePulseBtn {
    0%, 100% { box-shadow: 0 0 10px rgba(50, 200, 100, 0.2); }
    50% { box-shadow: 0 0 25px rgba(50, 200, 100, 0.4); }
}

.bomb-btn {
    border-color: rgba(255, 100, 50, 0.25);
}

.bomb-btn:hover {
    border-color: rgba(255, 100, 50, 0.5);
    box-shadow: 0 0 20px rgba(255, 100, 50, 0.15);
}

.bomb-btn .tool-icon {
    filter: drop-shadow(0 0 4px rgba(255, 100, 50, 0.3));
}

.modal-content h2 {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.modal-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-content p strong {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-buttons .modal-btn {
    padding: 12px 20px;
    border-radius: 14px;
    border: none;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 100%;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.4);
}

.modal-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

#gameover-modal .modal-content {
    border-color: rgba(255, 40, 40, 0.3);
}

.gameover-icon {
    font-size: 56px;
    margin-bottom: 8px;
}

.gameover-title {
    font-size: 22px;
    font-weight: bold;
    color: #ff3333;
    text-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
    margin-bottom: 4px;
}

.gameover-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 14px;
}

.gameover-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 18px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    display: block;
}

.stat-value {
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    display: block;
}

.gameover-buttons {
    flex-direction: row !important;
    gap: 10px !important;
}

.gameover-buttons .modal-btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 12px;
}

.revive-action {
    background: linear-gradient(135deg, rgba(50, 200, 100, 0.2), rgba(50, 200, 100, 0.1)) !important;
    border: 1px solid rgba(50, 200, 100, 0.4) !important;
    color: #32c864 !important;
    text-shadow: 0 0 10px rgba(50, 200, 100, 0.4);
}

.restart-action {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

#ad-status {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0a051a 0%, #0f0a25 50%, #150f33 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
}

.loading-content {
    text-align: center;
}

.loading-title {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.loading-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 3px;
}

.start-features .feature-item:nth-child(3) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.start-features .feature-item:nth-child(3) .feature-icon {
    display: flex;
    gap: 4px;
    font-size: 24px;
    margin-bottom: 8px;
}

@media (max-width: 380px) {
    #bottom-bar {
        gap: 6px;
        padding: 8px 8px;
    }

    .tool-btn {
        min-width: 52px;
        padding: 6px 8px;
    }

    .tool-icon {
        font-size: 18px;
    }

    .tool-name {
        font-size: 9px;
    }
}
