/* ============================================================
   CLOSE QUARTERS: Win98-desktop theme (on top of 98.css)
   ============================================================ */
:root {
  --navy: #000080;
  --teal: #008080;
  --silver: #c0c0c0;
  --taskbar-h: 30px;
  --wallpaper: none;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Pixelated MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 11px;
  background: var(--teal);
  overflow: hidden;
  -webkit-font-smoothing: none;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* ---------- desktop + wallpaper ---------- */
.desktop {
  position: fixed; inset: 0 0 var(--taskbar-h) 0;
  background: var(--teal) var(--wallpaper) center / cover no-repeat;
  overflow: hidden;
}
.desktop::after { /* faint CRT scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 9000;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ---------- icons ---------- */
.icons {
  list-style: none; margin: 0; padding: 10px 6px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 78px);
  gap: 4px 6px; height: 100%; width: max-content; position: relative; z-index: 1;
}
.dicon {
  all: unset; box-sizing: border-box; cursor: default;
  width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 2px; text-align: center; color: #fff; text-decoration: none;
}
.dicon svg { width: 32px; height: 32px; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.35)); }
.dicon span {
  font-size: 11px; line-height: 13px; padding: 0 2px;
  text-shadow: 1px 1px 0 #000, 0 0 2px #000;
}
.dicon:focus span, .dicon.is-selected span { background: var(--navy); outline: 1px dotted #ff0; text-shadow: none; }
.dicon:focus svg, .dicon.is-selected svg { filter: drop-shadow(1px 1px 0 rgba(0,0,0,.35)) sepia(1) hue-rotate(190deg) saturate(4) brightness(.8); }

/* ---------- windows ---------- */
.win { position: absolute; display: flex; flex-direction: column; min-width: 200px; max-width: calc(100vw - 8px); box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px grey, inset 2px 2px #fff, 4px 4px 0 rgba(0,0,0,.35); }
.win:not(.is-open) { display: none; }
.win .title-bar { cursor: default; user-select: none; touch-action: none; }
.win:not(.is-active) .title-bar { background: linear-gradient(90deg, #808080, #b5b5b5); }
.win:not(.is-active) .title-bar-text { color: #d4d0c8; }
.title-bar-text { display: flex; align-items: center; gap: 4px; }
.ti { width: 16px; height: 16px; flex: none; }
.window-body { margin: 6px; }
.win > .window-body { flex: 1; min-height: 0; overflow: auto; }
.status-grow { flex: 1; }
.menubar { display: flex; gap: 2px; padding: 2px 4px 0; user-select: none; }
.menubar span { padding: 1px 6px; }
.menubar span:hover { background: var(--navy); color: #fff; }
.sunken {
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  background: #fff;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

/* sizes */
.win--player { width: 440px; }
.win--cd { width: 560px; }
.win--readme { width: 420px; height: 330px; }
.win--buddy { width: 232px; }
.win--im { width: 380px; }
.win--mail { width: 330px; }
.win--photo { width: 520px; }
.win--dialog { width: 340px; }
.win--profile { width: 300px; }

/* ---------- media player ---------- */
.screen {
  position: relative; height: 240px; overflow: hidden;
  background: #000; border: 2px inset #808080;
  display: grid; place-items: end center; padding-bottom: 30px;
}
.screen__art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  object-position: 50% 4%;
  opacity: .78; filter: saturate(1.25) contrast(1.1);
}
.screen__fx {
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.45) 0 2px, transparent 2px 4px),
    linear-gradient(180deg, transparent 45%, rgba(0,0,0,.7) 100%),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.6));
}
.glitch {
  position: relative; z-index: 2;
  font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
  font-size: 52px; letter-spacing: -1px; line-height: 1; color: #f2e33a;
  text-shadow: 3px 3px 0 #000;
  transform: scaleY(1.15);
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
}
.glitch::before { color: #ff00c8; transform: translate(-3px, 0); mix-blend-mode: screen; clip-path: inset(0 0 60% 0); animation: gl1 2.8s steps(1) infinite; }
.glitch::after  { color: #00f0ff; transform: translate(3px, 0);  mix-blend-mode: screen; clip-path: inset(55% 0 0 0); animation: gl2 3.4s steps(1) infinite; }
@keyframes gl1 { 0%,86%,100% { clip-path: inset(0 0 100% 0); } 88% { clip-path: inset(10% 0 55% 0); transform: translate(-6px,0); } 92% { clip-path: inset(40% 0 30% 0); transform: translate(5px,0); } }
@keyframes gl2 { 0%,80%,100% { clip-path: inset(100% 0 0 0); } 83% { clip-path: inset(60% 0 10% 0); transform: translate(6px,0); } 90% { clip-path: inset(20% 0 65% 0); transform: translate(-4px,0); } }
.screen__sub {
  position: absolute; left: 0; right: 0; bottom: 8px; z-index: 2; text-align: center;
  font-family: "Courier New", monospace; font-size: 12px; letter-spacing: 3px; color: #9fff9f;
  text-shadow: 0 0 4px #3f3;
}
.screen.is-playing .screen__art { animation: drift 18s ease-in-out infinite alternate; transform-origin: 50% 10%; }
@keyframes drift { to { transform: scale(1.06); } }

.transport { display: flex; align-items: center; gap: 4px; margin: 6px 0; }
.transport button { min-width: 30px; padding: 0 6px; font-size: 12px; }
.seek { flex: 1; height: 16px; position: relative; cursor: pointer; background: #fff; }
.seek i { position: absolute; left: 2px; top: 2px; bottom: 2px; width: 0; max-width: calc(100% - 4px);
  background: repeating-linear-gradient(90deg, var(--navy) 0 8px, transparent 8px 10px); }

.tabs { margin-top: 4px; }
.tabpanel { margin-top: -2px; }
.tabpanel .window-body { margin: 6px; }
.embed-holder { background: #000; min-height: 80px; }
.embed-holder iframe { display: block; border: 0; }
.vol-label { margin-left: auto; }
#sdk-vol { width: 90px; }

/* ---------- CD burner ---------- */
.cd-grid { display: grid; grid-template-columns: 150px 1fr; gap: 8px; }
.cd-art { padding: 3px; align-self: start; }
.cd-art img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.cd-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cd-meta { margin: 0; color: #444; }
.cd-table { height: 220px; overflow: auto; }
.cd-table table { width: 100%; }
.cd-table td:first-child, .cd-table th:first-child { width: 26px; text-align: right; }
.cd-table td:last-child { width: 44px; text-align: right; }
.cd-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.cd-table td:nth-child(2) { width: 50%; }
.cd-table tr.is-playing td { font-weight: bold; }
.cd-table tr.is-playing td:first-child::before { content: "♪ "; }
.cd-actions { flex-wrap: wrap; gap: 4px; }
.cd-links { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.cd-links a { color: #000; }

/* ---------- notepad ---------- */
.win--readme .window-body { margin: 0 2px 2px; display: flex; }
.notepad {
  flex: 1; width: 100%; resize: none; padding: 6px 8px;
  font-family: "Pixelated MS Sans Serif", Tahoma, sans-serif; font-size: 13px; line-height: 1.45;
  border: 0; box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

/* ---------- buddy list ---------- */
.buddy-banner { display: flex; gap: 6px; align-items: center; padding: 6px; margin-bottom: 6px; background: linear-gradient(90deg, #000080, #1084d0); color: #fff; }
.buddy-banner svg { width: 28px; height: 28px; }
.buddy-tree { height: 200px; overflow: auto; }
.buddy-tree details summary { font-weight: bold; }
.buddy-tree .bud { display: flex; align-items: center; gap: 4px; cursor: default; padding: 1px 2px; }
.buddy-tree .bud:hover, .buddy-tree .bud:focus { background: var(--navy); color: #fff; outline: none; }
.buddy-tree .dot { width: 8px; height: 8px; background: #2c2; border: 1px solid #000; flex: none; }
.buddy-tree .away { color: #808080; font-style: italic; }
.buddy-actions { margin-top: 6px; justify-content: space-between; }

/* ---------- profile ---------- */
.profile-photo { padding: 3px; }
.profile-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.profile-away { margin: 6px 0 0; padding: 6px; background: #ffffe1; border: 1px solid #000; }

/* ---------- IM ---------- */
.im-log { height: 180px; overflow: auto; padding: 6px; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.4; }
.im-log p { margin: 0 0 4px; word-wrap: break-word; }
.im-log .sn { font-weight: bold; }
.im-log .sn--band { color: #00f; }
.im-log .sn--you { color: #f00; }
.im-log .sn--fan { color: #c00; }
.im-log .meta { color: #808080; font-size: 11px; }
.im-log .sys { color: #808080; font-style: italic; }
.im-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.im-form .field-row input { min-width: 0; flex: 1; }
.im-form textarea { width: 100%; resize: vertical; font-family: Arial, sans-serif; font-size: 12px; }
.im-send { justify-content: space-between; }
.im-status { margin: 0; color: #444; }

/* ---------- dialogs ---------- */
.dialog-row { display: flex; gap: 12px; align-items: flex-start; margin: 6px 4px 12px; }
.dialog-row p { margin: 4px 0 0; line-height: 1.4; }
.dialog-icon { width: 32px; height: 32px; flex: none; }
.dialog-buttons { display: flex; justify-content: center; gap: 8px; margin: 8px 0 2px; }
.dialog-buttons button { min-width: 75px; }
.field-row-stacked input { width: 100%; }

/* ---------- photo ---------- */
.photo-frame { padding: 3px; }
.photo-frame img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; }

/* ---------- taskbar ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 10000;
  display: flex; align-items: center; gap: 4px; padding: 2px 3px;
  background: var(--silver); box-shadow: inset 0 1px #dfdfdf, inset 0 2px #fff;
}
.start { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 0 6px; height: 24px; }
.start svg { width: 16px; height: 16px; }
.start.is-on { box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px grey; }
.tasks { flex: 1; display: flex; gap: 3px; min-width: 0; overflow: hidden; }
.task {
  display: inline-flex; align-items: center; gap: 4px; justify-content: flex-start;
  min-width: 0; width: 150px; flex: 0 1 150px; height: 24px; padding: 0 6px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task svg { width: 16px; height: 16px; flex: none; }
.task span { overflow: hidden; text-overflow: ellipsis; }
.task.is-active {
  font-weight: bold;
  background: repeating-conic-gradient(#fff 0 25%, var(--silver) 0 50%) 0 0 / 2px 2px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px grey;
}
.tray { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; background: var(--silver); }
.tray__eq { display: inline-flex; gap: 1px; align-items: flex-end; height: 12px; }
.tray__eq i { width: 3px; height: 3px; background: #008000; }
.tray__eq.is-on i { animation: eq .6s ease-in-out infinite alternate; }
.tray__eq.is-on i:nth-child(2) { animation-delay: .2s; }
.tray__eq.is-on i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { to { height: 12px; } }

/* ---------- start menu ---------- */
.startmenu { position: fixed; left: 2px; bottom: calc(var(--taskbar-h) - 2px); z-index: 10001; display: flex; padding: 3px; }
.startmenu__side {
  width: 24px; background: linear-gradient(0deg, #000080, #1084d0);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
}
.startmenu__side span { writing-mode: vertical-rl; transform: rotate(180deg); color: #c0c0c0; font-size: 18px; font-family: "Arial Black", Arial, sans-serif; letter-spacing: 1px; }
.startmenu__side b { color: #fff; }
.startmenu__items { list-style: none; margin: 0; padding: 0; min-width: 190px; }
.startmenu__items button, .startmenu__items a {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 4px 18px 4px 6px; cursor: default; color: #000; font-size: 11px;
}
.startmenu__items svg { width: 24px; height: 24px; flex: none; }
.startmenu__items button:hover, .startmenu__items a:hover,
.startmenu__items button:focus-visible, .startmenu__items a:focus-visible { background: var(--navy); color: #fff; }
.startmenu__items .sep { height: 2px; margin: 3px 2px; border-top: 1px solid grey; border-bottom: 1px solid #fff; }

/* ---------- shutdown ---------- */
.shutdown {
  position: fixed; inset: 0; z-index: 20000; background: #000; color: #ff8c00;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-family: Arial, sans-serif; cursor: pointer;
}
.shutdown p { font-size: clamp(22px, 4vw, 40px); margin: 0 0 20px; line-height: 1.3; }
.shutdown small { color: #555; font-size: 12px; }

/* ---------- small screens: windows stack, desktop scrolls ---------- */
@media (max-width: 760px) {
  body { overflow: auto; }
  .desktop { position: relative; inset: auto; min-height: 100vh; padding: 8px 8px calc(var(--taskbar-h) + 12px); overflow: visible; background-attachment: fixed; }
  .icons { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(auto-fill, 76px); width: auto; height: auto; justify-content: center; padding: 4px 0 10px; }
  .win { position: relative !important; left: auto !important; top: auto !important; width: 100% !important; max-width: none; margin: 0 0 12px; }
  .win.is-minimized { display: none; }
  .win--readme { height: 300px; }
  .cd-grid { grid-template-columns: 90px 1fr; }
  .glitch { font-size: 46px; }
  .screen { height: 180px; }
  .task { width: 40px; flex-basis: 40px; }
  .task span { display: none; }
  #w-alert { display: none; }
}

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