:root {
  --accent: #3daee9;
  --panel-bg: rgba(42, 46, 50, 0.82);
  --win-bg: #2a2e32;
  --win-header: #31363b;
  --text: #eff0f1;
  --text-dim: #a9b0b7;
  --border: rgba(255,255,255,0.08);
  --hover: rgba(255,255,255,0.07);
  --shadow: 0 12px 40px rgba(0,0,0,0.5);
  --font: 'IBM Plex Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}
[data-theme="light"] {
  --panel-bg: rgba(239, 240, 241, 0.85);
  --win-bg: #fcfcfc;
  --win-header: #eff0f1;
  --text: #232629;
  --text-dim: #6a7178;
  --border: rgba(0,0,0,0.1);
  --hover: rgba(0,0,0,0.05);
  --shadow: 0 12px 40px rgba(0,0,0,0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #root { height: 100%; width: 100%; overflow: hidden; font-family: var(--font); }
body { user-select: none; -webkit-user-select: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- Boot ---------- */
.boot {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1d3a52, #0a141d);
  color: #eff0f1; gap: 20px;
}
.boot-logo { font-size: 80px; animation: pulse 1.4s ease-in-out infinite; }
.boot-text { font-size: 22px; font-weight: 300; letter-spacing: 3px; }
.boot-sub { font-size: 12px; color: #7a8b98; letter-spacing: 1px; }
.boot-bar { width: 200px; height: 4px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
.boot-bar-fill { height: 100%; width: 40%; background: #3daee9; border-radius: 4px; animation: load 2s ease-in-out forwards; }
@keyframes load { from { width: 0; } to { width: 100%; } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: 0.7; } }

/* ---------- Power screen ---------- */
.power-screen {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, #14222e, #05090d); color: #eff0f1; gap: 12px; cursor: pointer;
}
.power-msg { font-size: 34px; font-weight: 300; }
.power-sub { font-size: 13px; color: #7a8b98; }

/* ---------- Kernel Panic ---------- */
.panic-screen {
  position: fixed; inset: 0; z-index: 99999; background: #05060a;
  color: #d8dfe6; font-family: var(--mono); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  animation: panic-shake 0.35s linear 0s 6, panic-appear 0.15s ease-out;
}
@keyframes panic-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes panic-shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -3px); }
  80% { transform: translate(2px, 3px); }
}
.panic-flash {
  position: absolute; inset: 0; background: #e93d58; mix-blend-mode: screen;
  animation: panic-flash-anim 0.5s steps(1) 0s 3 forwards;
}
@keyframes panic-flash-anim { 0% { opacity: 0.5; } 50% { opacity: 0; } 100% { opacity: 0; } }
.panic-body { position: relative; z-index: 2; max-width: 720px; width: 90%; padding: 24px; }
.panic-emoji { font-size: 40px; text-align: center; margin-bottom: 14px; animation: pulse 1s ease-in-out infinite; }
.panic-title { color: #ff5d73; font-size: 20px; font-weight: 700; letter-spacing: 1px; margin-bottom: 16px; text-align: center; text-shadow: 0 0 12px rgba(233,61,88,0.6); }
.panic-log {
  background: rgba(0,0,0,0.5); border: 1px solid rgba(233,61,88,0.3); border-radius: 6px;
  padding: 14px 16px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: #9fb2c2; box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
  overflow: hidden; animation: panic-type 3s steps(60) both;
}
@keyframes panic-type { from { max-height: 0; } to { max-height: 400px; } }
.panic-hint { margin-top: 16px; text-align: center; color: #6b7a88; font-size: 12px; }

.panic-reboot {
  position: fixed; inset: 0; z-index: 99999; background: radial-gradient(circle at 50% 40%, #14222e, #05090d);
  color: #eff0f1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  animation: panic-appear 0.4s ease-out;
}
.panic-reboot-spin {
  width: 44px; height: 44px; border: 4px solid rgba(255,255,255,0.15); border-top-color: #3daee9;
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.panic-reboot-text { font-size: 16px; font-weight: 300; letter-spacing: 0.5px; text-align: center; padding: 0 20px; }
.panic-reboot-sub { font-size: 12px; color: #7a8b98; font-family: var(--mono); }

/* ---------- Desktop ---------- */
.desktop { position: relative; height: 100%; width: 100%; overflow: hidden; color: var(--text); }
.icon-layer { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; }
.desktop-icon {
  width: 92px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 6px; cursor: pointer; text-align: center;
}
.desktop-icon .di-label { font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); line-height: 1.2; }
.desktop-icon:hover { background: rgba(255,255,255,0.12); }
.desktop-icon.selected { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- Panel ---------- */
.panel {
  position: absolute; bottom: 0; left: 0; right: 0; height: 44px; z-index: 9000;
  background: var(--panel-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; gap: 4px; padding: 0 6px; border-top: 1px solid var(--border);
}
.kickoff {
  width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.kickoff:hover { background: var(--hover); }
.kickoff.active { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.tasks { flex: 1; display: flex; gap: 4px; overflow-x: auto; padding: 0 4px; }
.tasks::-webkit-scrollbar { height: 0; }
.task {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px;
  max-width: 180px; white-space: nowrap; font-size: 12px; color: var(--text);
  border-bottom: 2px solid transparent; transition: background 0.15s;
}
.task:hover { background: var(--hover); }
.task.active { background: var(--hover); border-bottom-color: var(--accent); }
.task.min { opacity: 0.55; }
.task-name { overflow: hidden; text-overflow: ellipsis; }
.tray { display: flex; align-items: center; gap: 6px; padding-right: 4px; }
.tray-icon { font-size: 15px; opacity: 0.9; }
.clock { text-align: center; padding: 4px 8px; border-radius: 6px; line-height: 1.15; }
.clock:hover { background: var(--hover); }
.clock-time { font-size: 13px; font-weight: 500; }
.clock-date { font-size: 10px; color: var(--text-dim); }

/* ---------- Calendar popup ---------- */
.cal-popup {
  position: absolute; bottom: 52px; right: 8px; z-index: 9500;
  background: var(--win-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 26px; box-shadow: var(--shadow); text-align: center; color: var(--text);
}
.cal-big { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--accent); }
.cal-date { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ---------- Launcher ---------- */
.launcher {
  position: absolute; bottom: 52px; left: 8px; z-index: 9500; width: 340px;
  background: var(--panel-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px; color: var(--text); animation: pop 0.14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.launcher-head { margin-bottom: 10px; }
.launcher-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 30%, transparent); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.lu-name { font-weight: 600; font-size: 14px; }
.lu-host { font-size: 11px; color: var(--text-dim); }
.launcher-search {
  width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--win-bg); color: var(--text); font-size: 13px; outline: none; margin-bottom: 12px;
}
.launcher-search:focus { border-color: var(--accent); }
.launcher-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.launcher-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
  border-radius: 8px; font-size: 11px; text-align: center; transition: background 0.12s;
}
.launcher-item:hover { background: var(--hover); }
.launcher-power { display: flex; gap: 6px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.pw-btn { flex: 1; padding: 7px; border-radius: 6px; font-size: 11px; color: var(--text); }
.pw-btn:hover { background: var(--hover); }

/* ---------- Window ---------- */
.window {
  position: absolute; background: var(--win-bg); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.35); overflow: hidden;
  display: flex; flex-direction: column; color: var(--text); min-width: 280px;
  animation: winopen 0.16s ease-out;
}
@keyframes winopen { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.window.focused { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.titlebar {
  height: 34px; background: var(--win-header); display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 0 12px; cursor: move; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.title-left { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.title-controls { display: flex; gap: 2px; }
.wctrl {
  width: 30px; height: 26px; border-radius: 5px; font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.wctrl:hover { background: var(--hover); color: var(--text); }
.wctrl.close:hover { background: #e93d58; color: #fff; }
.window-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.rz { position: absolute; z-index: 5; }
.rz-e { right: 0; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.rz-w { left: 0; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.rz-s { bottom: 0; left: 6px; right: 6px; height: 6px; cursor: ns-resize; }
.rz-se { right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; }

/* ---------- Context menu ---------- */
.context-menu {
  position: absolute; z-index: 9800; background: var(--win-bg); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); padding: 5px; min-width: 160px; color: var(--text);
}
.cm-item { padding: 7px 12px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.cm-item:hover { background: var(--accent); color: #fff; }
.cm-item.danger:hover { background: #e93d58; }

/* ---------- Dolphin ---------- */
.dolphin { display: flex; flex-direction: column; height: 100%; background: var(--win-bg); }
.dolphin-toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tbtn { width: 28px; height: 26px; border-radius: 5px; font-size: 14px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.tbtn.wide { width: auto; padding: 0 12px; font-size: 12px; }
.tbtn:hover:not(:disabled) { background: var(--hover); }
.tbtn:disabled { opacity: 0.3; cursor: default; }
.breadcrumb { flex: 1; display: flex; align-items: center; font-size: 12px; overflow: hidden; margin-left: 6px; background: var(--hover); border-radius: 6px; padding: 4px 8px; }
.crumb { cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.crumb:hover { background: var(--hover); color: var(--accent); }
.crumb-sep { color: var(--text-dim); margin: 0 2px; }
.dolphin-body { flex: 1; display: flex; min-height: 0; }
.dolphin-sidebar { width: 150px; border-right: 1px solid var(--border); padding: 8px 6px; overflow-y: auto; flex-shrink: 0; }
.sb-label { font-size: 10px; text-transform: uppercase; color: var(--text-dim); padding: 4px 8px; letter-spacing: 0.5px; }
.sb-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.dolphin-main {
  flex: 1; position: relative; overflow-y: auto; padding: 12px;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px;
}
.empty-dir { width: 100%; text-align: center; color: var(--text-dim); font-size: 12px; padding: 30px; }
.file-item {
  width: 88px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  border-radius: 6px; cursor: pointer; text-align: center;
}
.file-item:hover { background: var(--hover); }
.file-item.selected { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.file-label { font-size: 11px; line-height: 1.25; word-break: break-word; }
.rename-input { width: 82px; font-size: 11px; text-align: center; border: 1px solid var(--accent); border-radius: 4px; background: var(--win-bg); color: var(--text); outline: none; }
.dolphin-status { border-top: 1px solid var(--border); padding: 5px 12px; font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

/* ---------- Konsole ---------- */
.konsole {
  height: 100%; background: #16191c; color: #d0d4d8; font-family: var(--mono); font-size: 12.5px;
  padding: 10px; overflow-y: auto; line-height: 1.5; cursor: text;
}
.kline { white-space: pre-wrap; word-break: break-word; }
.kline.prompt { color: #61a5c2; }
.kline.err { color: #e97c88; }
.kline.ascii { color: #61c9e9; white-space: pre; }
.input-line { display: flex; }
.kprompt { color: #6bc98a; white-space: pre; flex-shrink: 0; }
.kinput { flex: 1; background: transparent; border: none; outline: none; color: #d0d4d8; font-family: var(--mono); font-size: 12.5px; caret-color: #61a5c2; }

/* ---------- Firefox (Web Browser) ---------- */
.firefox { display: flex; flex-direction: column; height: 100%; background: var(--win-bg); }
.ff-toolbar { display: flex; align-items: center; gap: 5px; padding: 7px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ff-btn { width: 30px; height: 30px; border-radius: 15px; font-size: 15px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.ff-btn:hover:not(:disabled) { background: var(--hover); }
.ff-btn:disabled { opacity: 0.3; cursor: default; }
.ff-address {
  flex: 1; height: 30px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--hover); color: var(--text); font-size: 13px; outline: none; font-family: var(--font);
}
.ff-address:focus { border-color: var(--accent); background: var(--win-bg); }
.ff-go { height: 30px; padding: 0 14px; border-radius: 16px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
.ff-go:hover { filter: brightness(1.08); }
.ff-cors-tip {
  display: flex; align-items: flex-start; gap: 9px; flex-shrink: 0;
  padding: 8px 12px; font-size: 11.5px; line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, var(--win-header));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.ff-cors-tip-icon { flex-shrink: 0; font-size: 14px; line-height: 1.3; }
.ff-cors-tip-text { flex: 1; }
.ff-cors-tip-text strong { color: var(--accent); }
.ff-cors-tip-text a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ff-cors-tip-text a:hover { text-decoration: underline; }
.ff-tip-xframe {
  background: color-mix(in srgb, #e9a53d 16%, var(--win-header));
  border-bottom-color: color-mix(in srgb, #e9a53d 45%, transparent);
}
.ff-tip-xframe .ff-cors-tip-text strong,
.ff-tip-xframe .ff-cors-tip-text a { color: #e9a53d; }
.ff-tip-cors {
  background: color-mix(in srgb, #e93d58 14%, var(--win-header));
  border-bottom-color: color-mix(in srgb, #e93d58 45%, transparent);
}
.ff-tip-cors .ff-cors-tip-text strong,
.ff-tip-cors .ff-cors-tip-text a { color: #ff6b81; }
.ff-cors-tip-close {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 4px;
  font-size: 12px; color: var(--text-dim); display: flex; align-items: center; justify-content: center;
}
.ff-cors-tip-close:hover { background: var(--hover); color: var(--text); }
.ff-viewport { flex: 1; position: relative; overflow: hidden; background: #fff; min-height: 0; }
.ff-frame { width: 100%; height: 100%; border: none; background: #fff; }
.ff-loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--win-bg); color: var(--text-dim); padding: 24px; text-align: center; font-size: 13px;
}
.ff-spinner {
  width: 40px; height: 40px; border: 4px solid var(--hover); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.85s linear infinite;
}
.ff-loader-text { max-width: 420px; word-break: break-word; }
.ff-status {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border); padding: 5px 12px; font-size: 11px; color: var(--text-dim);
  flex-shrink: 0; overflow: hidden;
}
.ff-status > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-proxy-badge {
  flex-shrink: 0; background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent); padding: 2px 8px; border-radius: 10px; font-weight: 600;
}

/* ---------- KWrite ---------- */
.kwrite { display: flex; flex-direction: column; height: 100%; background: var(--win-bg); }
.kwrite-toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.kwrite-title { font-size: 12px; color: var(--text-dim); }
.kwrite-editor { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.gutter { padding: 12px 8px; text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); background: var(--hover); overflow: hidden; line-height: 1.55; user-select: none; }
.kwrite-textarea {
  flex: 1; resize: none; border: none; outline: none; padding: 12px; background: var(--win-bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
}
.kwrite-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 13px; }
.kwrite-status { border-top: 1px solid var(--border); padding: 5px 12px; font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

/* ---------- System Monitor ---------- */
.monitor { height: 100%; overflow-y: auto; padding: 14px; background: var(--win-bg); display: flex; flex-direction: column; gap: 14px; }
.monitor-graph { background: var(--hover); border-radius: 8px; padding: 10px; }
.graph-svg { width: 100%; height: 60px; display: block; }
.graph-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.monitor-metrics { display: flex; flex-direction: column; gap: 10px; }
.monitor-metric { }
.metric-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.metric-bar { height: 8px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.metric-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.proc-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.proc-row { display: grid; grid-template-columns: 60px 1fr 60px 60px 30px; align-items: center; padding: 6px 10px; font-size: 12px; border-bottom: 1px solid var(--border); }
.proc-row:last-child { border-bottom: none; }
.proc-head { font-weight: 600; color: var(--text-dim); font-size: 11px; text-transform: uppercase; background: var(--hover); }
.kill-btn { width: 22px; height: 22px; border-radius: 4px; font-size: 11px; color: var(--text-dim); }
.kill-btn:hover { background: #e93d58; color: #fff; }

/* ---------- Settings ---------- */
.settings { height: 100%; overflow-y: auto; padding: 18px; background: var(--win-bg); }
.settings-section { margin-bottom: 20px; }
.settings-h { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.theme-toggle { display: flex; gap: 8px; }
.theme-opt { flex: 1; padding: 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; color: var(--text); }
.theme-opt:hover { background: var(--hover); }
.theme-opt.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.accent-row { display: flex; gap: 8px; }
.accent-swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; }
.accent-swatch.active { border-color: var(--text); transform: scale(1.1); }
.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wall-opt { height: 60px; border-radius: 8px; border: 2px solid transparent; display: flex; align-items: flex-end; padding: 6px; color: #fff; font-size: 10px; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.wall-opt.active { border-color: var(--accent); }
.about-grid { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 12px; }
.about-grid > div:nth-child(odd) { color: var(--text-dim); }
.remix-foot { margin-top: 16px; font-size: 12px; }
.remix-foot a { color: var(--accent); text-decoration: none; }
.remix-foot a:hover { text-decoration: underline; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.4); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 600px) {
  .launcher { width: calc(100% - 16px); }
  .dolphin-sidebar { width: 110px; }
}