:root {
    --bg: #DEEAF6;
    --win: #F4F7FB;
    --brd: #2A2C2B;
    --acc: #5B9BD5;
    --acc-hov: #41719C;
    --txt: #2A2C2B;
    --mut: #3D5A80;
    --hi: #FFD966;
    --err: #EE6C4D;

    --fH: 'Space Mono', monospace;
    --fB: 'Inter', sans-serif;
    --bW: 2px;
    --rS: 4px;
    --rM: 6px;
    --sS: 8px;
    --sM: 16px;
    --sL: 24px;
    --sX: 32px;
}

[data-theme="green"] {
    --bg: #E2EFDA;
    --win: #F3F9F1;
    --acc: #70AD47;
    --acc-hov: #548235;
    --mut: #385723;
    --hi: #FFC0CB;
    --err: #ED7D31;
}

[data-theme="yellow"] {
    --bg: #FFF2CC;
    --win: #FFFDF4;
    --acc: #FFC000;
    --acc-hov: #BF9000;
    --mut: #7F6000;
    --hi: #375bb7fc;
    --err: #C00000;
}

[data-theme="red"] {
    --bg: #FCE8E8;
    --win: #FFF5F5;
    --acc: #D92B2B;
    --acc-hov: #A82121;
    --mut: #8B1D1D;
    --hi: #FFD54F;
    --err: #7030A0;
}

[data-theme="purple"] {
    --bg: #E7E6F7;
    --win: #F5F4FD;
    --acc: #7030A0;
    --acc-hov: #4A235A;
    --mut: #2B1B48;
    --hi: #00BFA5;
    --err: #FF3399;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg);
    color: var(--txt);
    font-family: var(--fB);
    font-size: 16px;
    line-height: 1.5;
    transition: background-color 0.35s ease, color 0.35s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--fH);
    font-weight: 700;
    letter-spacing: -0.5px;
}

::selection {
    background: var(--hi);
    color: var(--txt);
}

#desktop-environment {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.theme-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--brd);
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    min-width: 14px;
}

.theme-dot:hover {
    transform: scale(1.2);
}

.theme-dot.active {
    box-shadow: 0 0 0 2px var(--win), 0 0 0 4px var(--brd);
}

.system-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px var(--sM);
    background-color: var(--win);
    border-bottom: var(--bW) solid var(--brd);
    font-family: var(--fH);
    font-size: 0.85rem;
    height: 32px;
    user-select: none;
    z-index: 100;
}

.sys-left,
.sys-right {
    display: flex;
    align-items: center;
    gap: var(--sM);
}

.sys-logo {
    font-size: 1.1rem;
}

#sys-status {
    color: var(--mut);
}

.workspace {
    flex: 1;
    position: relative;
    padding: var(--space-theme);
    overflow: hidden;
    background-image:
        linear-gradient(var(--acc) 1px, transparent 1px),
        linear-gradient(90deg, var(--acc) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center;
}

.desktop-icons {
    position: absolute;
    right: var(--sX);
    top: var(--sX);
    display: flex;
    flex-direction: column;
    gap: var(--sL);
    z-index: 10;
}

.icon-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    width: 64px;
}

.icon-group .icon {
    width: 48px;
    height: 48px;
    background-color: var(--win);
    border: var(--bW) solid var(--brd);
    border-radius: var(--rS);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background-color 0.2s;
}

.icon-group:hover .icon {
    background-color: var(--hi);
}

.icon-label {
    font-family: var(--fH);
    font-size: 0.75rem;
    background-color: var(--win);
    padding: 2px 6px;
    border: 1px solid var(--brd);
    border-radius: 2px;
    text-align: center;
}

.window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background-color: var(--win);
    border: var(--bW) solid var(--brd);
    border-radius: var(--rS);
    box-shadow: 4px 4px 0px rgba(42, 44, 43, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow: hidden;
    max-height: 90vh;
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px var(--sM);
    background-color: var(--win);
    border-bottom: var(--bW) solid var(--brd);
    cursor: grab;
    user-select: none;
}

.window-header:active {
    cursor: grabbing;
}

.window-title {
    font-family: var(--fH);
    font-size: 0.9rem;
    font-weight: 700;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.win-btn {
    width: 12px;
    height: 12px;
    border: var(--bW) solid var(--brd);
    border-radius: 50%;
    background-color: var(--win);
    position: relative;
    transition: transform 0.1s ease;
}

.win-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
}

.win-btn.win-close {
    background-color: var(--txt);
    cursor: pointer;
}

.win-btn.win-close:hover {
    transform: scale(1.1);
}

.window-content {
    padding: var(--sX);
    position: relative;
    min-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.view-section {
    display: none;
    flex-direction: column;
    gap: var(--sL);
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.branding {
    text-align: center;
    margin-bottom: var(--sM);
}

.branding h1 {
    font-size: 3rem;
    margin-bottom: 4px;
}

.branding .subtitle {
    font-family: var(--fH);
    color: var(--mut);
    font-size: 0.9rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--sS);
}

.input-group label {
    font-family: var(--fH);
    font-size: 0.85rem;
    font-weight: 700;
}

input[type="url"] {
    width: 100%;
    padding: 12px var(--sM);
    font-family: var(--fH);
    font-size: 1rem;
    background-color: transparent;
    border: var(--bW) solid var(--brd);
    outline: none;
    transition: background-color 0.2s;
}

input[type="url"]:focus {
    background-color: var(--hi);
    opacity: 0.8;
}

input[type="url"]::placeholder {
    color: var(--mut);
    opacity: 0.5;
}

button {
    cursor: pointer;
    font-family: var(--fH);
    font-size: 1rem;
    font-weight: 700;
    padding: 12px var(--sL);
    border: var(--bW) solid var(--brd);
    background-color: var(--win);
    color: var(--txt);
    transition: all 0.2s ease;
    outline: none;
}

button.btn-primary {
    background-color: var(--acc);
    margin-top: var(--sS);
}

button.btn-primary:hover {
    background-color: var(--acc-hov);
    color: var(--win);
}

button.btn-secondary:hover {
    background-color: var(--hi);
}

.progress-bar-container {
    width: 100%;
    height: 16px;
    border: var(--bW) solid var(--brd);
    background-color: var(--win);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--txt);
    transition: width 0.2s linear;
}

.terminal-container {
    background-color: transparent;
    border: var(--bW) solid var(--brd);
    padding: var(--sM);
    height: 150px;
    overflow-y: auto;
    font-family: var(--fH);
    font-size: 0.85rem;
}

.terminal-logs {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-logs li {
    color: var(--mut);
}

.terminal-logs li:last-child {
    color: var(--txt);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: var(--bW) dashed var(--brd);
    padding-bottom: var(--sM);
}

.score-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.score-label {
    font-family: var(--fH);
    font-size: 0.75rem;
    color: var(--mut);
}

.score-value {
    font-family: var(--fH);
    font-size: 2rem;
    font-weight: 700;
}

.score-good {
    color: var(--txt);
}

.score-bad {
    color: var(--err);
}

.roast-output {
    background-color: transparent;
    border: var(--bW) solid var(--brd);
    padding: var(--sM);
    font-family: var(--fH);
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 150px;
    white-space: pre-wrap;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .system-bar {
        padding: 4px var(--sS);
        gap: var(--sS);
    }

    .sys-breadcrumb {
        display: none;
    }

    .desktop-icons {
        right: var(--sM);
        top: var(--sM);
        gap: var(--sM);
    }

    .icon-group {
        width: 56px;
    }

    .icon-group .icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .window {
        width: 96%;
        max-width: none;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-height: 85vh;
    }

    .window-content {
        padding: var(--sM);
        min-height: auto;
    }

    .view-section {
        gap: var(--sM);
    }

    .branding h1 {
        font-size: 2.2rem;
    }

    .branding .subtitle {
        font-size: 0.8rem;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sS);
    }

    .score-panel {
        align-items: flex-start;
    }

    .modal {
        width: 90%;
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .desktop-icons {
        display: none;
    }

    .window {
        max-height: 80vh;
    }

    .terminal-container,
    .roast-output {
        height: auto;
        max-height: 180px;
        min-height: 120px;
    }
}

.modal {
    width: 300px;
    min-height: auto;
    z-index: 150;
    transition: none;
}

.hidden {
    display: none !important;
}

.modal-content {
    min-height: 100px;
    padding: var(--sM);
    font-size: 0.85rem;
}

.modal-content p {
    margin-bottom: var(--sS);
}

.network-ping {
    font-family: var(--fH);
    color: var(--mut);
}

#recycle-list li {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
}

#recycle-list li:hover {
    background-color: var(--hi);
    color: var(--txt);
}

.network-reply {
    font-family: var(--fH);
    color: var(--acc);
    margin-top: 8px;
}

.audit-paper {
    background-color: #fdfaf0 !important;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 100% 18px;
    color: #2a2c2b;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    line-height: 1.25;
    border: 1px solid #dcd9ce;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.02);
    padding: 10px !important;
    position: relative;
    overflow-y: auto;
}

#modal-audit {
    width: 380px;
    max-height: 72vh;
}

.audit-header {
    text-align: center;
    border-bottom: 2px solid #2a2c2b;
    margin-bottom: 8px;
    padding-bottom: 4px;
}

.audit-stamp {
    display: inline-block;
    border: 2px solid #d9a0a0;
    color: #d9a0a0;
    padding: 1px 6px;
    font-weight: bold;
    text-transform: uppercase;
    transform: rotate(-8deg);
    font-size: 0.8rem;
    margin: 4px 0;
    font-family: var(--fH);
}

.audit-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    border: 4px double #c0392b;
    color: #c0392b;
    padding: 6px 12px;
    font-size: 2.2rem;
    font-weight: 900;
    font-family: var(--fH);
    opacity: 0.75;
    pointer-events: none;
    z-index: 10;
    background: rgba(255, 255, 255, 0.05);
    animation: stamp-in 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.audit-seal.certified {
    border-color: #27ae60;
    color: #27ae60;
    transform: translate(-50%, -50%) rotate(15deg);
}

@keyframes stamp-in {
    0% {
        transform: translate(-50%, -50%) rotate(-30deg) scale(3);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) rotate(-30deg) scale(1);
        opacity: 0.8;
    }
}

.audit-section {
    margin-top: 10px;
}

.audit-section-title {
    font-weight: bold;
    text-decoration: underline;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}