:root {
  --desktop-bg: #008080;
  --win95-gray: #c0c0c0;
  --win95-dark: #808080;
  --win95-darker: #404040;
  --win95-light: #ffffff;
  --win95-blue-top: #0a246a;
  --win95-blue-bottom: #2671d9;
  --inactive-top: #7f7f7f;
  --inactive-bottom: #a9a9a9;
  --shadow: rgba(0, 0, 0, 0.35);
  --font-stack: "MS Sans Serif", "Microsoft Sans Serif", "Tahoma", "Geneva", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  font-family: var(--font-stack);
  font-size: 14px;
  color: #000;
  cursor: default;
}

body {
  background: #000;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.desktop-shell,
.shutdown-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.desktop {
  position: relative;
  width: 100%;
  height: calc(100% - 40px);
  padding: 12px;
  background:
    linear-gradient(transparent 23px, rgba(255, 255, 255, 0.06) 24px),
    linear-gradient(90deg, transparent 23px, rgba(255, 255, 255, 0.06) 24px),
    var(--desktop-bg);
  background-size: 24px 24px, 24px 24px, auto;
  overflow: hidden;
}

.desktop-icon {
  display: flex;
  width: 88px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  text-align: center;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.desktop-icon:focus-visible,
.desktop-icon.selected {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(10, 36, 106, 0.35);
  outline: none;
}

.icon-art {
  display: inline-flex;
  width: 36px;
  height: 36px;
  justify-content: center;
  align-items: center;
}

.icon-art svg {
  width: 32px;
  height: 32px;
  shape-rendering: crispEdges;
}

.icon-label {
  display: inline-block;
  max-width: 80px;
  line-height: 1.1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.window-layer {
  position: absolute;
  inset: 0;
}

.taskbar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  height: 40px;
  padding: 4px;
  background: var(--win95-gray);
  border-top: 2px solid #fff;
}

.start-button,
.taskbar-button,
.menu-item > button,
.submenu button,
.win-btn,
.calc-btn,
.shutdown-message button {
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-darker);
  border-bottom: 2px solid var(--win95-darker);
  background: var(--win95-gray);
  color: #000;
}

.start-button:active,
.taskbar-button.active,
.menu-item > button:active,
.submenu button:active,
.win-btn:active,
.calc-btn:active,
.shutdown-message button:active {
  border-top-color: var(--win95-darker);
  border-left-color: var(--win95-darker);
  border-right-color: var(--win95-light);
  border-bottom-color: var(--win95-light);
}

.start-button {
  display: inline-flex;
  min-width: 86px;
  height: 30px;
  padding: 0 10px;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.start-button.open {
  border-top-color: var(--win95-darker);
  border-left-color: var(--win95-darker);
  border-right-color: var(--win95-light);
  border-bottom-color: var(--win95-light);
}

.start-flag {
  position: relative;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(90deg, #f44336 0 50%, #ffc107 50%),
    linear-gradient(90deg, #4caf50 0 50%, #2196f3 50%);
  background-size: 9px 9px;
  background-position: 0 0, 0 9px;
  background-repeat: no-repeat;
  transform: skew(-12deg);
}

.taskbar-windows {
  display: flex;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.taskbar-button {
  min-width: 120px;
  max-width: 180px;
  height: 30px;
  padding: 0 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sunken-panel {
  border-top: 2px solid var(--win95-dark);
  border-left: 2px solid var(--win95-dark);
  border-right: 2px solid var(--win95-light);
  border-bottom: 2px solid var(--win95-light);
  background: #fff;
}

.taskbar-clock {
  display: grid;
  min-width: 88px;
  height: 30px;
  padding: 0 8px;
  place-items: center;
  background: var(--win95-gray);
}

.start-menu {
  position: absolute;
  bottom: 40px;
  left: 4px;
  display: flex;
  width: 260px;
  min-height: 300px;
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-darker);
  border-bottom: 2px solid var(--win95-darker);
  background: var(--win95-gray);
  z-index: 5000;
}

.start-menu-sidebar {
  display: flex;
  width: 34px;
  padding: 8px 0;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  background: linear-gradient(180deg, #7f7f7f, #b7b7b7);
  color: #ddd;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 1px;
  font-size: 20px;
  font-weight: 700;
}

.start-menu-version {
  color: #fff;
}

.start-menu-list,
.submenu {
  margin: 0;
  padding: 4px;
  list-style: none;
}

.start-menu-list {
  flex: 1;
}

.menu-item {
  position: relative;
}

.menu-item.separator {
  height: 2px;
  margin: 8px 4px;
  background: linear-gradient(90deg, #808080, #fff);
}

.menu-item > button,
.submenu button {
  display: flex;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  justify-content: space-between;
  align-items: center;
  border: none;
  background: transparent;
  text-align: left;
}

.menu-item > button:hover,
.submenu button:hover,
.menu-item.open > button {
  background: #0a246a;
  color: #fff;
}

.has-submenu > button::after {
  content: "▶";
  font-size: 11px;
}

.submenu {
  position: absolute;
  top: -4px;
  left: calc(100% - 2px);
  display: none;
  width: 180px;
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-darker);
  border-bottom: 2px solid var(--win95-darker);
  background: var(--win95-gray);
}

.menu-item.open > .submenu {
  display: block;
}

.window {
  position: absolute;
  width: 440px;
  min-width: 260px;
  min-height: 180px;
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-darker);
  border-bottom: 2px solid var(--win95-darker);
  background: var(--win95-gray);
  box-shadow: 2px 2px 0 var(--shadow);
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - 40px) !important;
}

.window.hidden {
  display: none;
}

.window.active .title-bar {
  background: linear-gradient(90deg, var(--win95-blue-top), var(--win95-blue-bottom));
}

.window:not(.active) .title-bar {
  background: linear-gradient(90deg, var(--inactive-top), var(--inactive-bottom));
}

.title-bar {
  display: flex;
  height: 28px;
  padding: 3px;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  user-select: none;
}

.title-bar-text {
  padding-left: 4px;
  font-weight: 700;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}

.win-btn {
  display: inline-grid;
  width: 22px;
  height: 20px;
  padding: 0;
  place-items: center;
  font-size: 12px;
  line-height: 1;
}

.window-body {
  display: flex;
  height: calc(100% - 28px);
  padding: 6px;
  flex-direction: column;
  gap: 6px;
}

.window-body.inset,
.app-panel.inset {
  border-top: 2px solid var(--win95-dark);
  border-left: 2px solid var(--win95-dark);
  border-right: 2px solid var(--win95-light);
  border-bottom: 2px solid var(--win95-light);
  background: #fff;
}

.app-panel {
  height: 100%;
}

.info-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.info-card {
  min-height: 86px;
  padding: 10px;
  background: #efefef;
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-dark);
  border-bottom: 2px solid var(--win95-dark);
}

.folder-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.folder-icon {
  width: 36px;
  height: 28px;
  background: linear-gradient(#ffd24d 0 40%, #c89c12 40% 100%);
  border: 1px solid #000;
}

.notepad-menu {
  display: flex;
  gap: 16px;
  padding: 2px 6px 0;
}

.notepad-menu button {
  padding: 2px 4px;
  border: none;
  background: transparent;
}

.notepad-menu button:hover,
.notepad-menu button.open {
  background: #0a246a;
  color: #fff;
}

.dropdown-menu {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 2;
  width: 140px;
  padding: 4px;
  border-top: 2px solid var(--win95-light);
  border-left: 2px solid var(--win95-light);
  border-right: 2px solid var(--win95-darker);
  border-bottom: 2px solid var(--win95-darker);
  background: var(--win95-gray);
}

.dropdown-menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  text-align: left;
}

.dropdown-menu button:hover {
  background: #0a246a;
  color: #fff;
}

.notepad-editor {
  flex: 1;
  width: 100%;
  padding: 10px;
  border-top: 2px solid var(--win95-dark);
  border-left: 2px solid var(--win95-dark);
  border-right: 2px solid var(--win95-light);
  border-bottom: 2px solid var(--win95-light);
  resize: none;
  background: #fff;
  font-family: "Courier New", monospace;
  line-height: 1.4;
}

.status-bar {
  display: flex;
  gap: 8px;
}

.status-bar span {
  flex: 1;
  padding: 4px 8px;
}

.calculator {
  display: grid;
  height: 100%;
  gap: 8px;
  grid-template-rows: auto 1fr;
}

.calculator-display {
  display: flex;
  min-height: 56px;
  padding: 8px;
  justify-content: flex-end;
  align-items: center;
  overflow: hidden;
  background: #d7e3d4;
  font-size: 28px;
  font-family: "Courier New", monospace;
}

.calculator-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, 1fr);
}

.calc-btn {
  min-height: 44px;
  padding: 0;
  font-size: 18px;
}

.calc-btn.operator {
  background: #e5e5e5;
}

.shutdown-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
  color: #c8c8c8;
  font-family: "Courier New", monospace;
  z-index: 10000;
}

.shutdown-message {
  display: grid;
  width: min(560px, calc(100vw - 40px));
  gap: 18px;
  text-align: center;
}

.shutdown-message p {
  margin: 0;
  font-size: 22px;
}

.shutdown-safe {
  color: #f6b74b;
}

.shutdown-message button {
  justify-self: center;
  min-width: 120px;
  min-height: 36px;
}

@media (max-width: 720px) {
  .desktop {
    padding: 10px 8px;
  }

  .desktop-icon {
    width: 78px;
  }

  .window {
    width: min(94vw, 420px);
  }

  .start-menu {
    width: min(260px, calc(100vw - 8px));
  }

  .taskbar-button {
    min-width: 90px;
  }
}
