:root {
  --accent: #0078d4;
  --accent-2: #4cc2ff;
  --accent-text: #ffffff;

  --bg-1: #1c1c1c;
  --bg-2: #202020;
  --surface: rgba(44, 44, 44, 0.78);
  --surface-solid: #2b2b2b;
  --surface-2: rgba(58, 58, 58, 0.72);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-2: #cfcfcf;
  --text-3: #9a9a9a;
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.1);
  --control: rgba(255, 255, 255, 0.06);
  --control-hover: rgba(255, 255, 255, 0.1);
  --shadow-win: 0 32px 64px rgba(0, 0, 0, 0.55), 0 2px 21px rgba(0, 0, 0, 0.4);
  --shadow-fly: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius-win: 9px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-sm: 4px;
  --blur: blur(48px) saturate(160%);
  --taskbar-h: 48px;
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", "JetBrains Mono", "Fira Code", Consolas, "SF Mono", monospace;
}

body.light {
  --bg-1: #eaeaea;
  --bg-2: #f3f3f3;
  --surface: rgba(249, 249, 249, 0.8);
  --surface-solid: #f9f9f9;
  --surface-2: rgba(255, 255, 255, 0.7);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #1b1b1b;
  --text-2: #434343;
  --text-3: #6a6a6a;
  --hover: rgba(0, 0, 0, 0.045);
  --active: rgba(0, 0, 0, 0.08);
  --control: rgba(255, 255, 255, 0.7);
  --control-hover: rgba(255, 255, 255, 0.95);
  --shadow-win: 0 32px 64px rgba(0, 0, 0, 0.28), 0 2px 21px rgba(0, 0, 0, 0.18);
  --shadow-fly: 0 12px 40px rgba(0, 0, 0, 0.22);
}

body.no-transparency {
  --surface: var(--surface-solid);
  --surface-2: var(--surface-solid);
  --blur: none;
}
body.no-anim * { transition: none !important; animation: none !important; }

* { margin: 0; padding: 0; box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-2);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body { line-height: 1.4; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea { user-select: text; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 140, 0.5);
  border-radius: 8px;
  border: 4px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(170, 170, 170, 0.75); background-clip: padding-box; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 9000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s ease;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.boot-logo { animation: bootPulse 2.4s ease-in-out infinite; }
@keyframes bootPulse { 0%,100% { transform: scale(1); opacity: .95; } 50% { transform: scale(1.05); opacity: 1; } }
.boot-name { font-size: 30px; font-weight: 300; letter-spacing: 1px; color: #fff; }
.boot-spinner {
  width: 26px; height: 26px; margin-top: 8px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-status { color: #9a9a9a; font-size: 13px; }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 8000; display: flex; align-items: center; justify-content: center; }
.lock-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0b1026 0%, #14315c 45%, #4a1d6b 100%);
  background-size: 200% 200%; animation: lockGrad 18s ease infinite;
}
@keyframes lockGrad { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }
.lock::after { content:""; position:absolute; inset:0; backdrop-filter: blur(0px); }
.lock-center { position: relative; text-align: center; color: #fff; transform: translateY(-8%); }
.lock-time { font-size: 96px; font-weight: 600; line-height: 1; letter-spacing: -2px; text-shadow: 0 4px 30px rgba(0,0,0,.4); }
.lock-date { font-size: 22px; font-weight: 300; margin-top: 6px; opacity: .95; }
.lock-user { margin-top: 46px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid; place-items: center; font-size: 34px; font-weight: 600; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.avatar.sm { width: 32px; height: 32px; font-size: 14px; }
.lock-name { font-size: 22px; font-weight: 400; }
.lock-user form { display: flex; gap: 8px; margin-top: 4px; }
.lock-user input {
  width: 220px; padding: 9px 14px; border-radius: 20px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  color: #fff; outline: none; backdrop-filter: blur(10px); text-align: center;
}
.lock-user input::placeholder { color: rgba(255,255,255,.7); }
.lock-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  display: grid; place-items: center; color: #fff;
}
.lock-btn:hover { background: rgba(255,255,255,.28); }
.lock-hint { font-size: 12px; opacity: .7; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; right: 12px; bottom: calc(var(--taskbar-h) + 12px);
  z-index: 7000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  width: 340px; background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-fly);
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.3);
  display: flex; gap: 12px; align-items: flex-start;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.95); } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast .t-ico { font-size: 20px; line-height: 1; }
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-title { font-weight: 600; font-size: 13.5px; }
.toast .t-msg { color: var(--text-2); font-size: 12.5px; margin-top: 2px; word-break: break-word; }

.power-cover { position: fixed; inset: 0; background: #000; z-index: 9500; opacity: 0; transition: opacity .5s; }
.power-cover.show { opacity: 1; }
.power-cover .pmsg {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  font-size: 20px; font-weight: 300; gap: 20px;
}

/* ---------- OS mode launcher ---------- */
.launcher {
  position: fixed; inset: 0; z-index: 9600;
  background: radial-gradient(1200px 800px at 50% -10%, #12305c 0%, #0a1020 55%, #05070d 100%);
  display: grid; place-items: center; padding: 24px;
  transition: opacity .45s ease;
}
.launcher.out { opacity: 0; pointer-events: none; }
.launcher-inner { width: min(860px, 100%); text-align: center; color: #fff; }
.launcher-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 38px; }
.launcher-title { font-size: 34px; font-weight: 300; letter-spacing: 2px; }
.launcher-sub { color: #9fb0c6; font-size: 14px; }
.launcher-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 640px) { .launcher-cards { grid-template-columns: 1fr; } }
.launcher-card {
  border-radius: 18px; padding: 18px; color: #fff; text-align: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.launcher-card:hover { transform: translateY(-4px); border-color: rgba(120,190,255,.7); background: rgba(255,255,255,.1); }
.launcher-card.selected { border-color: #4cc2ff; box-shadow: 0 0 0 2px rgba(76,194,255,.4), 0 24px 60px rgba(0,0,0,.45); }
.lc-preview { height: 180px; border-radius: 12px; margin-bottom: 16px; overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.12); }
.lc-desktop {
  background: linear-gradient(150deg,#0a2342,#13528a 55%,#4cc2ff);
  display: grid; grid-template-columns: repeat(2, 34px); gap: 8px; align-content: start;
  justify-content: start; padding: 16px;
}
.lc-desktop i { width: 34px; height: 34px; border-radius: 7px; background: rgba(255,255,255,.85); box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.lc-desktop::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 10px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.lc-apple {
  background: linear-gradient(160deg,#ff9a9e,#a18cd1 55%,#5ba7ff);
  display: flex; gap: 12px; align-items: flex-end; justify-content: center; padding: 16px 16px 22px;
}
.lc-apple span { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.9); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.lc-apple span:nth-child(2){ transform: translateY(-8px);} .lc-apple span:nth-child(4){ transform: translateY(-8px);}
.lc-apple::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 8px; height: 30px; border-radius: 16px; background: rgba(255,255,255,.32); backdrop-filter: blur(8px); }
.lc-name { font-size: 17px; font-weight: 600; }
.lc-desc { font-size: 12.5px; color: #b9c6d8; margin-top: 4px; }
.launcher-hint { margin-top: 26px; color: #7f90a6; font-size: 12.5px; }
.launcher-hint kbd, .sh-grid kbd {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 4px;
  padding: 1px 6px; font-family: var(--font); font-size: 11px;
}

/* ---------- Shortcuts help ---------- */
.shortcuts-help {
  position: fixed; inset: 0; z-index: 8200; background: rgba(0,0,0,.45);
  display: grid; place-items: center; padding: 24px;
}
.sh-box {
  width: min(640px, 100%); max-height: 80vh; overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-win); padding: 20px 22px;
}
.sh-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.sh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
@media (max-width: 560px) { .sh-grid { grid-template-columns: 1fr; } }
.sh-grid .sh-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sh-grid .sh-row span { font-size: 12.5px; color: var(--text-2); }
.sh-grid .sh-row kbd { color: var(--text); white-space: nowrap; }

/* ---------- Connect / offline (server) screen ---------- */
.connect {
  position: fixed; inset: 0; z-index: 9800; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 800px at 30% 20%, #12385c 0%, #0b1a2b 55%, #05080d 100%);
  color: #fff; overflow-y: auto;
}
.connect-inner { width: min(560px, 100%); text-align: center; }
.connect-logo { display: grid; place-items: center; margin-bottom: 14px; filter: drop-shadow(0 10px 24px rgba(0,120,212,.5)); }
.connect h1 { font-size: 28px; font-weight: 300; letter-spacing: .5px; }
.connect-status { margin: 8px 0 20px; color: #9fb6d0; font-size: 13.5px; }
.connect-status.ok { color: #66d98a; }
.connect-status.bad { color: #ff8d7a; }
.connect-card {
  text-align: left; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 18px; backdrop-filter: blur(20px); box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.cc-field { display: block; margin-bottom: 12px; }
.cc-field > span { display: block; font-size: 12.5px; color: #cfe0f2; margin-bottom: 6px; }
.cc-field > span small { color: #7f97b0; font-weight: 400; }
.cc-field .field { background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.18); color: #fff; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cc-hint { margin-top: 10px; font-size: 12px; color: #86a0bb; min-height: 16px; }
.connect-foot { margin-top: 18px; font-size: 12px; color: #6d8299; }

/* offline banner + app guard */
#offlineBar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--taskbar-h) + 10px);
  z-index: 7000; display: flex; align-items: center; gap: 10px;
  background: rgba(120, 60, 20, .92); border: 1px solid rgba(255, 170, 90, .4);
  color: #ffe6cc; font-size: 12px; padding: 7px 12px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
#offlineBar button { color: #fff; background: rgba(255,255,255,.18); border: 0; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; }
#offlineBar button:hover { background: rgba(255,255,255,.3); }
.offline-panel { display: grid; place-items: center; height: 100%; text-align: center; padding: 30px; gap: 12px; color: var(--text-2); }
.offline-panel .op-ic { font-size: 40px; opacity: .6; }
.offline-panel h3 { color: var(--text); font-weight: 600; font-size: 15px; }
.offline-panel p { font-size: 12.5px; max-width: 320px; line-height: 1.5; }
.cl-cloud { display: flex; flex-direction: column; gap: 16px; padding: 18px; overflow-y: auto; height: 100%; }
.cl-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.cl-card h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.cl-card .cl-sub { color: var(--text-3); font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
.cl-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.cl-row .grow { flex: 1; min-width: 180px; }
.cl-row label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.cl-status { font-size: 12px; display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.cl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.cl-dot.on { background: #3ecf6a; box-shadow: 0 0 8px #3ecf6a; }
.cl-dot.off { background: #d9534f; }
.cl-url { font-family: var(--font-mono); font-size: 12px; color: var(--accent-2); word-break: break-all; cursor: pointer; }
