:root {
    /* Game specific */
    --panel-bg: rgba(255, 255, 255, 0.8);
    --panel-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --panel-bg: rgba(20, 20, 20, 0.8);
    --panel-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Override shared.css body styles for full screen app */
    padding: 0 !important;
    display: block !important;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: auto !important;
    max-width: none !important;
    z-index: 20;
    padding: 1.5rem !important;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
    margin: 0 !important;
    /* Restore grid layout from shared.css */
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: 1rem !important;
    pointer-events: none;
    /* Allow clicks to pass through empty space */
}

/* Make children interactive */
header>* {
    pointer-events: auto;
}

header .back-link {
    grid-column: 1;
    justify-self: start;
}

header .app-logo {
    grid-column: 2;
    justify-self: center;
}

header .header-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    gap: 8px;
    align-items: center;
}


header .app-logo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    font-weight: 700 !important;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5) !important;
    filter: drop-shadow(0 2px 8px rgba(118, 75, 162, 0.3));
}

.icon-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fullscreen .icon-btn .fullscreen-enter,
.icon-btn .fullscreen-exit {
    display: none;
}

.fullscreen .icon-btn .fullscreen-exit {
    display: block;
}

/* Controls Panel */
.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    background: linear-gradient(135deg, rgba(15, 15, 35, 0.9), rgba(25, 25, 55, 0.9));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 24px 32px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 60px rgba(99, 102, 241, 0.1);
    z-index: 10;
    pointer-events: auto;
    transition: all 0.3s ease;
}

.controls:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 80px rgba(99, 102, 241, 0.15);
}

.control-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group>label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a5b4fc;
    text-shadow: 0 0 10px rgba(165, 180, 252, 0.3);
}

/* Toggle Buttons */
.toggle-group {
    display: flex;
    background: rgba(15, 15, 35, 0.6);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #a5b4fc;
    padding: 12px 16px;
    font-size: 0.85rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.toggle-btn:hover {
    color: #ffffff;
    background: rgba(129, 140, 248, 0.2);
}

.toggle-btn.active {
    color: #ffffff;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow:
        0 4px 16px rgba(99, 102, 241, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.preset-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.preset-btn {
    background: rgba(30, 30, 50, 0.6);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
}

.preset-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.preset-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #818cf8;
    box-shadow:
        0 0 20px rgba(99, 102, 241, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.preset-btn::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 35, 0.95);
    color: #e0e7ff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.preset-btn:hover::after {
    opacity: 1;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e0e7ff;
    transition: color 0.2s ease;
    font-weight: 500;
}

.checkbox-label:hover {
    color: #ffffff;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: rgba(30, 30, 50, 0.6);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.1);
}

.checkbox-label input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Select Input */
select {
    background: rgba(30, 30, 50, 0.6);
    border: 2px solid rgba(99, 102, 241, 0.3);
    color: #e0e7ff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a5b4fc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select:hover {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Range Input */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 6px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 3px;
    outline: none;
    border: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(99, 102, 241, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(99, 102, 241, 0.5);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
    background: linear-gradient(135deg, #818cf8, #a78bfa);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Actions */
.control-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: space-between;
    height: 100%;
    min-height: 130px;
}

.action-btn {
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

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

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

#clear {
    background: rgba(30, 30, 50, 0.6);
    color: #f87171;
    border: 2px solid rgba(248, 113, 113, 0.3);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

#clear:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #f87171;
    color: #fff;
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(239, 68, 68, 0.4),
        0 0 20px rgba(220, 38, 38, 0.2);
}

#clear:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

#random {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    color: #c4b5fd;
    border: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

#random:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #818cf8;
    color: #fff;
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(99, 102, 241, 0.5),
        0 0 30px rgba(139, 92, 246, 0.3);
}

#random:active {
    transform: translateY(0);
}

.rainbow-btn {
    animation: rainbow-glow 4s ease-in-out infinite;
}

@keyframes rainbow-glow {

    0%,
    100% {
        border-color: #f472b6;
        box-shadow: 0 0 15px rgba(244, 114, 182, 0.3);
    }

    25% {
        border-color: #818cf8;
        box-shadow: 0 0 15px rgba(129, 140, 248, 0.3);
    }

    50% {
        border-color: #34d399;
        box-shadow: 0 0 15px rgba(52, 211, 153, 0.3);
    }

    75% {
        border-color: #fbbf24;
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
    }
}

.particle-count {
    font-size: 0.9rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    background: rgba(30, 30, 50, 0.6);
    padding: 10px 16px;
    border-radius: 10px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    font-weight: 600;
    color: #c7d2fe;
}

.particle-count span {
    color: #818cf8;
    font-weight: 700;
    font-size: 1.1rem;
}

.instructions {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    font-size: 1rem;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.85);
    padding: 14px 28px;
    border-radius: 30px;
    border: 2px solid rgba(165, 180, 252, 0.6);
    backdrop-filter: blur(10px);
    animation: pulse 2s ease-in-out infinite, fadeOutSlow 6s forwards 4s;
    z-index: 100;
    max-width: 90%;
}

.instructions p {
    margin: 0;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.4);
        border-color: rgba(165, 180, 252, 0.5);
    }

    50% {
        box-shadow: 0 0 50px rgba(118, 75, 162, 0.6);
        border-color: rgba(165, 180, 252, 0.8);
    }
}

@keyframes fadeOutSlow {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

body.fullscreen .controls {
    bottom: 30px;
}

body.fullscreen header {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.fullscreen:hover header {
    opacity: 1;
}

footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    padding: 1rem !important;
    margin: 0 !important;
    border: none !important;
}

body.fullscreen .instructions,
body.fullscreen footer {
    display: none;
}

@media (max-width: 900px) {
    .controls {
        width: 95%;
        flex-direction: column;
        gap: 20px;
        padding: 15px;
        bottom: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }

    .control-column {
        width: 100%;
    }

    .control-actions {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        min-height: auto;
    }

    .action-btn {
        flex: 1;
        min-width: 100px;
    }

    .particle-count {
        width: 100%;
    }

    input[type="range"] {
        width: 100%;
    }

    .preset-group {
        flex-wrap: wrap;
        justify-content: center;
    }
}