:root {
  --accent: #3daee9;
  --bg: #1b1e24;
  --panel: rgba(22, 25, 31, 0.92);
  --win: #232629;
  --win-2: #2a2e33;
  --titlebar: #1f2226;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6e9ee;
  --muted: #9aa3ad;
  --term-bg: #1c1f24;
  --green: #8ad17a;
  --yellow: #e5c07b;
  --red: #ef5b5b;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --taskbar-h: 46px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Boot ---------- */
#boot { position: fixed; inset: 0; z-index: 9999; background: #16181d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: opacity .5s; }
#boot.hide { opacity: 0; pointer-events: none; }
.boot-logo { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 50%, transparent); }
.boot-name { font-size: 26px; font-weight: 600; margin-top: 8px; }
.boot-sub { color: var(--muted); font-size: 13px; letter-spacing: .04em; }
.spinner { width: 26px; height: 26px; margin-top: 22px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#skipBoot { position: absolute; right: 30px; bottom: 30px; background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; }

/* ---------- Desktop ---------- */
#desktop { position: fixed; inset: 0 0 var(--taskbar-h) 0; background-size: cover; background-position: center; }
.wp-aurora { background: radial-gradient(ellipse at 70% 10%, #4b3f7a 0%, transparent 55%), radial-gradient(ellipse at 20% 90%, #10406a 0%, transparent 60%), linear-gradient(160deg, #1d2240 0%, #121a33 50%, #0d1a35 100%); }
.wp-ocean  { background: radial-gradient(ellipse at 30% 20%, #1c6f8c 0%, transparent 55%), linear-gradient(170deg, #0c2f45 0%, #071b2b 100%); }
.wp-sunset { background: radial-gradient(ellipse at 50% 100%, #d9734a 0%, transparent 55%), linear-gradient(180deg, #2b1d47 0%, #6b2f57 60%, #a24b4b 100%); }
.wp-mono   { background: radial-gradient(ellipse at 50% 30%, #3a3f47 0%, #1a1c20 70%); }

#icons { position: absolute; top: 16px; left: 16px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 94px); grid-auto-columns: 92px; gap: 4px; height: calc(100% - 32px); }
.icon { width: 88px; padding: 8px 4px; border-radius: 8px; text-align: center; cursor: pointer; user-select: none; border: 1px solid transparent; background: none; }
.icon:hover { background: rgba(255,255,255,.07); }
.icon:focus-visible, .icon.selected { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); outline: none; }
.icon svg { width: 40px; height: 40px; stroke-width: 1.5; }
.icon span { display: block; margin-top: 4px; font-size: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.8); line-height: 1.25; }

/* ---------- Windows ---------- */
.window { position: absolute; display: flex; flex-direction: column; background: var(--win); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.5); overflow: hidden; min-width: 300px; min-height: 180px; animation: pop .16s ease-out; }
.window.focused { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.window.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
.window.minimized { display: none; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.titlebar { height: 38px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; background: var(--titlebar); cursor: grab; user-select: none; }
.titlebar:active { cursor: grabbing; }
.titlebar .t-icon svg { width: 16px; height: 16px; color: var(--accent); }
.titlebar .t-title { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar button { width: 28px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.titlebar button:hover { background: rgba(255,255,255,.1); color: var(--text); }
.titlebar button.close:hover { background: var(--red); color: #fff; }
.titlebar button svg { width: 14px; height: 14px; }
.win-body { flex: 1; overflow: auto; position: relative; }
.resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }

/* ---------- Taskbar ---------- */
#taskbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); background: var(--panel); backdrop-filter: blur(14px); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; padding: 0 8px; z-index: 5000; }
#startBtn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
#startBtn:hover, #startBtn.open { background: rgba(255,255,255,.1); }
#startBtn .logo { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
#tasks { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.task { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 6px; border: 0; background: rgba(255,255,255,.05); cursor: pointer; max-width: 200px; white-space: nowrap; font-size: 12.5px; border-bottom: 2px solid transparent; }
.task svg { color: var(--accent); flex: none; width: 16px; height: 16px; }
.task span { overflow: hidden; text-overflow: ellipsis; }
.task.active { background: rgba(255,255,255,.12); border-bottom-color: var(--accent); }
.tray { display: flex; align-items: center; gap: 14px; padding: 0 8px; color: var(--muted); font-size: 12.5px; }
#clock { color: var(--text); white-space: nowrap; }

/* ---------- Start menu ---------- */
#startMenu { position: fixed; left: 8px; bottom: calc(var(--taskbar-h) + 8px); width: 320px; max-width: calc(100vw - 16px); max-height: 70vh; display: flex; flex-direction: column; background: var(--panel); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 6000; padding: 12px; }
#startMenu[hidden] { display: none; }
.sm-user { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sm-name { font-weight: 600; }
.sm-title { color: var(--muted); font-size: 12px; }
#appSearch { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,.3); color: var(--text); font: inherit; outline: none; }
#appSearch:focus { border-color: var(--accent); }
#appList { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; }
#appList button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
#appList button:hover, #appList button:focus-visible { background: rgba(255,255,255,.08); outline: none; }
#appList svg { color: var(--accent); }

/* ---------- Shared ---------- */
.avatar { border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sm-avatar { width: 40px; height: 40px; font-size: 15px; }
.pad { padding: 22px 26px; line-height: 1.6; }
.pad h1 { margin: 0; font-size: 24px; }
.pad h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 22px 0 8px; }
.muted { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid var(--border); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; border: 0; cursor: pointer; font-weight: 500; }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--text); }

/* About */
.about-head { display: flex; gap: 18px; align-items: center; }
.about-head .avatar { width: 84px; height: 84px; font-size: 30px; }

/* Terminal */
.terminal { background: var(--term-bg); font-family: var(--mono); font-size: 13px; padding: 12px 14px; min-height: 100%; cursor: text; line-height: 1.5; }
.terminal .line { white-space: pre-wrap; word-break: break-word; }
.terminal .prompt { color: var(--green); }
.terminal .k { color: var(--accent); }
.terminal .y { color: var(--yellow); }
.terminal .r { color: var(--red); }
.terminal .m { color: var(--muted); }
.term-input-row { display: flex; }
.term-input { flex: 1; min-width: 0;background: none; border: 0; outline: none; color: var(--text); font: inherit; padding: 0 0 0 8px; caret-color: var(--text); }
.neofetch { display: flex; gap: 28px; flex-wrap: wrap; }
.neofetch pre { margin: 0; color: var(--accent); font: inherit; line-height: 1.15; }

/* File manager */
.fm { display: flex; height: 100%; }
.fm-side { width: 160px; flex: none; background: var(--win-2); border-right: 1px solid var(--border); padding: 10px 6px; }
.fm-side button { width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.fm-side button.on, .fm-side button:hover { background: rgba(255,255,255,.08); }
.fm-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fm-path { padding: 8px 14px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fm-grid { padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; align-content: start; overflow: auto; }
.fm-grid .icon span { text-shadow: none; }

/* Text editor */
.editor { display: flex; font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 100%; background: var(--term-bg); }
.editor .gutter { padding: 12px 10px; text-align: right; color: #5c6670; user-select: none; background: rgba(0,0,0,.2); }
.editor pre { margin: 0; padding: 12px 16px; white-space: pre-wrap; flex: 1; font: inherit; }

/* Projects / browser */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--win-2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.browser-bar { display: flex; gap: 8px; padding: 8px 12px; background: var(--win-2); border-bottom: 1px solid var(--border); }
.browser-bar .url { flex: 1; background: rgba(0,0,0,.3); border-radius: 99px; padding: 6px 14px; font-size: 12.5px; color: var(--muted); }

/* Contact */
.form { display: grid; gap: 10px; margin-top: 12px; }
.form input, .form textarea { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,.25); color: var(--text); font: inherit; outline: none; }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form textarea { min-height: 120px; resize: vertical; }

/* Settings */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
.wp-pick { width: 110px; height: 66px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.wp-pick.on { border-color: var(--accent); }

/* Minesweeper */
.mines { padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; user-select: none; }
.mines-bar { display: flex; gap: 20px; align-items: center; font-family: var(--mono); }
.mines-grid { display: grid; gap: 2px; }
.cell { width: 28px; height: 28px; border-radius: 4px; border: 0; background: #3a4048; font-family: var(--mono); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; }
.cell:hover { background: #48505a; }
.cell.open { background: #22262b; cursor: default; }
.cell.boom { background: var(--red); }

/* Tetris */
.tetris { padding: 14px; display: flex; gap: 18px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.tetris canvas { background: #15171b; border: 1px solid var(--border); border-radius: 6px; }
.tetris .side { font-family: var(--mono); font-size: 13px; line-height: 1.8; min-width: 120px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  #icons { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 84px); grid-template-rows: none; grid-auto-rows: 94px; justify-content: center; width: calc(100% - 32px); height: auto; }
  .window { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; min-width: 0; }
  .titlebar .max, .resize { display: none; }
  .tray span:not(#clock) { display: none; }
  .fm-side { display: none; }
  .task span { display: none; }
  .win-body { overflow-x: hidden; }
  .neofetch pre:first-child { display: none; }
  .neofetch pre { white-space: pre-wrap; word-break: break-word; }
  .pad { padding: 18px 16px; }
}
