:root {
  --ubuntu-aubergine: #2c001e;
  --ubuntu-orange: #e95420;
  --ubuntu-purple: #77216f;
  --bg: #1b1021;
  --bg2: #2d1232;
  --panel: rgba(28, 20, 34, .78);
  --panel-solid: #22172a;
  --glass: rgba(255, 255, 255, .12);
  --glass-strong: rgba(255,255,255,.20);
  --line: rgba(255, 255, 255, .18);
  --text: #fff7f1;
  --muted: #d8c9dc;
  --shadow: 0 24px 80px rgba(0,0,0,.45);
  --radius: 18px;
  --topbar: 34px;
  --dock: 76px;
  --dock-side: left;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { font-family: var(--font); color: var(--text); background: #100815; }
button, input, textarea, select { font: inherit; }
button { color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: rgba(233,84,32,.22); }
[hidden] { display: none !important; }

.boot-screen {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; gap: 18px;
  grid-template-columns: auto minmax(220px, 360px); padding: 24px;
  background: radial-gradient(circle at 30% 25%, #6f1d7a 0 18%, transparent 44%),
              radial-gradient(circle at 75% 70%, #e95420 0 12%, transparent 38%),
              linear-gradient(135deg, #21001a, #09020d 72%);
  transition: opacity .5s ease, transform .5s ease, visibility .5s ease;
}
.boot-screen.done { opacity: 0; visibility: hidden; transform: scale(1.03); pointer-events: none; }
.boot-logo { width: 86px; height: 86px; border-radius: 25px; display: grid; place-items: center; font-weight: 900; letter-spacing: -.07em; font-size: 34px; background: linear-gradient(135deg, var(--ubuntu-orange), #ffb089); color: #240014; box-shadow: 0 22px 70px rgba(233,84,32,.35); }
.boot-screen h1 { margin: 0 0 4px; font-size: clamp(28px, 7vw, 50px); }
.boot-screen p { margin: 0 0 16px; color: var(--muted); }
.boot-bar { display: block; height: 6px; border-radius: 99px; background: rgba(255,255,255,.13); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 45%; border-radius: inherit; background: var(--ubuntu-orange); animation: boot 1.4s ease-in-out infinite alternate; }
@keyframes boot { from { transform: translateX(-80%); } to { transform: translateX(150%); } }

.os-shell { height: 100%; position: relative; overflow: hidden; background:
  radial-gradient(circle at var(--wall-x, 73%) var(--wall-y, 24%), color-mix(in srgb, var(--ubuntu-orange) 65%, transparent) 0 10%, transparent 35%),
  radial-gradient(circle at 18% 78%, color-mix(in srgb, var(--ubuntu-purple) 85%, transparent) 0 16%, transparent 43%),
  linear-gradient(140deg, var(--bg), var(--bg2) 62%, #18091e);
}
.os-shell::before { content: ""; position: absolute; inset: var(--topbar) 0 0; pointer-events: none; opacity: .27; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(circle at 50% 55%, black, transparent 78%); }

.topbar { height: var(--topbar); position: fixed; inset: 0 0 auto; z-index: 400; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 0 10px; background: rgba(18, 12, 22, .78); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.activities, .clock, .status-pill { border: 0; background: transparent; height: 26px; border-radius: 999px; padding: 0 12px; cursor: pointer; }
.activities:hover, .clock:hover, .status-pill:hover { background: var(--glass); }
.active-title { justify-self: center; font-weight: 700; opacity: .92; }
.status-cluster { display: flex; gap: 2px; }
.status-pill { min-width: 30px; padding: 0 8px; font-weight: 800; }

.dock { position: fixed; z-index: 380; left: 10px; top: calc(var(--topbar) + 12px); bottom: 12px; width: 58px; display: flex; flex-direction: column; gap: 9px; align-items: center; padding: 10px 7px; border-radius: 22px; background: rgba(28, 20, 34, .58); border: 1px solid rgba(255,255,255,.13); backdrop-filter: blur(18px); box-shadow: 0 16px 50px rgba(0,0,0,.28); }
body.dock-bottom .dock { left: 50%; right: auto; top: auto; bottom: max(10px, env(safe-area-inset-bottom)); width: min(94vw, 680px); height: 62px; transform: translateX(-50%); flex-direction: row; justify-content: center; }
.dock-btn, .desktop-icon, .app-tile { border: 1px solid transparent; background: transparent; cursor: pointer; }
.dock-btn { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; position: relative; background: rgba(255,255,255,.08); }
.dock-btn:hover, .dock-btn.active { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.16); transform: translateY(-1px); }
.dock-btn .icon { font-weight: 900; font-size: 18px; }
.dock-btn::after { content: attr(data-label); position: absolute; left: 58px; top: 50%; transform: translateY(-50%); white-space: nowrap; background: #141019; border: 1px solid var(--line); padding: 6px 9px; border-radius: 9px; opacity: 0; pointer-events: none; transition: .18s ease; }
body.dock-bottom .dock-btn::after { left: 50%; top: -34px; transform: translateX(-50%); }
.dock-btn:hover::after { opacity: 1; }

.desktop { position: absolute; inset: var(--topbar) 0 0; padding: 34px 28px 34px calc(var(--dock) + 24px); }
body.dock-bottom .desktop { padding: 34px 22px 92px; }
.desktop-brand { position: absolute; right: clamp(20px, 5vw, 70px); bottom: clamp(82px, 12vh, 150px); text-align: right; opacity: .22; user-select: none; }
.desktop-brand span { display: block; font-size: clamp(20px, 3vw, 38px); letter-spacing: .45em; font-weight: 800; }
.desktop-brand strong { display: block; font-size: clamp(76px, 16vw, 210px); line-height: .8; letter-spacing: -.08em; }
.desktop-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 86px)); gap: 18px 12px; align-content: start; }
.desktop-icon { width: 86px; min-height: 86px; border-radius: 15px; color: var(--text); display: grid; place-items: center; padding: 8px; text-align: center; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.desktop-icon:hover, .desktop-icon:focus-visible { background: rgba(255,255,255,.11); outline: none; }
.os-icon { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 6px; background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.07)); border: 1px solid rgba(255,255,255,.18); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 12px 30px rgba(0,0,0,.28); font-size: 18px; font-weight: 900; }
.desktop-icon small { font-size: 12px; line-height: 1.1; }

.launcher-panel, .quick-panel { position: fixed; inset: var(--topbar) 0 0; z-index: 500; background: rgba(8, 5, 11, .58); backdrop-filter: blur(16px); padding: 34px 22px; }
.launcher-card { max-width: 980px; margin: auto; border: 1px solid var(--line); border-radius: 28px; background: rgba(29, 20, 35, .78); box-shadow: var(--shadow); padding: 24px; }
.launcher-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.launcher-head h2 { margin: 0; font-size: clamp(26px, 5vw, 48px); }
.ghost-btn, .quick-actions button, .settings-row button, .terminal-form button, .note-actions button { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.1); padding: 9px 12px; cursor: pointer; }
.ghost-btn:hover, .quick-actions button:hover, .settings-row button:hover, .terminal-form button:hover, .note-actions button:hover { background: rgba(255,255,255,.18); }
.search-box { display: block; margin: 18px 0; }
.search-box span { display: block; color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.search-box input, .settings-row input, .settings-row select, .settings-row textarea, .terminal-form input, .browser-bar input, .notes textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.25); color: var(--text); padding: 12px 14px; outline: none; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 14px; }
.app-tile { color: var(--text); border-color: var(--line); border-radius: 20px; background: rgba(255,255,255,.08); padding: 16px 10px; min-height: 122px; }
.app-tile:hover { background: rgba(255,255,255,.15); transform: translateY(-2px); }
.app-tile .os-icon { width: 54px; height: 54px; }
.app-tile strong { display: block; }
.app-tile small { color: var(--muted); }

.quick-panel { background: transparent; pointer-events: none; padding: 10px; inset: var(--topbar) 0 auto auto; }
.quick-card { pointer-events: auto; width: min(360px, calc(100vw - 20px)); margin-left: auto; border: 1px solid var(--line); border-radius: 18px; background: rgba(29,20,35,.92); box-shadow: var(--shadow); padding: 16px; }
.quick-card p { color: var(--muted); margin: 8px 0 14px; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.windows { position: absolute; inset: var(--topbar) 0 0; pointer-events: none; }
.window { pointer-events: auto; position: absolute; width: min(780px, calc(100vw - 110px)); min-width: 280px; min-height: 220px; border: 1px solid rgba(255,255,255,.20); border-radius: 16px; background: rgba(33, 24, 39, .88); box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(24px); resize: both; }
.window.maximized { inset: 8px 8px 8px calc(var(--dock) + 8px) !important; width: auto !important; height: auto !important; resize: none; }
body.dock-bottom .window.maximized { inset: 8px 8px 78px 8px !important; }
.window.minimized { display: none; }
.window-bar { height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 12px; background: linear-gradient(#38263f, #26192d); border-bottom: 1px solid rgba(255,255,255,.12); cursor: grab; user-select: none; }
.window-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.window-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-icon { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--ubuntu-orange); color: #220014; font-weight: 900; font-size: 12px; }
.window-controls { display: flex; gap: 8px; position: relative; z-index: 5; }
.window-controls button { width: 36px; height: 34px; border: 0; border-radius: 999px; background: rgba(255,255,255,.16); cursor: pointer; font-size: 17px; font-weight: 900; touch-action: manipulation; }
.window-controls button:hover { background: rgba(255,255,255,.24); }
.window-controls button[data-win="close"] { background: #e95420; color: #26000d; font-weight: 900; }
.window-body { height: calc(100% - 42px); overflow: auto; padding: 18px; }
.window-body h2, .window-body h3 { margin-top: 0; }

.file-list { display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.file-item b { margin-left: auto; color: var(--muted); font-size: 12px; }
.terminal-screen { min-height: 260px; background: #160d18; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: #a7ff9b; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.terminal-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.notes textarea { min-height: 280px; resize: vertical; }
.note-actions { display: flex; gap: 8px; margin-top: 10px; }
.settings-grid { display: grid; gap: 14px; }
.settings-row { display: grid; gap: 7px; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.06); }
.settings-row label { font-weight: 800; }
.settings-row small { color: var(--muted); }
.browser-bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.browser-frame { min-height: 330px; border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: rgba(255,255,255,.06); }
.store-list { display: grid; gap: 10px; }
.store-app { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.07); }

@media (max-width: 760px) {
  :root { --topbar: 40px; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .activities, .clock { height: 34px; padding: 0 13px; }
  .active-title { justify-self: start; }
  .status-cluster { display: none; }
  .dock { left: 50%; right: auto; top: auto; bottom: max(8px, env(safe-area-inset-bottom)); width: min(96vw, 620px); height: 62px; transform: translateX(-50%); flex-direction: row; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; border-radius: 20px; }
  .dock-btn { flex: 0 0 44px; }
  .dock-btn::after { display: none; }
  .desktop { padding: 24px 14px 88px; }
  .desktop-icons { grid-template-columns: repeat(4, minmax(68px, 1fr)); gap: 8px; }
  .desktop-icon { width: auto; min-height: 78px; }
  .os-icon { width: 40px; height: 40px; }
  .desktop-brand { right: 16px; bottom: 110px; }
  .window { position: absolute !important; left: 8px !important; right: 8px !important; top: 8px !important; bottom: 78px !important; width: auto !important; height: auto !important; min-width: 0; resize: none; border-radius: 14px; }
  .window-bar { height: 52px; padding-right: 10px; }
  .window-controls button { width: 44px; height: 42px; font-size: 20px; }
  .window.minimized { display: none !important; }
  .launcher-panel { padding: 14px 10px 84px; }
  .launcher-card { padding: 16px; max-height: 100%; overflow: auto; border-radius: 22px; }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-panel { inset: var(--topbar) 0 auto 0; }
  .quick-card { margin: 0 auto; }
  .terminal-form, .browser-bar, .store-app { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }


/* OS v2: overview/workspaces, command palette, richer app surfaces */
.activities { font-weight: 800; }
.activities::after { content: "  ↵"; opacity: .55; font-weight: 600; }
.workspace-strip { position: absolute; right: clamp(14px, 3vw, 34px); top: 24px; display: grid; grid-template-columns: repeat(4, 44px); gap: 8px; z-index: 2; }
.workspace-btn { height: 32px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(255,255,255,.07); color: var(--text); cursor: pointer; position: relative; }
.workspace-btn.active { background: color-mix(in srgb, var(--ubuntu-orange) 42%, rgba(255,255,255,.08)); border-color: color-mix(in srgb, var(--ubuntu-orange) 75%, white 10%); }
.workspace-btn.has-windows::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; transform: translateX(-50%); background: #fff; opacity: .8; }
.command-panel { position: fixed; inset: var(--topbar) 0 0; z-index: 720; display: grid; place-items: start center; padding-top: clamp(28px, 9vh, 90px); background: rgba(8,5,11,.48); backdrop-filter: blur(18px); }
.command-card { width: min(720px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 24px; background: rgba(29,20,35,.92); box-shadow: var(--shadow); padding: 18px; }
.command-card h2 { margin: 0 0 12px; }
.command-card input { width: 100%; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; background: rgba(0,0,0,.32); color: var(--text); padding: 14px 16px; outline: none; font-size: 18px; }
.command-results { display: grid; gap: 8px; margin-top: 12px; max-height: 42vh; overflow: auto; }
.command-result { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; width: 100%; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.07); color: var(--text); padding: 10px; cursor: pointer; text-align: left; }
.command-result:hover, .command-result.active { background: rgba(255,255,255,.16); }
.command-result kbd, .command-hint { color: var(--muted); font-size: 12px; }
.command-hint { margin: 12px 2px 0; }
.quick-card { width: min(430px, calc(100vw - 20px)); }
.notification-list { display: grid; gap: 8px; margin: 12px 0; }
.notification { border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.07); padding: 10px; }
.notification strong { display: block; }
.notification small { color: var(--muted); }
.sys-grid, .dashboard-grid, .calendar-grid, .tasks-grid { display: grid; gap: 12px; }
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.dash-card, .metric-card, .task-item, .calendar-event { border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.07); padding: 14px; }
.dash-card strong, .metric-card strong { display: block; font-size: 24px; }
.progress { height: 9px; background: rgba(0,0,0,.28); border-radius: 99px; overflow: hidden; margin-top: 9px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ubuntu-orange), #ffb089); width: var(--value, 50%); }
.task-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.task-item.done span { text-decoration: line-through; color: var(--muted); }
.task-item button, .app-action { border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.1); color: var(--text); padding: 7px 10px; cursor: pointer; }
.task-composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.task-composer input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.25); color: var(--text); padding: 10px 12px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-day { min-height: 42px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.05); padding: 7px; font-size: 12px; }
.calendar-day.today { background: color-mix(in srgb, var(--ubuntu-orange) 35%, rgba(255,255,255,.06)); border-color: var(--ubuntu-orange); }
.palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-swatch { width: 34px; height: 34px; border-radius: 999px; border: 2px solid rgba(255,255,255,.3); cursor: pointer; }
.browser-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.browser-suggestions button { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.09); color: var(--text); padding: 7px 10px; cursor: pointer; }
.file-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.file-toolbar button { border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.09); color: var(--text); padding: 8px 10px; cursor: pointer; }
.muted { color: var(--muted); }

@media (max-width: 760px) {
  .workspace-strip { right: 12px; top: auto; bottom: 158px; grid-template-columns: repeat(4, 46px); }
  .workspace-btn { height: 38px; }
  .command-panel { padding: 12px 8px 86px; place-items: start center; }
  .command-card { border-radius: 20px; padding: 14px; }
  .command-card input { font-size: 16px; }
  .quick-actions { grid-template-columns: 1fr; }
  .task-composer { grid-template-columns: 1fr; }
  .calendar-days { gap: 4px; }
  .calendar-day { min-height: 34px; padding: 5px; }
}

.youtube-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 14px 0; position: relative; z-index: 4; }
.youtube-search input { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.25); color: var(--text); padding: 13px 14px; outline: none; font-size: 16px; line-height: 1.25; -webkit-user-select: text; user-select: text; touch-action: manipulation; pointer-events: auto; }
.youtube-search input:focus { border-color: var(--ubuntu-orange); box-shadow: 0 0 0 3px rgba(233,84,32,.24); }
.youtube-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.youtube-actions button, .youtube-actions .yt-link { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.09); color: var(--text); padding: 9px 12px; cursor: pointer; touch-action: manipulation; text-decoration: none; display: inline-flex; align-items: center; min-height: 38px; }
.youtube-actions button:hover, .youtube-actions .yt-link:hover, .yt-open-link:hover { background: rgba(255,255,255,.18); }
.yt-open-link { display: inline-flex; margin-top: 8px; color: #fff; background: var(--ubuntu-orange); border-radius: 999px; padding: 10px 14px; text-decoration: none; font-weight: 800; }
@media (max-width: 760px) { .youtube-search { grid-template-columns: 1fr; } .youtube-actions button, .youtube-actions .yt-link { min-height: 42px; } }
