:root {
    --bg-color: #f4f4f4;
    --surface: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --primary: #006400;       /* Glavna Ošven zelena */
    --primary-hover: #004d00;
    --accent: #a8f0a8;        /* Svetlo zelena */
    --wall: #2c3e50;          /* Barva zidu v labirintu */
    --path: #ffffff;          /* Barva poti v labirintu */
    --player: #ff9800;        /* Igralec Oranžen */
    --goal: #ffd700;          /* Zlata zvezda */
    --white: #ffffff;
    
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.app-container {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    height: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem; /* Dodaten odmik spodaj, da puščica ni čisto na robu zaslona */
}

@media (min-width: 501px) {
    .app-container {
        height: 90vh;
        max-height: 850px;
        border-radius: 12px;
    }
}

header {
    background: linear-gradient(180deg, #006400 0%, #004d00 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--white);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.header-btn:hover {
    color: var(--accent);
}

h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-align: center;
    flex: 1;
    letter-spacing: 1px;
}

main {
    flex: 1;
    position: relative;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center; /* keep centered vertically */
    align-items: center;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* No strict height 100% needed, we want content to layout naturally */
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease forwards;
}

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

/* UI ELEMENTI */
.intro-text p {
    text-align: center;
    margin: 1rem 0;
    line-height: 1.5;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 85%;
    max-width: 300px;
    margin: 2rem auto;
}

.btn {
    padding: 1rem;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition);
}

.btn:hover, .btn.primary-btn {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    margin-top: 1rem;
}
.text-btn:hover {
    color: var(--text-main);
    background: none;
    box-shadow: none;
    transform: none;
}

/* GAME SCREEN */
.hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

#game-container {
    width: 100%;
    max-width: 400px; /* same as canvas */
    aspect-ratio: 1/1;
    border-radius: 8px;
    background: var(--wall); /* Ozadje je dejansko zid! Risanje po canvasu briše zid s potjo */
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

canvas {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    touch-action: none; /* preprečimo skrolanje pri risanju/potezah na telefonu */
}

/* D-PAD Controls */
#mobile-controls {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.d-pad {
    display: grid;
    grid-template-columns: 60px 60px 60px;
    grid-template-rows: 60px 60px 60px;
    gap: 10px;
}

.control-btn {
    background: var(--surface);
    border: 2px solid #ccc;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.control-btn:active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: scale(0.95);
}

/* Postavitev v D-Pad mrežo */
.up { grid-column: 2; grid-row: 1; }
.left { grid-column: 1; grid-row: 2; }
.right { grid-column: 3; grid-row: 2; }
.down { grid-column: 2; grid-row: 3; }

.middle-row { display: contents; }

.center-dummy {
    background: #e9e9e9;
    border-radius: 50%;
    grid-column: 2;
    grid-row: 2;
    margin: 15px;
}

.desktop-hint {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #999;
}

/* Skrij mobilne kontrole na dovolj velikih zaslonih, če igramo s tipkovnico */
@media (min-width: 768px) {
    #mobile-controls {
        display: none;
    }
}
@media (max-width: 767px) {
    .desktop-hint {
        display: none;
    }
}

/* GAME OVER */
#game-over-title {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1.5rem;
    text-align: center;
}
.final-stats {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid #ddd;
}
