/* Modern Game-Like Layout for Quantum Garden */

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

:root {
    --bg-dark: #0a0e27;
    --bg-darker: #060918;
    --panel-bg: rgba(15, 20, 40, 0.85);
    --panel-border: rgba(0, 212, 255, 0.3);
    --accent-cyan: #00d4ff;
    --accent-purple: #7b68ee;
    --accent-gold: #ffd700;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --photon-color: #ffd700;
    --electron-color: #00d4ff;
    --quark-color: #ff4757;
    --neutrino-color: #9b59b6;
    --boson-color: #2ecc71;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Top HUD Bar */
.top-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(0.5rem, 1vh, 0.75rem) clamp(1rem, 2vw, 1.25rem);
    background: var(--panel-bg);
    border-bottom: 2px solid var(--panel-border);
    backdrop-filter: blur(10px);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.back-btn {
    padding: clamp(0.4rem, 0.8vh, 0.5rem) clamp(0.6rem, 1.2vw, 1rem);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
    transform: translateX(-3px);
}

.title-section {
    flex: 1;
    text-align: center;
}

.title-section h1 {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
    line-height: 1.2;
}

.subtitle {
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    color: var(--text-secondary);
    font-weight: 300;
}

/* Stats HUD */
.stats-hud {
    display: flex;
    gap: clamp(0.5rem, 1vw, 0.9375rem);
    flex-wrap: nowrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: clamp(0.3rem, 0.8vw, 0.5rem);
    padding: clamp(0.4rem, 0.8vh, 0.5rem) clamp(0.6rem, 1.2vw, 0.9375rem);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    min-width: 0;
    flex-shrink: 1;
}

.stat-item.energy-stat {
    border-color: var(--accent-gold);
}

.stat-icon {
    font-size: clamp(1rem, 2vw, 1.5rem);
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.stat-label {
    font-size: clamp(0.55rem, 0.9vw, 0.7rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: clamp(0.3px, 0.15vw, 1px);
    white-space: nowrap;
}

.stat-value {
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    font-weight: bold;
    color: var(--accent-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.energy-stat .stat-value {
    color: var(--accent-gold);
}

/* Game Area */
.game-area {
    display: grid;
    grid-template-columns: minmax(200px, 15vw) 1fr minmax(220px, 16vw);
    gap: clamp(0.5rem, 1vw, 0.9375rem);
    padding: clamp(0.5rem, 1vh, 0.9375rem) clamp(0.75rem, 1.5vw, 1.25rem);
    flex: 1;
    overflow: hidden;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
    min-height: 0;
}

/* Sidebars */
.left-sidebar,
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vh, 0.75rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-cyan) rgba(0, 0, 0, 0.3);
    min-height: 0;
}

.left-sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar {
    width: 6px;
}

.left-sidebar::-webkit-scrollbar-track,
.right-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.left-sidebar::-webkit-scrollbar-thumb,
.right-sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 10px;
}

/* Sidebar Sections */
.sidebar-section {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 12px;
    padding: clamp(0.5rem, 1vh, 0.9375rem);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: clamp(0.3rem, 0.8vw, 0.5rem);
    margin-bottom: clamp(0.5rem, 1vh, 0.75rem);
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: clamp(0.3px, 0.15vw, 1px);
    border-bottom: 2px solid var(--panel-border);
    padding-bottom: clamp(0.3rem, 0.8vh, 0.5rem);
    font-weight: 700;
}

.title-icon {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    flex-shrink: 0;
}

/* Particle Palette */
.particle-palette {
    display: flex;
    flex-direction: column;
    gap: clamp(0.4rem, 0.8vh, 0.5rem);
}

.particle-btn {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    padding: clamp(0.5rem, 1vh, 0.75rem);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    min-height: 0;
}

.particle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
    transform: translateX(5px);
}

.particle-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.particle-icon {
    width: clamp(32px, 5vw, 40px);
    height: clamp(32px, 5vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    box-shadow: 0 0 15px currentColor;
    flex-shrink: 0;
}

.photon-color { background: var(--photon-color); color: var(--photon-color); }
.electron-color { background: var(--electron-color); color: var(--electron-color); }
.quark-color { background: var(--quark-color); color: var(--quark-color); }
.neutrino-color { background: var(--neutrino-color); color: var(--neutrino-color); }
.boson-color { background: var(--boson-color); color: var(--boson-color); }
.observe-color { background: rgba(255, 255, 255, 0.3); color: white; }

.particle-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.particle-name {
    font-weight: 600;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.particle-cost {
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    color: var(--accent-gold);
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(0.4rem, 0.8vh, 0.625rem);
}

.achievement {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: help;
    min-height: 0;
}

.achievement.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.achievement.unlocked {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    animation: unlock 0.5s ease;
}

.achievement-icon {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

@keyframes unlock {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--panel-border);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

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

/* Tutorial Button */
.tutorial-btn-main {
    width: 100%;
    padding: clamp(0.6rem, 1.2vh, 0.9375rem);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(123, 104, 238, 0.3));
    border: 2px solid var(--accent-cyan);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: clamp(0.8rem, 1.3vw, 1rem);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.4rem, 1vw, 0.5rem);
    text-transform: uppercase;
    letter-spacing: clamp(0.3px, 0.15vw, 1px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.tutorial-btn-main:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.5), rgba(123, 104, 238, 0.5));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
}

.btn-icon {
    font-size: clamp(0.9rem, 1.6vw, 1.2rem);
    flex-shrink: 0;
}

/* Control Groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: clamp(0.4rem, 0.8vh, 0.5rem);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1vw, 0.625rem);
    padding: clamp(0.5rem, 1vh, 0.625rem) clamp(0.6rem, 1.2vw, 0.9375rem);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    min-height: 0;
    white-space: nowrap;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.control-btn.active {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
}

.control-btn.danger {
    border-color: #f44336;
}

.control-btn.danger:hover {
    background: rgba(244, 67, 54, 0.2);
}

.next-cycle-btn {
    background: rgba(63, 81, 181, 0.3) !important;
    border-color: rgba(63, 81, 181, 0.6) !important;
    font-weight: 600;
}

.next-cycle-btn:hover {
    background: rgba(63, 81, 181, 0.5) !important;
    border-color: #3f51b5 !important;
    box-shadow: 0 0 15px rgba(63, 81, 181, 0.4);
}

.save-btn {
    border-color: #4caf50 !important;
}

.save-btn:hover {
    background: rgba(76, 175, 80, 0.2) !important;
}

.btn-label {
    flex: 1;
    font-weight: 500;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    font-size: clamp(0.9rem, 1.6vw, 1.2rem);
    flex-shrink: 0;
}

/* Info Section */
.info-section .section-content {
    display: flex;
    flex-direction: column;
    gap: clamp(0.4rem, 0.8vh, 0.5rem);
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: clamp(0.25rem, 0.5vw, 0.375rem);
}

.info-item {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1vw, 0.625rem);
    padding: clamp(0.4rem, 0.8vh, 0.5rem);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: clamp(0.7rem, 1.1vw, 0.85rem);
    min-height: 0;
}

.info-icon {
    font-size: clamp(1rem, 2vw, 1.5rem);
    flex-shrink: 0;
}

.info-text strong {
    color: var(--accent-cyan);
}

/* Collapsible Sections */
.collapsible {
    cursor: pointer;
    user-select: none;
}

.collapsed .section-content {
    display: none;
}

.collapse-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* Tooltip */
.tooltip {
    position: absolute;
    padding: clamp(0.4rem, 0.8vh, 0.5rem) clamp(0.5rem, 1vw, 0.75rem);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--accent-cyan);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: clamp(0.7rem, 1.1vw, 0.9rem);
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-width: clamp(150px, 30vw, 250px);
    word-wrap: break-word;
}

.tooltip.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: minmax(180px, 14vw) 1fr minmax(200px, 15vw);
    }
}

@media (max-width: 992px) and (min-width: 769px) and (orientation: portrait) {
    .game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: clamp(0.4rem, 0.8vh, 0.6rem);
    }
    
    .left-sidebar,
    .right-sidebar {
        max-height: 25vh;
        overflow-y: auto;
    }
    
    .stats-hud {
        flex-wrap: wrap;
        gap: clamp(0.3rem, 0.8vw, 0.5rem);
    }
    
    .stat-item {
        min-width: 0;
        flex: 1 1 auto;
    }
}

@media (max-width: 768px) {
    .top-hud {
        flex-direction: column;
        gap: 0.15rem;
        padding: 0.2rem 0.3rem;
    }
    
    .title-section h1 {
        font-size: 0.75rem;
        margin-bottom: 0;
        line-height: 1;
    }
    
    .subtitle {
        font-size: 0.5rem;
        line-height: 1;
    }
    
    .back-btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.55rem;
    }
    
    .stats-hud {
        width: 100%;
        justify-content: center;
        gap: 0.15rem;
        flex-wrap: wrap;
    }
    
    .stat-item {
        padding: 0.15rem 0.25rem;
        gap: 0.15rem;
        flex: 1 1 calc(50% - 0.075rem);
        min-width: 0;
        border-width: 1px;
        border-radius: 6px;
    }
    
    .stat-icon {
        font-size: 0.7rem;
    }
    
    .stat-label {
        font-size: 0.4rem;
        letter-spacing: 0.1px;
    }
    
    .stat-value {
        font-size: 0.55rem;
    }
    
    /* Keep horizontal layout: left sidebar | canvas | right sidebar */
    .game-area {
        grid-template-columns: minmax(75px, 17vw) 1fr minmax(75px, 17vw);
        gap: 0.2rem;
        padding: 0.2rem 0.3rem;
    }
    
    .sidebar-section {
        padding: 0.2rem;
        border-width: 1px;
        border-radius: 6px;
    }
    
    .section-title {
        font-size: 0.5rem;
        gap: 0.15rem;
        margin-bottom: 0.2rem;
        padding-bottom: 0.15rem;
        border-width: 1px;
    }
    
    .title-icon {
        font-size: 0.6rem;
    }
    
    .particle-palette {
        gap: 0.15rem;
    }
    
    .particle-btn {
        padding: 0.2rem;
        gap: 0.2rem;
        border-width: 1px;
        border-radius: 4px;
    }
    
    .particle-icon {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    .particle-name {
        font-size: 0.5rem;
    }
    
    .particle-cost {
        font-size: 0.45rem;
    }
    
    .control-group {
        gap: 0.15rem;
    }
    
    .control-btn {
        padding: 0.2rem;
        gap: 0.15rem;
        border-width: 1px;
        border-radius: 4px;
    }
    
    .btn-text,
    .btn-label {
        font-size: 0.5rem;
    }
    
    .btn-icon {
        font-size: 0.6rem;
    }
    
    .tutorial-btn-main {
        padding: 0.3rem;
        font-size: 0.55rem;
        gap: 0.15rem;
        border-width: 1px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.15rem;
    }
    
    .achievement {
        border-width: 1px;
        border-radius: 6px;
    }
    
    .achievement-icon {
        font-size: 0.85rem;
    }
    
    /* Tooltips for tablet */
    .tooltip {
        font-size: 0.5rem;
        padding: 0.15rem 0.3rem;
        max-width: 110px;
        border-width: 1px;
    }
    
    /* Modal optimizations for tablet */
    .modal-content,
    .autosave-modal-content {
        width: clamp(320px, 85vw, 550px);
        max-height: 80vh;
    }
    
    .modal-header,
    .tutorial-header {
        padding: clamp(0.6rem, 2.5vh, 0.9rem) clamp(0.8rem, 3.5vw, 1.2rem);
    }
    
    .modal-header h2,
    .tutorial-header h2 {
        font-size: clamp(0.95rem, 3.5vw, 1.2rem);
    }
    
    .close-btn {
        width: clamp(26px, 5vw, 34px);
        height: clamp(26px, 5vw, 34px);
        font-size: clamp(0.95rem, 3vw, 1.2rem);
    }
    
    .modal-body,
    .import-body {
        padding: clamp(0.8rem, 3vw, 1.2rem);
        font-size: clamp(0.75rem, 2.5vw, 0.95rem);
    }
    
    .modal-btn {
        padding: clamp(0.5rem, 2vw, 0.7rem) clamp(0.9rem, 3.5vw, 1.3rem);
        font-size: clamp(0.75rem, 2.5vw, 0.95rem);
        min-width: clamp(100px, 30vw, 130px);
    }
    
    #import-text {
        min-height: clamp(90px, 18vh, 130px);
        font-size: clamp(0.7rem, 2.3vw, 0.85rem);
    }
    
    /* Info sections */
    .info-item {
        padding: 0.2rem;
        gap: 0.15rem;
        font-size: 0.5rem;
        border-radius: 4px;
    }
    
    .info-icon {
        font-size: 0.7rem;
    }
    
    .section-content {
        gap: 0.15rem;
    }
    
    .info-section .section-content {
        max-height: 35vh;
        padding-right: 0.1rem;
    }
    
    /* Tighter scrollbars */
    .left-sidebar::-webkit-scrollbar,
    .right-sidebar::-webkit-scrollbar {
        width: 2px;
    }
    
    .info-section .section-content::-webkit-scrollbar {
        width: 2px;
    }
}

@media (max-width: 480px) {
    .top-hud {
        padding: 0.15rem 0.25rem;
        gap: 0.1rem;
    }
    
    .back-btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.5rem;
    }
    
    .title-section h1 {
        font-size: 0.7rem;
        line-height: 1;
    }
    
    .subtitle {
        font-size: 0.45rem;
        line-height: 1;
    }
    
    .stats-hud {
        gap: 0.1rem;
    }
    
    .stat-item {
        padding: 0.1rem 0.2rem;
        flex: 1 1 calc(50% - 0.05rem);
        border-width: 1px;
        border-radius: 4px;
    }
    
    .stat-icon {
        font-size: 0.6rem;
    }
    
    .stat-label {
        font-size: 0.35rem;
    }
    
    .stat-value {
        font-size: 0.5rem;
    }
    
    /* Keep horizontal layout but make sidebars even narrower */
    .game-area {
        grid-template-columns: minmax(65px, 15vw) 1fr minmax(65px, 15vw);
        gap: 0.15rem;
        padding: 0.15rem 0.2rem;
    }
    
    .sidebar-section {
        padding: 0.15rem;
        border-width: 1px;
        border-radius: 4px;
    }
    
    .section-title {
        font-size: 0.45rem;
        gap: 0.1rem;
        margin-bottom: 0.15rem;
        padding-bottom: 0.1rem;
        border-width: 1px;
    }
    
    .title-icon {
        font-size: 0.5rem;
    }
    
    .particle-palette {
        gap: 0.1rem;
    }
    
    .particle-btn {
        padding: 0.15rem;
        gap: 0.15rem;
        border-width: 1px;
        border-radius: 3px;
    }
    
    .particle-icon {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
    }
    
    .particle-name {
        font-size: 0.45rem;
    }
    
    .particle-cost {
        font-size: 0.4rem;
    }
    
    .control-group {
        gap: 0.1rem;
    }
    
    .control-btn {
        padding: 0.15rem;
        gap: 0.1rem;
        border-width: 1px;
        border-radius: 3px;
    }
    
    .btn-text,
    .btn-label {
        font-size: 0.45rem;
    }
    
    .btn-icon {
        font-size: 0.55rem;
    }
    
    .tutorial-btn-main {
        padding: 0.25rem;
        font-size: 0.5rem;
        gap: 0.1rem;
        border-width: 1px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.1rem;
    }
    
    .achievement {
        border-width: 1px;
        border-radius: 4px;
    }
    
    .achievement-icon {
        font-size: 0.75rem;
    }
    
    /* Tooltips for mobile */
    .tooltip {
        font-size: 0.45rem;
        padding: 0.15rem 0.25rem;
        max-width: 90px;
        border-width: 1px;
    }
    
    /* Modal optimizations for mobile */
    .modal-content,
    .autosave-modal-content {
        width: clamp(280px, 92vw, 400px);
        max-height: 85vh;
        border-radius: clamp(10px, 2.5vw, 16px);
    }
    
    .modal-header,
    .tutorial-header {
        padding: clamp(0.5rem, 2vh, 0.7rem) clamp(0.65rem, 3vw, 0.9rem);
    }
    
    .modal-header h2,
    .tutorial-header h2 {
        font-size: clamp(0.85rem, 3.5vw, 1.05rem);
        letter-spacing: 0.03rem;
    }
    
    .close-btn {
        width: clamp(24px, 5.5vw, 30px);
        height: clamp(24px, 5.5vw, 30px);
        font-size: clamp(0.85rem, 3vw, 1rem);
    }
    
    .modal-body,
    .import-body {
        padding: clamp(0.65rem, 2.5vw, 0.9rem);
        font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    }
    
    .modal-btn {
        padding: clamp(0.45rem, 2vw, 0.6rem) clamp(0.75rem, 3.5vw, 1rem);
        font-size: clamp(0.7rem, 2.5vw, 0.85rem);
        min-width: clamp(95px, 32vw, 120px);
        border-width: 2px;
    }
    
    .modal-buttons {
        gap: clamp(0.4rem, 1.5vw, 0.7rem);
    }
    
    #import-text {
        min-height: clamp(80px, 16vh, 110px);
        max-height: clamp(150px, 30vh, 220px);
        font-size: clamp(0.65rem, 2.3vw, 0.8rem);
        padding: clamp(0.6rem, 2vw, 0.85rem);
    }
    
    .import-actions {
        gap: clamp(0.4rem, 1.5vw, 0.6rem);
    }
    
    .import-actions button {
        min-width: 100px;
        font-size: clamp(0.7rem, 2.3vw, 0.85rem);
    }
    
    /* Info sections */
    .info-item {
        padding: 0.15rem;
        gap: 0.1rem;
        font-size: 0.45rem;
        border-radius: 3px;
    }
    
    .info-icon {
        font-size: 0.6rem;
    }
    
    .section-content {
        gap: 0.1rem;
        padding-right: 0.1rem;
    }
    
    .info-section .section-content {
        max-height: 30vh;
    }
    
    /* Scrollbars for mobile */
    .left-sidebar::-webkit-scrollbar,
    .right-sidebar::-webkit-scrollbar {
        width: 2px;
    }
    
    .info-section .section-content::-webkit-scrollbar {
        width: 1px;
    }
    
    .left-sidebar,
    .right-sidebar {
        scrollbar-width: thin;
    }
}

/* ============================================
   NEW INTERACTIVE TUTORIAL SYSTEM
   ============================================ */

/* Tutorial System Container */
.tutorial-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tutorial-system.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Subtle Backdrop */
.tutorial-system .tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tutorial-system .tutorial-backdrop.active {
    opacity: 1;
    visibility: visible;
}

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

/* Element Highlighter */
.tutorial-highlight {
    position: absolute;
    border: 3px solid var(--accent-cyan);
    border-radius: 8px;
    box-shadow: 
        0 0 0 4px rgba(0, 212, 255, 0.2),
        0 0 20px rgba(0, 212, 255, 0.6),
        0 0 40px rgba(0, 212, 255, 0.4),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    animation: highlightPulse 2s ease-in-out infinite;
    opacity: 0;
    visibility: hidden;
}

.tutorial-highlight.active {
    opacity: 1;
    visibility: visible;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 4px rgba(0, 212, 255, 0.2),
            0 0 20px rgba(0, 212, 255, 0.6),
            0 0 40px rgba(0, 212, 255, 0.4),
            inset 0 0 20px rgba(0, 212, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 0 6px rgba(0, 212, 255, 0.3),
            0 0 30px rgba(0, 212, 255, 0.8),
            0 0 60px rgba(0, 212, 255, 0.6),
            inset 0 0 30px rgba(0, 212, 255, 0.2);
    }
}

/* ============================================
   TUTORIAL TOOLTIP
   ============================================ */

.tutorial-tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.98) 0%, rgba(22, 33, 62, 0.98) 100%);
    border: 2px solid var(--accent-cyan);
    border-radius: clamp(10px, 2vw, 14px);
    width: clamp(240px, 85vw, 360px);
    max-width: 90vw;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 212, 255, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    pointer-events: all;
    z-index: 1002;
    backdrop-filter: blur(10px);
    animation: tooltipEntrance 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes tooltipEntrance {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tooltip Pointer/Arrow */
.tooltip-pointer {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 1003;
}

/* Pointer positions */
.tutorial-tooltip[data-position="top"] .tooltip-pointer {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 12px 12px 0 12px;
    border-color: var(--accent-cyan) transparent transparent transparent;
    filter: drop-shadow(0 3px 6px rgba(0, 212, 255, 0.4));
}

.tutorial-tooltip[data-position="bottom"] .tooltip-pointer {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 12px 12px 12px;
    border-color: transparent transparent var(--accent-cyan) transparent;
    filter: drop-shadow(0 -3px 6px rgba(0, 212, 255, 0.4));
}

.tutorial-tooltip[data-position="left"] .tooltip-pointer {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 12px 0 12px 12px;
    border-color: transparent transparent transparent var(--accent-cyan);
    filter: drop-shadow(3px 0 6px rgba(0, 212, 255, 0.4));
}

.tutorial-tooltip[data-position="right"] .tooltip-pointer {
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 12px 12px 12px 0;
    border-color: transparent var(--accent-cyan) transparent transparent;
    filter: drop-shadow(-3px 0 6px rgba(0, 212, 255, 0.4));
}

/* Tooltip Header */
.tutorial-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.5rem, 2vh, 0.75rem) clamp(0.65rem, 2.5vw, 0.9rem);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(123, 104, 238, 0.12) 100%);
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    gap: clamp(0.4rem, 1.5vw, 0.6rem);
}

.tutorial-tooltip-header .tutorial-badge {
    display: flex;
    align-items: center;
    gap: clamp(0.3rem, 1vw, 0.4rem);
    flex: 1;
    min-width: 0;
}

.tutorial-badge .badge-icon {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    flex-shrink: 0;
}

.tutorial-badge .badge-text {
    font-size: clamp(0.65rem, 2.2vw, 0.75rem);
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.tutorial-badge .badge-step {
    font-size: clamp(0.6rem, 2vw, 0.7rem);
    color: var(--text-secondary);
    margin-left: clamp(0.2rem, 0.8vw, 0.3rem);
    white-space: nowrap;
}

.tutorial-end-btn {
    background: rgba(244, 67, 54, 0.15);
    border: 2px solid rgba(244, 67, 54, 0.4);
    color: #ff5252;
    width: clamp(24px, 8vw, 32px);
    height: clamp(24px, 8vw, 32px);
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tutorial-end-btn:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: #ff5252;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
}

/* Tooltip Body */
.tutorial-tooltip-body {
    padding: clamp(0.65rem, 2.5vh, 1rem) clamp(0.75rem, 3vw, 1.1rem);
}

.tooltip-title {
    color: var(--accent-cyan);
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    font-weight: 700;
    margin: 0 0 clamp(0.4rem, 1.5vh, 0.6rem) 0;
    line-height: 1.3;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.tooltip-content {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2.8vw, 0.9rem);
    line-height: 1.5;
    margin: 0;
}

/* Task Indicator */
.tooltip-task {
    margin-top: clamp(0.6rem, 2vh, 0.85rem);
    padding: clamp(0.5rem, 2vh, 0.7rem) clamp(0.6rem, 2.5vw, 0.85rem);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(123, 104, 238, 0.08) 100%);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 8px;
}

.tooltip-task.hidden {
    display: none;
}

.task-indicator {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1.5vw, 0.6rem);
}

.task-indicator .task-icon {
    font-size: clamp(1rem, 4vw, 1.3rem);
    flex-shrink: 0;
}

.task-description {
    flex: 1;
    color: var(--text-primary);
    font-size: clamp(0.7rem, 2.6vw, 0.85rem);
    font-weight: 600;
    line-height: 1.4;
}

.task-status {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    flex-shrink: 0;
}

.task-status.waiting {
    animation: taskWaiting 1.5s ease-in-out infinite;
}

@keyframes taskWaiting {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.task-status.completed {
    color: #4caf50;
    animation: taskSuccess 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes taskSuccess {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.4) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Tooltip Footer */
.tutorial-tooltip-footer {
    padding: clamp(0.5rem, 2vh, 0.7rem) clamp(0.65rem, 2.5vw, 0.9rem);
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: clamp(0.4rem, 1.5vw, 0.6rem);
}

.tutorial-action-btn {
    display: flex;
    align-items: center;
    gap: clamp(0.3rem, 1vw, 0.4rem);
    padding: clamp(0.4rem, 1.5vh, 0.55rem) clamp(0.7rem, 2.5vw, 1rem);
    background: rgba(0, 212, 255, 0.15);
    border: 2px solid var(--accent-cyan);
    border-radius: 6px;
    color: var(--accent-cyan);
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tutorial-action-btn .btn-icon {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
}

.tutorial-action-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.tutorial-action-btn:active {
    transform: translateY(0);
}

.tutorial-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.tutorial-action-btn.primary {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(123, 104, 238, 0.25) 100%);
}

.tutorial-action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.4) 0%, rgba(123, 104, 238, 0.4) 100%);
}

/* ============================================
   RESPONSIVE TUTORIAL DESIGN
   ============================================ */

/* Tablet (769-1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .tutorial-tooltip {
        width: clamp(260px, 70vw, 400px);
    }
}

/* Mobile landscape - compact layout */
@media (max-width: 768px) and (orientation: landscape) {
    .tutorial-tooltip {
        width: clamp(180px, 50vw, 280px);
        max-height: 65vh;
        overflow-y: auto;
    }
    
    .tutorial-tooltip-body {
        padding: clamp(0.4rem, 1.8vh, 0.6rem) clamp(0.5rem, 2vw, 0.7rem);
    }
    
    .tutorial-tooltip-title {
        font-size: clamp(0.75rem, 2.8vw, 0.9rem);
        margin-bottom: 0.3rem;
    }
    
    .tutorial-tooltip-content {
        font-size: clamp(0.65rem, 2.2vw, 0.75rem);
        line-height: 1.35;
    }
}

/* Mobile portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .tutorial-tooltip {
        width: clamp(220px, 75vw, 300px);
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .tutorial-tooltip-body {
        padding: 0.6rem 0.75rem;
    }
    
    .tutorial-tooltip-title {
        font-size: 0.85rem;
    }
    
    .tutorial-tooltip-content {
        font-size: 0.72rem;
        line-height: 1.4;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    .tutorial-tooltip {
        width: clamp(200px, 85vw, 260px);
        max-height: 55vh;
        overflow-y: auto;
    }
    
    .tutorial-tooltip-header {
        padding: 0.4rem 0.55rem;
    }
    
    .tutorial-badge .badge-text {
        font-size: 0.6rem;
    }
    
    .tutorial-badge .badge-step {
        font-size: 0.56rem;
    }
    
    .tutorial-close-btn {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }
    
    .tutorial-tooltip-body {
        padding: 0.5rem 0.6rem;
    }
    
    .tutorial-tooltip-title {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }
    
    .tutorial-tooltip-content {
        font-size: 0.68rem;
        line-height: 1.4;
    }
    
    .tutorial-task {
        margin-top: 0.5rem;
        padding: 0.45rem 0.55rem;
    }
    
    .tutorial-task-text {
        font-size: 0.65rem;
    }
    
    .tutorial-tooltip-footer {
        padding: 0.4rem 0.55rem;
    }
    
    .tutorial-action-btn {
        padding: 0.38rem 0.7rem;
        font-size: 0.65rem;
    }
}

/* Extra small landscape - ultra compact */
@media (max-width: 480px) and (orientation: landscape) {
    .tutorial-tooltip {
        width: clamp(160px, 45vw, 240px);
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .tutorial-tooltip-header {
        padding: 0.35rem 0.5rem;
    }
    
    .tutorial-tooltip-body {
        padding: 0.4rem 0.5rem;
    }
    
    .tutorial-tooltip-title {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    
    .tutorial-tooltip-content {
        font-size: 0.62rem;
        line-height: 1.35;
    }
    
    .tutorial-task {
        margin-top: 0.4rem;
        padding: 0.4rem 0.5rem;
    }
    
    .tutorial-task-text {
        font-size: 0.6rem;
    }
    
    .tutorial-tooltip-footer {
        padding: 0.35rem 0.5rem;
    }
    
    .tutorial-action-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.6rem;
    }
}

/* Make sure particle buttons are clickable during tutorial */
.particle-palette.tutorial-highlight .particle-btn,
.controls-section.tutorial-highlight .control-btn {
    position: relative;
    z-index: 1001;
    pointer-events: all;
}

/* Canvas needs special handling */
#garden-canvas.tutorial-highlight {
    position: relative;
    z-index: 1001;
    pointer-events: all;
}

/* Tutorial Modal (old system - keep for import) */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 20px);
}

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

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(123, 104, 238, 0.5);
    border-radius: clamp(12px, 3vw, 20px);
    padding: 0;
    max-width: clamp(320px, 90vw, 700px);
    width: 90%;
    max-height: clamp(400px, 85vh, 90vh);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tutorial-header {
    background: rgba(123, 104, 238, 0.2);
    padding: clamp(0.8rem, 3vh, 1.25rem) clamp(1rem, 4vw, 1.875rem);
    border-bottom: 2px solid rgba(123, 104, 238, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.tutorial-header h2 {
    margin: 0;
    background: linear-gradient(45deg, #ff6ec7, #7b68ee, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(1rem, 4vw, 1.5rem);
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #e0e0e0;
    font-size: clamp(1rem, 3vw, 1.5em);
    width: clamp(28px, 6vw, 40px);
    height: clamp(28px, 6vw, 40px);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.close-btn:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
    transform: rotate(90deg);
}

/* Import Modal Specific Styles */
.import-modal-content {
    max-width: clamp(400px, 85vw, 600px);
}

.import-body {
    padding: clamp(1rem, 4vw, 1.875rem);
}

.import-body p {
    margin-bottom: clamp(0.75rem, 2vh, 1rem);
    color: #d0d0d0;
    font-size: clamp(0.85rem, 3vw, 1.1em);
    line-height: 1.5;
}

#import-text {
    width: 100%;
    padding: clamp(0.75rem, 2.5vw, 1rem);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(123, 104, 238, 0.5);
    border-radius: clamp(6px, 2vw, 10px);
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: clamp(0.7rem, 2.5vw, 0.9em);
    resize: vertical;
    margin-bottom: clamp(0.75rem, 3vh, 1.25rem);
    min-height: clamp(100px, 20vh, 150px);
    max-height: clamp(200px, 35vh, 300px);
}

#import-text:focus {
    outline: none;
    border-color: #7b68ee;
    box-shadow: 0 0 15px rgba(123, 104, 238, 0.5);
}

.import-actions {
    display: flex;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: clamp(0.75rem, 2vh, 1rem);
}

.import-actions button {
    flex: 1 1 clamp(120px, 40%, 200px);
    min-width: 120px;
    font-size: clamp(0.75rem, 2.5vw, 1rem);
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 3vw, 1.25rem);
}

.import-message {
    padding: clamp(0.75rem, 2.5vw, 1rem);
    border-radius: clamp(6px, 2vw, 8px);
    text-align: center;
    font-weight: bold;
    display: none;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
}

.import-message.success {
    display: block;
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4caf50;
    color: #4caf50;
}

.import-message.error {
    display: block;
    background: rgba(244, 67, 54, 0.2);
    border: 2px solid #f44336;
    color: #f44336;
}

/* Auto-Save Restore Modal - Themed like Slot Machine */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(10px, 2vh, 20px);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.autosave-modal-content {
    background: linear-gradient(135deg, #0a0e27 0%, #16213e 100%);
    border: clamp(2px, 0.5vw, 4px) solid var(--accent-cyan);
    border-radius: clamp(12px, 3vw, 20px);
    padding: clamp(1rem, 4vw, 2rem);
    max-width: clamp(280px, 90vw, 500px);
    width: 90%;
    max-height: clamp(350px, 85vh, 90vh);
    overflow-y: auto;
    box-shadow: 
        0 0 40px rgba(0, 212, 255, 0.6),
        0 0 80px rgba(0, 212, 255, 0.4),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    transform: translateY(-100vh);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-overlay.show .autosave-modal-content {
    transform: translateY(0);
    animation: shake-modal 0.5s ease 0.5s;
}

@keyframes shake-modal {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.autosave-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(0, 212, 255, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0, 212, 255, 0.03) 3px
        );
    pointer-events: none;
}

.modal-header {
    text-align: center;
    margin-bottom: clamp(0.75rem, 3vh, 1.5rem);
    position: relative;
}

.modal-header h2 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: clamp(1.2rem, 5vw, 2rem);
    color: var(--accent-cyan);
    text-shadow: 
        0 0 10px rgba(0, 212, 255, 0.8),
        0 0 20px rgba(0, 212, 255, 0.5);
    letter-spacing: clamp(0.05rem, 0.5vw, 0.1rem);
    animation: pulse-glow-cyan 1.5s ease-in-out infinite;
    margin: 0;
    line-height: 1.3;
}

@keyframes pulse-glow-cyan {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(0, 212, 255, 0.8),
            0 0 20px rgba(0, 212, 255, 0.5);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(0, 212, 255, 1),
            0 0 40px rgba(0, 212, 255, 0.8),
            0 0 60px rgba(0, 212, 255, 0.5);
    }
}

.modal-body {
    text-align: center;
    margin-bottom: clamp(1rem, 4vh, 2rem);
    position: relative;
}

.modal-warning {
    font-size: clamp(0.95rem, 4vw, 1.5rem);
    color: var(--accent-cyan);
    font-weight: bold;
    margin-bottom: clamp(0.5rem, 2vh, 1rem);
    text-transform: uppercase;
    letter-spacing: clamp(0.03rem, 0.3vw, 0.05rem);
    line-height: 1.3;
}

.modal-subtext {
    font-size: clamp(0.8rem, 3vw, 1.1rem);
    color: var(--text-secondary);
    margin-bottom: clamp(0.5rem, 2vh, 1rem);
    line-height: 1.5;
}

.modal-question {
    font-size: clamp(0.9rem, 3.5vw, 1.3rem);
    color: var(--text-primary);
    font-weight: bold;
    margin-top: clamp(0.75rem, 3vh, 1.5rem);
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
}

.modal-btn {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    font-weight: bold;
    padding: clamp(0.65rem, 2.5vw, 1rem) clamp(1.25rem, 4vw, 2rem);
    border: clamp(2px, 0.4vw, 3px) solid;
    border-radius: clamp(6px, 2vw, 10px);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: clamp(0.05rem, 0.3vw, 0.1rem);
    min-width: clamp(110px, 35vw, 150px);
    position: relative;
    overflow: hidden;
}

.modal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.modal-btn:hover::before {
    width: 300px;
    height: 300px;
}

.modal-btn-yes {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #00a8cc 100%);
    color: var(--bg-dark);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.modal-btn-yes:hover {
    background: linear-gradient(135deg, #00e4ff 0%, var(--accent-cyan) 100%);
    box-shadow: 
        0 0 30px rgba(0, 212, 255, 0.8),
        0 0 50px rgba(0, 212, 255, 0.5);
    transform: scale(1.05);
}

.modal-btn-no {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border-color: #495057;
    box-shadow: 0 0 20px rgba(108, 117, 125, 0.3);
}

.modal-btn-no:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    box-shadow: 
        0 0 30px rgba(108, 117, 125, 0.5),
        0 0 50px rgba(108, 117, 125, 0.3);
    transform: scale(1.05);
}

.tutorial-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 30px;
    border-top: 2px solid rgba(123, 104, 238, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tutorial-nav-btn {
    background: rgba(123, 104, 238, 0.3);
    border: 2px solid #7b68ee;
    color: #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.tutorial-nav-btn:hover:not(:disabled) {
    background: rgba(123, 104, 238, 0.5);
    transform: translateX(3px);
}

.tutorial-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.tutorial-btn {
    border-color: #00d4ff !important;
}

/* ============================================
   MODAL RESPONSIVE ENHANCEMENTS
   ============================================ */

/* Mobile landscape - optimize for limited vertical space */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content,
    .autosave-modal-content {
        max-height: 88vh;
        width: clamp(300px, 70vw, 480px);
    }
    
    .modal-header,
    .tutorial-header {
        padding: clamp(0.4rem, 1.5vh, 0.6rem) clamp(0.7rem, 2.5vw, 1rem);
    }
    
    .modal-header h2,
    .tutorial-header h2 {
        font-size: clamp(0.85rem, 3vw, 1.1rem);
    }
    
    .modal-body,
    .import-body {
        padding: clamp(0.6rem, 2vh, 0.85rem) clamp(0.75rem, 2.5vw, 1rem);
        max-height: 65vh;
        overflow-y: auto;
    }
    
    .modal-btn {
        padding: clamp(0.4rem, 1.5vh, 0.55rem) clamp(0.8rem, 3vw, 1.1rem);
        font-size: clamp(0.7rem, 2.2vw, 0.85rem);
    }
    
    #import-text {
        min-height: clamp(70px, 15vh, 100px);
        max-height: clamp(120px, 28vh, 180px);
    }
}

/* Extra small mobile (portrait and landscape) */
@media (max-width: 480px) {
    .modal-content,
    .autosave-modal-content {
        width: clamp(260px, 94vw, 340px);
        max-height: 88vh;
        border-radius: 10px;
        border-width: 2px;
    }
    
    .modal-header,
    .tutorial-header {
        padding: 0.45rem 0.6rem;
    }
    
    .modal-header h2,
    .tutorial-header h2 {
        font-size: clamp(0.8rem, 4vw, 1rem);
        letter-spacing: 0.02rem;
    }
    
    .close-btn {
        width: clamp(22px, 6vw, 28px);
        height: clamp(22px, 6vw, 28px);
        font-size: clamp(0.8rem, 3.5vw, 0.95rem);
        border-width: 1px;
    }
    
    .modal-body,
    .import-body {
        padding: 0.6rem;
        font-size: clamp(0.68rem, 3vw, 0.82rem);
    }
    
    .modal-warning {
        font-size: clamp(0.85rem, 4.5vw, 1.1rem);
        margin-bottom: 0.45rem;
    }
    
    .modal-subtext {
        font-size: clamp(0.72rem, 3.2vw, 0.88rem);
        margin-bottom: 0.45rem;
    }
    
    .modal-question {
        font-size: clamp(0.78rem, 3.8vw, 0.95rem);
        margin-top: 0.6rem;
    }
    
    .modal-btn {
        padding: 0.42rem 0.7rem;
        font-size: clamp(0.68rem, 3vw, 0.82rem);
        min-width: clamp(90px, 35vw, 115px);
        border-width: 2px;
        letter-spacing: 0.03rem;
    }
    
    .modal-buttons {
        gap: 0.4rem;
    }
    
    #import-text {
        min-height: 75px;
        max-height: clamp(140px, 32vh, 200px);
        font-size: 0.65rem;
        padding: 0.55rem;
    }
    
    .import-actions {
        gap: 0.35rem;
        flex-direction: column;
    }
    
    .import-actions button {
        width: 100%;
        min-width: auto;
        font-size: clamp(0.7rem, 3.2vw, 0.85rem);
        padding: 0.5rem;
    }
    
    .import-message {
        padding: 0.6rem;
        font-size: clamp(0.7rem, 3vw, 0.85rem);
    }
}

/* Extra small landscape - ultra-compact */
@media (max-width: 480px) and (orientation: landscape) {
    .modal-content,
    .autosave-modal-content {
        max-height: 92vh;
        width: clamp(280px, 75vw, 420px);
    }
    
    .modal-header,
    .tutorial-header {
        padding: 0.35rem 0.65rem;
    }
    
    .modal-body,
    .import-body {
        padding: 0.5rem 0.7rem;
        max-height: 70vh;
    }
    
    .modal-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.7rem;
    }
    
    .import-actions {
        flex-direction: row;
    }
    
    .import-actions button {
        flex: 1;
    }
}

/* ============================================
   ROTATE DEVICE MODAL (Mobile Portrait Only)
   ============================================ */

.rotate-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.rotate-modal-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
    animation: rotatePromptPulse 2s ease-in-out infinite;
}

.rotate-icon {
    color: var(--accent-cyan);
    margin: 0 auto 30px;
    animation: rotateIconSpin 3s ease-in-out infinite;
}

.rotate-modal h2 {
    color: var(--text-primary);
    font-size: 1.8em;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.rotate-modal p {
    color: var(--text-secondary);
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
}

.rotate-hint {
    font-size: 3em;
    animation: rotateHintBounce 1s ease-in-out infinite;
}

@keyframes rotatePromptPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes rotateIconSpin {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-15deg);
    }
    75% {
        transform: rotate(15deg);
    }
}

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

/* Show modal only on mobile devices in portrait mode */
@media (max-width: 768px) and (orientation: portrait) {
    .rotate-modal {
        display: flex !important;
    }
}
