:root {
    --text: #1e293b;
    --muted: #475569;
    --heading: #0f172a;
    --panel-bg: #ffffff;
    --panel-border: #cbd5e1;
    --page-bg: #f8fafc;
    --header-bg: #ffffff;
    --nav-text: #374151;
    --logo-text: #111827;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e2e8f0;
        --muted: #cbd5e1;
        --heading: #f8fafc;
        --panel-bg: #0f172a;
        --panel-border: #334155;
        --page-bg: #020617;
        --header-bg: #0b1220;
        --nav-text: #cbd5e1;
        --logo-text: #f8fafc;
    }
}

.poly-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

.poly-header {
    border-bottom: 1px solid var(--panel-border);
    background: var(--header-bg);
}

.poly-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.poly-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--logo-text);
    text-decoration: none;
    font-weight: 700;
}

.poly-nav {
    display: flex;
    gap: 16px;
}

.poly-nav a {
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 600;
}

.poly-nav a.active {
    color: #1d4ed8;
}

.poly-main {
    padding: 28px 0 44px;
    background: transparent;
    min-height: auto;
    color: var(--text);
}

.polyglot-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.polyglot-global-sidebar {
    width: 220px;
    flex: 0 0 220px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 3;
    backdrop-filter: blur(4px);
}

.polyglot-content-area {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.polyglot-main {
    width: 100%;
}

.polyglot-banner {
    margin: 4px 16px 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
}

.poly-hero h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--heading);
    letter-spacing: 0.01em;
}

.poly-hero p {
    margin: 8px 0 0;
    color: var(--muted);
}

.poly-card {
    margin-top: 20px;
    padding: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.poly-card h2,
.poly-card h3 {
    color: var(--heading);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.poly-card p {
    color: var(--text);
}

.poly-download-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.poly-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 14px;
    background: #ffffff;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.poly-btn-primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.poly-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.poly-btn:active {
    transform: translateY(1px);
}

.poly-btn-primary:hover {
    background: #1e40af;
    border-color: #1e40af;
}

.poly-btn-primary:active {
    background: #1e3a8a;
    border-color: #1e3a8a;
}

.poly-sha-box {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.poly-sha-box code {
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.poly-copy-btn {
    border: 1px solid #94a3b8;
    background: #ffffff;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
}

.poly-note {
    margin-top: 8px;
    color: var(--muted);
}

.poly-form {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.poly-form label {
    font-weight: 600;
    color: var(--heading);
    display: grid;
    gap: 6px;
}

.poly-form input[type="file"],
.poly-form input[type="number"],
.poly-form select {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
}

.poly-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.poly-generate-btn {
    justify-content: center;
    width: fit-content;
}

.poly-output {
    margin-top: 18px;
}

.poly-log {
    margin: 8px 0 0;
    min-height: 180px;
    max-height: 340px;
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    background: #000000;
    color: #22c55e;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 0.87rem;
    line-height: 1.4;
    white-space: pre-wrap;
    border: 1px solid #1f2937;
}

.poly-result-row {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 600;
    color: #1e293b;
}

.polyglot-page {
    position: relative;
    min-height: 100vh;
    padding: 0;
    background: transparent;
    overflow: hidden;
}

.polyglot-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-color: #0b1220;
    background-image: url("/assets/wallpapers/chess-terminal-server.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.polyglot-page::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1;
    pointer-events: none;
}

.polyglot-card {
    position: relative;
    z-index: 2;
    width: min(1050px, 100%);
    margin: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    padding: 28px;
}

.debug-wallpaper .polyglot-page::after {
    background: rgba(0, 0, 0, 0.15);
}

@media (max-width: 900px) {
    .polyglot-shell {
        display: block;
    }

    .polyglot-global-sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .polyglot-global-sidebar .nav-header {
        padding: 14px 16px;
    }

    .polyglot-global-sidebar .nav-items {
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        padding: 10px 12px 12px;
    }

    .polyglot-global-sidebar .nav-item {
        width: auto;
        min-width: max-content;
        padding: 10px 12px;
    }

    .polyglot-global-sidebar .nav-item .nav-label {
        display: inline;
    }

    .polyglot-content-area {
        padding: 16px 12px 24px;
    }

    .polyglot-card {
        padding: 16px;
    }

    .polyglot-banner {
        margin: 4px 0 14px;
    }

    .poly-main {
        padding: 8px 0 20px;
    }

    .poly-container {
        padding: 0;
    }
}
