/* Z.ai OS — base design tokens, fonts, reset.
   Brand: minimalist monochrome surfaces + Z.ai blue accent, Geist typography. */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Z.ai brand colors */
  --z-blue: #1F63EC;
  --z-blue-2: #126EF6;
  --z-blue-deep: #183ce5;
  --z-ink: #0d0d0d;
  --z-paper: #f4f6f8;
  --arch-blue: #1793D1;

  --accent: var(--z-blue);
  --accent-2: var(--z-blue-2);
  --accent-soft: rgba(31, 99, 236, .16);
  --accent-glow: rgba(31, 99, 236, .45);

  --danger: #d92d20;
  --success: #34a853;
  --warning: #f59e0b;
  --pkg: #f5c211; /* pacman yellow */

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --radius-xl: 22px;

  --panel-h: 46px;
  --shadow-w: 0 18px 50px rgba(0,0,0,.55), 0 2px 10px rgba(0,0,0,.4);
  --shadow-p: 0 10px 32px rgba(0,0,0,.45);
  --ease: cubic-bezier(.22,.8,.24,1);
}

html[data-accent="blue"]    { --accent:#1F63EC; --accent-2:#126EF6; --accent-soft:rgba(31,99,236,.16); --accent-glow:rgba(31,99,236,.45); }
html[data-accent="violet"]  { --accent:#7C5CFC; --accent-2:#9d7bff; --accent-soft:rgba(124,92,252,.16); --accent-glow:rgba(124,92,252,.45); }
html[data-accent="green"]   { --accent:#1FA46B; --accent-2:#2ec283; --accent-soft:rgba(31,164,107,.16); --accent-glow:rgba(31,164,107,.45); }
html[data-accent="amber"]   { --accent:#D9900B; --accent-2:#f5b73a; --accent-soft:rgba(217,144,11,.16); --accent-glow:rgba(217,144,11,.45); }
html[data-accent="rose"]    { --accent:#E44C72; --accent-2:#fb7098; --accent-soft:rgba(228,76,114,.16); --accent-glow:rgba(228,76,114,.45); }

/* Dark theme (default) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --bg-1: #131313;
  --bg-2: #171717;
  --bg-3: #1f1f1f;
  --bg-4: #262626;
  --surface: rgba(23, 23, 23, .82);
  --surface-solid: #171717;
  --glass: rgba(19, 19, 19, .66);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-2: rgba(255, 255, 255, .14);
  --text: #ececec;
  --text-1: #f9f9f9;
  --text-2: #a6a6a6;
  --text-3: #82878d;
  --hover: rgba(255, 255, 255, .06);
  --active: rgba(255, 255, 255, .1);
  --term-bg: #0a0a0c;
  --scroll-thumb: rgba(255,255,255,.16);
}
/* Light theme */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-1: #eef1f4;
  --bg-2: #ffffff;
  --bg-3: #f7f8fa;
  --bg-4: #eaecef;
  --surface: rgba(255, 255, 255, .84);
  --surface-solid: #ffffff;
  --glass: rgba(244, 246, 248, .7);
  --stroke: rgba(13, 13, 13, .1);
  --stroke-2: rgba(13, 13, 13, .18);
  --text: #1a1c1f;
  --text-1: #0d0d0d;
  --text-2: #54585e;
  --text-3: #6f747c;
  --hover: rgba(13, 13, 13, .05);
  --active: rgba(13, 13, 13, .09);
  --term-bg: #10131a;
  --scroll-thumb: rgba(13,13,13,.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

/* Branded cursors (Z.ai blue accents) */
#desktop, .overlay, .power-screen {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M5 2.5v17l4.2-4.2 2.6 6 3-1.35-2.6-5.9h5.8z' fill='%231d1f24' stroke='%23ffffff' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M5 2.5v6l3.4 1.4z' fill='%231F63EC' stroke='none'/%3E%3C/svg%3E") 2 2, default;
}
.term, .zedit-input, .zedit-hl, input[type="text"], input[type="password"], textarea {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath d='M6 2h8M6 22h8M9.5 2c0 6-.5 10-3.5 13M9.5 2c0 6 .5 10 3.5 13' stroke='%231F63EC' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") 9 12, text;
}
body {
  font-family: var(--font-sans);
  background: #000;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  cursor: default;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; }
.hidden { display: none !important; }
::selection { background: var(--accent-soft); }

* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

#screen { position: fixed; inset: 0; overflow: hidden; background: #000; }

/* Generic overlay dim */
.overlay {
  position: absolute; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(3px);
  animation: fadein .16s var(--ease);
}
html[data-theme="light"] .overlay { background: rgba(20, 24, 30, .3); }

@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
@keyframes popin { from { opacity: 0; transform: translateY(8px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
@keyframes blink { 0%,49% { opacity: 1 } 50%,100% { opacity: 0 } }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ---- Buttons, fields, chrome ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 7px 14px; border-radius: var(--radius-s);
  background: var(--bg-3); border: 1px solid var(--stroke);
  color: var(--text-1); font-weight: 500; font-size: 13px;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); border-color: var(--stroke-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: transparent; border-color: rgba(217,45,32,.4); color: #ff6b5e; }
.btn.danger:hover { background: rgba(217,45,32,.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text-1); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.field {
  width: 100%; padding: 8px 12px; border-radius: var(--radius-s);
  background: var(--bg-2); border: 1px solid var(--stroke);
  color: var(--text-1); outline: none; font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field::placeholder { color: var(--text-3); }

.icon { width: 18px; height: 18px; flex: none; display: inline-grid; place-items: center; }
.icon svg { width: 100%; height: 100%; }

/* Scrollable app body helper */
.app-body { flex: 1; overflow: auto; user-select: text; }

/* Utility */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* Slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--bg-4) var(--fill, 50%));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* Switch */
.switch { position: relative; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch .knob {
  position: absolute; inset: 0; border-radius: 999px; background: var(--bg-4);
  border: 1px solid var(--stroke-2); transition: background .15s;
}
.switch .knob::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: transform .15s var(--ease);
}
.switch input:checked + .knob { background: var(--accent); border-color: transparent; }
.switch input:checked + .knob::after { transform: translateX(16px); }

.app-icon { display: inline-grid; place-items: center; flex: none; }
