:root {
    --bg-color: #131722; /* Tmavé pozadie z obrázku */
    --text-color: #ffffff;
    --accent-color: #F5B120; /* Zlatá z obrázku */
    --board-bg: transparent;
    --cell-bg: #1EB3B9; /* Nová modrá/tyrkysová */
    --cell-hover: #26c9cf;
    --cell-used: #1a1e29; /* Tmavá bunka po použití */
    --font-main: 'Montserrat', sans-serif;
    --success: #28a745;
    --danger: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Zamedzí scrollovaniu celej stránky */
    height: 100vh;
    height: 100dvh; /* Riešenie pre mobilné prehliadače (iOS) */
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Obrazovky */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-color);
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* Komponenty */
.box {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    max-width: 600px;
    width: 100%;
    margin: auto;
    text-align: center;
}

h1 {
    font-size: 3rem;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 10px;
}

h2 {
    font-size: 2rem;
    color: #ffffff;
    text-shadow: 1px 1px 3px #000;
}

p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Formuláre */
.form-group {
    margin-bottom: 25px;
    text-align: left;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    color: white;
}

.player-input-row {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
}

.player-input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: 5px;
    border: none;
    outline: none;
}

.remove-player-btn {
    padding: 0 15px;
    font-size: 1.2rem;
}

/* Tlačidlá */
.btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    font-family: var(--font-main);
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    background-color: var(--accent-color);
    color: #000;
}

.btn.primary:hover:not(:disabled) {
    background-color: #ffd633;
}

.btn.secondary {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

.btn.secondary:hover {
    background-color: rgba(255,255,255,0.3);
}

.btn.success {
    background-color: var(--success);
    color: white;
}
.btn.danger {
    background-color: var(--danger);
    color: white;
}

/* Hracie pole */
#screen-board .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    flex-wrap: wrap;
    gap: 15px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.current-player-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.current-player-selector select {
    padding: 8px;
    font-size: 1.2rem;
    border-radius: 5px;
    font-family: var(--font-main);
    font-weight: bold;
    background: var(--accent-color);
    border: none;
    cursor: pointer;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: calc(100% - 60px);
    margin-top: 10px;
}

#board-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--board-bg);
    padding: 5px;
    border-radius: 10px;
    overflow: hidden;
}

.board-row {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 5px;
    margin-bottom: 3px;
}
.board-row:last-child {
    margin-bottom: 0;
}

.board-cell {
    flex: 1;
    background-color: var(--cell-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffffff; /* Biely text bodov podľa obrázku */
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s, transform 0.1s;
    user-select: none;
    text-align: center;
    padding: 5px;
    min-width: 0;
    min-height: 0;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.2;
    overflow: hidden;
}

.board-cell.header-cell {
    color: white;
    font-size: 1.8rem;
    background-color: var(--cell-bg);
    cursor: default;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    text-transform: uppercase;
    border: 3px solid var(--accent-color); /* Lemovanie #F5B120 */
}

.board-cell:not(.header-cell):hover {
    background-color: var(--cell-hover);
    transform: scale(1.02);
}

.board-cell.used {
    visibility: hidden;
}

/* Skóre Panel */
.scores-panel {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 10px;
    /* Odstránené flex-shrink: 0 pre lepšiu odozvu na výšku */
}

.score-box {
    text-align: center;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    min-width: 100px;
    flex: 1 1 calc(25% - 15px);
    max-width: calc(25% - 15px);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.score-box:hover {
    transform: scale(1.05);
    background: rgba(255,255,255,0.2);
}

.score-box.active-player {
    border: 2px solid var(--accent-color);
    background: rgba(255,204,0,0.2);
}

.score-name {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 2px;
    white-space: nowrap;
}

.score-value {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--accent-color);
}

@media (max-width: 1200px) {
    .score-box {
        flex: 1 1 calc(33.33% - 20px);
        max-width: calc(33.33% - 20px);
    }
}

/* Extrémne nízke obrazovky */
@media (max-height: 600px) {
    .score-box {
        padding: 2px 5px;
    }
    .score-name {
        font-size: 0.8rem;
    }
    .score-value {
        font-size: 1.1rem;
    }
    .main-content {
        gap: 5px;
    }
}

@media (max-width: 800px) {
    .score-box {
        flex: 1 1 calc(50% - 20px);
        max-width: calc(50% - 20px);
    }
}

/* Obrazovka s otázkou */
#screen-question {
    background: var(--bg-color);
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.question-container {
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px 0;
}

.category-header {
    font-size: clamp(0.8rem, 3vw, 2rem);
    color: #ccc;
    text-transform: uppercase;
    margin-bottom: clamp(2px, 1vh, 10px);
    flex-shrink: 0;
}

.points-header {
    font-size: clamp(1rem, 4vw, 3rem);
    color: var(--accent-color);
    font-weight: 900;
    margin-bottom: clamp(5px, 3vh, 40px);
    flex-shrink: 0;
}

.question-text {
    font-size: clamp(1rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: clamp(5px, 3vh, 40px);
    flex-shrink: 0;
}

.answer-text {
    font-size: clamp(0.8rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(0,0,0,0.5);
    padding: clamp(5px, 2vh, 20px) clamp(10px, 3vw, 40px);
    border-radius: 10px;
    margin-bottom: clamp(5px, 2vh, 40px);
    animation: fadeIn 0.5s ease-in-out;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

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

.host-controls {
    padding-top: clamp(5px, 1vh, 20px);
    width: 100%;
    flex-shrink: 0;
}

.judge-buttons {
    display: flex;
    gap: clamp(5px, 1vw, 15px);
    justify-content: center;
    margin-top: clamp(5px, 1vh, 15px);
    flex-wrap: wrap;
}

.judge-buttons .btn {
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    padding: clamp(5px, 1vh, 12px) clamp(8px, 1.5vw, 20px);
    min-width: 0;
    flex-shrink: 1;
}

#judge-controls p {
    font-size: clamp(0.8rem, 2vw, 1.5rem);
    margin-bottom: clamp(3px, 1vh, 10px);
}

.q-player-select {
    padding: 5px 10px;
    font-size: clamp(0.8rem, 2vw, 1.5rem);
    font-family: var(--font-main);
    font-weight: bold;
    border-radius: 5px;
    background: var(--accent-color);
    border: none;
    cursor: pointer;
    margin-left: 10px;
}

#show-answer-btn {
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    padding: clamp(8px, 1.5vh, 15px) clamp(15px, 3vw, 30px);
}

/* Light Theme for Setup Screen */
.light-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 100%;
    margin: auto;
    text-align: center;
    position: relative;
    color: #333333;
    border-top: 8px solid var(--accent-color);
}

.setup-logo {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin-bottom: 15px;
}

.setup-mascot {
    position: absolute;
    bottom: -20px;
    right: -130px;
    width: 180px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
    z-index: 10;
    pointer-events: none;
}
@media (max-width: 800px) {
    .header h2 {
        font-size: 1.2rem;
    }
    .btn-text {
        display: none;
    }
}

@media (max-width: 800px) {
    .setup-mascot {
        right: -20px;
        width: 120px;
        opacity: 0.3;
        z-index: -1;
    }
}

.setup-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.light-box label {
    color: #333;
}

.light-box input[type="file"], 
.light-box .player-input {
    background: #f8f9fa;
    border: 2px solid #eaeaea;
    color: #333;
    border-radius: 10px;
    transition: border-color 0.3s;
}

.light-box input[type="file"]:focus, 
.light-box .player-input:focus {
    border-color: var(--cell-bg);
}

.light-box .btn.primary {
    background-color: var(--cell-bg);
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.3rem;
    border-radius: 10px;
    margin-top: 10px;
}

.light-box .btn.primary:hover:not(:disabled) {
    background-color: #1aa0a6;
    transform: translateY(-2px);
}

.light-box .btn.secondary {
    background-color: #f0f0f0;
    color: #333;
    border-radius: 10px;
    border: 1px solid #ddd;
}

.light-box .btn.danger {
    background-color: #ffeaea;
    color: #dc3545;
    border: none;
    border-radius: 10px;
}

.light-box .btn.danger:hover {
    background-color: #ffcccc;
}
