@import url('https://fonts.googleapis.com/css2?family=Bitcount+Grid+Double:wght@100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

/* The primary accent lives in a CSS variable so Settings can change it live.
   Desktop UI elements reference var(--accent); the landing screen keeps its
   own fixed gold so the boot sequence is never affected. */
:root {
    --accent: #E6B450;
}

* {
    box-sizing: border-box;
}

body {
    background: radial-gradient(ellipse at 50% 40%, #11151E 0%, #0B0E14 55%, #070910 100%);
    color: #BFBDB6;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    line-height: 1.9;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

#landing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#desktop {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
}

.terminal-window {
    position: relative;
    width: 640px;
    max-width: 100%;
    background-color: #0F1419;
    border: 1px solid #2D3640;
    border-radius: 10px;
    overflow: hidden;
    animation: power-on 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.terminal-window::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.04) 0px,
        rgba(255, 255, 255, 0.04) 1px,
        transparent 1px,
        transparent 3px
    );
}

.terminal-header {
    background-color: #131721;
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #1F2630;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red    { background-color: #D95757; }
.dot.yellow { background-color: #E6B450; }
.dot.green  { background-color: #7FD962; }

.terminal-body {
    padding: 24px 28px;
}

.Araadh { color: #7FD962; }
.loading-achievements { color: #D2A6FF; }
.spinner { color: #7FD962; }

.welcome {
    display: flex;
    align-items: center;
    line-height: 1;
    font-family: 'Bitcount Grid Double', monospace;
    color: #E6B450;
    font-size: 3rem;
    font-weight: 500;
    margin: 1.5rem 0 0;
    text-shadow: 0 0 20px rgba(230, 180, 80, 0.4);
}

.cursor {
    width: 3px;
    height: 2rem;
    margin-left: 10px;
    background-color: #BFBDB6;
    animation: blink 1.1s steps(1) infinite;
}

.mascot { color: #BFBDB6; margin-top: 0.5rem; }
.face { color: #E6B450; }

.enter-prompt { color: #565B66; margin-top: 1rem; cursor: pointer; }
.key {
    color: #E6B450;
    animation: pulse 1.4s ease-in-out infinite;
}

.menu-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* frosted glass to match the dock's material */
    background: linear-gradient(to bottom, rgba(26, 31, 41, 0.88), rgba(15, 19, 26, 0.80));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 10px rgba(0, 0, 0, 0.30);
    padding: 7px 16px;
    font-size: 13px;
    position: relative;
    z-index: 6000;               /* keep the bar above every window */
}
.menu-left { display: flex; align-items: center; gap: 8px; }

/* Brand mark: a small gradient chip + wordmark */
.brand {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-right: 8px;
}
.brand-logo {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--accent), #7FD962);
    box-shadow: 0 0 8px rgba(230, 180, 80, 0.45);
}
.menu-dim { color: #6B7079; padding: 0 4px; }
.menu-right { display: flex; align-items: center; gap: 12px; color: #BFBDB6; }

/* Clickable top-bar buttons that launch apps */
.menu-btn {
    color: #CDD0CF;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 7px;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.menu-btn:hover { background-color: rgba(255, 255, 255, 0.08); color: var(--accent); }
.menu-btn:active { background-color: rgba(255, 255, 255, 0.04); }

/* Grouped status glyphs sit in a subtle pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 9px;
}
.status-icon { font-size: 12px; cursor: default; opacity: 0.9; }
.menu-date { color: #8C9199; }
#clock {
    color: #E6E4DD;
    font-variant-numeric: tabular-nums;   /* digits don't jitter as they tick */
    min-width: 66px;
    text-align: right;
}

.desktop-body {
    flex: 1;
    position: relative;          /* anchor for absolutely-positioned windows */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;       /* lets uploaded wallpapers fill the surface */
    background-position: center;
}
.desktop-hint {
    color: #2D3640;
    font-size: 18px;
    pointer-events: none;        /* never blocks clicks on windows */
}

/* ---------- DESKTOP ICONS ---------- */
.desktop-icons {
    position: absolute;
    top: 18px;
    left: 18px;
    display: grid;
    grid-auto-flow: column;          /* fill top-to-bottom, then wrap to a new column */
    grid-template-rows: repeat(6, auto);
    gap: 6px 4px;
    z-index: 1;                      /* sits on the wallpaper, below open windows */
}
.desktop-icon {
    width: 84px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border-radius: 9px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}
.desktop-icon:hover { background-color: rgba(255, 255, 255, 0.06); }
.desktop-icon.selected {
    background-color: rgba(230, 180, 80, 0.16);
    border-color: rgba(230, 180, 80, 0.45);
}
.di-glyph {
    font-size: 30px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}
.di-label {
    font-size: 11px;
    color: #E6E4DD;
    text-align: center;
    /* legibility pill so labels read over any wallpaper */
    background-color: rgba(13, 17, 23, 0.55);
    padding: 1px 6px;
    border-radius: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.desktop-icon.selected .di-label {
    background-color: rgba(230, 180, 80, 0.28);
    color: #fff;
}

/* ---------- DOCK / TASKBAR ---------- */
.dock {
    position: relative;
    z-index: 5000;               /* always sits above windows */
    align-self: center;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 12px 10px;
    margin-bottom: 20px;
    /* layered frosted glass: soft top sheen → darker base */
    background: linear-gradient(to bottom, rgba(40, 47, 60, 0.55), rgba(13, 17, 23, 0.62));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid #2D3640;
    border-top-color: rgba(255, 255, 255, 0.10);   /* highlighted top edge */
    border-radius: 20px;
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);   /* inner top highlight */
}
.dock-item {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    border-radius: 15px;
    background: linear-gradient(to bottom, #222a36, #1A1F29);
    border: 1px solid #2D3640;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
                background 0.18s ease, box-shadow 0.18s ease;
}
.dock-icon {
    /* gentle drop shadow under the emoji so it pops off the tile */
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease;
}
.dock-item:hover {
    transform: translateY(-10px) scale(1.14);   /* lift + grow on hover */
    background: linear-gradient(to bottom, #2b3442, #20262f);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.55);
}
.dock-item:hover .dock-icon { transform: scale(1.08); }
.dock-item:active { transform: translateY(-4px) scale(1.05); }   /* press feel */
/* The little hop when an icon is clicked (toggled from JS) */
.dock-item.bounce { animation: dock-bounce 0.5s cubic-bezier(0.28, 0.84, 0.42, 1); }

/* Tooltip label above each tile on hover */
.dock-item .dock-label {
    position: absolute;
    bottom: 118%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    white-space: nowrap;
    font-size: 11px;
    color: #BFBDB6;
    background-color: rgba(28, 33, 43, 0.95);
    border: 1px solid #2D3640;
    padding: 4px 9px;
    border-radius: 7px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.dock-item:hover .dock-label { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Small dot under apps that currently have an open window */
.dock-item .dock-indicator {
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%) scale(0.4);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.dock-item.is-open .dock-indicator { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- WINDOW SYSTEM ---------- */
.window {
    position: absolute;
    min-width: 320px;
    background-color: #0F1419;
    border: 1px solid #2D3640;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: center;
    animation: window-open 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
/* Applied just before removal so the close animation can play */
.window.closing { animation: window-close 0.18s ease forwards; }
/* The focused window glows slightly so it reads as "on top" */
.window.focused { border-color: #3a4654; box-shadow: 0 18px 46px rgba(0, 0, 0, 0.65); }

.window-titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background-color: #131721;
    border-bottom: 1px solid #1F2630;
    cursor: grab;                /* hints that the bar is draggable */
    user-select: none;
}
.window-titlebar:active { cursor: grabbing; }
.window-dots { display: flex; gap: 7px; }
.wdot { width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.wdot.red    { background-color: #D95757; }
.wdot.yellow { background-color: #E6B450; }
.wdot.green  { background-color: #7FD962; }
.window-title { color: #8C9199; font-size: 13px; }

.window-content {
    padding: 18px;
    color: #BFBDB6;
    font-size: 14px;
    overflow: auto;
    max-height: 60vh;
}

@keyframes window-open {
    from { opacity: 0; transform: scale(0.94) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes window-close {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.94); }
}

/* ---------- APP CONTENT STYLES ---------- */
.app-heading {
    font-family: 'Bitcount Grid Double', monospace;
    color: var(--accent);
    font-size: 1.8rem;
    margin: 0 0 12px;
}
.muted { color: #8C9199; }
.accent-green  { color: #7FD962; }
.accent-blue   { color: #59C2FF; }
.accent-purple { color: #D2A6FF; }

/* Terminal app */
.term {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    width: 460px;
}
.term-output { white-space: pre-wrap; line-height: 1.6; }
.term-line { margin: 0; }
.term-inputline { display: flex; align-items: center; gap: 6px; }
.term-prompt { color: #7FD962; }
.term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #BFBDB6;
    font-family: inherit;
    font-size: inherit;
}

/* Notes app */
.notes { display: flex; flex-direction: column; gap: 8px; width: 440px; }
.notes-area {
    width: 100%;
    height: 280px;
    resize: vertical;
    background: #0B0E14;
    border: 1px solid #2D3640;
    border-radius: 8px;
    padding: 12px 14px;
    color: #D4D2CB;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.7;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.notes-area:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(230, 180, 80, 0.12);
}
.notes-area::placeholder { color: #565B66; }
.notes-foot {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8C9199;
}
.notes-status { color: var(--accent); transition: color 0.2s ease; }
.notes-status.dim { color: #8C9199; }
.notes-count { font-variant-numeric: tabular-nums; }

/* Settings app */
.settings-section { margin-bottom: 20px; }
.settings-label { color: #8C9199; font-size: 12px; margin-bottom: 8px; }
.wallpaper-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
    width: 64px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #2D3640;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.swatch:hover { transform: scale(1.06); border-color: var(--accent); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.upload-btn {
    display: inline-block;
    padding: 8px 14px;
    background-color: #1C212B;
    border: 1px solid #2D3640;
    border-radius: 8px;
    color: var(--accent);
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.upload-btn:hover { background-color: #232a36; }
.upload-btn input { display: none; }

/* Settings: rows of controls (toggle, slider, color chips) */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
}
.setting-row + .setting-row { border-top: 1px solid #1F2630; }

/* Accent color chips */
.accent-chips { display: flex; gap: 10px; align-items: center; }
.accent-chip {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #2D3640;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.accent-chip:hover { transform: scale(1.15); }
.accent-chip.active { border-color: #BFBDB6; }

/* A little pill toggle (used for 12/24h clock) */
.toggle {
    width: 46px;
    height: 24px;
    border-radius: 12px;
    background-color: #1C212B;
    border: 1px solid #2D3640;
    position: relative;
    cursor: pointer;
    transition: background-color 0.18s ease;
}
.toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #8C9199;
    transition: transform 0.18s ease, background-color 0.18s ease;
}
.toggle.on { background-color: rgba(230, 180, 80, 0.25); }
.toggle.on::after { transform: translateX(22px); background-color: var(--accent); }

/* Range slider for UI scale */
.setting-row input[type="range"] { accent-color: var(--accent); width: 140px; }
.setting-value { color: #8C9199; font-size: 12px; min-width: 42px; text-align: right; }

/* Generic ghost button (reset, etc.) */
.ghost-btn {
    padding: 7px 12px;
    background-color: #1C212B;
    border: 1px solid #2D3640;
    border-radius: 8px;
    color: #BFBDB6;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: background-color 0.15s ease;
}
.ghost-btn:hover { background-color: #232a36; }

.powering-off { animation: crt-off 0.5s ease forwards; }
.powering-on  { animation: crt-on 0.55s ease forwards; }

@keyframes blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@keyframes power-on {
    0%   { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes crt-off {
    0%   { transform: scale(1); opacity: 1; filter: brightness(1); }
    45%  { transform: scale(1.04); filter: brightness(1.8); }
    75%  { transform: scaleX(1) scaleY(0.012); filter: brightness(2.4); opacity: 1; }
    100% { transform: scaleX(0) scaleY(0.012); opacity: 0; filter: brightness(2.4); }
}

@keyframes crt-on {
    0%   { transform: scaleX(0) scaleY(0.012); opacity: 1; filter: brightness(2); }
    45%  { transform: scaleX(1) scaleY(0.012); filter: brightness(1.6); }
    100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

.boot-line {
    opacity: 0;
    animation: fade-up 0.5s ease forwards;
}

.boot-line.first-line           { animation-delay: 0.2s; }
.boot-line.loading-achievements { animation-delay: 0.9s; }
.boot-line.welcome              { animation-delay: 1.6s; }
.boot-line.mascot               { animation-delay: 4s; }
.boot-line.enter-prompt         { animation-delay: 5s; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}