:root {
    --primary: #facc15;
    --primary-glow: rgba(250, 204, 21, 0.2);
    --bg: #050505;
    --footer-bg: #0a0a0a;
    --surface: #121212;
    --surface-light: #1a1a1a;
    --text: #ffffff;
    --text-muted: #a1a1aa;
    --border: #27272a;
}

/* Podstawy */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

.container { 
    width: 100%; 
    max-width: 1100px; /* Zwiększamy max-width, żeby zmieścić foto + tekst obok siebie */
    margin: 0 auto;
    padding: 20px 20px 40px; 
    display: flex;
    flex-direction: column;
    align-items: center; 
    flex: 1;
    box-sizing: border-box;
}

.hidden { display: none !important; }

/* Header */
header { width: 100%; margin-bottom: 20px; text-align: center; }
.logo { 
    font-size: clamp(2.5rem, 8vw, 4rem); 
    font-weight: 900; 
    font-style: italic; 
    letter-spacing: -3px; 
    margin: 0; 
    line-height: 1;
    text-shadow: 0 0 30px var(--primary-glow);
    text-transform: uppercase;
}
.logo span { color: var(--primary); }
.tagline { color: var(--text-muted); margin-bottom: 20px; }
kbd { background: #222; padding: 2px 6px; border-radius: 5px; color: var(--primary); font-family: monospace; }

/* Upload Button */
.custom-file-upload {
    display: inline-block;
    padding: 14px 30px;
    background: linear-gradient(145deg, var(--surface-light), var(--surface));
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
    transition: 0.3s;
}
.custom-file-upload:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
#fileInput { display: none !important; }

#app { 
    width: 100%; 
    display: flex;
    flex-direction: row; 
    gap: 30px;
    align-items: center; /* Wyśrodkowanie w pionie dla lepszego looku */
    margin-top: 20px;
    max-height: 70vh; /* Obrazek + kontrolki nie zajmą więcej niż 70% wysokości ekranu */
}

.canvas-container { 
    flex: 2;
    background: var(--surface); 
    padding: 15px; 
    border-radius: 24px; 
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100%; /* Ważne: nie wychodzi poza #app */
    overflow: hidden; 
}

canvas { 
    max-width: 100%;
    max-height: 70vh; /* Kluczowe: płótno dopasuje się do wysokości ekranu */
    width: auto; /* Zachowanie proporcji */
    height: auto;
    border-radius: 8px; 
    background: #000; 
    cursor: move; 
}

.controls-container {
    flex: 1; /* Panel boczny */
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    position: sticky; /* Panel będzie "jechał" za zdjęciem przy scrollowaniu */
    top: 20px;
}

.input-group { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

input[type="text"] {
    background: var(--surface);
    border: 2px solid var(--border);
    padding: 16px;
    color: white;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    outline: none;
    text-transform: uppercase;
    transition: 0.2s;
}

input[type="text"]:focus { border-color: var(--primary); background: var(--surface-light); }

#downloadBtn {
    width: 100%; 
    background: var(--primary); 
    color: #000; 
    border: none; 
    padding: 18px;
    font-size: 1.3rem; 
    font-weight: 900; 
    border-radius: 14px; 
    cursor: pointer;
    transition: 0.2s;
}
#downloadBtn:hover { filter: brightness(1.1); transform: scale(1.02); }

/* --- FOOTER --- */
footer {
    width: 100%;
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    flex-shrink: 0;
}
.footer-content { max-width: 800px; margin: 0 auto; padding: 0 20px; text-align: center; }

.text-link {
    background: none; border: none; color: #666; cursor: pointer;
    font-size: 0.85rem; padding: 10px; transition: 0.2s;
}
.text-link:hover { color: var(--primary); }

.about-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    text-align: left;
    opacity: 0.7;
}
.about-drawer.open { max-height: 1200px; margin-top: 30px; }
.about-drawer h3 { color: var(--primary); font-size: 1.1rem; }
.about-drawer p { font-size: 0.9rem; color: #888; }

.footer-legal {
    margin-top: 40px; padding-top: 20px; border-top: 1px solid #1a1a1a;
    font-size: 0.8rem; color: #444;
}
.footer-legal a { color: var(--primary); text-decoration: none; font-weight: bold; }

@media (max-width: 900px) {
    #app {
        flex-direction: column;
        max-height: none; /* Na telefonie scroll jest naturalny */
    }
    canvas {
        max-height: 50vh;
    }
}
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.secondary-btn {
    width: 100%;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.secondary-btn:hover {
    background: #222;
    border-color: var(--text-muted);
}

/* Stan po skopiowaniu (feedback dla usera) */
.secondary-btn.success {
    background: #166534; /* Ciemna zieleń */
    border-color: #22c55e;
    color: white;
}