/* ==========================================================
   DESKTOP.CSS — UKŁAD DESKTOP / FOOTER / KARTA ZADANIA
   Kolory i typografia pochodzą z :root w boardsvg.css.
   Specyficzne dla urządzenia media queries pozostają bez zmian.
========================================================== */

/* =========================================
   UKŁAD SZACHOWNICY — DESKTOP
========================================= */

.device-desktop .main-task,
.main-analyze {
    --board-size: min(
        752px,
        calc(100vw - 410px),
        calc(100dvh - var(--nav-height, 70px) - 193px)
    );
    width: 100%;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(302px, 500px);
    justify-content: start;
    align-content: start;
    gap: 20px;
    padding: calc(var(--nav-height, 70px) + 10px) 10px 10px;
    color: var(--light);
    overflow: hidden;
    box-sizing: border-box;
}

/* Wycentrowanie szachownicy na dużych ekranach */
.device-desktop .main-task.layout-centered {
    justify-content: center;
}

.device-desktop .game-container {
    grid-column: 1;
    grid-row: 1;
    width: var(--board-size);
    min-width: 302px;
    max-width: var(--board-size);
    padding: 0;
    box-sizing: border-box;
    resize: horizontal;
    overflow: hidden;
}

.device-desktop #board {
    width: 100%;
    max-width: 752px;
    box-sizing: border-box;
    overflow: hidden;
}

.device-desktop #chessboard {
    display: block;
    width: 94%;
    height: 94%;
    margin: 1.5% 1.5% 1.5% 1.5%;
    background-size: cover;
    overflow: visible;
}

.device-desktop .game-option-container {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 100%;
    min-width: 302px;
    max-width: 500px;
    max-height: calc(100dvh - var(--nav-height, 70px) - 20px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0 0;
    padding: 20px;
    overflow-y: auto;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 1rem;
}

.device-desktop .main-task > .user-game {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media screen and (max-width: 900px) {
    .device-desktop .main-task {
        --board-size: min(calc(100% - 48px), 752px);
        display: flex;
        flex-direction: column;
        align-items: center;
        height: 100dvh;
        padding-inline: 10px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .device-desktop .main-task.layout-centered {
        justify-content: flex-start;
    }

    .device-desktop .game-container,
    .device-desktop #board {
        width: var(--board-size);
        min-width: 0;
    }

    .device-desktop .game-container {
        max-width: none;
        resize: none;
        overflow: visible;
    }

    .device-desktop .game-option-container {
        width: min(100%, 500px);
        min-width: 0;
        max-height: none;
        flex: 0 0 auto;
        margin: 10px 0;
        overflow: visible;
    }

    .device-desktop .user-game {
        width: 100%;
        min-width: 0;
        gap: 8px;
        flex-wrap: wrap;
    }

    .device-desktop .user-info,
    .device-desktop .username-container {
        min-width: 0;
    }

    .device-desktop .main-task #taskResult {
        white-space: normal;
    }

    .device-desktop .main-task #pgn {
        min-width: 0;
    }
}

@media screen and (max-width: 480px) {
    .device-desktop .game-option-container,
    .device-desktop .main-task .task-card {
        padding: 10px;
    }

    .device-desktop .username {
        max-width: 90px;
    }
}

@media screen and (orientation: landscape) and (max-height: 600px) and (max-width: 1000px) {
    .device-desktop .main-task {
        --board-size: min(
            752px,
            calc(100% - 48px),
            calc(100svh - var(--nav-height, 70px) - 68px)
        );
        display: grid;
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        grid-template-rows: auto minmax(0, 1fr);
        align-items: start;
        align-content: stretch;
        justify-content: stretch;
        gap: 10px;
        height: 100svh;
        padding: calc(var(--nav-height, 70px) + 10px) 10px 10px;
        overflow: hidden;
    }

    .device-desktop .main-task.layout-centered {
        justify-content: stretch;
    }

    .device-desktop .game-container {
        position: relative;
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 100%;
        min-width: 0;
        max-width: none;
        resize: none;
        overflow: visible;
    }

    .device-desktop .option-labels {
        position: absolute;
        top: 4px;
        right: 4px;
        z-index: 20;
    }

    .device-desktop #board {
        width: var(--board-size);
        margin-inline: auto;
    }

    .device-desktop .captured-pieces {
        width: var(--board-size);
        margin-inline: auto;
    }

    .device-desktop .main-task > .user-game {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        margin: 0;
        padding: 8px 10px;
    }

    .device-desktop .game-option-container {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: 100%;
        margin: 0;
        padding: 10px;
        overflow-y: auto;
        align-items: stretch;
    }

    .device-desktop .game-option-container #task {
        width: 100%;
        margin-top: 0 !important;
        order: 2;
    }

    .device-desktop .game-option-container #gamestatus {
        order: 0;
        flex: 0 0 30px;
        text-align: center;
    }

    .device-desktop .game-option-container #pgn {
        order: 1;
        flex: 0 0 50px;
    }
}

.device-desktop #pgn {
    width: 100%;
    min-width: 200px;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    box-sizing: border-box;
    background-color: transparent;
    color: var(--light);
    display: grid;
    grid-template-columns: 15% 42.5% 42.5%;
    grid-auto-rows: 30px;
    row-gap: 4px;
}

/* =========================================
   FOOTER — DESKTOP
   Wymaga jednego .footer-links z trzema grupami
   oraz .footer-copyright po elemencie footer
========================================= */

.device-desktop .footer {
    background: var(--footer-bg);
    color: var(--footer-text);
}

.device-desktop .footer .footer-links-info {
    width: 100%;
    margin: 0 !important; /* neutralizuje margin:10px ze starego footer.php */
    padding: 12px 20px;
    box-sizing: border-box;
}

/* Trzy grupy w jednym rzędzie; środek fizycznie pośrodku stopki */
.device-desktop .footer .footer-links {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
    row-gap: 10px;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.device-desktop .footer .left-links,
.device-desktop .footer .center-links,
.device-desktop .footer .right-links {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    margin: 0;
}

.device-desktop .footer .left-links {
    grid-column: 1;
    justify-self: start;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.device-desktop .footer .center-links {
    grid-column: 2;
    justify-self: center;
    justify-content: center;
    flex-wrap: nowrap;
}

.device-desktop .footer .right-links {
    grid-column: 3;
    justify-self: end;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.device-desktop .footer .left-links .text-link {
    white-space: nowrap;
}

/* Ikony z left-links są przeznaczone na małe ekrany */
.device-desktop .footer .left-links .icon-link {
    display: none;
}

/* Copyright pod stopką, mniejszy tekst */
.device-desktop .footer-copyright {
    display: block;
    margin: 5px auto 12px;
    padding: 0 12px;
    color: var(--footer-text);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
    text-align: center;
}

.device-desktop .footer-copyright a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.device-desktop .footer-copyright a:hover {
    color: var(--tx);
    text-decoration: underline;
}

.device-desktop .footer-copyright a:focus-visible {
    outline: 2px solid var(--tx);
    outline-offset: 3px;
}

/* Węższy desktop: ikony idą wyżej, zanim grupy zaczną na siebie nachodzić */
@media screen and (min-width: 800px) and (max-width: 1100px) {
    .device-desktop .footer .footer-links {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "center center"
            "left right";
    }

    .device-desktop .footer .center-links {
        grid-area: center;
    }

    .device-desktop .footer .left-links {
        grid-area: left;
    }

    .device-desktop .footer .right-links {
        grid-area: right;
    }
}

/* Mały desktop: grupy wyśrodkowane pionowo */
@media screen and (min-width: 601px) and (max-width: 799px) {
    .device-desktop .footer .footer-links {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "center"
            "left"
            "right";
        justify-items: center;
    }

    .device-desktop .footer .center-links {
        grid-area: center;
        justify-self: center;
    }

    .device-desktop .footer .left-links {
        grid-area: left;
        justify-self: center;
        justify-content: center;
    }

    .device-desktop .footer .right-links {
        grid-area: right;
        justify-self: center;
        justify-content: center;
    }
}

/* Do 600px zachowujemy dotychczasowy widok samych ikon */
@media screen and (max-width: 600px) {
    .device-desktop .footer .footer-links {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .device-desktop .footer .right-links,
    .device-desktop .footer .center-links,
    .device-desktop .footer .left-links .text-link,
    .device-desktop .footer-copyright,
    .device-desktop .copyright {
        display: none;
    }

    .device-desktop .footer .left-links {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }

    .device-desktop .footer .left-links .icon-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        margin: 0;
    }
}

/* =========================================
   KARTY ZADAŃ — BEZ ZMIAN
========================================= */

.device-desktop .task-card {
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}

.device-desktop .task-header {
    margin-bottom: 15px;
}

/* Autor + avatar w jednej linii */
.device-desktop .task-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.device-desktop .task-avatar {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
}

.device-desktop .task-author-name {
    font-size: 16px;
}

/* Kolejne linie */
.device-desktop .task-date,
.task-rating,
.task-category {
    margin-bottom: 6px;
    font-size: 14px;
}

.device-desktop .task-seen-info {
    margin-top: 5px;
    color: orange;
    font-weight: bold;
}

.device-desktop .task-desc {
    margin-top: 15px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--task-description-text);
}

.device-desktop .task-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

/* =========================================
   STATUS SERWERA — BEZ ZMIAN
========================================= */

.server-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    gap: 20px;
    background: #f7f7f7;
    border-radius: 20px;
    text-decoration: none;
    color: black;
    width: auto;
    box-sizing: border-box;
}

/* Sygnał ping i serwer */
.server-status .server-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    font-size: 14px;
}

.server-status .ping,
.server-status .server {
    line-height: 1.4;
}

.server-status span#ping,
.server-status span#response {
    font-weight: bold;
    margin-left: 4px;
}

#signal {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
}

#signal > i {
    width: 6px;
    height: 20%;
    background-color: red;
    border-radius: 2px;
    transition: background-color 0.3s;
}

#signal > i:nth-child(1) {
    height: 25%;
}

#signal > i:nth-child(2) {
    height: 50%;
}

#signal > i:nth-child(3) {
    height: 75%;
}

#signal > i:nth-child(4) {
    height: 100%;
}

/* Status serwera */
.footer .server-status {
    background: rgb(0 0 0 / 18%);
    color: var(--tx);
}

/* Wartości PING i Serwer */
.footer .server-status #ping,
.footer .server-status #response {
    color: var(--home-gold);
}
