/* ==========================================================================
   retro.css — beveled 90s chrome for the tools and games, plus the easter eggs.
   Aero lives in vista.css; this is the stuff that never got the memo.
   ========================================================================== */

:root {
  --face:   #c0c0c0;
  --lite:   #ffffff;
  --shade:  #808080;
  --dark:   #404040;
  --led-bg: #1a0000;
  --led-on: #ff2d2d;
}

/* ---------- bevel primitives ---------- */
.sunken {
  border: 2px solid;
  border-color: var(--shade) var(--lite) var(--lite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 #dfdfdf;
}

.retro-menubar {
  background: var(--face);
  border-bottom: 1px solid var(--shade);
  color: #000;
  padding: 3px 4px;
}
.retro-menubar button {
  color: #000; border-radius: 0; padding: 2px 9px;
  border: 1px solid transparent;
}
.retro-menubar button:hover { background: #000080; color: #fff; border-color: transparent; }
.retro-menubar button.on { background: #000080; color: #fff; }

/* ==========================================================================
   Minesweeper
   ========================================================================== */
.ms-stage {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10px;
  background: var(--face);
  overflow: auto;
}
.ms-outer {
  background: var(--face);
  border: 3px solid;
  border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  padding: 6px;
}
.ms-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--face);
  padding: 5px 6px; margin-bottom: 6px;
}
.led {
  font-family: "DSEG7", "Consolas", "Lucida Console", monospace;
  font-size: 23px; line-height: 1;
  letter-spacing: 2px;
  color: var(--led-on);
  background: var(--led-bg);
  padding: 2px 4px;
  border: 1px solid;
  border-color: var(--shade) var(--lite) var(--lite) var(--shade);
  text-shadow: 0 0 7px rgba(255,45,45,.75);
  font-variant-numeric: tabular-nums;
}
.ms-face {
  width: 30px; height: 30px; padding: 0;
  background: var(--face);
  border: 2px solid;
  border-color: var(--lite) var(--shade) var(--shade) var(--lite);
  display: grid; place-items: center;
}
.ms-face:active { border-color: var(--shade) var(--lite) var(--lite) var(--shade); }
.ms-face svg { width: 22px; height: 22px; }

.ms-board {
  display: grid;
  background: var(--face);
  align-content: start;
}
.ms-cell {
  width: 22px; height: 22px; padding: 0;
  background: var(--face);
  border: 2px solid;
  border-color: var(--lite) var(--shade) var(--shade) var(--lite);
  font: 700 14px/1 "Tahoma", "Segoe UI", sans-serif;
  display: grid; place-items: center;
  color: transparent;
  user-select: none;
}
.ms-cell:hover { background: #cdcdcd; }
.ms-cell.rev {
  border: 1px solid #9a9a9a;
  background: var(--face);
  cursor: default;
}
.ms-cell.rev:hover { background: var(--face); }
.ms-cell.blast { background: #e03127; }
.ms-cell.wrongflag { position: relative; }
.ms-cell.wrongflag::after {
  content: ""; position: absolute; inset: 2px;
  background:
    linear-gradient(45deg, transparent 43%, #c0281c 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, #c0281c 43% 57%, transparent 57%);
}
.ms-cell svg { width: 15px; height: 15px; }

/* ==========================================================================
   Command Prompt
   ========================================================================== */
.cmd {
  flex: 1 1 auto; min-height: 0;
  position: relative;
  background: #000;
  color: #cfd6dc;
  font-family: "Consolas", "Lucida Console", "DejaVu Sans Mono", monospace;
  font-size: 13px; line-height: 1.42;
  cursor: text;
}
.cmd-scroll { position: absolute; inset: 0; overflow: auto; padding: 8px 10px 14px; }
.cmd-out { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: inherit; }
.cmd-line { display: flex; align-items: baseline; gap: 6px; }
.cmd-prompt { white-space: pre; color: inherit; }
.cmd-in {
  flex: 1 1 auto; min-width: 0;
  background: none; border: 0; outline: none;
  font: inherit; color: inherit;
  caret-color: #cfd6dc;
  padding: 0;
}
.cmd .rain {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
}
.cmd ::-webkit-scrollbar-track { background: #111; border: 0; }
.cmd ::-webkit-scrollbar-thumb { background: #3a3a3a; border-color: #555; }

/* ==========================================================================
   Task Manager
   ========================================================================== */
.tm {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--face); color: #000;
  padding: 6px;
}
.tm-tabs { display: flex; gap: 2px; padding: 2px 2px 0; }
.tm-tab {
  padding: 4px 14px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--lite) var(--shade) transparent var(--lite);
  border-radius: 3px 3px 0 0;
  font-size: 12px; color: #000;
}
.tm-tab.on { background: #d4d4d4; font-weight: 600; padding-bottom: 6px; }
.tm-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 2px 2px; }
.tm-list { flex: 1 1 auto; min-height: 0; overflow: auto; background: #fff; }
.tm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px; font-size: 12px;
  border-bottom: 1px solid #ededed;
}
.tm-row span:first-child { flex: 1 1 auto; min-width: 0; }
.tm-row .tm-name { display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-row .tm-name svg { width: 16px; height: 16px; flex: 0 0 16px; }
.tm-row .tm-state { flex: 0 0 90px; color: #4a4a4a; }
.tm-head { background: #eaeaea; font-weight: 600; position: sticky; top: 0; }
.tm-row.sel { background: #0a246a; color: #fff; }
.tm-row.sel .tm-state { color: #cfd9ef; }
.tm-empty { padding: 20px; text-align: center; color: #666; font-size: 12px; }
.tm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tm-graphs { display: flex; gap: 12px; flex-wrap: wrap; }
.tm-glabel { font-size: 11px; margin-bottom: 4px; }
.tm-graphs canvas { display: block; background: #04120a; max-width: 100%; }
.tm-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 14px;
  font-size: 11.5px; padding: 8px; background: #fff;
  border: 2px solid; border-color: var(--shade) var(--lite) var(--lite) var(--shade);
}
.tm-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
  margin-top: 2px;
}
.tm-totals fieldset {
  border: 1px solid var(--shade); border-top-color: var(--shade);
  margin: 0; padding: 6px 10px 8px;
  box-shadow: inset 1px 1px 0 var(--lite);
}
.tm-totals legend { font-size: 11px; padding: 0 4px; }
.tm-totals div {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11.5px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.tm-totals b { font-weight: 400; }

.tm-status {
  flex: 0 0 auto; margin-top: 6px; padding: 4px 8px;
  font-size: 11px; color: #222;
  border: 2px solid; border-color: var(--shade) var(--lite) var(--lite) var(--shade);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Disk Defragmenter
   ========================================================================== */
.dfg {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 12px;
  background: var(--face); color: #000;
  overflow: auto;
}
.dfg-title { font-size: 13px; font-weight: 700; }
.dfg-sect { font-size: 11.5px; }
.dfg-map {
  display: grid; gap: 1px;
  background: #ffffff; padding: 3px;
  height: 86px;
}
.dfg-map i { display: block; border-radius: 0; }
.dfg-map .c0 { background: #ffffff; box-shadow: inset 0 0 0 1px #e4e4e4; }
.dfg-map .c1 { background: #d83a2c; }
.dfg-map .c2 { background: #2f7fc4; }
.dfg-map .c3 { background: #57b45f; }
.dfg-status { font-size: 11.5px; min-height: 30px; line-height: 1.4; }
.dfg-bar { height: 18px; background: #fff; padding: 2px; }
.dfg-bar i {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, #2f7fc4 0 9px, #c0c0c0 9px 12px);
  transition: width .18s linear;
}
.dfg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dfg-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; margin-top: 2px; }
.dfg-legend span { display: flex; align-items: center; gap: 6px; }
.dfg-legend i { width: 12px; height: 12px; display: block; border: 1px solid #8a8a8a; }
.dfg-legend .k1 { background: #d83a2c; } .dfg-legend .k2 { background: #2f7fc4; }
.dfg-legend .k3 { background: #fff; }    .dfg-legend .k4 { background: #57b45f; }

/* ==========================================================================
   Paint
   ========================================================================== */
.pnt { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: var(--face); }
.pnt-tools { display: flex; align-items: center; gap: 4px; padding: 5px 6px; }
.pnt-tool {
  width: 28px; height: 28px; font-size: 15px; color: #000;
  background: var(--face);
  border: 2px solid; border-color: var(--lite) var(--shade) var(--shade) var(--lite);
}
.pnt-tool.on { border-color: var(--shade) var(--lite) var(--lite) var(--shade); background: #b0b0b0; }
.pnt-sizes { display: flex; gap: 3px; margin-left: 10px; }
.pnt-size {
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--face);
  border: 2px solid; border-color: var(--lite) var(--shade) var(--shade) var(--lite);
}
.pnt-size.on { border-color: var(--shade) var(--lite) var(--lite) var(--shade); background: #b0b0b0; }
.pnt-size i { display: block; background: #000; border-radius: 50%; }
.pnt-stage { flex: 1 1 auto; min-height: 0; margin: 0 6px; background: #808080; overflow: auto; }
.pnt-canvas { display: block; width: 100%; height: auto; background: #fff; cursor: crosshair; touch-action: none; }
.pnt-palette { display: flex; align-items: center; gap: 3px; padding: 6px; flex-wrap: wrap; }
.pnt-palette .spacer { flex: 1 1 auto; }
.pnt-swatch { width: 18px; height: 18px; border: 1px solid #6b6b6b; padding: 0; }
.pnt-current {
  position: relative; width: 34px; height: 28px; margin-right: 8px;
}
.pnt-current i {
  position: absolute; width: 18px; height: 18px; border: 1px solid #6b6b6b; display: block;
}
.pnt-current .fg { left: 0; top: 0; background: #000; z-index: 2; }
.pnt-current .bg { left: 12px; top: 8px; background: #fff; }

/* ==========================================================================
   Pinball
   ========================================================================== */
.pb {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  background: radial-gradient(120% 90% at 50% 0%, #10293c, #05121c 70%);
}
.pb-stage {
  flex: 1 1 auto; min-height: 0;
  display: grid; place-items: center;
  padding: 6px;
  overflow: hidden;
}
/* sized in JS by a ResizeObserver so the drawing surface and the CSS box stay
   in exact proportion — pointer coordinates depend on it */
.pb-canvas {
  display: block;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 10px 34px rgba(0,0,0,.6);
  border-radius: 3px;
}
.pb-touch { display: none; }
.pb-btn {
  flex: 1 1 0; padding: 14px 8px;
  border-radius: 7px;
  border: 1px solid rgba(180,220,255,.35);
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.04));
  color: #dff0ff; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  touch-action: none; user-select: none;
}
.pb-btn:active { background: linear-gradient(180deg, rgba(160,215,255,.5), rgba(60,130,200,.25)); }

@media (hover: none), (pointer: coarse) {
  .pb-touch { display: flex; gap: 8px; padding: 8px; flex: 0 0 auto; }
}

/* ==========================================================================
   Blue screen
   ========================================================================== */
#bsod {
  position: absolute; inset: 0; z-index: 975;
  background: #0a16a8;
  color: #e8ecff;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 5vw, 60px);
  cursor: pointer;
  animation: bsodIn .12s steps(2) both;
}
@keyframes bsodIn { from { opacity: 0; } to { opacity: 1; } }
#bsod pre {
  margin: 0; max-width: 78ch;
  font-family: "Consolas", "Lucida Console", monospace;
  font-size: clamp(11px, 1.35vw, 15px);
  line-height: 1.45;
  white-space: pre-wrap;
}

/* ==========================================================================
   Overlays: card cascade + screensaver
   ========================================================================== */
#cascade {
  position: absolute; left: 0; top: 0;
  z-index: 930;
  pointer-events: auto;
  transition: opacity .2s linear;
}
#saver {
  position: fixed; inset: 0;
  z-index: 952;
  background: #000;
  cursor: none;
}

/* ==========================================================================
   Flip — the desktop assistant
   ========================================================================== */
#assistant {
  position: absolute; right: 18px; bottom: calc(var(--taskbar-h) + 18px);
  z-index: 74;
  width: 232px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  animation: flipIn .35s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes flipIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
.as-bubble {
  position: relative;
  background: #fffce8;
  border: 1px solid #b8ad7a;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px; line-height: 1.45; color: #3a3320;
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}
.as-bubble::after {
  content: ""; position: absolute; right: 26px; bottom: -8px;
  border: 8px solid transparent; border-top-color: #fffce8;
  filter: drop-shadow(0 1px 0 #b8ad7a);
}
.as-bubble.pop { animation: asPop .22s ease both; }
@keyframes asPop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
.as-body {
  position: relative;
  width: 74px; height: 74px;
  background: none; border: 0; padding: 0;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.45));
  animation: asBob 3.4s ease-in-out infinite;
}
.as-body:active { cursor: grabbing; }
@keyframes asBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
.as-body svg { width: 74px; height: 74px; display: block; }
.as-close {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid #8fa3b4;
  background: #eef4fa; color: #33475a;
  font-size: 13px; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  z-index: 3;
}
.as-close:hover { background: #ffd8d2; border-color: #d07a6c; color: #8a2718; }
.as-wrap { position: relative; }

@media (prefers-reduced-motion: reduce) {
  .as-body { animation: none; }
}

@media (max-width: 680px) {
  #assistant { width: 190px; right: 10px; }
  .as-body, .as-body svg { width: 60px; height: 60px; }
  .ms-stage { padding: 6px; }
  .tm-graphs { flex-direction: column; }
}
