/* YuZora OS — Windows 11 style, YuZora theme, smooth + mobile */
:root {
  --yz-bg: #020617;
  --yz-surface: #0b1220;
  --yz-surface-2: #111827;
  --yz-elevated: #151c2c;
  --yz-border: rgba(148,163,184,0.14);
  --yz-accent: #00a5ef;
  --yz-cyan: #22d3ee;
  --yz-text: #f1f5f9;
  --yz-muted: #94a3b8;
  --yz-taskbar-h: 48px;
  --yz-radius: 10px;
  --yz-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --yz-display: "Space Grotesk", Inter, "Segoe UI", sans-serif;
  --yz-touch: 44px;
}

html.yuzora-os, html.yuzora-os body { height: 100%; }
body.yuzora-os {
  margin: 0;
  font-family: var(--yz-font);
  color: var(--yz-text);
  background: var(--yz-bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.yuzora-os.os-lock { overflow: auto; }

/* Soft static desktop (no animation, no blur) */
.os-wallpaper {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(90% 55% at 12% -5%, rgba(0,165,239,0.16), transparent 55%),
    radial-gradient(70% 45% at 100% 0%, rgba(98,95,255,0.12), transparent 50%),
    var(--yz-bg);
}

/* ===== Windows-style taskbar ===== */
.os-taskbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--yz-taskbar-h);
  z-index: 100;
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px;
  background: #0a101c;
  border-top: 1px solid var(--yz-border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
}
.os-taskbar .tb-center {
  flex: 1; display: flex; justify-content: center; align-items: center;
  gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.os-taskbar .tb-center::-webkit-scrollbar { display: none; }
.os-taskbar .tb-end {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

.tb-btn, .tb-app {
  appearance: none; border: 0; background: transparent;
  color: var(--yz-text); cursor: pointer; font: inherit;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px;
  border-radius: 8px;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tb-btn:hover, .tb-app:hover, .tb-btn:focus-visible, .tb-app:focus-visible {
  background: rgba(255,255,255,0.08);
}
.tb-btn:active, .tb-app:active { background: rgba(255,255,255,0.12); }
.tb-app.active {
  background: rgba(0,165,239,0.16);
  box-shadow: inset 0 -2px 0 var(--yz-cyan);
}
.tb-app .ico {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  background: #152033; border: 1px solid var(--yz-border);
  font-size: 0.85rem;
}
.tb-start .ico {
  background: linear-gradient(135deg, #00a5ef, #625fff);
  border: 0; color: #fff; font-weight: 700;
}
.tb-clock {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--yz-muted);
  text-align: right;
  line-height: 1.15;
  padding: 4px 8px;
  border-radius: 8px;
  min-width: 64px;
}
.tb-clock:hover { background: rgba(255,255,255,0.06); color: var(--yz-text); }

/* Start / app launcher flyout */
.os-start {
  position: fixed;
  left: 50%; bottom: calc(var(--yz-taskbar-h) + 10px);
  transform: translateX(-50%) translateY(8px);
  width: min(420px, calc(100vw - 16px));
  max-height: min(70vh, 520px);
  z-index: 120;
  background: var(--yz-surface);
  border: 1px solid var(--yz-border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
  padding: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.os-start.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.os-start h2 {
  margin: 0 0 10px; font-family: var(--yz-display);
  font-size: 0.95rem; font-weight: 600;
}
.os-start-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.os-start-grid a, .os-start-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 10px;
  text-decoration: none; color: var(--yz-text);
  background: transparent; border: 0; cursor: pointer; font: inherit;
  min-height: var(--yz-touch);
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.os-start-grid a:hover, .os-start-grid button:hover,
.os-start-grid a:active, .os-start-grid button:active {
  background: rgba(0,165,239,0.12);
}
.os-start-grid .ico {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: #152033; border: 1px solid var(--yz-border);
  font-size: 1.1rem;
}
.os-start-grid .lbl { font-size: 0.72rem; color: var(--yz-muted); text-align: center; }
.os-start-backdrop {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
}
.os-start-backdrop.open { opacity: 1; pointer-events: auto; }

/* Desktop + window (Win11 acrylic-ish solid, no blur) */
.os-desktop {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: var(--yz-taskbar-h);
  z-index: 1;
  padding: 12px;
  display: flex; justify-content: center;
}
.os-window {
  width: min(1200px, 100%);
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--yz-surface);
  border: 1px solid var(--yz-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  overflow: hidden;
}
.os-titlebar {
  flex-shrink: 0; height: 36px;
  display: flex; align-items: center;
  padding: 0 4px 0 12px;
  background: var(--yz-surface-2);
  border-bottom: 1px solid var(--yz-border);
  gap: 8px;
}
.os-titlebar h1 {
  margin: 0; flex: 1;
  font-family: var(--yz-display);
  font-size: 0.85rem; font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.os-win-controls { display: flex; margin-left: auto; }
.os-win-controls button {
  width: 46px; height: 36px; border: 0; background: transparent;
  color: var(--yz-muted); cursor: pointer; font-size: 0.75rem;
  -webkit-tap-highlight-color: transparent;
}
.os-win-controls button:hover { background: rgba(255,255,255,0.08); color: var(--yz-text); }
.os-win-controls .close:hover { background: #e81123; color: #fff; }

.os-window-body {
  flex: 1; min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 18px 24px;
  transform: translateZ(0);
}

/* Hide legacy chrome */
body.yuzora-os .layout > .sidebar,
body.yuzora-os .layout > .sidebar-backdrop,
body.yuzora-os .main > .topbar { display: none !important; }
body.yuzora-os .layout, body.yuzora-os .main { background: transparent; min-height: 0; }

/* Lock screen */
.os-lock-screen {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
}
.os-lock-clock {
  font-family: var(--yz-display);
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  font-weight: 600; letter-spacing: -0.03em; margin: 0 0 4px;
}
.os-lock-date { color: var(--yz-muted); margin: 0 0 28px; }
.os-lock-card {
  width: min(380px, 100%);
  background: var(--yz-surface);
  border: 1px solid var(--yz-border);
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* AI chat panel (slide-over) */
.os-ai-panel {
  position: fixed; top: 0; right: 0; bottom: var(--yz-taskbar-h);
  width: min(400px, 100vw);
  z-index: 130;
  background: var(--yz-surface);
  border-left: 1px solid var(--yz-border);
  display: flex; flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.2s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.35);
}
.os-ai-panel.open { transform: translateX(0); }
.os-ai-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--yz-border);
  background: var(--yz-surface-2);
}
.os-ai-head h2 { margin: 0; flex: 1; font-size: 0.95rem; font-family: var(--yz-display); }
.os-ai-modelbar {
  display: flex; align-items: center; gap: 7px; padding: 8px 10px;
  border-bottom: 1px solid var(--yz-border); background: rgba(0,0,0,0.12);
}
.os-ai-modelbar label { font-size: 0.72rem; color: var(--yz-muted); white-space: nowrap; }
.os-ai-modelbar select {
  flex: 1; min-width: 0; height: 36px; border-radius: 8px;
  background: #0a101c; border: 1px solid var(--yz-border); color: var(--yz-text);
  padding: 0 8px; font: inherit; font-size: 0.75rem;
}
.os-ai-modelbar button { min-width: 36px; min-height: 36px; padding: 0 8px; }
.os-ai-head button {
  border: 0; background: transparent; color: var(--yz-muted);
  min-width: 40px; min-height: 40px; border-radius: 8px; cursor: pointer;
}
.os-ai-head button:hover { background: rgba(255,255,255,0.08); color: var(--yz-text); }
.os-ai-msgs {
  flex: 1; overflow: auto; padding: 12px;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px;
}
.os-ai-msg {
  max-width: 92%; padding: 10px 12px; border-radius: 12px;
  font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.os-ai-msg.user {
  align-self: flex-end;
  background: rgba(0,165,239,0.2);
  border: 1px solid rgba(0,165,239,0.3);
}
.os-ai-msg.bot {
  align-self: flex-start;
  background: var(--yz-elevated);
  border: 1px solid var(--yz-border);
}
.os-ai-msg.os-ai-final { border-left: 3px solid rgba(0,165,239,0.65); }
.os-ai-task { min-height: 1.2em; }
.os-ai-msg.err { border-color: rgba(255,35,87,0.4); color: #fecdd3; }
.os-ai-input {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid var(--yz-border);
  background: var(--yz-surface-2);
}
.os-ai-input textarea {
  flex: 1; min-height: 44px; max-height: 120px;
  resize: none; border-radius: 10px; padding: 10px 12px;
  background: #0a101c; border: 1px solid var(--yz-border); color: var(--yz-text);
  font: inherit;
}
.os-ai-input button {
  min-width: 48px; min-height: 44px; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #00a5ef, #625fff);
  color: #fff; font-weight: 600; cursor: pointer;
}
.os-ai-input button:disabled { opacity: 0.5; cursor: wait; }

/* Cards without glass */
body.yuzora-os .card {
  background: #121a2a !important;
  border: 1px solid var(--yz-border) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
body.yuzora-os .stat {
  background: #0f1623 !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

/* Mobile: full-bleed window, larger taskbar targets */
@media (max-width: 720px) {
  :root { --yz-taskbar-h: 56px; }
  .os-desktop { padding: 0; }
  .os-window {
    width: 100%; border-radius: 0; border-left: 0; border-right: 0; border-top: 0;
  }
  .os-titlebar { height: 40px; }
  .os-window-body { padding: 12px 12px 20px; }
  .tb-app .lbl-m { display: none; }
  .os-start {
    left: 8px; right: 8px; width: auto; transform: none;
    bottom: calc(var(--yz-taskbar-h) + 8px);
  }
  .os-start.open { transform: none; }
  .os-start-grid { grid-template-columns: repeat(3, 1fr); }
  .os-ai-panel { width: 100vw; }
  .os-taskbar .tb-center { justify-content: flex-start; }
}

@media (min-width: 721px) {
  .os-start { left: 50%; }
}

.os-ai-status{
  margin:0; padding:8px 12px;
  font-size:0.72rem; line-height:1.35; color:#94a3b8;
  border-bottom:1px solid rgba(148,163,184,0.14);
  white-space:pre-wrap; background:#0a101c;
}

/* Modern AI composer / reasoning controls */
.os-ai-controls{position:relative;display:flex;align-items:center;gap:7px;padding:6px 10px;border-bottom:1px solid var(--yz-border);background:rgba(0,0,0,.10);min-height:40px}
.os-ai-control-pill{border:1px solid var(--yz-border);background:#0a101c;color:var(--yz-text);border-radius:999px;padding:6px 12px;font:inherit;font-size:.74rem;cursor:pointer}
.os-ai-control-pill.active{border-color:rgba(0,165,239,.45);background:rgba(0,165,239,.12)}
.os-ai-reason-menu{position:absolute;left:10px;top:38px;z-index:20;display:flex;flex-direction:column;min-width:145px;background:#0b1220;border:1px solid var(--yz-border);border-radius:10px;padding:5px;box-shadow:0 10px 30px rgba(0,0,0,.4)}
.os-ai-reason-menu[hidden],.os-ai-tools-menu[hidden]{display:none}
.os-ai-reason-menu button,.os-ai-tools-menu button{border:0;background:transparent;color:var(--yz-text);text-align:left;padding:8px 10px;border-radius:7px;cursor:pointer;font:inherit;font-size:.76rem}
.os-ai-reason-menu button:hover,.os-ai-tools-menu button:hover{background:rgba(0,165,239,.12)}
.os-ai-capability{font-size:.68rem;color:var(--yz-muted);white-space:nowrap}
.os-ai-live{margin-left:auto;font-size:.68rem;color:#67e8f9;animation:yz-ai-pulse 1.2s ease-in-out infinite}
@keyframes yz-ai-pulse{50%{opacity:.35}}
.os-ai-plus,.os-ai-stop{width:42px;min-width:42px!important;min-height:44px;border:1px solid var(--yz-border)!important;border-radius:10px!important;background:#0a101c!important;color:var(--yz-text)!important;font-size:1.1rem!important}
.os-ai-stop{color:#fecdd3!important}
.os-ai-tools-menu{position:absolute;right:10px;bottom:72px;z-index:25;display:flex;flex-direction:column;gap:3px;min-width:230px;background:#0b1220;border:1px solid var(--yz-border);border-radius:12px;padding:6px;box-shadow:0 10px 30px rgba(0,0,0,.45)}
.os-ai-tools-menu span{padding:8px 10px;font-size:.66rem;color:var(--yz-muted);line-height:1.35}
.os-ai-inline-action{margin-left:8px;border:1px solid var(--yz-border);background:rgba(255,255,255,.05);color:var(--yz-text);border-radius:7px;padding:3px 8px;font-size:.68rem;cursor:pointer}

.os-ai-task-meta{display:block;margin-top:6px;font-size:.68rem;color:var(--yz-muted);}
