[hidden] {
  display: none !important;
}

:root {
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --face-highlight: #ffffff;
  --face-shadow: #808080;
  --face-darkshadow: #0a0a0a;
  --navy1: #000080;
  --navy2: #1084d0;
  --desktop-teal: #008080;
  --sel-blue: #0a246a;
  --taskbar-h: 34px;
  --font: "Tahoma", "MS Sans Serif", "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 11px;
  color: #000;
  -webkit-font-smoothing: none;
  overflow: hidden;
}

.sprite-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 1px dotted #000;
  outline-offset: 1px;
}

.titlebar :focus-visible,
.program:focus-visible .plabel,
.desktop-icon:focus-visible .dlabel,
.start-items button:focus-visible,
.start-items a:focus-visible,
.tree-item:focus-visible {
  outline: 1px dotted #fff;
}

.bevel-raised {
  background: var(--face);
  box-shadow:
    inset -1px -1px 0 var(--face-darkshadow),
    inset 1px 1px 0 var(--face-highlight),
    inset -2px -2px 0 var(--face-shadow),
    inset 2px 2px 0 var(--face-light);
}

.bevel-sunken {
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--face-darkshadow),
    inset -1px -1px 0 var(--face-highlight),
    inset 2px 2px 0 var(--face-shadow),
    inset -2px -2px 0 var(--face-light);
}

.bevel-raised-thin {
  background: var(--face);
  box-shadow:
    inset -1px -1px 0 var(--face-darkshadow),
    inset 1px 1px 0 var(--face-highlight);
}

.bevel-sunken-thin {
  background: var(--face);
  box-shadow:
    inset 1px 1px 0 var(--face-darkshadow),
    inset -1px -1px 0 var(--face-highlight);
}

/* ---------- boot splash ---------- */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1084d0, #000080 75%);
  transition: opacity 0.4s ease;
}
.boot-splash.fade-out {
  opacity: 0;
}
.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.boot-flag {
  width: 64px;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.5));
}
.boot-flag div:nth-child(1) {
  background: #f0413a;
}
.boot-flag div:nth-child(2) {
  background: #7cbb00;
}
.boot-flag div:nth-child(3) {
  background: #00a4ef;
}
.boot-flag div:nth-child(4) {
  background: #ffb900;
}
.boot-title {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}
.boot-bar {
  width: 160px;
  height: 14px;
  padding: 2px;
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  background: repeating-linear-gradient(90deg, #000080 0 10px, #1084d0 10px 20px);
  background-size: 40px 100%;
  animation: boot-scroll 0.9s linear infinite;
}
@keyframes boot-scroll {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

/* ---------- desktop ---------- */
.desktop {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 480px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%), var(--desktop-teal);
  cursor: default;
  user-select: none;
}

.desktop-icons {
  position: absolute;
  top: 16px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
}
.desktop-icon {
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
}
.desktop-icon svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5));
}
.desktop-icon .dlabel {
  color: #fff;
  text-shadow: 1px 1px 1px #000;
  text-align: center;
  line-height: 1.3;
  padding: 1px 3px;
}
.desktop-icon:hover .dlabel,
.desktop-icon:focus-visible .dlabel {
  background: var(--sel-blue);
  outline: 1px dotted #fff;
  text-shadow: none;
}
.desktop-icon:focus-visible {
  outline: none;
}

/* ---------- windows ---------- */
.window {
  position: absolute;
  display: none;
  flex-direction: column;
  background: var(--face);
  padding: 3px;
  box-shadow:
    inset -1px -1px 0 var(--face-darkshadow),
    inset 1px 1px 0 var(--face-highlight),
    inset -2px -2px 0 var(--face-shadow),
    inset 2px 2px 0 var(--face-light),
    6px 8px 16px rgba(0, 0, 0, 0.45);
  z-index: 10;
  max-width: 96vw;
  max-height: 88vh;
}
.window.open {
  display: flex;
}
.window.open.minimized {
  display: none;
}
.window.maximized {
  position: fixed;
  left: 0 !important;
  top: 0 !important;
  right: 0;
  bottom: var(--taskbar-h);
  width: auto !important;
  height: auto !important;
  max-width: none;
  max-height: none;
  transform: none !important;
}

#win-programs {
  left: 50%;
  top: 5%;
  width: min(760px, 94vw);
  height: min(560px, 80vh);
  transform: translateX(-50%);
}
#win-about {
  left: calc(50% - 230px);
  top: 12%;
  width: min(440px, 90vw);
  height: min(380px, 62vh);
}
#win-recycle {
  left: calc(50% + 60px);
  top: 24%;
  width: min(300px, 86vw);
  height: min(190px, 40vh);
}

.titlebar {
  height: 24px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 0 5px;
  background: linear-gradient(90deg, #808080, #b5b5b5 85%);
  touch-action: none;
}
.window.active .titlebar {
  background: linear-gradient(90deg, var(--navy1), var(--navy2) 85%);
}
.titlebar .tleft {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.titlebar svg.ticon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.tbuttons {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}
.win-btn {
  width: 18px;
  height: 16px;
  padding: 0;
  border: 0;
  font-family: var(--font);
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
}
.win-btn.close {
  font-size: 12px;
}
.win-btn:active {
  box-shadow:
    inset 1px 1px 0 var(--face-darkshadow),
    inset -1px -1px 0 var(--face-highlight);
}

.menubar {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  padding: 3px 8px;
  border-bottom: 1px solid var(--face-shadow);
}
.menubar span {
  padding: 1px 4px;
}
.menubar span:hover {
  background: var(--sel-blue);
  color: #fff;
}

.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--face-shadow);
}
.search-field {
  flex: 1 1 auto;
  max-width: 260px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 2px 6px;
  height: 20px;
}
.search-field svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}
.search-field input {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 11px;
  color: #000;
}
.search-field input:focus {
  outline: none;
}
.search-field input::-webkit-search-cancel-button {
  cursor: pointer;
}

.explorer {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 3px;
  padding-top: 3px;
}

.tree {
  flex: 0 0 170px;
  overflow-y: auto;
  padding: 4px;
}
.tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tree-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  background: transparent;
  border: 1px dotted transparent;
  text-align: left;
  cursor: pointer;
}
.tree-item svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.tree-item .tname {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-item .tcount {
  flex: 0 0 auto;
  color: #333;
}
.tree-item:hover {
  border-color: #000;
}
.tree-item.selected {
  background: var(--sel-blue);
  color: #fff;
}
.tree-item.selected .tcount {
  color: #dfe6f0;
}

.content {
  flex: 1 1 auto;
  background: #fff;
  padding: 12px;
  overflow-y: auto;
  min-height: 0;
}

.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px 4px;
}
.program {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #000;
  padding: 8px 4px 6px;
  border: 1px dotted transparent;
}
.program img {
  width: 32px;
  height: 32px;
}
.program .plabel {
  text-align: center;
  line-height: 1.3;
  padding: 1px 4px;
  overflow-wrap: anywhere;
}
.program:hover,
.program:focus-visible {
  outline: none;
  border-color: #000;
}
.program:hover .plabel,
.program:focus-visible .plabel {
  background: var(--sel-blue);
  color: #fff;
  outline: 1px dotted #fff;
}
.empty-note {
  color: #444;
  padding: 6px 2px;
}

.statusbar {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 4px 4px 2px;
}
.statusbar .pane {
  padding: 2px 8px;
  flex: 0 0 auto;
}
.statusbar .pane.grow {
  flex: 1 1 auto;
}

.notepad-content {
  line-height: 1.6;
  font-size: 12px;
}
.notepad-content p {
  margin: 0 0 12px;
}
.notepad-content p:last-child {
  margin-bottom: 0;
}

.recycle-window .content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.recycle-window .content svg {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

/* ---------- start menu ---------- */
.start-menu {
  position: fixed;
  left: 4px;
  bottom: calc(var(--taskbar-h) + 4px);
  width: 230px;
  max-height: 74vh;
  display: flex;
  padding: 3px;
  z-index: 300;
  box-shadow: 4px 6px 12px rgba(0, 0, 0, 0.45);
}
.start-strip {
  flex: 0 0 26px;
  background: linear-gradient(180deg, var(--navy1), var(--navy2));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
}
.start-strip span {
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.start-body {
  flex: 1 1 auto;
  background: var(--face);
  overflow-y: auto;
  padding: 4px 0;
}
.start-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.start-items button,
.start-items a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  color: #000;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}
.start-items svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.start-items button:hover,
.start-items a:hover,
.start-items button:focus-visible,
.start-items a:focus-visible {
  background: var(--sel-blue);
  color: #fff;
}
.start-sep {
  height: 1px;
  margin: 4px 8px;
  box-shadow:
    inset 0 1px 0 var(--face-shadow),
    inset 0 -1px 0 var(--face-highlight);
}

/* ---------- taskbar ---------- */
.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  box-shadow: inset 0 1px 0 var(--face-highlight);
  z-index: 200;
}
.start-btn {
  height: 26px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 5px;
  font-weight: bold;
  font-size: 12px;
  font-style: italic;
  cursor: pointer;
  border: 0;
}
.start-btn.pressed {
  box-shadow:
    inset 1px 1px 0 var(--face-darkshadow),
    inset -1px -1px 0 var(--face-highlight),
    inset 2px 2px 0 var(--face-shadow),
    inset -2px -2px 0 var(--face-light);
}
.start-flag {
  width: 15px;
  height: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  flex: 0 0 auto;
}
.start-flag div:nth-child(1) {
  background: #f0413a;
}
.start-flag div:nth-child(2) {
  background: #7cbb00;
}
.start-flag div:nth-child(3) {
  background: #00a4ef;
}
.start-flag div:nth-child(4) {
  background: #ffb900;
}

.groove {
  width: 2px;
  align-self: stretch;
  margin: 2px 1px;
  flex: 0 0 auto;
}

.tasks {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}
.task-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
}
.task-btn.bevel-raised-tb {
  background: var(--face);
  box-shadow:
    inset -1px -1px 0 var(--face-darkshadow),
    inset 1px 1px 0 var(--face-highlight);
}
.task-btn.active {
  box-shadow:
    inset 1px 1px 0 var(--face-darkshadow),
    inset -1px -1px 0 var(--face-highlight);
}
.task-btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.task-btn .tlabel {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 10px;
  flex: 0 0 auto;
}
.tray-hint {
  white-space: nowrap;
  font-size: 10px;
}
.clock {
  white-space: nowrap;
}

/* ---------- shutdown screen ---------- */
.shutdown-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #000080;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
}
.shutdown-message {
  font-size: 20px;
  margin: 0;
}
.shutdown-hint {
  margin: 0;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.shutdown-hint.visible {
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  :root {
    --taskbar-h: 44px;
  }

  .desktop-icons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100% - 20px);
    gap: 10px;
    top: 10px;
    left: 10px;
  }
  .desktop-icon {
    width: auto;
  }

  #win-programs {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: 0;
    bottom: var(--taskbar-h);
    width: auto !important;
    height: auto !important;
    max-width: none;
    max-height: none;
    transform: none !important;
  }
  #win-about,
  #win-recycle {
    left: 3vw;
    width: 94vw;
  }

  .explorer {
    flex-direction: column;
  }
  .tree {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    padding: 6px 4px;
    gap: 6px;
  }
  .tree-list {
    flex-direction: row;
    gap: 6px;
  }
  .tree-item {
    width: auto;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .program-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .search-field {
    max-width: none;
  }

  .tray-hint {
    display: none;
  }
  .task-btn {
    max-width: 96px;
  }

  .start-menu {
    left: 0;
    right: 0;
    bottom: var(--taskbar-h);
    width: auto;
    max-height: 70vh;
  }
}

@media (max-width: 380px) {
  .desktop-icons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .program-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
