/* ========================================================
   Koło Fortuny – frontend game styles
   ======================================================== */

#kolo-fortuny-game {
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 860px;
    margin: 0 auto;
    color: #2c3e50;
}

/* ---- Toolbar (fullscreen button – top right) ---- */
#kolo-fortuny-game .omni-game-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 4px 4px 0;
}

#kolo-fortuny-game .omni-game-toolbar__actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ---- Theme toggle button ---- */
.kf-theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.kf-theme-btn:hover {
    background: #f0f3f6;
    border-color: #adb5bd;
    color: #495057;
}

/* ---- Screens ---- */
.kf-screen {
    padding: 20px 10px;
}

/* ==============================
   SETUP SCREEN
   ============================== */
#kf-setup {
    max-width: 760px;
    margin: 10px auto 14px;
    padding: 26px 22px 30px;
    border-radius: 20px;
    border: 1px solid #d7e4ef;
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(25, 62, 96, 0.12);
}

.kf-title {
    text-align: center;
    font-size: 2rem;
    margin: 0 0 6px;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

.kf-subtitle {
    text-align: center;
    color: #95a5a6;
    margin: 0 0 28px;
    font-size: 0.92rem;
}

#kf-setup .kf-title {
    font-size: 2.15rem;
    margin-bottom: 8px;
}

#kf-setup .kf-subtitle {
    color: #6c7a86;
    margin-bottom: 24px;
    font-size: 1rem;
}

/* Card wrapping all players */
.kf-players-setup {
    position: relative;
    max-width: 520px;
    margin: 0 auto 24px;
    background: #ffffff;
    border: 1px solid #dbe7f3;
    border-radius: 16px;
    padding: 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.kf-players-setup::before {
    content: none;
}

/* 2-column grid for player fields */
.kf-players-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

.kf-player-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kf-players-grid .kf-player-field:nth-child(n+3) {
    margin-top: 10px;
}

.kf-player-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #111111;
    margin: 0 0 4px;
    line-height: 1.2;
}

.kf-player-field br {
    display: none !important;
}

.kf-required {
    color: #e74c3c;
}

.kf-player-field input {
    padding: 14px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #2c3e50;
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
    width: 100%;
    box-sizing: border-box;
    margin: 0 !important;
}

.kf-player-field input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.16);
    outline: none;
}

.kf-player-field input::placeholder {
    font-weight: 400;
    color: #ced4da;
    font-style: italic;
}

.kf-puzzle-count {
    text-align: center;
    color: #95a5a6;
    margin-bottom: 22px;
    font-size: 0.88rem;
}

#kf-setup .kf-puzzle-count {
    display: table;
    margin: 0 auto 22px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ecf5eb;
    border: 1px solid #cfe2ca;
    color: #4f883d;
    font-weight: 700;
    font-size: 0.86rem;
}

#kf-start-btn {
    background: linear-gradient(135deg, #4f883d 0%, #3f6f31 100%);
    box-shadow: 0 10px 24px rgba(79, 136, 61, 0.24);
}

#kf-start-btn:hover:not(:disabled) {
    filter: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(63, 111, 49, 0.32);
}

/* ==============================
   BUTTONS
   ============================== */
.kf-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s, opacity 0.18s;
    background: #ecf0f1;
    color: #2c3e50;
    line-height: 1.3;
    white-space: nowrap;
}

.kf-btn:hover:not(:disabled) {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.kf-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.kf-btn-primary {
    background: #2980b9;
    color: #fff;
    display: block;
    margin: 0 auto;
    padding: 13px 40px;
    font-size: 1.05rem;
}

.kf-btn-spin   { background: #27ae60; color: #fff; }
.kf-btn-vowel  { background: #8e44ad; color: #fff; }
.kf-btn-solve  { background: #e67e22; color: #fff; }

/* ==============================
   GAME SCREEN – vertical layout
   ============================== */

/* Scores bar */
.kf-scores {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.kf-player-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 8px 16px;
    min-width: 120px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.kf-player-card--active {
    border-color: #2980b9;
    background: #ebf5fb;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.22);
}

.kf-player-card__name  { font-weight: 700; margin-bottom: 3px; }
.kf-player-card__round { font-size: 1rem; color: #27ae60; font-weight: 600; }
.kf-player-card__total { font-size: 1rem; color: #2980b9; font-weight: 600; }

.kf-player-card__name {
    font-size: 1.55rem;
}

/* Puzzle counter */
.kf-puzzle-counter {
    text-align: center;
    color: #95a5a6;
    font-size: 0.85rem;
    margin-bottom: 0;
}

#kolo-fortuny-game p:empty {
    display: none;
    margin: 0 !important;
    padding: 0 !important;
}

/* Category */
.kf-kategoria {
    text-align: center;
    font-size: 1rem;
    color: #555;
    margin-bottom: 12px;
    padding: 7px 16px;
    background: #eaf4fb;
    border-radius: 6px;
    display: none;
}

/* Hint */
.kf-hint { text-align: center; margin: 8px 0 12px; }
.kf-hint .kf-podpowiedz { font-style: italic; color: #666; margin: 0 0 8px; }
.kf-hint .kf-obrazek {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: zoom-in;
}

.kf-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.kf-lightbox.is-open {
    display: flex;
}

.kf-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 14, 22, 0.62);
}

.kf-lightbox-content {
    position: relative;
    z-index: 1;
    width: min(96vw, 980px);
    max-height: 92vh;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.36);
}

.kf-lightbox-content img {
    display: block;
    width: 100%;
    max-height: calc(92vh - 44px);
    object-fit: contain;
    border-radius: 8px;
}

.kf-lightbox-close {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: rgba(12, 20, 31, 0.76);
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

/* ---- Letter board ---- */
.kf-board {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 16px 12px;
    background: #e1e3e6;
    border-radius: 10px;
    margin-bottom: 20px;
    min-height: 70px;
    align-items: center;
}

.kf-word { display: inline-flex; gap: 3px; margin: 2px 0; }
.kf-word-gap { display: inline-block; width: 18px; }

.kf-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 42px;
    border-radius: 4px;
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    border-bottom: 3px solid #5d6d7e;
    background: transparent;
    color: transparent;
    transition: background 0.25s, color 0.25s;
}

#kolo-fortuny-game .kf-tile--hidden  { background: #4f883d; border-bottom-color: #3f6f31; }
#kolo-fortuny-game .kf-tile--revealed {
    background: #ffffff;
    color: #1a252f;
    border-bottom-color: #2980b9;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

/* ---- Wheel section (centered, full width) ---- */
.kf-wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.kf-wheel-container {
    position: relative;
    display: block;
    width: min(500px, 100%);
    margin: 0 auto;
}

.kf-wheel-container canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.kf-wheel-pointer {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: #e74c3c;
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 10;
}

/* Spin result badge */
.kf-spin-result {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    padding: 10px 24px;
    border-radius: 10px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: kfPopIn 0.3s ease-out;
}

.kf-spin-result--value   { background: #d5f5e3; color: #1e8449; border: 2px solid #27ae60; }
.kf-spin-result--bankrut { background: #fadbd8; color: #922b21; border: 2px solid #e74c3c; }
.kf-spin-result--strata  { background: #fdebd0; color: #784212; border: 2px solid #e67e22; }

@keyframes kfPopIn {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ---- Controls section ---- */
.kf-controls-section {
    max-width: 600px;
    margin: 0 auto;
}

.kf-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 14px;
}

.kf-status {
    text-align: center;
    font-size: 1rem;
    min-height: 26px;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 500;
}

/* ---- Letter keyboard ---- */
.kf-keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 14px;
    background: #f4f6f8;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    margin-bottom: 12px;
}

.kf-key {
    width: 42px;
    height: 42px;
    border: 2px solid #bdc3c7;
    background: #fff;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.13s, border-color 0.13s, transform 0.1s;
    color: #2c3e50;
}

.kf-key:hover:not(:disabled) {
    background: #2980b9;
    color: #fff;
    border-color: #2980b9;
    transform: translateY(-2px);
}

.kf-key:active:not(:disabled) { transform: translateY(0); }

.kf-key--used {
    background: #ecf0f1;
    color: #bdc3c7;
    border-color: #ddd;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ---- Solve area ---- */
.kf-solve-area {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.kf-solve-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 10px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.kf-solve-input:focus {
    border-color: #2980b9;
    outline: none;
}

.kf-solve-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ==============================
   END SCREEN
   ============================== */
.kf-final-scores { max-width: 440px; margin: 0 auto 24px; }
.kf-winner-title { text-align: center; color: #e67e22; font-size: 1.3rem; margin-bottom: 16px; }

.kf-final-player {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 1rem;
}

.kf-final-player--winner {
    background: #d5f5e3;
    border-color: #27ae60;
    font-size: 1.1rem;
}

/* ---- Error ---- */
.kf-error {
    text-align: center;
    color: #c0392b;
    padding: 20px;
    background: #fadbd8;
    border-radius: 8px;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 500px) {
    #kf-setup {
        padding: 20px 14px 24px;
        border-radius: 16px;
    }

    .kf-players-setup {
        padding: 16px;
    }

    .kf-players-grid {
        grid-template-columns: 1fr;
    }

    .kf-players-grid .kf-player-field:nth-child(n+3) {
        margin-top: 0;
    }

    .kf-tile {
        width: 28px;
        height: 36px;
        font-size: 1.6rem;
    }

    .kf-actions { gap: 8px; }
    .kf-btn { padding: 9px 14px; font-size: 0.9rem; }
}

/* ---- Fullscreen ---- */
#kolo-fortuny-game:fullscreen,
#kolo-fortuny-game:-webkit-full-screen,
#kolo-fortuny-game:-moz-full-screen,
#kolo-fortuny-game:-ms-fullscreen {
    background: #ffffff;
    padding: 20px;
    overflow-y: auto;
}

#kolo-fortuny-game:fullscreen::backdrop {
    background: #ffffff;
}

/* ==============================
   DARK MODE
   ============================== */
#kolo-fortuny-game.kf-dark {
    background: #111c29;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-title {
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-subtitle,
#kolo-fortuny-game.kf-dark .kf-puzzle-count,
#kolo-fortuny-game.kf-dark .kf-puzzle-counter {
    color: #5f8ab0;
}

#kolo-fortuny-game.kf-dark #kf-setup {
    border-color: #304865;
    background: radial-gradient(circle at 10% 0%, #1c2f4a 0%, #121f31 44%, #132a1f 100%);
    box-shadow: 0 20px 38px rgba(6, 11, 18, 0.5);
}

#kolo-fortuny-game.kf-dark #kf-setup .kf-subtitle {
    color: #87a7c4;
}

#kolo-fortuny-game.kf-dark #kf-setup .kf-puzzle-count {
    background: #17312a;
    border-color: #27503f;
    color: #7fd79f;
}

#kolo-fortuny-game.kf-dark #kf-start-btn {
    background: linear-gradient(135deg, #4f883d 0%, #2f5424 100%);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

#kolo-fortuny-game.kf-dark .kf-players-setup {
    background: #1a2740;
    border-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-players-setup::before {
    background:
        radial-gradient(circle at 93% 10%, rgba(79, 136, 61, 0.2) 0%, rgba(79, 136, 61, 0) 48%),
        radial-gradient(circle at 4% 2%, rgba(77, 163, 229, 0.18) 0%, rgba(77, 163, 229, 0) 46%);
}

#kolo-fortuny-game.kf-dark .kf-player-label {
    color: #5f8ab0;
}

#kolo-fortuny-game.kf-dark .kf-player-field input {
    background: #0f1923;
    border-color: #2d4060;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-player-field input:focus {
    border-color: #4da3e5;
    box-shadow: 0 0 0 3px rgba(77,163,229,0.18);
}

#kolo-fortuny-game.kf-dark .kf-player-field input::placeholder {
    color: #2e4a63;
}

#kolo-fortuny-game.kf-dark .kf-btn {
    background: #1e2d4a;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-btn:hover:not(:disabled) {
    filter: brightness(1.15);
}

#kolo-fortuny-game.kf-dark .kf-scores {
    border-bottom-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-player-card {
    background: #1a2740;
    border-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-player-card--active {
    background: #132240;
    border-color: #4da3e5;
    box-shadow: 0 0 0 3px rgba(77,163,229,0.22);
}

#kolo-fortuny-game.kf-dark .kf-player-card__name {
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-player-card__round {
    color: #3dba7a;
}

#kolo-fortuny-game.kf-dark .kf-player-card__total {
    color: #4da3e5;
}

#kolo-fortuny-game.kf-dark .kf-kategoria {
    background: #132240;
    color: #a0c4e8;
}

#kolo-fortuny-game.kf-dark .kf-hint .kf-podpowiedz {
    color: #8ab4d4;
}

#kolo-fortuny-game.kf-dark .kf-board {
    background: #060e17;
}

#kolo-fortuny-game.kf-dark .kf-tile--hidden {
    background: #1a2740;
    border-bottom-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-tile--revealed {
    background: #d6eaf8;
    color: #0a1929;
    border-bottom-color: #4da3e5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

#kolo-fortuny-game.kf-dark .kf-status {
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-keyboard {
    background: #1a2740;
    border-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-key {
    background: #1e2d4a;
    border-color: #2d4060;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-key:hover:not(:disabled) {
    background: #4da3e5;
    border-color: #4da3e5;
    color: #fff;
}

#kolo-fortuny-game.kf-dark .kf-key--used {
    background: #111c29;
    color: #2a3f56;
    border-color: #1a2740;
}

#kolo-fortuny-game.kf-dark .kf-solve-area {
    background: #1a2740;
    border-color: #2d4060;
}

#kolo-fortuny-game.kf-dark .kf-solve-input {
    background: #0f1923;
    border-color: #2d4060;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-solve-input:focus {
    border-color: #4da3e5;
}

#kolo-fortuny-game.kf-dark .kf-final-scores .kf-final-player {
    background: #1a2740;
    border-color: #2d4060;
    color: #d6e4f7;
}

#kolo-fortuny-game.kf-dark .kf-final-player--winner {
    background: #0e2219;
    border-color: #3dba7a;
}

#kolo-fortuny-game.kf-dark .kf-winner-title {
    color: #e8a030;
}

#kolo-fortuny-game.kf-dark .kf-theme-btn {
    border-color: #2d4060;
    color: #5f8ab0;
}

#kolo-fortuny-game.kf-dark .kf-theme-btn:hover {
    background: #1a2740;
    border-color: #4da3e5;
    color: #d6e4f7;
}

/* Fullscreen dark mode */
#kolo-fortuny-game.kf-dark:fullscreen,
#kolo-fortuny-game.kf-dark:-webkit-full-screen,
#kolo-fortuny-game.kf-dark:-moz-full-screen,
#kolo-fortuny-game.kf-dark:-ms-fullscreen {
    background: #111c29;
}

#kolo-fortuny-game.kf-dark:fullscreen::backdrop {
    background: #111c29;
}
