/*-------------------------------------------------------+
| KraZZam - Metallic Futuristic Theme CSS
| Colors: Black, Green (#32cd32), Red (#cc2200)
+--------------------------------------------------------*/

/* Global Styles */
#krazzam-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(50, 205, 50, 0.15), 0 10px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(50, 205, 50, 0.25);
}

.krazzam-screen {
    display: none;
    min-height: 700px;
    background: #0a0a0a;
    padding: 30px;
    position: relative;
}

.krazzam-screen.active {
    display: block;
}

/* ============================================================
   SPLASH / MAIN MENU
   ============================================================ */
#krazzam-menu.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    min-height: 700px;
    position: relative;
    overflow: hidden;
}

/* Subtle animated grid background */
#krazzam-menu.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(50,205,50,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(50,205,50,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: gridDrift 20s linear infinite;
    pointer-events: none;
}

@keyframes gridDrift {
    0%   { background-position: 0 0; }
    100% { background-position: 48px 48px; }
}

/* Ambient green glow behind logo */
.krazzam-logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(50,205,50,0.12) 0%, transparent 70%);
    animation: ambientPulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes ambientPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -60%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -60%) scale(1.15); }
}

/* Logo image container */
.krazzam-logo {
    position: relative;
    z-index: 1;
    margin-bottom: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.krazzam-logo img {
    max-width: 480px;
    width: 90%;
    height: auto;
    filter: drop-shadow(0 0 18px rgba(50,205,50,0.45));
    animation: logoFloat 3s ease-in-out infinite;
}

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

/* Menu button stack */
.krazzam-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
    position: relative;
    z-index: 1;
}

/* ============================================================
   METALLIC BUTTONS
   ============================================================ */
.krazzam-btn {
    padding: 16px 36px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    /* Base metallic body */
    background: linear-gradient(180deg,
        #3a3a3a 0%,
        #2a2a2a 40%,
        #1a1a1a 60%,
        #111111 100%
    );
    color: #e0e0e0;
    /* Top highlight edge */
    border-top: 1px solid #555;
    /* Bottom edge shadow */
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 2px 8px rgba(0,0,0,0.5);
}

/* Shine streak across button */
.krazzam-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}
.krazzam-btn:hover::before {
    left: 140%;
}

/* Primary: green accent stripe */
.krazzam-btn-primary {
    border-bottom: 2px solid #32cd32;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 0 12px rgba(50,205,50,0.2),
        0 2px 8px rgba(0,0,0,0.5);
}
.krazzam-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 0 22px rgba(50,205,50,0.35),
        0 4px 14px rgba(0,0,0,0.5);
}
.krazzam-btn-primary i {
    color: #32cd32;
    text-shadow: 0 0 6px rgba(50,205,50,0.6);
}

/* Secondary: red accent stripe */
.krazzam-btn-secondary {
    border-bottom: 2px solid #cc2200;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 0 10px rgba(204,34,0,0.15),
        0 2px 8px rgba(0,0,0,0.5);
}
.krazzam-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 0 20px rgba(204,34,0,0.3),
        0 4px 14px rgba(0,0,0,0.5);
}
.krazzam-btn-secondary i {
    color: #cc2200;
    text-shadow: 0 0 6px rgba(204,34,0,0.5);
}

.krazzam-btn i {
    margin-right: 10px;
}
.krazzam-btn span {
    position: relative;
    z-index: 1;
}

/* ============================================================
   GAME SCREEN & HUD
   ============================================================ */
#krazzam-game {
    background: #0a0a0a;
    padding: 0;
    min-height: 800px;
}

#krazzam-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #151515 0%, #0d0d0d 100%);
    padding: 12px 28px;
    color: white;
    border-bottom: 1px solid rgba(50,205,50,0.2);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
}

.krazzam-hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.krazzam-hud-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
}

.krazzam-hud-value {
    font-size: 22px;
    font-weight: bold;
    color: #32cd32;
    text-shadow: 0 0 8px rgba(50,205,50,0.4);
}

/* HUD icon buttons */
.krazzam-btn-icon {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(50,205,50,0.25);
    color: #888;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.krazzam-btn-icon:hover {
    background: rgba(50,205,50,0.1);
    border-color: #32cd32;
    color: #32cd32;
}

/* Power-up Bar */
#krazzam-powerup-bar {
    display: flex;
    gap: 10px;
    padding: 8px 28px;
    background: rgba(0,0,0,0.5);
    min-height: 50px;
    align-items: center;
    border-bottom: 1px solid rgba(50,205,50,0.08);
}

.krazzam-powerup-active {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(50,205,50,0.08), rgba(50,205,50,0.03));
    border: 1px solid rgba(50,205,50,0.3);
    border-radius: 4px;
    padding: 6px 12px;
    color: #aaa;
    font-size: 13px;
    font-weight: 600;
    animation: powerupPulse 2s ease-in-out infinite;
}

@keyframes powerupPulse {
    0%, 100% { border-color: rgba(50,205,50,0.3); }
    50%      { border-color: rgba(50,205,50,0.6); }
}

.krazzam-powerup-icon {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    color: #32cd32;
}

.krazzam-powerup-timer {
    font-size: 11px;
    color: #555;
}

/* Canvas */
#krazzam-canvas {
    display: block;
    width: 100%;
    height: calc(100vh - 200px);
    max-height: 700px;
    background: #0a0a0a;
    cursor: none;
}

/* ============================================================
   MESSAGE OVERLAY (Level Start / Game Over)
   ============================================================ */
.krazzam-message {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
    padding: 36px 56px;
    border-radius: 8px;
    text-align: center;
    color: white;
    border: 1px solid rgba(50,205,50,0.3);
    box-shadow:
        0 0 30px rgba(50,205,50,0.1),
        0 10px 40px rgba(0,0,0,0.7);
    display: none;
    z-index: 100;
}

.krazzam-message.active {
    display: block;
    animation: messageSlideIn 0.35s ease;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translate(-50%, -58%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

#krazzam-message-title {
    font-size: 42px;
    font-weight: bold;
    margin: 0 0 14px 0;
    color: #32cd32;
    text-shadow: 0 0 14px rgba(50,205,50,0.5);
    letter-spacing: 2px;
}

#krazzam-message-text {
    font-size: 18px;
    margin: 0;
    color: #888;
}

/* ============================================================
   PAUSE OVERLAY & MODAL
   ============================================================ */
.krazzam-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.krazzam-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

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

.krazzam-modal {
    background: linear-gradient(180deg, #1e1e1e 0%, #141414 100%);
    padding: 40px 48px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(50,205,50,0.3);
    box-shadow:
        0 0 40px rgba(50,205,50,0.1),
        0 10px 50px rgba(0,0,0,0.7);
    max-width: 420px;
    width: 90%;
}

.krazzam-modal h2 {
    color: #32cd32;
    font-size: 38px;
    margin: 0 0 28px 0;
    text-shadow: 0 0 12px rgba(50,205,50,0.4);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.krazzam-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================================
   PANELS (Highscores, Instructions)
   ============================================================ */
.krazzam-panel {
    background: linear-gradient(180deg, #161616 0%, #0e0e0e 100%);
    border-radius: 8px;
    padding: 40px;
    max-width: 860px;
    margin: 0 auto;
    border: 1px solid rgba(50,205,50,0.2);
    box-shadow:
        0 0 24px rgba(50,205,50,0.06),
        0 8px 40px rgba(0,0,0,0.5);
}

.krazzam-panel h2 {
    color: #32cd32;
    font-size: 36px;
    text-align: center;
    margin: 0 0 28px 0;
    text-shadow: 0 0 12px rgba(50,205,50,0.4);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.krazzam-panel h3 {
    color: #999;
    font-size: 16px;
    margin: 30px 0 14px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(50,205,50,0.15);
    padding-bottom: 8px;
}

/* ============================================================
   INSTRUCTIONS GRID
   ============================================================ */
.krazzam-instructions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.krazzam-instruction-item {
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 22px 16px;
    text-align: center;
    color: #aaa;
    border: 1px solid rgba(50,205,50,0.12);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.krazzam-instruction-item:hover {
    border-color: rgba(50,205,50,0.3);
    background: rgba(50,205,50,0.04);
}

.krazzam-instruction-item i {
    display: block;
    margin-bottom: 12px;
    color: #32cd32;
    font-size: 24px;
    text-shadow: 0 0 8px rgba(50,205,50,0.4);
}

.krazzam-instruction-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #888;
}

/* ============================================================
   BRICK TYPE LEGEND
   ============================================================ */
.krazzam-brick-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 16px 0 28px 0;
}

.krazzam-brick-type {
    background: rgba(255,255,255,0.03);
    border-radius: 5px;
    padding: 12px 14px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(255,255,255,0.07);
    font-size: 14px;
}

/* Metallic brick demo swatches matching game */
.brick-demo {
    display: inline-block;
    width: 44px; height: 22px;
    border-radius: 3px;
    flex-shrink: 0;
}
.brick-1 {
    background: linear-gradient(180deg, #5a5a5a, #2a2a2a, #1a1a1a);
    border: 1px solid #32cd32;
    box-shadow: 0 0 6px rgba(50,205,50,0.3);
}
.brick-4 {
    background: linear-gradient(180deg, #5a3a3a, #3a2020, #1a1010);
    border: 1px solid #cc2200;
    box-shadow: 0 0 6px rgba(204,34,0,0.3);
}
.brick-6 {
    background: linear-gradient(180deg, #6a3a3a, #4a2525, #2a1515);
    border: 1px solid #cc2200;
    box-shadow: 0 0 6px rgba(204,34,0,0.35);
}
.brick-7 {
    background: linear-gradient(180deg, #222, #111, #0a0a0a);
    border: 1px solid #333;
    box-shadow: 0 0 4px rgba(200,30,0,0.2);
}
.brick-8 {
    background: linear-gradient(180deg, #8a2a2a, #5a1515, #2a0808);
    border: 1px solid #cc2200;
    box-shadow: 0 0 10px rgba(204,34,0,0.5);
}
.brick-9 {
    background: linear-gradient(180deg, #4aff4a, #32cd32, #20a020);
    border: 1px solid #4aff4a;
    box-shadow: 0 0 10px rgba(74,255,74,0.5);
}

/* ============================================================
   HIGHSCORES TABLE
   ============================================================ */
#krazzam-highscores-list {
    background: rgba(0,0,0,0.35);
    border-radius: 6px;
    padding: 16px;
    margin: 18px 0;
    max-height: 460px;
    overflow-y: auto;
    border: 1px solid rgba(50,205,50,0.1);
}

.krazzam-highscore-row {
    display: grid;
    grid-template-columns: 52px 1fr 130px 80px 130px;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    margin-bottom: 6px;
    color: #aaa;
    align-items: center;
    transition: background 0.2s ease;
    border: 1px solid rgba(255,255,255,0.04);
    font-size: 14px;
}

.krazzam-highscore-row:hover {
    background: rgba(50,205,50,0.05);
    border-color: rgba(50,205,50,0.15);
}

.krazzam-highscore-row.header {
    background: rgba(50,205,50,0.07);
    border-color: rgba(50,205,50,0.2);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #32cd32;
}

.krazzam-highscore-rank {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    color: #32cd32;
    text-shadow: 0 0 6px rgba(50,205,50,0.4);
}

.krazzam-highscore-rank.gold   { color: #d4af37; text-shadow: 0 0 8px rgba(212,175,55,0.5); }
.krazzam-highscore-rank.silver { color: #a0a0a0; text-shadow: 0 0 6px rgba(160,160,160,0.4); }
.krazzam-highscore-rank.bronze { color: #cd7f32; text-shadow: 0 0 6px rgba(205,127,50,0.4); }

.krazzam-highscore-score {
    font-weight: bold;
    font-size: 16px;
    color: #ddd;
}

.krazzam-empty-highscores {
    text-align: center;
    padding: 56px 20px;
    color: #555;
    font-size: 17px;
}

/* ============================================================
   FULLSCREEN MODE
   ============================================================ */
#krazzam-container.fullscreen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    max-width: none;
    margin: 0;
    z-index: 9999;
    border-radius: 0;
    border: none;
}

#krazzam-container.fullscreen .krazzam-screen {
    display: none !important;
}

#krazzam-container.fullscreen #krazzam-game {
    display: block !important;
    min-height: 100vh;
    padding: 0;
}

#krazzam-container.fullscreen #krazzam-canvas {
    height: calc(100vh - 120px);
    max-height: none;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
#krazzam-highscores-list::-webkit-scrollbar { width: 8px; }
#krazzam-highscores-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}
#krazzam-highscores-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #32cd32, #1a8a1a);
    border-radius: 4px;
}
#krazzam-highscores-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4aff4a, #32cd32);
}

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
.krazzam-settings-group {
    margin: 20px 0;
}

.krazzam-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(50,205,50,0.12);
    border-radius: 6px;
    padding: 20px 24px;
    gap: 20px;
}

.krazzam-settings-label {
    color: #aaa;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.krazzam-settings-label i {
    color: #32cd32;
    font-size: 18px;
    text-shadow: 0 0 8px rgba(50,205,50,0.4);
    width: 20px;
    text-align: center;
}

.krazzam-settings-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    max-width: 340px;
}

/* Toggle Button */
.krazzam-toggle-btn {
    position: relative;
    width: 100px;
    height: 36px;
    border: 1px solid rgba(50,205,50,0.3);
    border-radius: 18px;
    background: linear-gradient(180deg, #1e1e1e 0%, #141414 100%);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.krazzam-toggle-btn .toggle-on,
.krazzam-toggle-btn .toggle-off {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.krazzam-toggle-btn .toggle-on {
    color: #32cd32;
    text-shadow: 0 0 6px rgba(50,205,50,0.5);
    opacity: 0;
    transform: translateY(-100%);
}

.krazzam-toggle-btn .toggle-off {
    color: #666;
    opacity: 1;
    transform: translateY(0);
}

.krazzam-toggle-btn.active {
    border-color: rgba(50,205,50,0.6);
    box-shadow: 0 0 8px rgba(50,205,50,0.15);
}

.krazzam-toggle-btn.active .toggle-on {
    opacity: 1;
    transform: translateY(0);
}

.krazzam-toggle-btn.active .toggle-off {
    opacity: 0;
    transform: translateY(100%);
}

/* Volume Slider */
.krazzam-volume-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.krazzam-volume-slider.disabled {
    opacity: 0.25;
    pointer-events: none;
}

.krazzam-volume-slider i {
    color: #555;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.krazzam-volume-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: linear-gradient(90deg, #2a2a2a 0%, #333 100%);
    border-radius: 2px;
    outline: none;
}

.krazzam-volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 2px solid #32cd32;
    box-shadow: 0 0 6px rgba(50,205,50,0.3);
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.krazzam-volume-slider input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 10px rgba(50,205,50,0.5);
}

.krazzam-volume-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 2px solid #32cd32;
    box-shadow: 0 0 6px rgba(50,205,50,0.3);
    cursor: pointer;
}

.volume-value {
    color: #666;
    font-size: 13px;
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .krazzam-logo img { max-width: 360px; }
    .krazzam-btn { font-size: 15px; padding: 14px 28px; }
    #krazzam-hud { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
    .krazzam-highscore-row {
        grid-template-columns: 44px 1fr 100px;
        font-size: 13px;
    }
    .krazzam-highscore-row .krazzam-highscore-level,
    .krazzam-highscore-row .krazzam-highscore-date { display: none; }
}

/* ============================================================
   UTILITY ANIMATIONS
   ============================================================ */
.shake { animation: shake 0.3s ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-8px); }
    75%      { transform: translateX(8px); }
}

.bounce { animation: bounce 0.5s ease; }
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-16px); }
}

.flash { animation: flash 0.3s ease; }
@keyframes flash {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}
