/* ═══════════════════════════════════════════════
   BASE RESET & FONTS
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --win95-gray: #c0c0c0;
  --win95-dark: #808080;
  --win95-teal: #008080;
  --win95-blue: #000080;
  --win95-white: #ffffff;
  --win95-black: #000000;
  --win95-light: #dfdfdf;
  --accent-hot: #ff6600;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'VT323', monospace;
  --font-sys: 'Microsoft Sans Serif', 'Tahoma', sans-serif;
  --taskbar-h: 42px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sys);
  font-size: 12px;
  user-select: none;
  cursor: default;
}

/* ═══════════════════════════════════════════════
   BOOT SCREEN
═══════════════════════════════════════════════ */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  text-align: center;
  width: 420px;
}

.boot-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

.boot-logo-flag {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  font-size: 22px;
  line-height: 1;
}
.flag-r { color: #e74c3c; }
.flag-g { color: #2ecc71; }
.flag-b { color: #3498db; }
.flag-y { color: #f1c40f; }

.boot-logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.boot-win {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: #fff;
  letter-spacing: -1px;
}

.boot-95 {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: #aaa;
  margin-top: 2px;
}

.boot-messages {
  font-family: var(--font-mono);
  font-size: 18px;
  color: #ccc;
  text-align: left;
  min-height: 140px;
  margin-bottom: 24px;
  padding: 0 20px;
  line-height: 1.6;
}

.boot-msg-line {
  opacity: 0;
  animation: bootMsgAppear 0.1s ease forwards;
}

.boot-msg-ok {
  color: #2ecc71;
}

.boot-msg-warn {
  color: #f1c40f;
}

@keyframes bootMsgAppear {
  to { opacity: 1; }
}

.boot-progress-wrap {
  background: #1a1a1a;
  border: 1px solid #444;
  height: 18px;
  width: 300px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.boot-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--win95-blue);
  transition: width 0.4s ease;
}

.boot-copy {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #555;
}

/* ═══════════════════════════════════════════════
   DESKTOP
═══════════════════════════════════════════════ */
#desktop {
  position: fixed;
  inset: 0;
  bottom: var(--taskbar-h);
  background-color: var(--win95-teal);
  overflow: hidden;
}

/* Subtle noise texture on teal */
#desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* CRT scanlines overlay */
.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.04) 0px,
    rgba(0,0,0,0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: crtFlicker 8s infinite;
}

.crt-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0,0,0,0.25) 100%);
}

.crt-overlay.hidden {
  display: none;
}

@keyframes crtFlicker {
  0%, 98%, 100% { opacity: 1; }
  99% { opacity: 0.92; }
}

/* Watermark */
.desktop-watermark {
  position: absolute;
  bottom: 30px;
  right: 30px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: rgba(255,255,255,0.08);
  letter-spacing: 3px;
  pointer-events: none;
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   DESKTOP ICONS
═══════════════════════════════════════════════ */
.desktop-icons {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: border-color 0.1s;
}

.desktop-icon:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1);
  animation: iconBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.desktop-icon.selected {
  background: rgba(0, 0, 128, 0.5);
  border-color: rgba(255,255,255,0.6);
}

.desktop-icon .icon-gfx {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.5));
}

.desktop-icon span {
  font-size: 11px;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
  line-height: 1.3;
  word-break: break-word;
}

@keyframes iconBounce {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-10px) scale(1.1); }
  60%  { transform: translateY(-4px) scale(1.02); }
  80%  { transform: translateY(-7px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes iconEntrance {
  0%  { opacity: 0; transform: scale(0) rotate(-20deg); }
  60% { opacity: 1; transform: scale(1.15) rotate(5deg); }
  100%{ opacity: 1; transform: scale(1) rotate(0deg); }
}


/* ═══════════════════════════════════════════════
   WINDOWS - BASE (on top of 98.css .window)
═══════════════════════════════════════════════ */
.desktop-window {
  position: absolute;
  min-width: 280px;
  max-width: 96vw;
  max-height: calc(100vh - var(--taskbar-h) - 20px);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
}

.desktop-window .window-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

/* Window open bounce */
@keyframes winOpen {
  0%   { transform: scale(0.75) translateY(30px); opacity: 0; }
  55%  { transform: scale(1.04) translateY(-4px); opacity: 1; }
  75%  { transform: scale(0.97) translateY(2px); }
  90%  { transform: scale(1.01) translateY(-1px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes winClose {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.7) translateY(20px); opacity: 0; }
}

.win-opening {
  animation: winOpen 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.win-closing {
  animation: winClose 0.18s ease-in forwards;
  pointer-events: none;
}

/* Active (focused) window gets a slightly stronger title bar */
.desktop-window.focused .title-bar {
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
}

/* Title bar drag cursor */
.title-bar {
  cursor: move !important;
}

/* Window menu bar */
.window-menu-bar {
  background: var(--win95-gray);
  border-bottom: 1px solid var(--win95-dark);
  padding: 2px 4px;
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.window-menu-bar span {
  padding: 1px 6px;
  cursor: pointer;
  font-size: 12px;
}

.window-menu-bar span:hover {
  background: var(--win95-blue);
  color: #fff;
}

/* Window body padding variant */
.win-body-pad {
  padding: 8px !important;
}

/* ═══════════════════════════════════════════════
   NOTEPAD WINDOW
═══════════════════════════════════════════════ */
.notepad-body {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.notepad-area {
  flex: 1;
  width: 100%;
  min-height: 260px;
  font-family: var(--font-mono);
  font-size: 17px;
  color: #000;
  background: #fff;
  border: none;
  outline: none;
  resize: none;
  padding: 8px;
  line-height: 1.5;
  cursor: text;
  user-select: text;
}

/* ═══════════════════════════════════════════════
   LINK LIST ROWS (Explorer-style)
═══════════════════════════════════════════════ */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  text-decoration: none;
  color: #000;
  border: 1px solid transparent;
  transition: background 0.08s, border-color 0.08s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.link-row::before {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.4s;
}

.link-row:hover::before {
  left: 100%;
}

.link-row:hover {
  background: var(--win95-blue);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  transform: translateX(3px);
}

.link-row:hover .lr-desc {
  color: rgba(255,255,255,0.8);
}

.link-row:active {
  transform: translateX(1px) scale(0.99);
}

.link-row.featured {
  border-left: 3px solid var(--accent-hot);
}

.lr-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.lr-name {
  font-weight: bold;
  font-size: 13px;
  flex-shrink: 0;
  min-width: 140px;
}

.lr-desc {
  font-size: 12px;
  color: #555;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lr-arrow {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.link-row:hover .lr-arrow {
  color: #fff;
  transform: translateX(4px);
}

/* ═══════════════════════════════════════════════
   CASSETTE DECK (Music window)
═══════════════════════════════════════════════ */
.cassette-deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #1a1a1a;
  border: 2px inset var(--win95-gray);
  padding: 10px 14px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.cassette-reel {
  font-size: 28px;
  color: #888;
  animation: reelSpin 3s linear infinite;
  display: inline-block;
}

.cassette-reel.reel-r {
  animation-direction: reverse;
}

@keyframes reelSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.cassette-label {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 16px;
  color: #fff;
  background: #2a2a2a;
  padding: 4px 12px;
  border: 1px solid #444;
  min-width: 160px;
  line-height: 1.4;
}

.cassette-label small {
  font-size: 12px;
  color: #888;
}

/* ═══════════════════════════════════════════════
   ACCORDION / SLIDING PANELS
═══════════════════════════════════════════════ */
.section-label {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #555;
  margin-bottom: 6px;
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.acc-item {
  border: 1px solid var(--win95-dark);
  background: #fff;
  overflow: hidden;
}

.acc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  cursor: pointer;
  background: var(--win95-gray);
  border-bottom: 1px solid transparent;
  transition: background 0.1s;
}

.acc-header:hover {
  background: #b0b0b0;
}

.acc-item.open .acc-header {
  background: var(--win95-blue);
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.2);
}

.acc-item.open .acc-header .acc-desc {
  color: rgba(255,255,255,0.7);
}

.acc-arrow {
  font-size: 9px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.acc-item.open .acc-arrow {
  transform: rotate(90deg);
}

.acc-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.acc-title {
  font-weight: bold;
  font-size: 13px;
  min-width: 150px;
}

.acc-desc {
  font-size: 12px;
  color: #666;
  flex: 1;
}

.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.35s ease;
  padding: 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  background: #fefefe;
}

.acc-item.open .acc-body {
  max-height: 120px;
  padding: 8px 10px;
}

.acc-open-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  background: var(--win95-gray);
  border: 2px outset var(--win95-gray);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  color: #000;
  transition: border-style 0.05s, transform 0.1s;
}

.acc-open-btn:hover {
  background: #d0d0d0;
  transform: translateY(-1px);
}

.acc-open-btn:active {
  border-style: inset;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════
   ICON GRID (My Computer)
═══════════════════════════════════════════════ */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px;
}

.grid-folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  transition: background 0.1s, border-color 0.1s;
}

.grid-folder:hover {
  background: rgba(0, 0, 128, 0.15);
  border-color: var(--win95-blue);
  animation: iconBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gf-icon {
  font-size: 30px;
  margin-bottom: 4px;
}

.grid-folder span {
  font-size: 11px;
  line-height: 1.3;
}

.grid-folder small {
  font-size: 10px;
  color: #666;
}

/* ═══════════════════════════════════════════════
   ABOUT WINDOW
═══════════════════════════════════════════════ */
.about-content {
  font-size: 12px;
}

.about-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.about-flag {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  font-size: 18px;
  line-height: 1;
}

.about-flag span:nth-child(1) { color: #e74c3c; }
.about-flag span:nth-child(2) { color: #2ecc71; }
.about-flag span:nth-child(3) { color: #3498db; }
.about-flag span:nth-child(4) { color: #f1c40f; }

.about-os-name {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #000080;
}

.about-version {
  font-size: 11px;
  color: #555;
}

.about-content hr {
  border: none;
  border-top: 1px solid var(--win95-dark);
  margin: 8px 0;
}

.about-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.about-table td {
  padding: 3px 6px;
}

.about-table td:first-child {
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  width: 110px;
}

.about-table tr:nth-child(even) {
  background: rgba(0,0,0,0.04);
}

.about-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ═══════════════════════════════════════════════
   FUN DIALOG
═══════════════════════════════════════════════ */
.dialog-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.dialog-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.dialog-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════
   CONTEXT MENU
═══════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  z-index: 9000;
  background: var(--win95-gray);
  border: 2px outset var(--win95-gray);
  min-width: 180px;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  animation: ctxAppear 0.1s ease forwards;
}

@keyframes ctxAppear {
  from { transform: scale(0.9); opacity: 0.5; }
  to   { transform: scale(1); opacity: 1; }
}

.ctx-item {
  padding: 5px 20px 5px 24px;
  font-size: 12px;
  cursor: pointer;
}

.ctx-item:hover {
  background: var(--win95-blue);
  color: #fff;
}

.ctx-separator {
  border-top: 1px solid var(--win95-dark);
  margin: 3px 4px;
}

.ctx-joke {
  font-size: 11px;
  color: #333;
}

/* ═══════════════════════════════════════════════
   TASKBAR
═══════════════════════════════════════════════ */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-h);
  z-index: 9500;
  background: var(--win95-gray);
  border-top: 2px solid var(--win95-white);
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  box-shadow: 0 -2px 0 var(--win95-dark);
}

#start-btn {
  height: 32px;
  padding: 0 10px;
  font-weight: bold;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px outset var(--win95-gray);
  background: var(--win95-gray);
}

#start-btn:hover {
  background: #d0d0d0;
}

#start-btn:active {
  border-style: inset;
}

.start-flag {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  font-size: 8px;
  line-height: 1;
}

#taskbar-divider {
  width: 2px;
  height: 28px;
  border-left: 1px solid var(--win95-dark);
  border-right: 1px solid var(--win95-white);
  flex-shrink: 0;
}

#taskbar-windows {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.taskbar-btn {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border: 2px outset var(--win95-gray);
  background: var(--win95-gray);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: background 0.1s;
}

.taskbar-btn:hover {
  background: #d0d0d0;
}

.taskbar-btn.active {
  border-style: inset;
  background: #b8b8b8;
}

@keyframes taskBtnPop {
  0% { transform: scaleY(0) translateY(10px); opacity: 0; }
  70%{ transform: scaleY(1.1) translateY(-2px); opacity: 1; }
  100%{ transform: scaleY(1) translateY(0); opacity: 1; }
}

.taskbar-btn.new {
  animation: taskBtnPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#system-tray {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 2px inset var(--win95-gray);
  padding-left: 8px;
  flex-shrink: 0;
  height: 100%;
}

.tray-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 2px;
  transition: background 0.1s;
}

.tray-btn:hover {
  background: rgba(0,0,0,0.1);
}

#clock {
  font-family: var(--font-sys);
  font-size: 12px;
  min-width: 50px;
  text-align: center;
  padding: 2px 6px;
  border: 1px inset var(--win95-gray);
  background: var(--win95-gray);
}

/* ═══════════════════════════════════════════════
   START MENU
═══════════════════════════════════════════════ */
#start-menu {
  position: fixed;
  bottom: var(--taskbar-h);
  left: 2px;
  z-index: 9800;
  display: flex;
  background: var(--win95-gray);
  border: 2px outset var(--win95-gray);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.4);
  min-width: 220px;
  animation: startMenuOpen 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: bottom left;
}

@keyframes startMenuOpen {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}

#start-menu.hidden {
  display: none;
}

.sm-sidebar {
  width: 26px;
  background: linear-gradient(to top, #000080, #1084d0);
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
  justify-content: center;
  flex-shrink: 0;
}

.sm-sidebar-text {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: rgba(255,255,255,0.6);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  letter-spacing: 2px;
}

.sm-items {
  flex: 1;
  padding: 4px 0;
}

.sm-item {
  padding: 5px 24px 5px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.sm-item:hover {
  background: var(--win95-blue);
  color: #fff;
}

.sm-item a {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.sm-item:hover a {
  color: #fff;
}

.sm-separator {
  border-top: 1px solid var(--win95-dark);
  border-bottom: 1px solid var(--win95-white);
  margin: 3px 4px;
}

.sm-heading {
  font-size: 10px;
  color: #888;
  cursor: default;
}

.sm-heading:hover {
  background: none;
  color: #888;
}

.sm-shutdown {
  color: #000;
  font-weight: bold;
}

.sm-link a {
  font-size: 12px;
}

/* ═══════════════════════════════════════════════
   SHUTDOWN SCREEN
═══════════════════════════════════════════════ */
#shutdown-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#shutdown-screen.hidden {
  display: none;
}

#shutdown-msg {
  font-family: var(--font-mono);
  font-size: 24px;
  color: #fff;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════ */
.hidden {
  display: none !important;
}

/* Scrollbar - Win95 style */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: var(--win95-gray); }
::-webkit-scrollbar-thumb {
  background: var(--win95-gray);
  border: 2px outset var(--win95-gray);
}
::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}
::-webkit-scrollbar-button { background: var(--win95-gray); height: 16px; width: 16px; }

/* ═══════════════════════════════════════════════
   INITIAL ICON LOAD ANIMATION
   Triggered via JS (.icons-ready) after boot
═══════════════════════════════════════════════ */
.desktop-icon { opacity: 0; }

.desktop-icons.icons-ready .desktop-icon:nth-child(1)  { animation: iconEntrance 0.4s 0.05s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(2)  { animation: iconEntrance 0.4s 0.12s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(3)  { animation: iconEntrance 0.4s 0.19s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(4)  { animation: iconEntrance 0.4s 0.26s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(5)  { animation: iconEntrance 0.4s 0.33s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(6)  { animation: iconEntrance 0.4s 0.40s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(7)  { animation: iconEntrance 0.4s 0.47s cubic-bezier(0.34,1.56,0.64,1) both; }
.desktop-icons.icons-ready .desktop-icon:nth-child(8)  { animation: iconEntrance 0.4s 0.54s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ═══════════════════════════════════════════════
   GITHUB REPOS WINDOW
═══════════════════════════════════════════════ */
.gh-loading {
  padding: 8px 6px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: #666;
  font-style: italic;
}

.gh-sep {
  padding: 4px 6px 2px;
  font-size: 10px;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-top: 1px solid var(--win95-dark);
  margin-top: 4px;
  cursor: default;
}

.gh-fork .lr-name::after {
  content: ' [fork]';
  font-weight: normal;
  font-size: 10px;
  opacity: 0.5;
}

body.dark .gh-loading { color: #777 !important; }
body.dark .gh-sep     { color: #666 !important; border-top-color: #444 !important; }

/* ═══════════════════════════════════════════════
   RESPONSIVE / MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  :root { --taskbar-h: 50px; }

  /* Icons: centered app-grid layout */
  .desktop-icons {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    width: calc(100vw - 16px);
    max-width: 400px;
  }

  .desktop-icon {
    width: 74px;
    padding: 6px 4px;
  }

  .desktop-icon .icon-gfx {
    font-size: 34px;
  }

  .desktop-icon span {
    font-size: 10px;
  }

  /* Windows: full-screen overlays */
  .desktop-window {
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100dvh - 50px) !important;
    max-height: calc(100dvh - 50px) !important;
    border-left: none !important;
    border-right: none !important;
  }

  /* Disable drag cursor on mobile - no dragging */
  .title-bar { cursor: default !important; }

  /* Bigger touch targets for accordion */
  .acc-header { padding: 10px 8px; min-height: 44px; }
  .acc-title  { font-size: 13px; }

  /* Bigger link rows */
  .link-row { padding: 10px 8px; min-height: 44px; }
  .lr-icon  { font-size: 22px; width: 28px; }
  .lr-name  { font-size: 13px; }
  .lr-desc  { display: none; }

  /* Start menu full-width */
  #start-menu { left: 0; right: 0; min-width: unset; }
  .sm-item { padding: 9px 16px 9px 10px; font-size: 14px; }

  /* Taskbar bigger */
  #taskbar { padding: 0 6px; gap: 6px; }
  #start-btn { height: 38px; font-size: 14px; }
  .taskbar-btn { height: 34px; font-size: 12px; }

  /* Icon grid in My Computer */
  .icon-grid { grid-template-columns: repeat(3, 1fr); }
  .gf-icon   { font-size: 36px; }

  /* Notepad bigger font on mobile */
  .notepad-area { font-size: 19px; }
}

/* ═══════════════════════════════════════════════
   REDUCED MOTION / MOBILE ANIMATION KILL
   Stops continuous GPU animations that can tank
   performance on low-end phones.
═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Kill all continuous animations */
  .cassette-reel        { animation: none !important; }
  .crt-overlay          { display: none !important; }
  .desktop-icon:hover   { animation: none !important; }

  /* Snap open/close instead of animating */
  .win-opening {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .win-closing {
    animation: none !important;
  }

  /* No icon entrance stagger on mobile */
  .desktop-icons.icons-ready .desktop-icon {
    animation: none !important;
    opacity: 1 !important;
  }
}

/* Respect OS-level reduced motion setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════
   DARK MODE  (body.dark)
   Overrides 98.css variables + specific elements
═══════════════════════════════════════════════ */
body.dark {
  /* 98.css internal variables */
  --surface: #2d2d2d;
  --button-highlight: #4a4a4a;
  --button-face: #2d2d2d;
  --button-shadow: #1a1a1a;
  --button-dk-shadow: #000;
  --window-frame: #000;
  --window-background: #1e1e1e;

  /* Our custom variables */
  --win95-gray:  #2d2d2d;
  --win95-dark:  #1a1a1a;
  --win95-light: #3a3a3a;
  --win95-white: #555555;
  --win95-black: #e8e8e8;
}

body.dark #desktop {
  background-color: #0a0f1e;
}

/* Window chrome */
body.dark .window {
  background: #2d2d2d !important;
  border-color: #555 !important;
}

body.dark .window-body {
  background: #1e1e1e !important;
  color: #e0e0e0 !important;
}

body.dark .window-menu-bar {
  background: #2d2d2d !important;
  border-bottom-color: #555 !important;
  color: #e0e0e0;
}

body.dark .window-menu-bar span { color: #e0e0e0 !important; }
body.dark .window-menu-bar span:hover { background: var(--win95-blue); color: #fff; }

/* Notepad */
body.dark .notepad-area {
  background: #1a1a2e !important;
  color: #e0e0e0 !important;
}

/* Link rows */
body.dark .link-row        { color: #e0e0e0 !important; }
body.dark .link-row:hover  { color: #fff !important; background: var(--win95-blue) !important; }
body.dark .lr-desc         { color: #999 !important; }
body.dark .link-row:hover .lr-desc { color: rgba(255,255,255,0.8) !important; }
body.dark .lr-arrow        { color: #666 !important; }
body.dark .link-row:hover .lr-arrow { color: #fff !important; }

/* Section label */
body.dark .section-label { color: #888 !important; }

/* Accordion */
body.dark .acc-item   { background: #1e1e1e !important; border-color: #444 !important; }
body.dark .acc-header { background: #2d2d2d !important; color: #e0e0e0 !important; }
body.dark .acc-header:hover { background: #3a3a3a !important; }
body.dark .acc-body   { background: #181818 !important; color: #ccc !important; }
body.dark .acc-open-btn {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* Icon grid */
body.dark .grid-folder       { color: #e0e0e0 !important; }
body.dark .grid-folder small { color: #888 !important; }
body.dark .grid-folder:hover { background: rgba(16,132,208,0.25) !important; }

/* About table */
body.dark .about-table td:first-child   { color: #aaa !important; }
body.dark .about-table tr:nth-child(even) { background: rgba(255,255,255,0.04) !important; }
body.dark .about-version { color: #999 !important; }
body.dark .about-content hr { border-top-color: #444 !important; }

/* Context menu */
body.dark .ctx-menu         { background: #2d2d2d !important; border-color: #555 !important; }
body.dark .ctx-item         { color: #e0e0e0 !important; }
body.dark .ctx-item:hover   { background: var(--win95-blue) !important; color: #fff !important; }
body.dark .ctx-joke         { color: #aaa !important; }
body.dark .ctx-separator    { border-top-color: #555 !important; }

/* Taskbar */
body.dark #taskbar {
  background: #1a1a1a !important;
  border-top-color: #444 !important;
  box-shadow: 0 -2px 0 #000 !important;
}

body.dark #start-btn {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark .taskbar-btn {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

body.dark .taskbar-btn.active {
  background: #141414 !important;
  border-color: #666 !important;
}

body.dark #taskbar-divider {
  border-left-color: #555 !important;
  border-right-color: #333 !important;
}

body.dark #clock {
  background: #141414 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

body.dark .tray-btn {
  background: transparent !important;
  box-shadow: none !important;
  color: #ffffff !important;
}
body.dark .tray-btn:hover { background: rgba(255,255,255,0.1) !important; }

/* Start menu */
body.dark #start-menu {
  background: #2d2d2d !important;
  border-color: #555 !important;
}

body.dark .sm-items { background: #2d2d2d !important; }
body.dark .sm-item  { color: #e0e0e0 !important; }
body.dark .sm-heading { color: #777 !important; }
body.dark .sm-item:hover { background: var(--win95-blue) !important; color: #fff !important; }
body.dark .sm-item:hover a { color: #fff !important; }
body.dark .sm-separator {
  border-top-color: #555 !important;
  border-bottom-color: #222 !important;
}
body.dark .sm-shutdown { color: #e0e0e0 !important; }
body.dark .sm-link a { color: #e0e0e0 !important; }

/* 98.css button overrides - title bar controls excluded so their SVG icons survive */
body.dark button:not(.tray-btn):not(#start-btn):not(.taskbar-btn):not([aria-label="Minimize"]):not([aria-label="Maximize"]):not([aria-label="Close"]) {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* Title bar min/max/close: pre-invert bg so filter:invert(1) lands on dark bg + white icons
   #d2d2d2 inverted = #2d2d2d (dark gray); black SVG inverted = white */
body.dark .title-bar-controls button {
  background-color: #d2d2d2 !important;
  filter: invert(1) !important;
}

/* Status bar */
body.dark .status-bar { background: #2d2d2d !important; }
body.dark .status-bar-field {
  border-color: #555 !important;
  color: #aaa !important;
}

/* Scrollbar */
body.dark ::-webkit-scrollbar-track { background: #1a1a1a !important; }
body.dark ::-webkit-scrollbar-thumb { background: #3a3a3a !important; }
body.dark ::-webkit-scrollbar-button { background: #2d2d2d !important; }
