/* Chrome — coque PWA. Aucun framework, aucun CDN. */

:root {
  --bg-0: #070b14;
  --bg-1: #0b1220;
  --panel: rgba(13, 20, 35, 0.72);
  --panel-solid: #0f172a;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e6edf7;
  --text-dim: #94a3b8;
  --accent: #67e8f9;
  --accent-2: #818cf8;
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  --bar-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; }

:focus-visible {
  outline: 2px solid rgba(103, 232, 249, 0.72);
  outline-offset: 2px;
}

/* ── Bureau ─────────────────────────────────────────────────────────── */

.desktop {
  position: fixed;
  inset: 0 0 var(--bar-h) 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 15% 8%, rgba(103, 232, 249, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 86% 18%, rgba(129, 140, 248, 0.12), transparent 55%),
    radial-gradient(900px 600px at 50% 104%, rgba(56, 189, 248, 0.08), transparent 60%),
    linear-gradient(160deg, #070b14 0%, #0a1120 45%, #0b1324 100%);
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 76%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 76%);
  pointer-events: none;
}

.windows { position: absolute; inset: 0; }

/* ── Fenêtres ───────────────────────────────────────────────────────── */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: win-in 0.18s ease-out;
}

@keyframes win-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.window.focused {
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.16), var(--shadow);
}

.window.maximized { border-radius: 0; border-top: 0; border-left: 0; border-right: 0; }
.window.minimized { display: none; }

.window-bar {
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.window-bar:active { cursor: grabbing; }

.window-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex: 0 0 auto;
}

.window-icon svg { width: 17px; height: 17px; }

.window-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-actions { margin-left: auto; display: flex; gap: 2px; }

.window-actions button {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.window-actions button:hover { background: rgba(148, 163, 184, 0.14); color: var(--text); }
.window-actions button[data-act="close"]:hover { background: rgba(251, 113, 133, 0.18); color: #fecdd3; }
.window-actions svg { width: 15px; height: 15px; }

.window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background: #0b1220;
}

.window-body.flush { overflow: hidden; }

.window-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
}

.window-resize::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  border-radius: 0 0 3px 0;
}

/* ── Barre des tâches ───────────────────────────────────────────────── */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(9, 14, 26, 0.94));
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  z-index: 1000;
}

.spacer { flex: 1; }

.bar-btn {
  width: 42px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.bar-btn:hover { background: rgba(103, 232, 249, 0.12); color: var(--accent); border-color: rgba(103, 232, 249, 0.22); }

.grid-icon {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
}

.grid-icon i { display: block; background: currentColor; border-radius: 1px; }

.tasks { display: flex; gap: 6px; overflow: hidden; min-width: 0; }

.task {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  max-width: 210px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  cursor: pointer;
}

.task:hover { background: rgba(148, 163, 184, 0.14); }
.task.active { background: rgba(103, 232, 249, 0.12); border-color: rgba(103, 232, 249, 0.30); }
.task.minimized { opacity: 0.55; }
.task-icon { display: grid; place-items: center; color: var(--accent); flex: 0 0 auto; }
.task-icon svg { width: 17px; height: 17px; }
.task .label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.pill:hover { background: rgba(148, 163, 184, 0.13); color: var(--text); }
.pill.install { color: var(--accent); border-color: rgba(103, 232, 249, 0.35); }
.pill .bar { width: 54px; height: 6px; border-radius: 999px; background: rgba(148, 163, 184, 0.18); overflow: hidden; }
.pill .bar i { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); }
.pill.warn .bar i { background: var(--warn); }

.clock {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 118px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Lanceur ────────────────────────────────────────────────────────── */

.launcher {
  position: fixed;
  inset: 0 0 var(--bar-h) 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 16, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.launcher[hidden] { display: none; }

.launcher-panel {
  width: min(760px, 100%);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 22px;
  background: linear-gradient(180deg, rgba(17, 26, 44, 0.98), rgba(11, 18, 32, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.launcher-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.launcher-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--text);
  cursor: pointer;
}

.app-tile:hover {
  background: rgba(103, 232, 249, 0.10);
  border-color: rgba(103, 232, 249, 0.25);
  transform: translateY(-1px);
}

.app-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.18), rgba(129, 140, 248, 0.18));
  color: var(--accent);
}

.app-icon svg { width: 24px; height: 24px; }
.app-name { font-size: 13px; }
.launcher-hint { margin: 14px 0 0; text-align: center; }

/* ── Bandeau et notifications ───────────────────────────────────────── */

.banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + 16px);
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: min(680px, calc(100vw - 32px));
  padding: 12px 14px 12px 18px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 16px;
  background: rgba(17, 26, 44, 0.97);
  box-shadow: var(--shadow);
}

.banner[hidden] { display: none; }
.banner-text { display: flex; flex-direction: column; gap: 2px; }
.banner-actions { display: flex; align-items: center; gap: 6px; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bar-h) + 16px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 360px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(17, 26, 44, 0.97);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 0.2s ease-out;
}

.toast.warn { border-color: rgba(251, 191, 36, 0.45); }
.toast.error { border-color: rgba(251, 113, 133, 0.5); }
.toast.ok { border-color: rgba(52, 211, 153, 0.45); }
.toast.out { opacity: 0; transform: translateY(4px); transition: opacity 0.2s, transform 0.2s; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── Contenu des applis ─────────────────────────────────────────────── */

.app-pad { padding: 22px 24px 26px; }

.hero { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }

.hero-badge {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.18), rgba(129, 140, 248, 0.18));
  color: var(--accent);
}

.hero-badge svg { width: 28px; height: 28px; }
.hero h1 { margin: 0 0 3px; font-size: 26px; letter-spacing: -0.02em; }
.hero p { margin: 0; }

h2 { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.05);
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.12);
  font-size: 13px;
}

.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-dim); }
.kv b { font-weight: 600; text-align: right; }

.row { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.09);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: rgba(148, 163, 184, 0.16); }

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06121a;
}

.btn-primary:hover { filter: brightness(1.06); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover { background: rgba(148, 163, 184, 0.14); color: var(--text); }

.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

.fill-frame { display: block; width: 100%; height: 100%; border: 0; }

/* ── Divers ─────────────────────────────────────────────────────────── */

* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.32) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .task .label { display: none; }
  #storage-label { display: none; }
  .clock { min-width: 0; font-size: 11px; }
  .app-pad { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
