/* ==========================================================================
   LAME OS — the desktop he actually works on
   ========================================================================== */

.os {
  position: relative;
  border: 1px solid var(--ink-500);
  border-radius: var(--r-3);
  background:
    radial-gradient(70% 50% at 22% 8%, rgba(120,136,112,.10), transparent 70%),
    linear-gradient(180deg, #0d100b, #080a07);
  box-shadow: var(--sh-3), inset 0 0 0 1px rgba(255,255,255,.02);
  overflow: hidden;
  display: grid; grid-template-rows: 1fr auto; grid-template-columns: minmax(0, 1fr);
  height: clamp(560px, 82vh, 780px);
  isolation: isolate;
}

/* faint wallpaper: grid + a big coin ghost */
.os::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(120,136,112,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,136,112,.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 100%);
}
.os__wallmark {
  position: absolute; right: -4%; bottom: 8%; width: min(46%, 420px);
  opacity: .05; pointer-events: none; filter: grayscale(1) contrast(1.2);
}

.os__stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }

/* --- desktop icons ------------------------------------------------------ */
.os__icons {
  position: absolute; inset: 0; z-index: 1;
  display: grid; align-content: start; justify-content: start;
  grid-auto-flow: column; grid-template-rows: repeat(5, auto);
  gap: 2px 6px;
  padding: var(--s-4);
  pointer-events: none;
}
.dicon {
  pointer-events: auto;
  width: 100px; padding: 10px 4px 8px;
  display: grid; justify-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-2);
  text-align: center;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.dicon:hover, .dicon:focus-visible { background: rgba(120,136,112,.1); border-color: rgba(120,136,112,.25); }
.dicon__glyph {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--ink-500); border-radius: var(--r-2);
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  color: var(--sage-400);
  box-shadow: var(--sh-1);
}
.dicon__glyph svg { width: 20px; height: 20px; }
.dicon__glyph img { width: 26px; height: 26px; }
.dicon--secret .dicon__glyph { color: var(--rust-400); border-color: var(--rust-600); }
.dicon__name {
  font-size: 10px; letter-spacing: .03em; color: var(--bone-300);
  text-transform: uppercase; line-height: 1.3;
  overflow-wrap: normal; hyphens: none;
}

/* --- windows ------------------------------------------------------------ */
.os__windows { position: absolute; inset: 0; z-index: 2; pointer-events: none; min-width: 0; }

.win {
  position: absolute; pointer-events: auto;
  width: min(440px, 84%); min-width: 0;

  background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
  border: 1px solid var(--ink-500);
  border-radius: var(--r-2);
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.5);
  display: grid; grid-template-rows: auto 1fr;
  max-height: calc(100% - 24px);
  /* No fill-mode: a window whose animation never runs must still be visible
     rather than stuck on the opacity-0 first frame. */
  animation: win-in 200ms var(--ease-out);
}
.win[hidden] { display: none !important; }
.win--wide { width: min(600px, 92%); }
.win:focus { outline: none; }
/* An unfocused window recedes; the focused one gets the screen light. */
.win:not(.is-focused) { opacity: .84; }
.win.is-focused {
  opacity: 1;
  border-color: var(--sage-600);
  box-shadow: 0 28px 70px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(120,136,112,.22);
}
.win.is-closing { animation: win-out 180ms var(--ease) both; pointer-events: none; }
@keyframes win-in  { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes win-out { to { opacity: 0; transform: translateY(4px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .win, .win.is-closing { animation: none; }
  .win:not(.is-focused) { opacity: 1; }
}

.win__bar {
  display: flex; align-items: center; gap: var(--s-2);
  height: 32px; padding-inline: 10px;
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-2) var(--r-2) 0 0;
  cursor: grab; user-select: none; touch-action: none;
}
.win__bar:focus-visible {
  outline: 2px solid var(--gold-300); outline-offset: -2px;
}
.win.is-dragging .win__bar { cursor: grabbing; }
.win__name {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--bone-300); font-weight: 500;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.win__actions { margin-left: auto; display: flex; gap: 4px; }
.win__btn {
  width: 20px; height: 18px; display: grid; place-items: center;
  border: 1px solid var(--ink-500); border-radius: 2px;
  color: var(--bone-400); font-size: 11px; line-height: 1;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.win__btn:hover { background: var(--ink-600); color: var(--bone-100); }
.win__btn--close:hover { background: var(--rust-600); color: #fff; border-color: var(--rust-400); }

.win__body {
  padding: var(--s-4);
  overflow: auto; overscroll-behavior: contain; min-height: 0; min-width: 0;
  scrollbar-width: thin; scrollbar-color: var(--ink-500) transparent;
  font-size: var(--t-sm);
}
.win__body::-webkit-scrollbar { width: 8px; }
.win__body::-webkit-scrollbar-thumb { background: var(--ink-500); border-radius: var(--r-pill); }
.win__body > * + * { margin-top: var(--s-3); }
.win__body p { color: var(--bone-400); line-height: 1.7; }
.win__body .win-h {
  margin: 0; font-size: var(--t-xs); letter-spacing: .16em; text-transform: uppercase;
  color: var(--bone-500); font-weight: 500;
}

/* --- taskbar ------------------------------------------------------------ */
.os__bar {
  position: relative; z-index: 3;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px 8px;
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  border-top: 1px solid var(--ink-500);
}
.os__start {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--ink-500); border-radius: var(--r-1);
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
  color: var(--gold-300);
}
.os__start:hover { background: var(--ink-600); }
.os__start img { width: 15px; height: 15px; }
.os__tasks { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.os__tasks::-webkit-scrollbar { display: none; }
.os__task {
  padding: 5px 9px; border: 1px solid var(--ink-500); border-radius: var(--r-1);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--bone-400);
  white-space: nowrap;
}
.os__task:hover { background: var(--ink-600); color: var(--bone-100); }
.os__task.is-active { color: var(--bone-100); border-color: var(--sage-600); background: var(--ink-600); }
/* minimised: still open, just put away */
.os__task.is-min { color: var(--bone-500); border-style: dashed; }
.os__task.is-min::before { content: "2  "; color: var(--gold-500); }
.os__tray {
  display: flex; align-items: center; gap: var(--s-3); flex: none;
  font-size: 10px; letter-spacing: .1em; color: var(--bone-500); text-transform: uppercase;
  padding-left: var(--s-3); border-left: 1px solid var(--ink-500);
}
.os__tray .os__clock { font-variant-numeric: tabular-nums; color: var(--sage-400); }
@media (max-width: 560px) { .os__tray .os__hidesm { display: none; } }

/* --- window inner widgets ---------------------------------------------- */
.notes__list { display: grid; gap: 2px; }
.notes__item {
  display: grid; grid-template-columns: 18px 1fr; gap: var(--s-2); align-items: start;
  padding: 7px 6px; border-radius: var(--r-1); text-align: left; width: 100%;
  transition: background var(--dur-1) var(--ease);
}
.notes__item:hover { background: var(--ink-700); }
.notes__box {
  width: 14px; height: 14px; margin-top: 2px;
  border: 1px solid var(--ink-500); border-radius: 2px;
  display: grid; place-items: center; color: var(--go-400); font-size: 10px; line-height: 1;
}
.notes__text { color: var(--bone-200); line-height: 1.5; }
.notes__item[aria-checked="true"] .notes__text { color: var(--bone-500); text-decoration: line-through; }
.notes__item[aria-checked="true"] .notes__box { border-color: var(--sage-600); }

.feed { display: grid; gap: var(--s-2); }
.feed__item {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s-3);
  padding: 9px 10px; background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--r-2);
}
.feed__app { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-500); }
.feed__msg { color: var(--bone-200); line-height: 1.5; }
.feed__time { font-size: 9px; color: var(--bone-500); letter-spacing: .1em; }
.feed__avatar { width: 26px; height: 26px; border-radius: var(--r-1); background: var(--ink-600); display: grid; place-items: center; overflow: hidden; }

.poseview { display: grid; gap: var(--s-3); justify-items: center; }
.poseview__stage {
  height: 190px; display: grid; place-items: center; width: 100%;
  background: radial-gradient(60% 60% at 50% 60%, rgba(120,136,112,.09), transparent 70%);
  border: 1px solid var(--line); border-radius: var(--r-2);
}
.poseview__stage img { height: 170px; width: auto; }
.poseview__pads { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.poseview__pad {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid var(--ink-500); border-radius: var(--r-1); color: var(--bone-400);
}
.poseview__pad:hover { color: var(--bone-100); background: var(--ink-700); }
.poseview__pad.is-on { color: var(--ink-950); background: var(--gold-400); border-color: var(--gold-300); font-weight: 700; }

.bigstat { display: grid; gap: 2px; justify-items: center; padding-block: var(--s-3); }
.bigstat__num {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 8vw, 3rem);
  color: var(--gold-300); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.bigstat__cap { font-size: var(--t-xs); letter-spacing: .16em; text-transform: uppercase; color: var(--bone-500); }

.win .term__out { height: 210px; }
.win .console { border-radius: var(--r-2); }

/* --- stacked windows on small screens ---------------------------------- */
@media (max-width: 860px) {
  .os { height: auto; }
  .os__stage { overflow: visible; }
  .os__icons {
    position: static; inset: auto;
    grid-auto-flow: row; grid-template-rows: none;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: var(--s-2); padding: var(--s-3);
  }
  .dicon { width: auto; }
  .os__windows {
    position: static; inset: auto; pointer-events: auto;
    display: grid; gap: var(--s-3); padding: 0 var(--s-3) var(--s-3);
  }
  .os__windows:empty { padding: 0; }
  .win {
    position: static !important;
    width: auto !important;
    transform: none !important;
    max-height: none;
    left: auto !important; top: auto !important;
  }
  .win__bar { cursor: default; }
  .win__body { max-height: 62vh; }
  /* Stacked windows are a list, not a desk: nothing should look receded. */
  .win:not(.is-focused) { opacity: 1; }
  .win.is-focused { box-shadow: 0 24px 60px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(120,136,112,.22); }
  .os__wallmark { display: none; }
}
