/**
 * =============================================================================
 * SUNNY'S FLOWERFIELD - STYLESHEET
 * Production Version 0.8.1
 * =============================================================================
 */

/* =============================================================================
   CSS VARIABLES & ROOT CONFIGURATION
   ============================================================================= */

:root {
    --bg-canvas: #452c1b;
    --bg-ui: rgba(255, 255, 255, 0.1);
    --text-light: #f0fdf4;
    --text-medium: #d1d5db;
    --button-bg: #166534;
    --button-hover: #15803d;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --yellow-color: #FBBF24;
    --text-dark: #3a3a3a;
    --header-height: 60px;
    --footer-height: 60px;
}

/* =============================================================================
   BASE LAYOUT & TYPOGRAPHY
   ============================================================================= */

/* Universal Touch Focus Prevention */
* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><rect width="100%" height="100%" fill="%233c271b"/><path d="M 0 5 L 5 0 M 15 20 L 20 15 M 0 15 L 15 0 M 5 20 L 20 5" stroke="%234a3224" stroke-width="1"/><circle cx="5" cy="5" r="0.5" fill="%234a3224"/><circle cx="15" cy="15" r="0.5" fill="%234a3224"/></svg>');
    background-color: #3c271b;
    color: var(--text-light);
    padding-bottom: var(--header-height);
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* =============================================================================
   CANVAS & GAME BOARD STYLING
   ============================================================================= */

canvas#game-board {
    background-color: var(--bg-canvas);
    border-radius: 1rem;
    cursor: pointer;
    display: block;
    border: 4px solid var(--yellow-color);
    margin: 0 auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    outline: none !important;
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
    
    /* Touch-Device Focus Prevention */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Prevent any focus outline or border changes */
    border: 4px solid var(--yellow-color) !important;
}

canvas#game-board:focus,
canvas#game-board:active,
canvas#game-board:focus-visible,
canvas#game-board:focus-within {
    outline: none !important;
    border: 4px solid var(--yellow-color) !important;
    box-shadow: none !important;
}

/* Erweiterte Canvas-Textur für Spielfeld */
canvas#game-board {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><rect width="100%" height="100%" fill="%23452c1b"/><path d="M 0 5 L 5 0 M 15 20 L 20 15 M 0 15 L 15 0 M 5 20 L 20 5" stroke="%234a3224" stroke-width="1.5"/><circle cx="5" cy="5" r="0.7" fill="%234a3224"/><circle cx="15" cy="15" r="0.7" fill="%234a3224"/><circle cx="10" cy="2" r="0.4" fill="%234a3224"/><circle cx="2" cy="18" r="0.4" fill="%234a3224"/></svg>');
    background-color: #452c1b !important;
    background-size: 20px 20px;
}

#overlay-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
    pointer-events: none;
}

/* Sonnenblumen-Farben für SVG-Rendering */
.sunflower-color-0 { fill: #ff1c1c; }
.sunflower-color-1 { fill: #008d28; }
.sunflower-color-2 { fill: #00c3ff; }
.sunflower-color-3 { fill: #FBBF24; }
.sunflower-color-4 { fill: #7100d4; }
.sunflower-color-5 { fill: #fcaeff; }

.sunflower-svg {
    width: 100%;
    height: 100%;
}

/* =============================================================================
   HEADER & FOOTER SYSTEM
   ============================================================================= */

.global-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjMTQ1MzJkIi8+PHBhdGggZD0iTSAwIDUgTCA1IDAgTSAxNSAyMCBMIDIwIDE1IE0gMCAxNSBMIDE1IDAgTSA1IDIwIEwgMjAgNSIgc3Ryb2tlPSIjMTY2NTM0IiBzdHJva2Utd2lkdGg9IjEiLz48L3N2Zz4=');
    background-color: #14532d;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    padding: 0 1rem;
}

.main-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.main-menu-header .game-title {
    font-size: 2rem;
    color: var(--text-light);
}

.main-menu-header #sunny-avatar {
    width: 2.5rem;
    height: 2.5rem;
}

.game-header-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 600;
}

.game-header-stats .separator {
    color: rgba(255, 255, 255, 0.6);
}

.global-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjMTQ1MzJkIi8+PHBhdGggZD0iTSAwIDUgTCA1IDAgTSAxNSAyMCBMIDIwIDE1IE0gMCAxNSBMIDE1IDAgTSA1IDIwIEwgMjAgNSIgc3Ryb2tlPSIjMTY2NTM0IiBzdHJva2Utd2lkdGg9IjEiLz48L3N2Zz4=');
    background-color: #14532d;
    z-index: 100;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    padding: 0 1rem;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
}

.footer-content .action-button {
    display: none;
}

.global-footer.main-menu-mode #info-button {
    display: inline-block;
}

.global-footer.main-menu-mode .button-group {
    display: none;
}

.global-footer.game-mode .button-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.global-footer.game-mode .button-group .action-button {
    display: inline-block;
}

.global-footer.game-mode #info-button {
    display: none;
}

/* =============================================================================
   NAVIGATION & MENU SYSTEM
   ============================================================================= */

#main-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: calc(100vh - 2 * var(--header-height));
    animation: fadeIn 1s ease-in-out;
}

.main-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

main#game-content {
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--footer-height, 60px));
    padding: 1rem;
    box-sizing: border-box;
    position: relative;
    top: var(--header-height);
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

/* =============================================================================
   BUTTON & FORM ELEMENTS
   ============================================================================= */

.btn {
    background-color: var(--button-bg);
    color: var(--text-light);
    font-weight: 700;
    border-radius: 0.75rem;
    border: 2px solid var(--yellow-color);
    cursor: pointer;
    transition: background-color 150ms ease-in-out;
    text-align: center;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

.btn:hover {
    background-color: var(--button-hover);
}

.btn-main {
    padding: 1rem 2rem;
    font-size: 1.25rem;
}

.btn-main.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--background-tertiary);
}

.btn-main.disabled:hover {
    background-color: var(--background-tertiary);
    transform: none;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 1.2rem;
}

.button-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-button {
    background-color: #3c271b;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjM2MyNzFiIi8+PHBhdGggZD0iTSAwIDUgTCA1IDAgTSAxNSAyMCBMIDIwIDE1IE0gMCAxNSBMIDE1IDAgTSA1IDIwIEwgMjAgNSIgc3Ryb2tlPSIjNGEzMjI0IiBzdHJva2Utd2lkdGg9IjEiLz48Y2lyY2xlIGN4PSI1IiBjeT0iNSIgcj0iMC41IiBmaWxsPSIjNGEzMjI0Ci8+PGNpcmNsZSBjeD0iMTUiIGN5PSIxNSIgcj0iMC41IiBmaWxsPSIjNGEzMjI0Ci8+PC9zdmc+');
    color: var(--yellow-color);
    font-weight: 700;
    padding: 0.5rem 1rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
    border: 2px solid var(--yellow-color);
    cursor: pointer;
    text-align: center;
}

.action-button:hover {
    color: var(--text-light);
}

.action-button.opacity-50 {
    opacity: 0.5;
}

.footer-content .action-button {
    background-color: #3c271b;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjM2MyNzFiIi8+PHBhdGggZD0iTSAwIDUgTCA1IDAgTSAxNSAyMCBMIDIwIDE1IE0gMCAxNSBMIDE1IDAgTSA1IDIwIEwgMjAgNSIgc3Ryb2tlPSIjNGEzMjI0IiBzdHJva2Utd2lkdGg9IjEiLz48Y2lyY2xlIGN4PSI1IiBjeT0iNSIgcj0iMC41IiBmaWxsPSIjNGEzMjI0Ci8+PGNpcmNsZSBjeD0iMTUiIGN5PSIxNSIgcj0iMC41IiBmaWxsPSIjNGEzMjI0Ci8+PC9zdmc+');
    color: var(--yellow-color);
    font-weight: 700;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 2px solid var(--yellow-color);
    cursor: pointer;
    text-align: center;
    transition: color 150ms ease-in-out;
}

.footer-content .action-button:hover {
    color: var(--text-light);
}

.footer-content .action-button.opacity-50 {
    opacity: 0.5;
}

.modal-button {
    background-color: var(--button-bg);
    color: var(--text-light);
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
    border: 2px solid var(--yellow-color);
    cursor: pointer;
    transition: background-color 150ms ease-in-out, opacity 150ms ease-in-out;
    text-align: center;
    min-width: 120px;
}

.modal-button:hover {
    background-color: var(--button-hover);
}

.checkbox-container {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.checkbox-container input {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.checkbox-container label {
    font-size: 1.125rem;
    cursor: pointer;
}

/* =============================================================================
   MODAL & DIALOG SYSTEM
   ============================================================================= */

.dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.7);
    z-index: 140;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.dialog-content {
    background-color: rgba(20, 83, 45, 0.95);
    color: var(--text-light);
    padding: 2rem;
    border-radius: 1rem;
    border: 2px solid var(--yellow-color);
    max-width: 42rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    text-align: left;
    position: relative;
    z-index: 1010;
}

.dialog-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--yellow-color);
}

.dialog-content p, .dialog-content ul {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.dialog-content li {
    margin-bottom: 0.5rem;
}

.dialog-content .close-button {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    color: var(--text-medium);
    cursor: pointer;
}

.dialog-content .close-button:hover {
    color: var(--text-light);
}

.dialog-content a {
    color: var(--yellow-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease-in-out;
}

.dialog-content a:hover {
    color: var(--text-light);
    border-bottom: 1px solid var(--text-light);
}

.modal-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    z-index: 140;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background-color: var(--yellow-color);
    color: var(--text-dark);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    text-align: center;
    animation: zoomIn 0.3s ease-out;
    max-width: 42rem;
    width: 100%;
    position: relative;
    z-index: 1010;
}

.modal-button-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.checkbox-container {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.checkbox-container input {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.checkbox-container label {
    font-size: 1.125rem;
    cursor: pointer;
}

/* =============================================================================
   GAME UI COMPONENTS
   ============================================================================= */

.ui-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.ui-box {
    background-color: var(--bg-ui);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-box {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background-color: var(--yellow-color) !important;
    color: var(--text-dark) !important;
    font-weight: normal !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.stats-box > * {
    justify-self: center;
    text-align: center;
}

.stats-box .separator {
    color: rgba(58, 58, 58, 0.6) !important;
    padding: 0 0.5rem;
}

.stats-box .important-number {
    color: var(--text-dark) !important;
    font-weight: 800;
    font-size: 1.4em;
    text-shadow: none !important;
    line-height: 1;
    display: inline;
    margin-left: 0.4rem;
}

.objective-box {
    min-width: 240px;
    margin: auto;
    background-color: var(--yellow-color) !important;
    background-size: 40px 40px !important;
    color: var(--text-dark) !important;
    font-weight: 700 !important;
    border: 2px solid #FF8C00 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* =============================================================================
   ICON SYSTEM & SVG STYLING
   ============================================================================= */

.icon-button {
    padding: 0.75rem;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon {
    display: block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.hamburger-icon {
    background-image: url('../img/ui/menu.svg');
    filter: brightness(0) saturate(100%) invert(70%) sepia(51%) saturate(2878%) hue-rotate(356deg) brightness(104%) contrast(97%);
}

.refresh-icon {
    background-image: url('../img/ui/reload.svg');
    filter: brightness(0) saturate(100%) invert(70%) sepia(51%) saturate(2878%) hue-rotate(356deg) brightness(104%) contrast(97%);
}

.lightbulb-icon {
    background-image: url('../img/ui/bulb.svg');
    filter: brightness(0) saturate(100%) invert(70%) sepia(51%) saturate(2878%) hue-rotate(356deg) brightness(104%) contrast(97%);
}

.shuffle-icon {
    background-image: url('../img/ui/dice.svg');
    filter: brightness(0) saturate(100%) invert(70%) sepia(51%) saturate(2878%) hue-rotate(356deg) brightness(104%) contrast(97%);
}

.action-button:hover .hamburger-icon,
.action-button:hover .refresh-icon,
.action-button:hover .lightbulb-icon,
.action-button:hover .shuffle-icon {
    filter: brightness(0) saturate(100%) invert(99%) sepia(3%) saturate(82%) hue-rotate(58deg) brightness(118%) contrast(100%);
}

/* =============================================================================
   ANIMATION & EFFECTS
   ============================================================================= */

@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =============================================================================
   RESPONSIVE DESIGN & MEDIA QUERIES
   ============================================================================= */

@media (max-width: 480px) {
    main#game-content {
        padding: 0.5rem;
        height: calc(100vh - var(--header-height) - var(--footer-height));
    }
    
    .game-container {
        padding: 0 0.25rem;
        justify-content: center;
    }
    
    .ui-container {
        margin-bottom: 0.75rem;
        flex-shrink: 0;
    }
    
    .stats-box {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }
    
    .stats-box .important-number {
        font-size: 1.2em;
        margin-left: 0.3rem;
    }
    
    :root {
        --header-height: 55px;
        --footer-height: 55px;
    }
}

@media (max-width: 360px) {
    main#game-content {
        padding: 0.25rem;
        height: calc(100vh - var(--header-height) - var(--footer-height));
    }
    
    .game-container {
        padding: 0;
        justify-content: center;
    }
    
    .ui-container {
        margin-bottom: 0.5rem;
    }
    
    .stats-box {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .stats-box .important-number {
        font-size: 1.15em;
        margin-left: 0.25rem;
    }
    
    :root {
        --header-height: 50px;
        --footer-height: 50px;
    }
    
    .footer-content .action-button {
        padding: 0.5rem 0.9rem;
        font-size: 0.95rem;
    }
    
    .footer-content .icon-button {
        padding: 0.7rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .footer-content .icon {
        width: 18px;
        height: 18px;
    }
}
