:root {
    --bg: #0f2340;
    --window: #dfe4ed;
    --titlebar: #4A7CB9;
    --titlebar-dark: #35648a;
    --border: #9aa9bd;
    --border-strong: #4567a1;
    --text: #1e293b;
    --text-muted: #5f6f86;
    --blue: #4A7CB9;
    --blue-dark: #35648a;
    --blue-light: #d6e4f4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: top/cover no-repeat url('drawing.png'), #3B3B3B;
    background-attachment: fixed;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-top: 88px;
}

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar .brand { font-weight: 700; font-size: 1.05rem; }
.navbar .nav-links { display: flex; gap: 10px; }
.navbar .nav-link { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 4px; font-size: 0.88rem; }
.navbar .nav-link:hover { background: rgba(255,255,255,0.15); }
@media (max-width: 520px) { .navbar .nav-links { display: none; } }

/* ---- Window ---- */
.window {
    width: min(100%, 540px);
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
}
.window.closing {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.97);
}

/* ---- Titlebar ---- */
.titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px 6px;
    background: var(--blue);
    cursor: grab;
}
.titlebar.dragging { cursor: grabbing; user-select: none; }
.titlebar .left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
}
.titlebar .left .icon {
    width: 18px; height: 18px;
    display: inline-flex;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.75rem;
}

.titlebar .controls { display: flex; gap: 4px; }

.control {
    display: inline-flex;
    justify-content: center;
    width: 28px; height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s;
}
.control:hover { background: rgba(255,255,255,0.30); }
.control.close { background: #c0392b; border-color: #8e1b12; }
.control.close:hover { background: #e74c3c; }

/* ---- Window body ---- */
.window-body {
    padding: 22px 22px 20px;
    background: #f0f4fa;
}
.window-body h1 {
    margin: 0 0 10px;
    font-size: 1.35rem;
    color: #122043;
    font-weight: 700;
}
.window-body p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* ---- Buttons ---- */
.actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 7px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #c2d5ec; border-color: var(--blue); }
.btn.ok { background: var(--blue); color: #fff; border-color: var(--blue-dark); }
.btn.ok:hover { background: var(--blue-dark); }
.btn.cancel { background: #e8edf5; color: #3a5070; border-color: #8a9ab5; }
.btn.cancel:hover { background: #d4dcea; }

/* ---- Boom overlay ---- */
.boom-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
}
.boom-overlay.show { opacity: 1; pointer-events: auto; }
.boom-overlay img { width: 100vw; height: 100vh; object-fit: cover; opacity: 0; transition: opacity 0.25s ease; display: block; }
.boom-overlay.show img { opacity: 1; }

/* ---- Desktop folders ---- */
.desktop {
    position: fixed;
    inset: 0;
    z-index: 1500;
}
.desktop .folder {
    position: absolute;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.desktop .folder::before {
    content: "";
    position: absolute;
    left: -8px; top: -8px; right: -8px; bottom: -16px;
    border-radius: 6px;
    background: rgba(255,255,255,0.18);
    opacity: 0;
    transition: opacity 0.12s;
    pointer-events: none;
}
.desktop .folder img { width: 64px; height: 64px; display: block; }
.desktop .folder span { font-size: 0.82rem; text-align: center; color: #ffffff; }
.desktop .folder:hover { opacity: 0.95; transform: translateY(-4px); }
.desktop .folder:hover::before { opacity: 1; }
.desktop .folder:nth-of-type(1) { left: 50%; top: 50%; transform: translate(-110px, -20px); }
.desktop .folder:nth-of-type(2) { left: 50%; top: 50%; transform: translate(10px, -20px); }

/* ---- User status bar ---- */
.user-status {
    position: fixed;
    bottom: 20px; right: 20px;
    padding: 10px 14px;
    background: var(--blue);
    border-radius: 5px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 5000;
}
.user-status.show { display: flex; }
.user-status .status-label {
    padding: 3px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    font-weight: 700;
}
.user-status .logout-btn {
    background: #c0392b;
    border: none;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.15s;
}
.user-status .logout-btn:hover { background: #e74c3c; }

/* ---- Login form ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; color: #1e293b; font-weight: 600; font-size: 0.84rem; }
.form-group input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.84rem;
    background: #fff;
    transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(74,124,185,0.12); }
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.84rem;
    font-family: inherit;
    background: #fff;
    resize: vertical;
}
.form-group textarea:focus { outline: none; border-color: var(--blue); }
.login-btn { background: var(--blue-light); border: 1px solid var(--border-strong); }
.login-btn:hover { background: #c2d5ec; }
.error-msg { color: #c0392b; font-size: 0.75rem; margin-top: 3px; display: none; }
.success-msg { color: #218557; font-size: 0.8rem; margin-top: 10px; text-align: center; display: none; }

@media (max-width: 600px) { body { padding: 14px; padding-top: 78px; } .window { width: 100%; } }

/* ---- Comment windows ---- */
.comment-window { width: 320px; position: fixed; z-index: 3000; }
.comment-window .window-body.comment-body { max-height: 300px; overflow-y: auto; }
.comment-text { margin: 0 0 10px; font-size: 0.9rem; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.comment-drawing-wrap { margin-top: 12px; padding-top: 10px; border-top: 1px solid #d8e4f0; }
.comment-drawing { max-width: 100%; border-radius: 3px; border: 1px solid #d0d8e8; display: block; }
.comment-pseudo { font-weight: 700; margin-left: 6px; }
.comment-editor-window { width: 360px; position: fixed; z-index: 4000; }
