
:root { --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
        --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
body[data-theme="dark"] { --bg: #1e1f24; --panel: #2a2c33; --panel2: #34363e; --text: #eceef2; --dim: #9a9fab;
  --line: #3d4048; --accent: #4f8cff; --accent-text: #fff; --bar: rgba(25,26,30,.72); --shadow: 0 14px 40px rgba(0,0,0,.5);
  --term-bg: #14151a; --term-fg: #d6f5d6; }
body[data-theme="light"] { --bg: #eceef2; --panel: #ffffff; --panel2: #f1f2f5; --text: #1c1d21; --dim: #6a6f7c;
  --line: #d8dbe2; --accent: #2f6df0; --accent-text: #fff; --bar: rgba(255,255,255,.72); --shadow: 0 14px 40px rgba(0,0,0,.25);
  --term-bg: #fbfbfd; --term-fg: #16301a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; }
button, input, textarea { font: inherit; color: inherit; }
#root { position: fixed; inset: 0; }

/* wallpapers */
.wp0 { background: linear-gradient(135deg, #1b2a49, #5b3a8c 55%, #e0795c); }
.wp1 { background: linear-gradient(160deg, #0f2027, #203a43 50%, #2c5364); }
.wp2 { background: linear-gradient(135deg, #134e5e, #71b280); }
.wp3 { background: linear-gradient(135deg, #42275a, #734b6d); }
.wp4 { background: linear-gradient(135deg, #f7971e, #ffd200 60%, #fff4c2); }
.wp5 { background: linear-gradient(135deg, #cfd9df, #e2ebf0); }
.wp6 { background: radial-gradient(circle at 30% 20%, #3a7bd5, #00d2ff 40%, #0a1f44); }
.wp7 { background: #101114; }

/* centred screens */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card { width: 340px; background: var(--bar); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
        border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px; box-shadow: var(--shadow); text-align: center; }
.card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.card p { margin: 0 0 18px; color: var(--dim); }
.avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; background: var(--accent); color: var(--accent-text);
          display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 600; }
.field { width: 100%; margin: 5px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); outline: none; }
.field:focus { border-color: var(--accent); }
.btn { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.wide { width: 100%; margin-top: 8px; padding: 10px; }
.err { color: #ff6b6b; min-height: 20px; margin-top: 8px; font-size: 13px; }
.link { color: var(--accent); cursor: pointer; font-size: 13px; margin-top: 10px; display: inline-block; background: none; border: 0; }

/* desktop */
#desk { position: absolute; inset: 0; }
#bar { position: absolute; top: 0; left: 0; right: 0; height: 28px; z-index: 100000; display: flex; align-items: center; gap: 16px;
       padding: 0 12px; background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
       border-bottom: 1px solid var(--line); font-size: 13px; }
#bar .grow { flex: 1; }
#bar .name { font-weight: 700; }
#bar .menu { cursor: pointer; }
#area { position: absolute; top: 28px; left: 0; right: 0; bottom: 0; overflow: hidden; }
#dock { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; gap: 10px;
        padding: 8px 12px; border-radius: 20px; background: var(--bar); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
        border: 1px solid var(--line); box-shadow: var(--shadow); }
.dock-item { width: 52px; text-align: center; cursor: pointer; position: relative; }
.dock-icon { width: 52px; height: 52px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
             font-size: 28px; color: #fff; transition: transform .12s; }
.dock-item:hover .dock-icon { transform: translateY(-6px) scale(1.12); }
.dock-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text); margin: 3px auto 0; opacity: 0; }
.dock-item.running .dot { opacity: .85; }
.c-terminal { background: linear-gradient(145deg, #3b3e48, #14151a); } .c-files { background: linear-gradient(145deg, #5aa9ff, #2467d8); }
.c-textedit { background: linear-gradient(145deg, #ffd25a, #f09a16); } .c-photos { background: linear-gradient(145deg, #ff7eb3, #6a82fb); }
.c-settings { background: linear-gradient(145deg, #a0a6b2, #5d6270); }
.c-browser { background: linear-gradient(145deg, #4cc2ff, #0a6cff); }
.webframe { flex: 1; width: 100%; border: 0; background: #fff; min-height: 0; }

/* windows */
.win { position: absolute; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
       border-radius: 11px; box-shadow: var(--shadow); overflow: hidden; }
.win.active { box-shadow: 0 18px 54px rgba(0,0,0,.55); }
.win.hidden { display: none; }
.wt { height: 32px; flex: none; display: flex; align-items: center; padding: 0 10px; gap: 8px; background: var(--panel2);
      border-bottom: 1px solid var(--line); cursor: default; user-select: none; touch-action: none; }
.wt .title { flex: 1; text-align: center; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 54px; }
.win.active .wt .title { color: var(--text); }
.light { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; }
.l-close { background: #ff5f57; } .l-min { background: #febc2e; } .l-zoom { background: #28c840; }
.win:not(.active) .light { background: #666; }
.wb { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.wr { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none; }

/* terminal */
.terminal { flex: 1; min-height: 0; background: var(--term-bg); color: var(--term-fg); font-family: var(--mono); font-size: 13px; overflow: auto; padding: 8px 10px; }
.t-out { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.t-row { display: flex; align-items: baseline; }
.t-prompt { white-space: pre; }
.t-in { flex: 1; min-width: 40px; background: transparent; border: 0; outline: none; font-family: var(--mono); font-size: 13px; color: inherit; padding: 0; }

/* toolbars, lists */
.toolbar { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--panel2); flex-wrap: wrap; }
.toolbar .btn { padding: 4px 10px; font-size: 13px; }
.toolbar .path { flex: 1; color: var(--dim); font-family: var(--mono); font-size: 12px; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list { flex: 1; overflow: auto; }
.row { display: flex; align-items: center; gap: 10px; padding: 5px 12px; cursor: default; border-bottom: 1px solid transparent; }
.row:hover { background: var(--panel2); }
.row.sel { background: var(--accent); color: var(--accent-text); }
.row .ico { width: 22px; text-align: center; }
.row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sz, .row .dt { width: 90px; text-align: right; color: var(--dim); font-size: 12px; }
.row.sel .sz, .row.sel .dt { color: var(--accent-text); }
.empty { padding: 24px; color: var(--dim); text-align: center; }
.te { flex: 1; width: 100%; resize: none; border: 0; outline: none; padding: 10px 12px; background: var(--panel); font-family: var(--mono); font-size: 13px; line-height: 1.45; tab-size: 4; }
.status { padding: 4px 10px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); background: var(--panel2); }
.grid { flex: 1; overflow: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; padding: 12px; }
.tile { width: 120px; cursor: pointer; text-align: center; font-size: 12px; }
.tile .pic { width: 120px; height: 96px; border-radius: 8px; background: var(--panel2); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--dim); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile span { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; min-height: 0; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.side { display: flex; flex: 1; min-height: 0; }
.side nav { width: 150px; border-right: 1px solid var(--line); background: var(--panel2); padding: 8px; }
.side nav .item { padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.side nav .item.on { background: var(--accent); color: var(--accent-text); }
.side .pane { flex: 1; padding: 16px 20px; overflow: auto; }
.pane h3 { margin: 0 0 10px; font-size: 15px; }
.pane .line { margin: 8px 0; color: var(--dim); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px; }
.sw { width: 56px; height: 36px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.sw.on { border-color: var(--accent); }

/* dialogs and toasts */
.modal-bg { position: fixed; inset: 0; z-index: 200000; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.modal { width: 360px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 10px; color: var(--dim); white-space: pre-wrap; }
.modal .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 300000; background: var(--panel); border: 1px solid var(--line);
         border-radius: 10px; padding: 8px 14px; box-shadow: var(--shadow); display: none; max-width: 80vw; }
