/* NEXUS Desktop Mode — Chrome OS skin. All rules scoped under #nxos. */

#nxos {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  overflow: hidden;
  font-family: 'Google Sans', 'Roboto', -apple-system, 'Segoe UI', sans-serif;
  color: #202124;
  --nxos-shelf-h: 64px;
  --nxos-blue: #8ab4f8;
  --nxos-action: #1a73e8;
  --nxos-glass: rgba(32, 33, 36, 0.72);
}
#nxos.nxos-open { display: block; }

@keyframes nxos-win-in { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes nxos-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nxos-pop { from { opacity: 0; transform: scale(0.96) translateY(10px); } to { opacity: 1; transform: none; } }

/* ── wallpaper ── */
#nxos .nxos-wallpaper {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

/* ── windows layer ── */
#nxos .nxos-windows {
  position: absolute;
  left: 0; right: 0; top: 0;
  bottom: var(--nxos-shelf-h);
  z-index: 1;
}

/* ── window ── */
#nxos .nxos-win {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.42), 0 4px 12px rgba(0,0,0,0.24);
  overflow: hidden;
  animation: nxos-win-in 0.18s cubic-bezier(0.2, 0, 0, 1);
}
#nxos .nxos-win.nxos-min { display: none; }
#nxos .nxos-win.nxos-max {
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: 100% !important;
  border-radius: 0;
}
#nxos .nxos-titlebar {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 6px 0 16px;
  background: #fff;
  border-bottom: 1px solid #ededf0;
  cursor: move;
  user-select: none;
}
#nxos .nxos-titlebar .nxos-win-icon {
  width: 18px; height: 18px; margin-right: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #5f6368;
}
#nxos .nxos-titlebar .nxos-win-icon svg { width: 18px; height: 18px; }
#nxos .nxos-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #3c4043;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#nxos .nxos-caption { display: flex; align-items: center; gap: 2px; }
#nxos .nxos-caption button {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #5f6368;
  transition: background 0.12s, color 0.12s;
}
#nxos .nxos-caption button svg { width: 15px; height: 15px; }
#nxos .nxos-caption button:hover { background: rgba(60,64,67,0.10); }
#nxos .nxos-caption button.nxos-close:hover { background: #e81123; color: #fff; }
#nxos .nxos-win-content {
  flex: 1;
  position: relative;
  overflow: auto;
  background: #fff;
  color: #202124;
}
#nxos .nxos-win-content iframe { width: 100%; height: 100%; border: none; display: block; }
#nxos .nxos-resize {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  z-index: 5;
}

/* ── shelf ── */
#nxos .nxos-shelf {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--nxos-shelf-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--nxos-glass);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 2;
}
#nxos .nxos-launcher-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #1f1f1f;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.12s, box-shadow 0.12s;
}
#nxos .nxos-launcher-btn:hover { transform: scale(1.06); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
#nxos .nxos-launcher-btn svg { width: 16px; height: 16px; }
#nxos .nxos-shelf-apps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}
#nxos .nxos-shelf-app {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: none;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #e8eaed;
  transition: background 0.14s, transform 0.14s;
}
#nxos .nxos-shelf-app:hover { background: rgba(255,255,255,0.20); transform: translateY(-2px); }
#nxos .nxos-shelf-app svg { width: 24px; height: 24px; }
#nxos .nxos-shelf-app img { width: 24px; height: 24px; border-radius: 5px; }
#nxos .nxos-shelf-app.nxos-running::after {
  content: "";
  position: absolute;
  bottom: -7px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 3px; border-radius: 3px;
  background: var(--nxos-blue);
}
#nxos .nxos-tray {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 9999px;
  color: #e8eaed;
  cursor: default;
  transition: background 0.14s;
}
#nxos .nxos-tray:hover { background: rgba(255,255,255,0.12); }
#nxos .nxos-tray svg { width: 16px; height: 16px; opacity: 0.92; }
#nxos .nxos-clock { font-size: 13px; font-weight: 500; letter-spacing: 0.2px; }
#nxos .nxos-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--nxos-blue); color: #202124;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ── launcher (floating bubble) ── */
#nxos .nxos-launcher {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
}
#nxos .nxos-launcher.nxos-open { display: flex; animation: nxos-fade 0.14s ease; }
#nxos .nxos-launcher-panel {
  width: min(700px, 88%);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 30px 34px;
  background: rgba(36, 37, 41, 0.86);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.55);
  margin-bottom: calc(var(--nxos-shelf-h) - 10px);
  animation: nxos-pop 0.2s cubic-bezier(0.2, 0, 0, 1);
}
#nxos .nxos-launcher-search {
  width: 100%;
  padding: 13px 22px;
  border-radius: 9999px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 15px;
  outline: none;
  margin-bottom: 30px;
}
#nxos .nxos-launcher-search:focus { background: rgba(255,255,255,0.18); }
#nxos .nxos-launcher-search::placeholder { color: rgba(255,255,255,0.55); }
#nxos .nxos-app-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 22px 16px;
  width: 100%;
  justify-content: center;
  overflow-y: auto;
  padding: 4px;
}
#nxos .nxos-app-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 9px;
  background: none; border: none; cursor: pointer;
  color: #e8eaed;
}
#nxos .nxos-app-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  display: flex; align-items: center; justify-content: center;
  color: #e8eaed;
  transition: background 0.14s, transform 0.14s;
}
#nxos .nxos-app-tile:hover .nxos-app-icon { background: rgba(255,255,255,0.22); transform: scale(1.06); }
#nxos .nxos-app-icon svg { width: 28px; height: 28px; }
#nxos .nxos-app-icon img { width: 32px; height: 32px; border-radius: 7px; }
#nxos .nxos-app-label {
  font-size: 12.5px; text-align: center; max-width: 90px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── generic content helpers (light app panes) ── */
#nxos .nxos-pad { padding: 18px; }
#nxos .nxos-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid #ededf0;
  background: #fff;
}
#nxos .nxos-toolbar button {
  border: none; background: transparent; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #5f6368;
  transition: background 0.12s;
}
#nxos .nxos-toolbar button:hover { background: rgba(60,64,67,0.10); }
#nxos .nxos-toolbar button svg { width: 18px; height: 18px; }
#nxos .nxos-url {
  flex: 1;
  padding: 9px 16px;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: #f1f3f4;
  font-size: 13px;
  outline: none;
  color: #202124;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
#nxos .nxos-url:focus { background: #fff; border-color: #e0e0e0; box-shadow: 0 1px 6px rgba(60,64,67,0.18); }
#nxos .nxos-go {
  border: none; background: var(--nxos-action); color: #fff;
  padding: 9px 18px; border-radius: 9999px; font-size: 13px;
  cursor: pointer; font-weight: 500;
  transition: background 0.12s;
}
#nxos .nxos-go:hover { background: #1765cc; }
#nxos .nxos-search-input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid #e0e0e0; border-radius: 9999px;
  font-size: 13px; outline: none; margin-bottom: 16px; color: #202124;
  background: #f8f9fa;
  transition: background 0.12s, box-shadow 0.12s;
}
#nxos .nxos-search-input:focus { background: #fff; box-shadow: 0 1px 6px rgba(60,64,67,0.18); }
#nxos .nxos-loading { padding: 26px; color: #5f6368; font-size: 13px; }

/* tiles grid for games / shortcuts inside a window */
#nxos .nxos-tilegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 14px;
}
#nxos .nxos-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  height: 104px;
  border: 1px solid #ececf0; border-radius: 16px;
  background: #fff; cursor: pointer;
  padding: 10px; text-align: center;
  font-size: 12.5px; color: #3c4043;
  transition: box-shadow 0.14s, transform 0.14s, border-color 0.14s;
}
#nxos .nxos-tile:hover { border-color: transparent; box-shadow: 0 6px 18px rgba(60,64,67,0.16); transform: translateY(-2px); }
#nxos .nxos-tile img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; }
#nxos .nxos-tile-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* poster grid (movies / tv) */
#nxos .nxos-posters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 16px;
}
#nxos .nxos-poster { cursor: pointer; transition: transform 0.14s; }
#nxos .nxos-poster:hover { transform: translateY(-3px); }
#nxos .nxos-poster img { width: 100%; border-radius: 12px; display: block; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
#nxos .nxos-poster-noimg {
  width: 100%; aspect-ratio: 2/3; border-radius: 12px;
  background: #e8eaed; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #5f6368; padding: 8px; text-align: center;
}
#nxos .nxos-poster-title { font-size: 12px; margin-top: 6px; color: #3c4043; }
#nxos .nxos-seg {
  display: inline-flex; background: #f1f3f4; border-radius: 9999px; overflow: hidden; margin-right: 10px; padding: 2px;
}
#nxos .nxos-seg button {
  border: none; background: transparent; color: #3c4043; padding: 6px 18px; cursor: pointer; font-size: 13px; border-radius: 9999px;
  transition: background 0.12s, color 0.12s;
}
#nxos .nxos-seg button.nxos-active { background: var(--nxos-action); color: #fff; }
#nxos select.nxos-select {
  padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 9999px; font-size: 13px; color: #202124; background: #fff;
}

/* ── AI chat ── */
#nxos .nxos-ai { display: flex; flex-direction: column; height: 100%; }
#nxos .nxos-ai-bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid #ededf0; }
#nxos .nxos-ai-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
#nxos .nxos-ai-msg { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
#nxos .nxos-ai-msg.user { align-self: flex-end; background: var(--nxos-action); color: #fff; border-bottom-right-radius: 5px; }
#nxos .nxos-ai-msg.assistant { align-self: flex-start; background: #f1f3f4; color: #202124; border-bottom-left-radius: 5px; }
#nxos .nxos-ai-msg.error { align-self: center; background: #fce8e6; color: #c5221f; }
#nxos .nxos-ai-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #ededf0; }
#nxos .nxos-ai-input { flex: 1; padding: 10px 14px; border: 1px solid #e0e0e0; border-radius: 9999px; font-size: 13px; outline: none; color: #202124; background: #f8f9fa; }
#nxos .nxos-ai-input:focus { background: #fff; }

/* ── buttons used across panes ── */
#nxos .nxos-btn {
  border: none; background: var(--nxos-action); color: #fff;
  padding: 9px 20px; border-radius: 9999px; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: background 0.12s, box-shadow 0.12s;
}
#nxos .nxos-btn:hover { background: #1765cc; box-shadow: 0 2px 8px rgba(26,115,232,0.35); }
#nxos .nxos-btn.secondary { background: #f1f3f4; color: #3c4043; }
#nxos .nxos-btn.secondary:hover { background: #e8eaed; box-shadow: none; }

/* ── Settings app (dark Chrome OS settings look) ── */
#nxos .nxos-settings-win .nxos-win-content { background: #202124; color: #e8eaed; }
#nxos .nxos-settings-win .nxos-titlebar { background: #292a2d; border-bottom-color: #3c4043; }
#nxos .nxos-settings-win .nxos-title { color: #e8eaed; }
#nxos .nxos-settings-win .nxos-win-icon { color: #9aa0a6; }
#nxos .nxos-settings-win .nxos-caption button { color: #9aa0a6; }
#nxos .nxos-settings-win .nxos-caption button:hover { background: rgba(255,255,255,0.10); }
#nxos .nxos-settings { display: flex; height: 100%; }
#nxos .nxos-settings-nav {
  width: 220px; flex-shrink: 0;
  background: #202124;
  border-right: 1px solid #3c4043;
  padding: 14px 0;
  overflow-y: auto;
}
#nxos .nxos-settings-nav button {
  display: block; width: calc(100% - 10px);
  text-align: left;
  border: none; background: transparent; color: #e8eaed;
  padding: 11px 22px; font-size: 13px; cursor: pointer;
  border-radius: 0 9999px 9999px 0;
  transition: background 0.12s, color 0.12s;
}
#nxos .nxos-settings-nav button:hover { background: #292a2d; }
#nxos .nxos-settings-nav button.nxos-active { background: #303134; color: var(--nxos-blue); }
#nxos .nxos-settings-pane { flex: 1; overflow-y: auto; padding: 22px 30px; }
#nxos .nxos-settings-card {
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
#nxos .nxos-settings-card h2 { font-size: 14px; color: #e8eaed; margin: 0 0 4px; font-weight: 600; }
#nxos .nxos-settings-card p.nxos-sub { font-size: 12px; color: #9aa0a6; margin: 0 0 14px; }
#nxos .nxos-wall-grid { display: flex; gap: 12px; flex-wrap: wrap; }
#nxos .nxos-wall-swatch {
  width: 92px; height: 56px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; background-size: cover; background-position: center;
  transition: transform 0.12s;
}
#nxos .nxos-wall-swatch:hover { transform: scale(1.04); }
#nxos .nxos-wall-swatch.nxos-active { border-color: var(--nxos-blue); box-shadow: 0 0 0 2px rgba(138,180,248,0.35); }
#nxos .nxos-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#nxos .nxos-settings-row .nxos-row-label { font-size: 13px; color: #e8eaed; }

/* reparented NEXUS settings groups keep their dark theme; normalize as rounded cards */
#nxos .nxos-settings-host { display: block; }
#nxos .nxos-settings-host .settings-group {
  background: #292a2d;
  border: 1px solid #3c4043;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

/* desktop-mode toggle group injected into the normal settings panel */
.os-mode-group .settings-row { display: flex; align-items: center; justify-content: space-between; }

/* ── dark titlebars for dev tools (Terminal / Code Editor) ── */
#nxos .nxos-term-win .nxos-titlebar,
#nxos .nxos-code-win .nxos-titlebar { background: #323233; border-bottom-color: #252526; }
#nxos .nxos-term-win .nxos-title,
#nxos .nxos-code-win .nxos-title { color: #e8eaed; }
#nxos .nxos-term-win .nxos-win-icon,
#nxos .nxos-code-win .nxos-win-icon { color: #9aa0a6; }
#nxos .nxos-term-win .nxos-caption button,
#nxos .nxos-code-win .nxos-caption button { color: #9aa0a6; }
#nxos .nxos-term-win .nxos-caption button:hover,
#nxos .nxos-code-win .nxos-caption button:hover { background: rgba(255,255,255,0.10); }
#nxos .nxos-term-win .nxos-win-content,
#nxos .nxos-code-win .nxos-win-content { background: #1e1e1e; }

/* ── output text colours (shared by Terminal + Editor) ── */
#nxos .nxos-out-cmd { color: #9cdcfe; }
#nxos .nxos-out-error { color: #f48771; }
#nxos .nxos-out-info { color: #808080; }
#nxos .nxos-out-result { color: #b5cea8; }
#nxos .nxos-out-warn { color: #dcdcaa; }
#nxos .nxos-out-log { color: #d4d4d4; }

/* ── Terminal ── */
#nxos .nxos-term {
  display: flex; flex-direction: column; height: 100%;
  background: #1e1e1e; color: #d4d4d4;
  font-family: 'Roboto Mono', Menlo, Consolas, 'Courier New', monospace; font-size: 13px;
}
#nxos .nxos-term-output { flex: 1; overflow-y: auto; padding: 12px 14px; white-space: pre-wrap; line-height: 1.5; }
#nxos .nxos-term-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid #2a2a2a; }
#nxos .nxos-term-prompt { color: #4ec9b0; flex-shrink: 0; }
#nxos .nxos-term-input { flex: 1; background: transparent; border: none; outline: none; color: #d4d4d4; font-family: inherit; font-size: 13px; }

/* ── Code Editor ── */
#nxos .nxos-code { display: flex; height: 100%; background: #1e1e1e; color: #d4d4d4; font-size: 13px; }
#nxos .nxos-code-side { width: 184px; flex-shrink: 0; background: #252526; border-right: 1px solid #1a1a1a; display: flex; flex-direction: column; }
#nxos .nxos-code-side-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; font-size: 11px; letter-spacing: 1px; color: #bbb; }
#nxos .nxos-code-new { border: none; background: transparent; color: #bbb; font-size: 18px; line-height: 1; cursor: pointer; border-radius: 6px; width: 24px; height: 24px; }
#nxos .nxos-code-new:hover { background: rgba(255,255,255,0.10); }
#nxos .nxos-code-files { flex: 1; overflow-y: auto; padding-bottom: 8px; }
#nxos .nxos-code-file { padding: 6px 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #cfcfcf; }
#nxos .nxos-code-file:hover { background: #2a2d2e; }
#nxos .nxos-code-file.nxos-active { background: #37373d; color: #fff; }
#nxos .nxos-code-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#nxos .nxos-code-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #2d2d2d; border-bottom: 1px solid #1a1a1a; }
#nxos .nxos-code-fname { color: #fff; font-size: 13px; }
#nxos .nxos-code-lang { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
#nxos .nxos-code-bar .nxos-btn { padding: 7px 18px; }
#nxos .nxos-code-edit { flex: 1; min-height: 0; overflow: hidden; }
#nxos .nxos-code-edit .CodeMirror { height: 100%; font-family: 'Roboto Mono', Menlo, Consolas, monospace; font-size: 13px; }
#nxos .nxos-code-textarea { width: 100%; height: 100%; border: none; outline: none; resize: none; background: #1e1e1e; color: #d4d4d4; font-family: Menlo, Consolas, monospace; font-size: 13px; padding: 10px 12px; }
#nxos .nxos-code-panel { height: 34%; border-top: 1px solid #1a1a1a; display: flex; flex-direction: column; background: #1e1e1e; }
#nxos .nxos-code-panel-head { padding: 7px 12px; font-size: 11px; letter-spacing: 1px; color: #bbb; border-bottom: 1px solid #2a2a2a; }
#nxos .nxos-code-output { flex: 1; overflow-y: auto; padding: 10px 12px; white-space: pre-wrap; font-family: Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
#nxos .nxos-code-preview { flex: 1; border: none; width: 100%; background: #fff; }

/* while dragging/resizing, stop iframes from swallowing pointer events */
#nxos.nxos-dragging { user-select: none; }
#nxos.nxos-dragging iframe { pointer-events: none; }
