/* Add playful font */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap');

/* Base Styles */
body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1b2e 50%, #252650 100%);
    color: #ffffff;
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Layout */
.game-interface {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: inherit;
    position: relative;
}

.ascii-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

#ascii-art-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 10px;
}

/* Sidebar */
.sidebar {
    width: 288px;
    background: linear-gradient(180deg, rgba(15, 15, 35, 0.8) 0%, rgba(26, 27, 46, 0.9) 100%);
    backdrop-filter: blur(10px);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border-right: 1px solid rgba(139, 92, 246, 0.15);
    position: relative;
    z-index: 1000;
    flex-shrink: 0;
}

.sidebar-inner {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Title Styles */
.game-title, .mobile-title {
    font-size: 2.5rem;
    font-weight: 700;
    padding: 2rem 1rem 2rem 1rem;
    letter-spacing: 1px;
    line-height: 1.1;
}

.game-title {
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #fe7ca8 0%, #5856D6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
    animation: titleGlow 3s ease-in-out infinite;
}

.mobile-title {
    display: none;
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    color: #ff6b9d !important;
    font-weight: 700;
}

/* Control Groups */
.control-group {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.control-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(139, 92, 246, 0.9);
    font-weight: 600;
}

/* Buttons */
.control-button {
    padding: 12px 20px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(196, 69, 105, 0.1) 100%);
    color: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    width: 100%;
    justify-content: flex-start;
    font-size: 0.9rem;
}

.control-button:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(196, 69, 105, 0.2) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.control-button:active {
    transform: translateY(1px);
}

.control-button svg {
    width: 18px;
    height: 18px;
}

/* Dropdowns */
.dropdown {
    position: relative;
    width: 100%;
}

.dropdown-content {
    display: none;
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    width: 90%;
    background: linear-gradient(135deg, rgba(15, 15, 35, 0.95) 0%, rgba(26, 27, 46, 0.95) 100%);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
    z-index: 1001;
    border-radius: 12px;
    padding: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    max-height: 60vh;
    overflow-y: auto;
    transform: translate(-50%, 0);
    transition: opacity 0.2s ease;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
}

.dropdown-content button:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(196, 69, 105, 0.2) 100%);
    transform: translateX(4px);
}

/* Theme Options Grid */
#themeOptions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    width: 90%;
    margin: 0 auto;
}

#themeOptions button {
    text-align: center;
    padding: 8px;
    border-radius: 4px;
}

/* Frame Container */
.frame-container {
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(34, 35, 55, 0.8);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    width: 600px;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.frame-container-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

pre {
    font-family: monospace;
    white-space: pre;
    margin: 0;
    transform-origin: center;
}

/* Export styles */
.frame-container.for-export {
    width: 600px !important;
    height: 600px !important;
    background: #222337;
    border: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    padding: 40px;
}

.frame-container.for-export .frame-container-inner {
    padding: 0;
}

#ascii-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

/* Mobile Navigation - Clean iOS Tab Bar Style */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(15, 15, 35, 0.95) 0%, rgba(26, 27, 46, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-top: 0.5px solid rgba(139, 92, 246, 0.2);
    z-index: 1000;
}

.bottom-nav-buttons {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

.nav-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding:12px 4px 20px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-height: 50px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.nav-button svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-button span {
    font-size: 0.625rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.1px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.nav-button:hover {
    color: rgba(255, 255, 255, 0.8);
}

.nav-button.active {
    color: #ff6b9d;
}

.nav-button.active svg {
    color: #ff6b9d;
}

/* Settings Panel */
.settings-panel {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: rgba(34, 35, 55, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 40vh;
    overflow-y: auto;
}

.settings-panel.show {
    transform: translateY(0);
    display: block;
}

.settings-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
}

.settings-option {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Fredoka', 'Righteous', cursive, sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-align: center;
}

.settings-option:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.settings-option.active {
    background: rgba(125, 249, 255, 0.2);
    border-color: #7df9ff;
    color: #7df9ff;
    text-shadow: 0 0 10px #7df9ff;
}

/* Optimized Glow Effects - Clear Differentiation */
.glow-normal span {
    text-shadow: 0 0 4px currentColor, 0 0 8px currentColor;
}

.glow-strong span {
    text-shadow: 0 0 8px currentColor, 0 0 16px currentColor, 0 0 24px currentColor;
}

/* Mobile optimization - lighter but still differentiated */
@media (max-width: 768px) {
    .glow-normal span {
        text-shadow: 0 0 3px currentColor, 0 0 6px currentColor;
    }
    
    .glow-strong span {
        text-shadow: 0 0 6px currentColor, 0 0 12px currentColor, 0 0 18px currentColor;
    }
}

/* Simplified Animations - Better Performance */
@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

@keyframes pulse-blue {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
  100% { filter: brightness(1); }
}

@keyframes titleGlow {
  0% { 
    filter: brightness(1);
    text-shadow: 0 2px 10px rgba(255, 107, 157, 0.3);
  }
  50% { 
    filter: brightness(1.05);
    text-shadow: 0 2px 12px rgba(255, 107, 157, 0.4);
  }
  100% { 
    filter: brightness(1);
    text-shadow: 0 2px 10px rgba(255, 107, 157, 0.3);
  }
}

/* Disable animations on mobile for better performance */
@media (max-width: 768px) {
    .game-title, .mobile-title {
        animation: none !important;
    }
    
    /* Disable all animations on mobile */
    * {
        animation: none !important;
        animation-duration: 0s !important;
        animation-delay: 0s !important;
    }
    
    /* Disable all transitions on mobile */
    * {
        transition: none !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
        transition-property: none !important;
    }
    
    /* Disable complex transitions on mobile */
    .control-button,
    .dropdown-content button,
    .nav-button,
    .settings-option {
        transition: none !important;
    }
    
    /* Disable transform transitions on mobile */
    .control-button:hover,
    .dropdown-content button:hover,
    .nav-button:hover,
    .settings-option:hover {
        transform: none !important;
        transition: none !important;
    }
    
    /* Disable settings panel slide animation on mobile */
    .settings-panel {
        transition: none !important;
        transform: none !important;
    }
    
    .settings-panel.show {
        transform: none !important;
    }
}

/* Tablet optimizations - disable animations and transitions for better performance */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Align Save Art button with desktop download button color */
    #downloadBtn, #downloadNavBtn {
        background: #5856D6 !important;
        color: white !important;
        border: 1px solid #5856D6 !important;
    }
    
    #downloadBtn:hover, #downloadNavBtn:hover {
        background: #4A4AC7 !important;
        border-color: #4A4AC7 !important;
    }
}

/* Theme Colors */
.theme-remix .number { color: #f78c6c; }
.theme-remix .type { color: #82aaff; }
.theme-remix .keyword { color: #FFA500; }
.theme-remix .function { color: #FF69B4; }
.theme-remix .comment { color: #546e7a; font-style: italic; }

.theme-neon .number { color: #ff6ec7; }
.theme-neon .type { color: #00ffff; }
.theme-neon .keyword { color: #ffff00; }
.theme-neon .function { color: #39ff14; }
.theme-neon .comment { color: #ff9933; }

.theme-classic .number { color: #ffcc00; }
.theme-classic .type { color: #ff6600; }
.theme-classic .keyword { color: #cc0000; }
.theme-classic .function { color: #009900; }
.theme-classic .comment { color: #333; font-style: italic; }

.theme-cyberpunk .number { color: #ff00ff; }
.theme-cyberpunk .type { color: #00ffff; }
.theme-cyberpunk .keyword { color: #ff0000; }
.theme-cyberpunk .function { color: #00ff00; }
.theme-cyberpunk .comment { color: #ff8800; }

.theme-matrix .number { color: #00ff00; }
.theme-matrix .type { color: #33ff33; }
.theme-matrix .keyword { color: #66ff66; }
.theme-matrix .function { color: #99ff99; }
.theme-matrix .comment { color: #004400; }

.theme-sunset .number { color: #ff6b6b; }
.theme-sunset .type { color: #ffd93d; }
.theme-sunset .keyword { color: #ff8e3c; }
.theme-sunset .function { color: #ff4949; }
.theme-sunset .comment { color: #6c5b7b; }

.theme-ocean .number { color: #48cae4; }
.theme-ocean .type { color: #00b4d8; }
.theme-ocean .keyword { color: #0096c7; }
.theme-ocean .function { color: #023e8a; }
.theme-ocean .comment { color: #caf0f8; }

.theme-forest .number { color: #95d5b2; }
.theme-forest .type { color: #74c69d; }
.theme-forest .keyword { color: #52b788; }
.theme-forest .function { color: #40916c; }
.theme-forest .comment { color: #2d6a4f; }

.theme-candy .number { color: #ff99c8; }
.theme-candy .type { color: #fcf6bd; }
.theme-candy .keyword { color: #d0f4de; }
.theme-candy .function { color: #a9def9; }
.theme-candy .comment { color: #e4c1f9; }

.theme-retro .number { color: #f4a261; }
.theme-retro .type { color: #e9c46a; }
.theme-retro .keyword { color: #2a9d8f; }
.theme-retro .function { color: #264653; }
.theme-retro .comment { color: #e76f51; }

/* Dark mode titles use main gradient - removed override */

/* Media Queries */
/* Desktop (1025px and up) */
@media (min-width: 1025px) {
    .game-interface {
        flex-direction: row;
    }

    .sidebar {
        display: flex !important;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .mobile-title {
        display: none;
    }

    .bottom-nav,
    .settings-panel {
        display: none !important;
    }

    #ascii-art-container {
        height: 100vh;
        margin: 0;
    }

    .dropdown {
        position: relative;
    }

    .dropdown-content {
        position: absolute;
        left: 50%;
        top: calc(100% + 8px);
        transform: translateX(-50%);
        width: 90%;
    }

    /* Handle dropdowns at bottom of sidebar */
    .control-group:last-child .dropdown-content {
        top: auto;
        bottom: calc(100% + 8px);
    }

    #themeOptions {
        width: 90%;
        margin: 0 auto;
    }
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: rgba(34, 35, 55, 0.95);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-content .control-group {
    padding: 0;
}

.modal-content .control-label {
    margin-bottom: 16px;
    text-align: center;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.modal-content .settings-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
}

.modal-content .settings-option {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Fredoka', 'Righteous', cursive, sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.modal-content .settings-option:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.modal-content .settings-option.active {
    background: rgba(125, 249, 255, 0.2);
    border-color: #7df9ff;
    color: #7df9ff;
    text-shadow: 0 0 10px #7df9ff;
}

/* Tablet (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-interface {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        display: none;
    }

    .mobile-title {
        display: block;
        text-align: center;
        font-size: 2rem;
        padding: 24px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1100;
    }

    #ascii-art-container {
        margin-top: calc(60px); 
        height: calc(100vh - 200px); /* Adjusted for title, nav and copyright */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .frame-container {
        width: min(400px, 80vh, 80vw);
        height: min(400px, 80vh, 80vw);
    }

    .bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 71px;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .dropdown-content {
        display: none;
    }

    #themeOptions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    #themeOptions button {
        padding: 12px;
    }

    pre {
        font-size: 5px;
        line-height: 5px;
    }

    /* .ascii-wrapper {
        margin-top: 90px;
    } */
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .game-interface {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        display: none;
    }

    .mobile-title {
        display: block;
        text-align: center;
        font-size: 2rem;
        padding: 2rem 1rem 2rem 1rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1100;
    }

    #ascii-art-container {
        margin-top: calc(40px);
        height: calc(100vh - 140px); /* Reduced to account for bottom nav height */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin-bottom: 71px; /* Space for bottom nav */
    }

    .frame-container {
        width: min(400px, 85vh, 68vw);
        height: min(400px, 85vh, 68vw);
    }

    .bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 71px;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .dropdown-content {
        display: none;
    }

    #themeOptions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }

    #themeOptions button {
        padding: 10px;
    }

    .modal-content {
        padding: 20px;
        width: calc(100% - 32px);
        margin: 16px;
    }

    .modal-content .settings-options {
        gap: 8px;
    }

    .modal-content .settings-option {
        padding: 12px;
        font-size: 0.9rem;
    }

    pre {
        font-size: 4.5px;
        line-height: 4.5px;
    }

    .ascii-wrapper {
        margin-top: 12px;
    }

    /* Align Save Art button with desktop download button color */
    #downloadBtn, #downloadNavBtn {
        background: #5856D6 !important;
        color: white !important;
        border: 1px solid #5856D6 !important;
    }
    
    #downloadBtn:hover, #downloadNavBtn:hover {
        background: #4A4AC7 !important;
        border-color: #4A4AC7 !important;
    }
}

/* Small Mobile (up to 360px) */
@media (max-width: 360px) {
    .frame-container {
        width: min(320px, 68vw);
        height: min(320px, 68vw);
    }

    pre {
        font-size: 4px;
        line-height: 4px;
    }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 600px) {
    .mobile-title {
        font-size: 1rem;
        padding: 0.25rem;
    }

    #ascii-art-container {
        height: calc(100vh - 90px);
    }

    .bottom-nav {
        height: 40px;
    }

    .nav-button {
        min-height: 46px;
        padding: 6px 2px;
        gap: 2px;
    }

    .nav-button svg {
        width: 22px;
        height: 22px;
        margin-bottom: 1px;
    }

    .nav-button span {
        font-size: 0.55rem;
    }

    .frame-container {
        width: min(350px, 70vh, 70vw);
        height: min(350px, 70vh, 70vw);
    }

    .frame-container-inner {
        padding: 1rem;
    }

    pre {
        font-size: min(1.8vw, 10px);
    }
}

/* Ultra-wide Screens */
@media (min-width: 1600px) {
    pre {
        font-size: min(0.5vw, 14px);
        padding: min(2rem, 3vh);
    }
}

/* Apple-Inspired Theme Variables */
:root {
  --artisan-bg: #f2f2f7;
  --artisan-bg-secondary: #ffffff;
  --artisan-text: #1d1d1f;
  --artisan-accent: #007AFF;
  --artisan-accent2: #5856D6;
  --artisan-accent3: #AF52DE;
  --artisan-border: #d1d1d6;
  --artisan-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.theme-dark {
  --artisan-bg: #1a1a1d;
  --artisan-bg-secondary: #2a2a2e;
  --artisan-text: #ffffff;
  --artisan-accent: #007AFF;
  --artisan-accent2: #5856D6;
  --artisan-accent3: #AF52DE;
  --artisan-border: #48484a;
  --artisan-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
.theme-light {
  --artisan-bg: #f2f2f7;
  --artisan-bg-secondary: #ffffff;
  --artisan-text: #1d1d1f;
  --artisan-accent: #007AFF;
  --artisan-accent2: #5856D6;
  --artisan-accent3: #AF52DE;
  --artisan-border: #d1d1d6;
  --artisan-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

body, html {
  background: var(--artisan-bg);
  color: var(--artisan-text);
  transition: background 0.3s, color 0.3s;
}

/* Explicit dark mode background override - higher specificity */
body.theme-dark {
  background: #1a1a1d !important;
  color: #ffffff !important;
}

/* Explicit light mode background override - higher specificity */
body.theme-light {
  background: linear-gradient(135deg, #f2f2f7 0%, #ffffff 100%) !important;
  color: #1d1d1f !important;
}

.sidebar, .frame-container, .settings-panel, .dropdown-content {
  background: var(--artisan-bg-secondary);
  border-color: var(--artisan-border);
  box-shadow: var(--artisan-shadow);
}

.game-title, .mobile-title {
  color: var(--artisan-accent3);
}

.control-label span {
  color: var(--artisan-accent);
}

.control-button, .nav-button {
  color: var(--artisan-text);
  transition: background 0.2s, color 0.2s, border 0.2s;
}

.control-button:hover, .nav-button:hover {
  background: var(--artisan-accent3);
  color: #fff;
  border-color: var(--artisan-accent2);
}

.dropdown-content button.active, .settings-option.active {
  background: var(--artisan-accent);
  color: #fff;
}

/* Accent for export/download, etc. */
#downloadBtn, #downloadNavBtn {
  background: var(--artisan-accent2);
  color: #fff;
}

/* Artisan style for ASCII art frame */
.frame-container {
  border-radius: 18px;
  border: 2.5px solid var(--artisan-border);
  background: var(--artisan-bg-secondary);
  box-shadow: var(--artisan-shadow);
}

/* Add more artisan touches as needed for other elements */

/* Fix dropdown text color in light theme */
.theme-light .dropdown-content,
.theme-light .dropdown-content button {
  color: #3a2c1a;
}

/* Light mode styling for game title and mobile elements */
.theme-light .game-title, 
.theme-light .mobile-title {
  /* Keep the same gradient as dark mode for consistency */
}

/* Light mode bottom navigation */
.theme-light .bottom-nav {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(242, 242, 247, 0.95) 100%);
  border-top: 0.5px solid rgba(209, 209, 214, 0.6);
  backdrop-filter: blur(20px);
}

.theme-light .nav-button {
  color: rgba(29, 29, 31, 0.6);
}

.theme-light .nav-button:hover {
  color: rgba(29, 29, 31, 0.8);
}

.theme-light .nav-button.active {
  color: #007AFF;
}

.theme-light .nav-button.active svg {
  color: #007AFF;
}

/* Light mode copyright */
.theme-light .copyright-mobile {
  color: var(--artisan-text);
  opacity: 0.7;
}

/* Light mode body background */
.theme-light body {
  background: linear-gradient(135deg, #f2f2f7 0%, #ffffff 100%);
  color: #1d1d1f;
}

/* Light mode modal styling */
.theme-light .modal-overlay {
  background: rgba(29, 29, 31, 0.3);
}

.theme-light .modal-content {
  background: var(--artisan-bg-secondary);
  border: 1px solid var(--artisan-border);
  box-shadow: var(--artisan-shadow);
}

.theme-light .modal-content .control-label {
  color: var(--artisan-text);
  text-shadow: none;
}

.theme-light .modal-content .settings-option {
  background: var(--artisan-bg);
  border: 1px solid var(--artisan-border);
  color: var(--artisan-text);
}

.theme-light .modal-content .settings-option:hover {
  background: var(--artisan-accent);
  color: white;
  transform: translateY(-1px);
}

.theme-light .modal-content .settings-option.active {
  background: var(--artisan-accent3);
  border-color: var(--artisan-accent3);
  color: white;
  text-shadow: none;
}

/* Copyright positioning for mobile and tablet */
.copyright-mobile {
  display: none;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  z-index: 1001;
  position: relative;
  opacity: 0.8;
}

.copyright-desktop {
  display: none;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

@media (min-width: 1025px) {
  .copyright-desktop { display: block; }
  .copyright-mobile { display: none; }
}

@media (max-width: 1024px) {
  .copyright-desktop { display: none; }
  .copyright-mobile { display: block; }
}

/* Adjust copyright sizing for different screen sizes */
@media (max-width: 768px) {
  .copyright-mobile {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .copyright-mobile {
    font-size: 0.75rem;
  }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce expensive effects on mobile - Dark mode */
    .theme-dark .sidebar, 
    .theme-dark .bottom-nav, 
    .theme-dark .dropdown-content, 
    .theme-dark .modal-content {
        backdrop-filter: none !important;
    }
    
    /* Reduce expensive effects on mobile - Light mode */
    .theme-light .sidebar, 
    .theme-light .bottom-nav, 
    .theme-light .dropdown-content, 
    .theme-light .modal-content {
        backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    /* Default fallback for mobile when no theme class */
    .sidebar, .dropdown-content, .modal-content {
        backdrop-filter: none !important;
    }
    
    /* Disable heavy gradients on mobile */
    .control-button {
        background: rgba(72, 72, 74, 0.8) !important;
        border: 1px solid rgba(140, 140, 150, 0.2) !important;
    }
    
    .control-button:hover {
        background: rgba(0, 122, 255, 0.4) !important;
    }
    
    /* Disable transforms on mobile */
    .control-button:hover, .dropdown-content button:hover {
        transform: none !important;
    }
    
    /* Disable expensive box-shadows on mobile */
    .control-button:hover {
        box-shadow: none !important;
    }
    
    /* Simplify transitions */
    * {
        transition-duration: 0.1s !important;
    }
    
    /* Align Save Art button with desktop download button color */
    #downloadBtn, #downloadNavBtn {
        background: #5856D6 !important;
        color: white !important;
        border: 1px solid #5856D6 !important;
    }
    
    #downloadBtn:hover, #downloadNavBtn:hover {
        background: #4A4AC7 !important;
        border-color: #4A4AC7 !important;
    }
}

/* Tablet optimizations for download button */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Special styling for download button on tablet */
    #downloadBtn, #downloadNavBtn {
        background: #5856D6 !important;
        color: white !important;
        border: 1px solid #5856D6 !important;
    }
    
    #downloadBtn:hover, #downloadNavBtn:hover {
        background: #4A4AC7 !important;
        border-color: #4A4AC7 !important;
    }
}

/* Performance optimizations for mobile/tablet */
@media (max-width: 1024px) {
    /* Force hardware acceleration */
    .frame-container,
    #ascii-frame,
    #ascii-art {
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        perspective: 1000px;
    }
    
    /* Optimize rendering */
    .frame-container,
    #ascii-frame {
        contain: layout style paint;
        will-change: auto;
    }
    
    /* Reduce paint complexity */
    .glow-normal span,
    .glow-strong span {
        will-change: text-shadow;
    }
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    /* Disable complex CSS properties on mobile */
    .control-button,
    .dropdown-content,
    .nav-button,
    .settings-option {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Simplify gradients on mobile */
    .control-button,
    .dropdown-content,
    .nav-button {
        background: rgba(139, 92, 246, 0.1) !important;
    }
    
    .control-button:hover,
    .dropdown-content button:hover,
    .nav-button:hover {
        background: rgba(139, 92, 246, 0.2) !important;
    }
}

/* Mobile and Tablet Nav Button Colors - Consolidated */
@media (max-width: 1024px) {
    /* Dark theme nav buttons */
    .theme-dark .nav-button,
    .nav-button {
        color: rgba(255, 255, 255, 0.6) !important;
        background: none !important;
    }
    
    .theme-dark .nav-button:hover,
    .nav-button:hover {
        color: rgba(255, 255, 255, 0.8) !important;
        background: none !important;
    }
    
    .theme-dark .nav-button.active,
    .nav-button.active {
        color: #ff6b9d !important;
        background: none !important;
    }
    
    .theme-dark .nav-button.active svg,
    .nav-button.active svg {
        color: #ff6b9d !important;
    }
    
    /* Light theme nav buttons */
    .theme-light .nav-button {
        color: rgba(29, 29, 31, 0.6) !important;
        background: none !important;
    }
    
    .theme-light .nav-button:hover {
        color: rgba(29, 29, 31, 0.8) !important;
        background: none !important;
    }
    
    .theme-light .nav-button.active {
        color: #007AFF !important;
        background: none !important;
    }
    
    .theme-light .nav-button.active svg {
        color: #007AFF !important;
    }
}