:root {
    --primary: #2ecc71;
    --dark: #1e272e;
    --accent: #f1c40f;
    --bg: #f5f6fa;
    --white: #ffffff;
    --shadow: 0 15px 35px rgba(0,0,0,0.1);
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--dark);
}

.screen {
    background: var(--white);
    width: 92%;
    max-width: 420px;
    padding: 35px 25px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

/* --- Status Bar --- */
.status-bar {
    position: fixed; top: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex; justify-content: space-between;
    font-weight: 800; 
    border-bottom: 1px solid #eee; 
    z-index: 100;
}

/* --- Mygtukai --- */
button {
    width: 100%; padding: 16px; border-radius: 16px;
    border: none; font-size: 1rem; font-weight: 700;
    cursor: pointer; margin: 8px 0; transition: 0.2s;
}

.primary-btn { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.primary-btn:active { transform: scale(0.98); }
.secondary-btn { background: #f1f2f6; color: var(--dark); }
button:disabled { background: #ccc !important; cursor: not-allowed; opacity: 0.7; }

/* --- Lyderių Lentelės GRID Sistema --- */
.leaderboard-header, 
.entry {
    display: grid !important;
    /* Griežtai nustatome stulpelių proporcijas: #, Žaidėjas, Užduotys, Taškai, Laikas */
    grid-template-columns: 35px 1.2fr 75px 60px 65px !important; 
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 12px 10px;
}

.leaderboard-header {
    background: #f8f9fa;
    border-radius: 15px 15px 0 0;
    font-size: 0.65rem;
    font-weight: 800;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 5px;
}

/* Antraščių tekstų lygiavimas pagal stulpelius */
.leaderboard-header div { text-align: center; }
.leaderboard-header .info-col { text-align: left; }
.leaderboard-header .time-col { text-align: right; }

.overlay { 
    position: fixed; inset: 0; 
    background: rgba(0,0,0,0.4); 
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; 
    z-index: 1000; 
    animation: fadeIn 0.3s ease;
}

.overlay-content { 
    background: rgba(255, 255, 255, 0.98); 
    width: 95%; max-width: 420px; 
    padding: 25px 10px; 
    border-radius: 30px; 
    text-align: center; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.leaderboard-list { 
    margin: 10px 0; 
    overflow-y: auto; 
    text-align: left;
}

.entry {
    background: white;
    margin-bottom: 8px;
    border-radius: 15px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 0.85rem;
}

/* Stulpelių specifinis stilius */
.rank-col { text-align: center; font-weight: 800; }
.info-col { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.tasks-col { text-align: center; color: #666; font-size: 0.8rem; }
.score-col { text-align: center; font-weight: 800; color: var(--primary); }
.time-col { text-align: right; color: #888; font-size: 0.75rem; font-family: monospace; }

/* Top 3 dekoracijos */
.entry.top-1 { border-left: 5px solid #ffd700; background: #fffdf0; }
.entry.top-2 { border-left: 5px solid #c0c0c0; }
.entry.top-3 { border-left: 5px solid #cd7f32; }

/* --- Užduoties elementai --- */
.main-image-container {
    width: 100%; max-height: 250px; overflow: hidden;
    border-radius: 20px; margin-bottom: 20px;
    border: 1px solid #eee; background: #f9f9f9;
}
.main-image-container img { width: 100%; height: 100%; object-fit: contain; }

.option-item {
    display: flex;
    align-items: center; /* Sulygiuoja tekstą ir radijo tašką viename aukštyje */
    background: #fff;
    border: 2px solid #eee;
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 10px;
    transition: 0.2s;
    cursor: pointer;
}
.option-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 12px;
}
.option-item:active { background: #f8f9fa; }

.option-item:hover {
    border-color: var(--primary);
    background: #f0fff4;
}

.option-item input[type="radio"] {
    width: 22px;
    height: 22px;
    margin-right: 15px;
    flex-shrink: 0;
}

.camera-btn { 
    background: var(--dark); color: white; 
    display: flex; align-items: center; justify-content: center; 
    height: 60px; border-radius: 18px; margin-top: 20px; 
}

#image-preview { 
    width: 100%; border-radius: 20px; margin-top: 15px; 
    max-height: 220px; object-fit: cover; border: 3px solid #eee;
}

.hint-box { 
    background: #fff9e6; padding: 15px; border-radius: 15px; 
    margin-top: 10px; font-size: 0.9rem; color: #856404; 
    border: 1px solid #ffeeba; text-align: left; 
}

.result-card { 
    background: #f8f9fa; border-radius: 25px; padding: 20px; 
    margin: 20px 0; display: flex; justify-content: space-around; 
}

.input-container input { 
    width: 100%; padding: 12px 0; font-size: 1.2rem; 
    border: none; border-bottom: 2px solid #ddd; 
    outline: none; background: transparent; 
}

.name-message {
    background: #e3f2fd; color: #0d47a1; padding: 12px;
    border-radius: 15px; margin-bottom: 15px; font-weight: bold;
}

.close-btn { background: #ff4757; color: white; }

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none; /* Neleidžia scrollinti puslapio kol atidarytas lightbox */
}

#lightbox-img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    z-index: 10001;
}

.lightbox-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 10000;
}

.feedback-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.feedback-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

#choice-section, 
#input-section + #hint-btn {
    margin-top: 0 !important;
}
.upload-section {
    margin-bottom: 20px !important;
}

/* --- Modernus įvedimo laukas --- */
.input-task-wrapper {
    padding: 0;           
    margin-bottom: 5px;
}

#hint-btn {
    margin-top: 10px !important;
    clear: both;
}

.input-group {
    position: relative;
    margin-bottom: 10px;
}

.input-group input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #eee;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: #fff;
    text-align: center; /* Centruotas tekstas dažnai atrodo geriau mobiliuose */
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.1);
}

.input-group label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    background: white;
    padding: 0 5px;
}

/* Animacija, kai laukas užpildytas arba fokusuojamas */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: bold;
}

/* Išvalome seną placeholder, kad nesimaišytų su label */
.input-group input::placeholder {
    color: transparent;
}

/* Grįžtamojo ryšio (feedback) blokas */
.feedback-box {
    margin: 10px 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* Mygtuko patobulinimas */
#submit-text-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}