:root {
  --taskbar-h: 46px;
  --accent: #2f6df6;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: var(--font); user-select: none; }
body {
  /* Le voile sombre (au-dessus) garde les noms lisibles quelle que soit l'image. */
  background:
    linear-gradient(rgba(6,14,22,0.45), rgba(6,14,22,0.66)),
    url('bg.png') center / cover no-repeat,
    #08131f; /* repli si bg.png absent */
  color: #fff;
}

/* ----- Bureau ----- */
.desktop {
  position: absolute; inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
}

/* Conteneur de positionnement : les icônes sont placées librement (left/top en %). */
.icons { position: absolute; inset: 0; }

.icon {
  position: absolute; width: 104px; padding: 10px 6px 8px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; border: 1px solid transparent; text-align: center;
}
.icon:hover { background: rgba(255,255,255,0.08); }
.icon.selected { background: rgba(47,109,246,0.35); border-color: rgba(120,170,255,0.6); }
.icon:focus-visible { outline: 2px solid #9fc0ff; outline-offset: -2px; }
.icon .glyph {
  font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
.icon .label {
  font-size: 12px; line-height: 1.25; color: #f3f6fb;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9); word-break: break-word;
  max-height: 2.6em; overflow: hidden;
}

/* ----- Barre des tâches ----- */
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--taskbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: rgba(8,16,28,0.82); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.start {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  background: transparent; border: 0; color: #fff; font-family: var(--font); font-size: 13px;
  border-radius: 6px; cursor: pointer;
}
.start:hover { background: rgba(255,255,255,0.1); }
.start-logo { font-size: 17px; color: #6ea8ff; }
.tray { margin-left: auto; display: flex; align-items: center; gap: 12px; padding-right: 6px; }
.tray-ico { font-size: 14px; opacity: .85; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-size: 12px; }
.clock-date { font-size: 11px; opacity: .8; }

/* ----- Menu Démarrer ----- */
.startmenu {
  position: absolute; left: 8px; bottom: calc(var(--taskbar-h) + 6px); z-index: 40;
  width: 240px; background: rgba(16,24,38,0.97); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.startmenu.hidden { display: none; }
.startmenu .sm-head { font-size: 11px; color: #8aa0bb; padding: 6px 10px; text-transform: uppercase; letter-spacing: .08em; }
.startmenu .sm-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  font-size: 13px; color: #eaf0f8; cursor: pointer;
}
.startmenu .sm-item:hover { background: rgba(255,255,255,0.08); }

/* ----- Dialogue d'erreur ----- */
.dialog-overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
}
.dialog-overlay.hidden { display: none; }
.dialog {
  width: min(440px, 92vw); background: #f4f6f9; color: #1b2430;
  border-radius: 10px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  animation: dlgIn .14s ease;
}
.dialog.shake { animation: shake .35s; }
@keyframes dlgIn { from { transform: scale(.94); opacity: 0; } }
@keyframes shake {
  10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-7px); } 40%,60% { transform: translateX(7px); }
}
.dialog-title {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #c0392b, #a5281b); color: #fff;
  padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.dialog-x {
  background: transparent; border: 0; color: #fff; font-size: 14px; cursor: pointer;
  width: 26px; height: 22px; border-radius: 4px;
}
.dialog-x:hover { background: rgba(255,255,255,0.25); }
.dialog-body { display: flex; align-items: center; gap: 16px; padding: 22px 20px; }
.dialog-ico { font-size: 38px; flex: none; }
.dialog-msg { margin: 0; font-size: 14px; line-height: 1.5; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 16px; background: #e7ebf1; border-top: 1px solid #d3dae3;
}
.dlg-btn {
  font-family: var(--font); font-size: 13px; cursor: pointer;
  padding: 7px 18px; border-radius: 6px; border: 1px solid #b7c0cd; background: #fff; color: #1b2430;
  min-width: 92px;
}
.dlg-btn:hover { background: #eef2f7; }
.dlg-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dlg-btn.primary:hover { background: #245fe0; }

/* ----- Écran de blocage (verrou) ----- */
.lock-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; background: #08131f;
}
.lock-screen .box { max-width: 420px; }
.lock-screen .ico { font-size: 54px; }
.lock-screen h1 { font-size: 20px; margin: 14px 0 8px; color: #ff6b6b; }
.lock-screen p { color: #8aa0bb; font-size: 13px; line-height: 1.6; margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  .dialog, .dialog.shake { animation: none; }
}
