/* ==========================================================================
   PORTFOLIO OS — SHELL  ·  Windows 11 / Fluent
   Youness Ajdir · Full-Stack Developer · Tangier
   ========================================================================== */

:root {
  /* --- Fluent dark base ------------------------------------------------- */
  --solid-base:      #202020;
  --solid-secondary: #1c1c1c;
  --solid-tertiary:  #282828;

  /* Mica / Acrylic */
  --mica:     rgba(32, 32, 32, .82);
  --acrylic:  rgba(44, 44, 44, .72);
  --flyout:   rgba(43, 43, 43, .86);

  /* Layer + card fills (Fluent tokens) */
  --card:        rgba(255, 255, 255, .0512);
  --card-2:      rgba(255, 255, 255, .0326);
  --control:     rgba(255, 255, 255, .0605);
  --control-h:   rgba(255, 255, 255, .0837);
  --control-p:   rgba(255, 255, 255, .0326);
  --subtle-h:    rgba(255, 255, 255, .0605);

  /* Strokes */
  --stroke:      rgba(255, 255, 255, .0698);
  --stroke-2:    rgba(255, 255, 255, .0930);
  --stroke-card: rgba(255, 255, 255, .0578);
  --divider:     rgba(255, 255, 255, .0837);

  /* Text */
  --tx:    #ffffff;
  --tx-2:  rgba(255, 255, 255, .786);
  --tx-3:  rgba(255, 255, 255, .544);
  --tx-4:  rgba(255, 255, 255, .363);

  /* Accent (Windows 11 dark-theme default) */
  --accent:      #60cdff;
  --accent-2:    #4cc2ff;
  --accent-3:    #0078d4;
  --on-accent:   #003e5c;
  --accent-soft: rgba(96, 205, 255, .12);
  --accent-line: rgba(96, 205, 255, .28);

  /* Semantic */
  --ok:   #6ccb5f;
  --warn: #fce100;
  --bad:  #ff99a4;

  /* Geometry — Windows 11 radii */
  --r-win:  8px;
  --r-lg:   8px;
  --r-md:   6px;
  --r-sm:   4px;

  /* Elevation */
  --sh-flyout: 0 8px 16px rgba(0,0,0,.28);
  --sh-dialog: 0 32px 64px rgba(0,0,0,.56);
  --sh-win:    0 16px 48px rgba(0,0,0,.52), 0 2px 8px rgba(0,0,0,.32);

  --taskbar-h: 48px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-fluent: cubic-bezier(0, 0, 0, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: #0a0a0a;
  color: var(--tx);
  font-family: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Inter,
               -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", Inter, sans-serif;
  font-weight: 600;
  margin: 0;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }

/* Icons -------------------------------------------------------------------- */
.ic {
  width: 1em; height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Brand marks are filled single paths */
.ic.brand { stroke: none; fill: currentColor; }

/* Fluent focus rectangle: dark inner ring + light outer ring */
:focus-visible {
  outline: 2px solid var(--tx);
  outline-offset: 1px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 4px rgba(0,0,0,.7);
}

/* Scrollbars — Windows 11 thin overlay style ------------------------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.24);
  border: 5px solid transparent;
  background-clip: content-box;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); background-clip: content-box; }


/* ==========================================================================
   BOOT — Windows startup
   ========================================================================== */
#boot {
  position: fixed; inset: 0; z-index: 300;
  background: #000;
  display: grid; place-content: center; justify-items: center;
  gap: 26px;
  transition: opacity .6s ease, visibility .6s;
}
#boot.hide { opacity: 0; visibility: hidden; }

.boot-logo { color: #60cdff; animation: bootIn .8s var(--ease) both; }
.boot-logo svg { width: 56px; height: 56px; fill: currentColor; stroke: none; }
@keyframes bootIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

.boot-ring {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.14);
  border-top-color: #fff;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot-name {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--tx-3);
}


/* ==========================================================================
   DESKTOP — Windows 11 "Bloom" inspired wallpaper
   ========================================================================== */
.os {
  position: relative;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: #04101f;
  isolation: isolate;
}

.wp-bloom {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 46% at 50% 44%, rgba(120, 226, 255, .60) 0%, rgba(70, 160, 255, .28) 38%, transparent 72%),
    radial-gradient(30% 34% at 36% 32%, rgba(160, 120, 255, .40) 0%, transparent 70%),
    radial-gradient(30% 34% at 66% 62%, rgba(64, 224, 208, .34) 0%, transparent 70%),
    radial-gradient(60% 60% at 50% 50%, rgba(20, 70, 140, .55) 0%, transparent 78%),
    linear-gradient(160deg, #051225 0%, #04101f 45%, #030b17 100%);
  animation: bloom 28s ease-in-out infinite alternate;
}
@keyframes bloom {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

/* Petal-like light rays radiating from the bloom */
.wp-rays {
  position: absolute; inset: -20%; z-index: 0;
  pointer-events: none;
  opacity: .5;
  background:
    conic-gradient(from 0deg at 50% 50%,
      transparent 0deg, rgba(140, 220, 255, .16) 18deg, transparent 40deg,
      transparent 70deg, rgba(180, 140, 255, .14) 92deg, transparent 118deg,
      transparent 155deg, rgba(120, 235, 220, .13) 178deg, transparent 205deg,
      transparent 240deg, rgba(120, 190, 255, .15) 262deg, transparent 290deg,
      transparent 320deg, rgba(160, 150, 255, .12) 342deg, transparent 360deg);
  filter: blur(42px);
  animation: swirl 60s linear infinite;
}
@keyframes swirl { to { transform: rotate(360deg); } }

.wp-grain {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
}

.wp-vignette {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background: radial-gradient(130% 105% at 50% 45%, transparent 30%, rgba(2,8,18,.6) 74%, rgba(1,5,12,.94) 100%);
}


/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: absolute; inset: 0;
  z-index: 2;
  display: grid; place-content: center; justify-items: center;
  text-align: center;
  padding: 0 24px calc(var(--taskbar-h) + 12px);
  pointer-events: none;
}
.hero > * { pointer-events: auto; }

.hero-status {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 15px 6px 11px;
  border-radius: 999px;
  background: var(--acrylic);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(60px) saturate(125%);
  -webkit-backdrop-filter: blur(60px) saturate(125%);
  box-shadow: var(--sh-flyout);
  font-size: 12px; font-weight: 400;
  color: var(--tx-2);
  margin-bottom: 26px;
  animation: rise .7s .1s var(--ease) both;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(108,203,95,.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(108,203,95,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(108,203,95,0); }
  100% { box-shadow: 0 0 0 0 rgba(108,203,95,0); }
}

.hero-name {
  display: flex; flex-direction: column; align-items: center;
  font-size: clamp(52px, 7.2vw, 104px);
  font-weight: 300;
  line-height: .94;
  letter-spacing: -.03em;
  user-select: none;
}
.hn-1 {
  color: #fff;
  font-weight: 200;
  text-shadow: 0 6px 40px rgba(0,0,0,.6);
  animation: rise .8s .16s var(--ease) both;
}
.hn-2 {
  font-weight: 600;
  background: linear-gradient(100deg, #a8e9ff 0%, #60cdff 45%, #b79dff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 30px rgba(96,205,255,.3));
  animation: rise .8s .24s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.hero-role {
  margin: 20px 0 0;
  font-size: 12px; font-weight: 400;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--tx-3);
  animation: rise .8s .32s var(--ease) both;
}

.hero-stats {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 22px;
  animation: rise .8s .4s var(--ease) both;
}
.hero-stat {
  display: flex; align-items: baseline; gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  background: var(--acrylic);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}
.hero-stat b { font-size: 15px; font-weight: 600; color: var(--accent); }
.hero-stat span { font-size: 12px; color: var(--tx-3); }

.hero-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 28px;
  animation: rise .8s .48s var(--ease) both;
}

/* Fluent buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke-2);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .1s linear, border-color .1s linear;
}
.btn .ic { font-size: 16px; }
.btn:active { transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: rgba(255,255,255,.08);
  color: var(--on-accent);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.14);
}
.btn-primary:hover  { background: #55b9e8; }
.btn-primary:active { background: #4aa5cf; color: rgba(0,62,92,.7); }

.btn-ghost {
  background: var(--control);
  color: var(--tx);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.05);
}
.btn-ghost:hover  { background: var(--control-h); }
.btn-ghost:active { background: var(--control-p); color: var(--tx-2); }

/* Segmented language control ---------------------------------------------- */
.lang-switch {
  display: inline-flex;
  height: 36px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--acrylic);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}
.lang-switch button {
  position: relative;
  border: 0; background: transparent;
  color: var(--tx-3);
  font-size: 12px; font-weight: 600;
  padding: 0 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: color .1s, background .1s;
}
.lang-switch button:hover { color: var(--tx); background: var(--subtle-h); }
.lang-switch button.on { color: var(--tx); background: var(--control-h); }
.lang-switch button.on::after {
  content: ""; position: absolute; left: 50%; bottom: -2px;
  transform: translateX(-50%);
  width: 14px; height: 2.5px; border-radius: 2px;
  background: var(--accent);
}


/* ==========================================================================
   DESKTOP ICONS
   ========================================================================== */
.icons {
  position: absolute; z-index: 3;
  top: 12px; left: 12px;
  display: grid;
  grid-template-columns: repeat(2, 92px);
  gap: 2px;
  max-height: calc(100vh - var(--taskbar-h) - 30px);
  overflow: auto;
  scrollbar-width: none;
}
.icons::-webkit-scrollbar { display: none; }

.icons button {
  width: 92px;
  min-width: 0;
  padding: 10px 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: #fff;
  font-size: 12px; font-weight: 400;
  line-height: 1.35;
  display: grid; justify-items: center; gap: 7px;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
  transition: background .08s linear, border-color .08s linear;
  animation: rise .5s var(--ease) both;
}
.icons button:hover  { background: rgba(255,255,255,.08); border-color: var(--stroke); }
.icons button:active { background: rgba(255,255,255,.05); }
.icons button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fluent-style app tiles */
.app-tile {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.18);
}
.t-indigo { background: linear-gradient(160deg,#5b8def,#2b56c9); }
.t-teal   { background: linear-gradient(160deg,#2fd6c2,#0f9186); }
.t-cyan   { background: linear-gradient(160deg,#48b6f5,#1268c3); }
.t-amber  { background: linear-gradient(160deg,#ffc357,#d4820f); }
.t-violet { background: linear-gradient(160deg,#b088f9,#6b3fd4); }
.t-gold   { background: linear-gradient(160deg,#f5cf5f,#b5820e); }
.t-rose   { background: linear-gradient(160deg,#ff8fa0,#c33a54); }
.t-red    { background: linear-gradient(160deg,#ff7a72,#c02b3c); }
.t-slate  { background: linear-gradient(160deg,#2b3242,#12161f); color:#60cdff; }
.t-blue   { background: linear-gradient(160deg,#7fb0ff,#2f5fc0); }
.t-gray   { background: linear-gradient(160deg,#eef1f6,#9aa3b2); color:#2b3140; }


/* ==========================================================================
   WINDOWS — Fluent chrome
   ========================================================================== */
#windows { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#windows > * { pointer-events: auto; }

.window {
  position: absolute;
  width: min(920px, 76vw);
  height: min(650px, 76vh);
  min-width: 400px; min-height: 280px;
  display: flex; flex-direction: column;
  border-radius: var(--r-win);
  background: var(--mica);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(70px) saturate(130%);
  -webkit-backdrop-filter: blur(70px) saturate(130%);
  box-shadow: var(--sh-win);
  overflow: hidden;
  animation: winIn .3s var(--ease-fluent);
}
@keyframes winIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.window.closing { animation: winOut .15s ease forwards; }
@keyframes winOut { to { opacity: 0; transform: scale(.97); } }

/* .window sets display:flex, which beats the UA rule for [hidden] */
.window[hidden] { display: none !important; }

.window.active {
  border-color: rgba(255,255,255,.13);
  box-shadow: var(--sh-dialog);
}
.window:not(.active) { filter: saturate(.9) brightness(.94); }

.window.max {
  left: 0 !important; top: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--taskbar-h)) !important;
  border-radius: 0;
  border-width: 0 0 1px 0;
}

/* Title bar — 32px like Windows 11 */
.bar {
  height: 32px; flex: none;
  display: flex; align-items: center; gap: 8px;
  padding-left: 12px;
  background: transparent;
  cursor: default;
  user-select: none;
}
.bar .bar-ic { width: 16px; height: 16px; display: grid; place-items: center; font-size: 13px; border-radius: 3px; }
.bar-title { flex: 1; font-size: 12px; font-weight: 400; color: var(--tx-2); }
.bar-title small { color: var(--tx-4); margin-left: 6px; }

/* Caption buttons — 46x32, close goes red */
.bar-btns { display: flex; height: 32px; }
.bar-btns button {
  width: 46px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 0;
  background: transparent;
  color: var(--tx-2);
  cursor: pointer;
  transition: background .08s linear;
}
.bar-btns button .ic { width: 10px; height: 10px; stroke-width: 1.4; }
.bar-btns button:hover  { background: rgba(255,255,255,.07); color: #fff; }
.bar-btns button:active { background: rgba(255,255,255,.04); }
.bar-btns .x:hover  { background: #c42b1c; color: #fff; }
.bar-btns .x:active { background: #b02a1c; }

/* Content sits on a lighter "layer" like a Fluent app body */
.content {
  flex: 1;
  margin: 0 1px 1px;
  border-radius: var(--r-win) var(--r-win) 7px 7px;
  background: rgba(255,255,255,.028);
  border-top: 1px solid var(--stroke);
  padding: 26px 30px 34px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.max .content { border-radius: 0; margin: 0; }

.grip { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 3; }

#snap-hint {
  position: absolute; z-index: 9;
  border-radius: var(--r-win);
  background: rgba(96,205,255,.12);
  border: 1px solid rgba(96,205,255,.4);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}
#snap-hint.on { opacity: 1; }


/* ==========================================================================
   TASKBAR — Windows 11
   ========================================================================== */
.taskbar {
  position: absolute; z-index: 30;
  bottom: 0; left: 0; right: 0;
  height: var(--taskbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
  background: var(--mica);
  border-top: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(60px) saturate(125%);
  -webkit-backdrop-filter: blur(60px) saturate(125%);
}

.tb-left, .tb-right { display: flex; align-items: center; flex: 1 1 0; min-width: 0; }
.tb-right { justify-content: flex-end; gap: 2px; }

/* Widgets pill (bottom-left, like Win11 weather) */
.tb-widget {
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 12px 0 10px;
  border: 0; border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
  min-width: 0;
  transition: background .08s linear;
}
.tb-widget:hover { background: var(--subtle-h); }
.tw-temp { font-size: 20px; line-height: 1; color: #ffd166; }
.tw-txt { text-align: left; min-width: 0; }
.tw-txt b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tw-txt small { display: block; font-size: 11px; color: var(--tx-3); white-space: nowrap; }

/* Centered dock ------------------------------------------------------------ */
.dock { display: flex; align-items: center; gap: 2px; }

.dock button, .dock a {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--tx);
  font-size: 18px;
  cursor: pointer;
  transition: background .08s linear;
}
.dock button:hover  { background: var(--subtle-h); }
.dock button:active { background: var(--control-p); transform: scale(.94); }

/* Windows 11 running indicator: a small bar under the icon */
.dock button.running::after {
  content: "";
  position: absolute; bottom: 1px; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.5);
  transition: width .16s var(--ease), background .16s;
}
.dock button.running.focus::after { width: 16px; background: var(--accent); }

.dock .start-btn .ic { width: 22px; height: 22px; color: #60cdff; fill: currentColor; stroke: none; }
.dock .start-btn.on { background: var(--control-h); }

.dock .search-btn {
  width: auto; padding: 0 12px 0 10px;
  gap: 8px;
  display: flex; align-items: center;
  color: var(--tx-2);
  font-size: 13px; font-weight: 400;
}
.dock .search-btn .ic { font-size: 16px; }
.dock .search-btn kbd {
  font: 400 10px/1 "Segoe UI", sans-serif;
  padding: 3px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--stroke-2);
  color: var(--tx-3);
}
.dock .sep { width: 1px; height: 24px; background: var(--divider); margin: 0 4px; }

/* System tray -------------------------------------------------------------- */
.tray-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--tx-2);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .08s linear;
}
.tray-btn:hover { background: var(--subtle-h); }
.tray-btn b { font-size: 11px; font-weight: 600; }

.tray-icons {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--tx-2);
  font-size: 15px;
  transition: background .08s linear;
}
.tray-icons:hover { background: var(--subtle-h); }

.tray-clock {
  padding: 0 10px;
  height: 40px;
  display: grid; align-content: center;
  text-align: right;
  border-radius: var(--r-sm);
  line-height: 1.35;
  transition: background .08s linear;
}
.tray-clock:hover { background: var(--subtle-h); }
.tray-clock b { display: block; font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tray-clock small { display: block; font-size: 12px; color: var(--tx-2); font-variant-numeric: tabular-nums; }


/* ==========================================================================
   START MENU — Windows 11
   ========================================================================== */
#startmenu {
  position: absolute; z-index: 40;
  left: 50%; bottom: calc(var(--taskbar-h) + 8px);
  transform: translateX(-50%) translateY(14px);
  width: min(620px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - var(--taskbar-h) - 24px));
  display: flex; flex-direction: column;
  padding: 24px 24px 0;
  border-radius: var(--r-win);
  background: var(--flyout);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(90px) saturate(130%);
  -webkit-backdrop-filter: blur(90px) saturate(130%);
  box-shadow: var(--sh-dialog);
  opacity: 0; visibility: hidden;
  transition: opacity .2s var(--ease-fluent), transform .25s var(--ease-fluent), visibility .25s;
}
#startmenu.open { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.sm-search {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--stroke-2);
  border-bottom-color: rgba(255,255,255,.14);
  color: var(--tx-3);
  font-size: 15px;
}
.sm-search:focus-within { border-bottom: 2px solid var(--accent); background: rgba(255,255,255,.07); }
.sm-search input { flex: 1; border: 0; background: transparent; outline: 0; font-size: 13.5px; color: var(--tx); }
.sm-search input::placeholder { color: var(--tx-3); }

.sm-row { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.sm-label { font-size: 13px; font-weight: 600; color: var(--tx); }

.sm-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.sm-grid button {
  padding: 12px 4px 10px;
  display: grid; justify-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--tx);
  font-size: 11.5px; font-weight: 400;
  cursor: pointer;
  transition: background .08s linear;
}
.sm-grid button:hover  { background: var(--subtle-h); }
.sm-grid button:active { background: var(--control-p); }
.sm-grid button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-grid .app-tile { width: 32px; height: 32px; font-size: 17px; border-radius: 6px; }

/* Recommended list */
.sm-reco { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.sm-reco button {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--tx);
  text-align: left;
  cursor: pointer;
  transition: background .08s linear;
  min-width: 0;
}
.sm-reco button:hover { background: var(--subtle-h); }
.sm-reco .app-tile { width: 28px; height: 28px; font-size: 15px; border-radius: 5px; }
.sm-reco b { display: block; font-size: 12.5px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-reco small { display: block; font-size: 11px; color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#startmenu footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin: 20px -24px 0;
  padding: 12px 24px;
  background: rgba(255,255,255,.036);
  border-top: 1px solid var(--divider);
  border-radius: 0 0 7px 7px;
}
.sm-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sm-user img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: center 18%; }
.sm-user b { display: block; font-size: 13px; font-weight: 400; }
.sm-user small { display: block; font-size: 11px; color: var(--tx-3); }
.sm-foots { display: flex; gap: 2px; }
.sm-icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--tx-2);
  font-size: 16px; cursor: pointer;
  transition: background .08s linear;
}
.sm-icon-btn:hover { background: var(--subtle-h); color: var(--tx); }


/* ==========================================================================
   SEARCH / COMMAND PALETTE
   ========================================================================== */
#palette {
  position: absolute; inset: 0; z-index: 60;
  display: grid; justify-items: center;
  padding-top: 12vh;
  background: rgba(0,0,0,.35);
  opacity: 0; visibility: hidden;
  transition: opacity .18s var(--ease-fluent), visibility .18s;
}
#palette.open { opacity: 1; visibility: visible; }

.pal-box {
  width: min(620px, calc(100vw - 24px));
  max-height: 62vh;
  display: flex; flex-direction: column;
  border-radius: var(--r-win);
  background: var(--flyout);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(90px) saturate(130%);
  -webkit-backdrop-filter: blur(90px) saturate(130%);
  box-shadow: var(--sh-dialog);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform .2s var(--ease-fluent);
}
#palette.open .pal-box { transform: none; }

.pal-input {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
  font-size: 16px;
  color: var(--tx-3);
}
.pal-input input { flex: 1; border: 0; background: transparent; outline: 0; font-size: 14px; color: var(--tx); }
.pal-input input::placeholder { color: var(--tx-3); }
.pal-input kbd {
  font: 400 11px/1 "Segoe UI", sans-serif;
  padding: 4px 7px; border-radius: 3px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke-2);
}

.pal-list { overflow-y: auto; padding: 6px; }
.pal-group {
  padding: 10px 10px 6px;
  font-size: 12px; font-weight: 600;
  color: var(--tx-2);
}
.pal-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--tx-2);
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
}
.pal-item .ic { font-size: 17px; color: var(--tx-3); }
.pal-item b { font-weight: 400; color: var(--tx); }
.pal-item small { display: block; font-size: 11.5px; color: var(--tx-3); margin-top: 1px; }
.pal-item:hover { background: var(--subtle-h); }
.pal-item.sel { background: var(--control-h); }
.pal-item.sel::before {
  content: ""; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px;
  background: var(--accent);
}
.pal-empty { padding: 26px; text-align: center; color: var(--tx-3); font-size: 13px; }


/* ==========================================================================
   TOAST + LIGHTBOX
   ========================================================================== */
.toast {
  position: fixed; z-index: 90;
  bottom: calc(var(--taskbar-h) + 14px); right: 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-radius: var(--r-win);
  background: var(--flyout);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(60px) saturate(130%);
  -webkit-backdrop-filter: blur(60px) saturate(130%);
  box-shadow: var(--sh-dialog);
  font-size: 13px;
  opacity: 0; visibility: hidden;
  transform: translateX(16px);
  transition: opacity .22s var(--ease-fluent), transform .22s var(--ease-fluent), visibility .22s;
}
.toast.show { opacity: 1; visibility: visible; transform: none; }
.toast .ic { font-size: 16px; color: var(--accent); }

.lightbox {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 5vh 5vw;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s, visibility .22s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 14px; }
.lightbox img {
  max-width: 100%; max-height: 78vh;
  border-radius: var(--r-win);
  border: 1px solid var(--stroke-2);
  box-shadow: var(--sh-dialog);
}
.lightbox figcaption { font-size: 13px; color: var(--tx-2); }
.lb-close {
  position: absolute; top: 18px; right: 18px;
  width: 46px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: #fff; font-size: 15px; cursor: pointer;
}
.lb-close:hover { background: #c42b1c; }


/* ==========================================================================
   PHONE CHROME — hidden on desktop
   ========================================================================== */
.phone-statusbar, .phone-widget, .phone-home { display: none; }


/* Without backdrop-filter the acrylic reads as plain transparency —
   fall back to solid Fluent surfaces so text never fights the desktop. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .window     { background: #1f1f1f; }
  #startmenu, .pal-box, .toast { background: #2b2b2b; }
  .taskbar    { background: #1c1c1c; }
  .hero-status, .hero-stat, .lang-switch, .btn-ghost, .phone-chip { background: rgba(32,32,32,.96); }
}


/* ==========================================================================
   TABLET
   ========================================================================== */
@media (max-width: 1024px) {
  .window { width: min(780px, 90vw); }
  .tw-txt { display: none; }
}

@media (max-width: 880px) {
  .icons { grid-template-columns: 92px; }
  .tb-left, .tb-right { flex: 0 0 auto; }
  .tray-icons { display: none; }
  .dock .search-btn span, .dock .search-btn kbd { display: none; }
  .dock .search-btn { width: 40px; padding: 0; justify-content: center; }
  .window {
    left: 12px !important; top: 12px !important;
    width: calc(100vw - 24px) !important;
    height: calc(100vh - var(--taskbar-h) - 24px) !important;
  }
  .grip { display: none; }
  .sm-grid { grid-template-columns: repeat(4, 1fr); }
  .sm-reco { grid-template-columns: 1fr; }
}


/* ==========================================================================
   PHONE OS MODE (<= 650px)
   ========================================================================== */
@media (max-width: 650px) {
  :root { --taskbar-h: 0px; }

  .phone-statusbar {
    position: relative; z-index: 140;
    display: flex; align-items: center; justify-content: space-between;
    height: calc(40px + env(safe-area-inset-top, 0px));
    padding: max(8px, env(safe-area-inset-top, 0px)) 20px 0;
    font-size: 12.5px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
  }
  .phone-statusbar > * { pointer-events: auto; }
  .phone-island {
    width: 86px; height: 22px;
    border-radius: 20px;
    background: #000;
    box-shadow: 0 0 0 1px rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 9px;
  }
  .phone-island i { width: 7px; height: 7px; border-radius: 50%; background: #1b2233; display: block; }
  .phone-tray { display: flex; align-items: center; gap: 6px; }
  .phone-lang {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--stroke-2);
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    color: var(--tx-2);
    font-size: 11px; font-weight: 600;
    cursor: pointer;
  }
  .phone-lang .ic { font-size: 13px; }

  .hero-status, .hero-name, .hero-role, .hero-stats, .hero-actions,
  #startmenu, .tb-left, .tb-right, .dock .start-btn, .dock .search-btn,
  .dock .sep, .dock .dock-more, .grip {
    display: none !important;
  }

  .hero { position: relative; inset: auto; display: block; height: auto; padding: 16px 20px 4px; z-index: 5; }
  .phone-widget { display: block; text-align: center; animation: rise .6s var(--ease) both; }
  .phone-clock {
    font-size: 62px; font-weight: 300;
    letter-spacing: -.03em; line-height: 1;
    text-shadow: 0 4px 24px rgba(0,0,0,.7);
    font-variant-numeric: tabular-nums;
  }
  .phone-date { margin-top: 4px; font-size: 13px; color: var(--tx-2); }
  .phone-chip {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 14px;
    padding: 5px 14px 5px 5px;
    border-radius: 999px;
    background: var(--acrylic);
    border: 1px solid var(--stroke-2);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    font-size: 11.5px;
  }
  .phone-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; object-position: center 18%; }
  .phone-chip b { color: var(--tx-3); font-weight: 400; }

  .icons {
    position: relative; inset: auto; top: auto; left: auto;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 2px;
    padding: 26px 12px 120px;
    max-height: none;
    overflow: visible;
  }
  .icons button { width: 100%; padding: 0; gap: 7px; font-size: 11px; }
  .icons button:hover { background: transparent; border-color: transparent; }
  .app-tile { width: 56px; height: 56px; border-radius: 15px; font-size: 25px; }

  .taskbar {
    position: fixed;
    left: 50%; bottom: 20px; right: auto;
    transform: translateX(-50%);
    width: auto; height: auto;
    padding: 0; border: 0;
    background: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    z-index: 45;
  }
  .dock {
    gap: 6px;
    padding: 8px 10px;
    border-radius: 24px;
    background: var(--acrylic);
    border: 1px solid var(--stroke-2);
    backdrop-filter: blur(50px) saturate(130%);
    -webkit-backdrop-filter: blur(50px) saturate(130%);
    box-shadow: 0 12px 36px rgba(0,0,0,.7);
  }
  .dock button { width: 44px; height: 44px; border-radius: 13px; font-size: 19px; background: rgba(255,255,255,.07); }
  .dock button.running::after { display: none; }

  .phone-home {
    display: block;
    position: fixed; z-index: 130;
    bottom: 7px; left: 50%;
    transform: translateX(-50%);
    width: 132px; height: 5px;
    border-radius: 5px;
    background: rgba(255,255,255,.5);
    cursor: pointer;
  }
  .phone-home:active { background: rgba(255,255,255,.85); }

  .window {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-width: 0;
    left: 0 !important; top: 0 !important;
    border: 0; border-radius: 0;
    background: #141414;
    z-index: 100;
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    animation: sheetUp .28s var(--ease-fluent);
  }
  .window:not(.active) { filter: none; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
  .window.closing { animation: sheetDown .18s ease forwards; }
  @keyframes sheetDown { to { transform: translateY(100%); opacity: .6; } }

  .bar { height: 52px; padding: 0 8px 0 16px; }
  .bar .bar-ic { width: 22px; height: 22px; font-size: 16px; }
  .bar-title { font-size: 15px; font-weight: 600; color: var(--tx); }
  .bar-title small { display: none; }
  .bar-btns .min, .bar-btns .max { display: none; }
  .bar-btns .x { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.09); margin: 8px; }
  .bar-btns .x .ic { width: 14px; height: 14px; }

  .content { margin: 0; border-radius: 0; padding: 18px 18px 44px; background: transparent; }
  body.has-window .taskbar { display: none; }

  #palette { padding-top: 8vh; }
  .toast { bottom: 92px; right: 12px; left: 12px; }
}

/* ==========================================================================
   MOTION PREFERENCES
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .wp-bloom, .wp-rays { animation: none; }
}
