:root {
  --desktop: #008080;
  --desktop-shadow: #045c5c;
  --window-face: #c0c0c0;
  --window-light: #ffffff;
  --window-mid: #dfdfdf;
  --window-dark: #808080;
  --window-deep: #000000;
  --title-a: #01007c;
  --title-b: #1084d0;
  --text: #101010;
  --text-muted: #404040;
  --panel-white: #f8f8f8;
  --pixel: "Silkscreen", "Courier New", monospace;
  --ui: "MS Sans Serif", "Tahoma", "Geneva", sans-serif;
}

body[data-theme="midnight"] {
  --desktop: #102048;
  --desktop-shadow: #050d22;
  --window-face: #bcc8d8;
  --window-light: #f8fbff;
  --window-mid: #dce6f1;
  --window-dark: #556175;
  --window-deep: #111828;
  --title-a: #10285f;
  --title-b: #4f87ff;
  --text: #0f172a;
  --text-muted: #334155;
  --panel-white: #f4f7fb;
}

body[data-theme="amber"] {
  --desktop: #2a220c;
  --desktop-shadow: #120f06;
  --window-face: #d1c49f;
  --window-light: #f7efcb;
  --window-mid: #e4d6ad;
  --window-dark: #7b6842;
  --window-deep: #261b09;
  --title-a: #5f3800;
  --title-b: #d78c17;
  --text: #24170a;
  --text-muted: #5a4525;
  --panel-white: #fcf6df;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--ui);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 36%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(135deg, var(--desktop), var(--desktop-shadow));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: soft-light;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: #000;
  color: #fff;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.boot-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-panel {
  width: min(520px, calc(100% - 32px));
  padding: 28px 26px;
  border: 2px solid #bfbfbf;
  background: #000080;
  box-shadow: inset -2px -2px 0 #000, inset 2px 2px 0 #dfdfdf;
}

.boot-brand {
  margin: 0 0 18px;
  font-size: 1.08rem;
  font-weight: 700;
}

.boot-copy {
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.boot-bar {
  height: 20px;
  padding: 2px;
  border: 2px solid #fff;
}

.boot-progress {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #35d5ff, #d3ffff);
  animation: bootload 1.8s steps(12) forwards;
}

.desktop-shell {
  position: relative;
  min-height: 100vh;
  padding: 18px 18px 62px;
}

.desktop-icons {
  position: absolute;
  top: 16px;
  left: 14px;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.desktop-icon {
  width: 96px;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 8px 4px;
  border: 1px solid transparent;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(0, 0, 128, 0.24);
  outline: none;
}

.desktop-icon span:last-child {
  font-size: 0.8rem;
  line-height: 1.25;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.56);
}

.desktop-icon-art {
  position: relative;
  display: block;
  width: 34px;
  height: 30px;
}

.desktop-icon-art::before,
.desktop-icon-art::after {
  content: "";
  position: absolute;
}

.desktop-icon-art.monitor::before {
  inset: 0 0 6px;
  background: #d7d7d7;
  border: 2px solid #fff;
  border-right-color: #4e4e4e;
  border-bottom-color: #4e4e4e;
}

.desktop-icon-art.monitor::after {
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 6px;
  background: #d7d7d7;
  border: 2px solid #fff;
  border-right-color: #4e4e4e;
  border-bottom-color: #4e4e4e;
}

.desktop-icon-art.folder::before {
  left: 2px;
  top: 4px;
  width: 14px;
  height: 8px;
  background: #ffef85;
  border: 2px solid #fff7be;
  border-right-color: #a88b2c;
  border-bottom-color: #a88b2c;
}

.desktop-icon-art.folder::after {
  inset: 10px 0 0;
  background: #ffe465;
  border: 2px solid #fff7be;
  border-right-color: #a88b2c;
  border-bottom-color: #a88b2c;
}

.desktop-icon-art.note::before {
  inset: 0 4px 0 0;
  background: #fff;
  border: 2px solid #fff;
  border-right-color: #737373;
  border-bottom-color: #737373;
}

.desktop-icon-art.note::after {
  inset: 7px 10px 7px 8px;
  background:
    linear-gradient(#000080, #000080) 0 0 / 100% 2px no-repeat,
    linear-gradient(#000080, #000080) 0 50% / 100% 2px no-repeat,
    linear-gradient(#000080, #000080) 0 100% / 70% 2px no-repeat;
}

.desktop-stage {
  position: relative;
  width: min(1240px, calc(100% - 120px));
  height: calc(100vh - 110px);
  margin: 0 auto;
}

.win95-window {
  position: absolute;
  display: grid;
  background: var(--window-face);
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-deep);
  border-bottom: 2px solid var(--window-deep);
  box-shadow: inset -1px -1px 0 var(--window-dark), inset 1px 1px 0 var(--window-mid), 12px 12px 0 rgba(0, 0, 0, 0.18);
}

.win95-window.is-active {
  box-shadow: inset -1px -1px 0 var(--window-dark), inset 1px 1px 0 var(--window-mid), 14px 14px 0 rgba(0, 0, 0, 0.22);
}

.win95-window.dragging {
  cursor: grabbing;
}

.hero-window {
  top: 32px;
  left: 88px;
  width: min(620px, 100%);
}

.about-window {
  top: 56px;
  right: 92px;
  width: min(340px, 100%);
}

.projects-window {
  top: 316px;
  left: 146px;
  width: min(560px, 100%);
}

.contact-window {
  top: 230px;
  right: 118px;
  width: min(360px, 100%);
}

.latest-window {
  bottom: 76px;
  right: 78px;
  width: min(360px, 100%);
}

.settings-window {
  bottom: 88px;
  left: 186px;
  width: min(420px, 100%);
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 6px;
  color: #fff;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  user-select: none;
}

.window-titlebar strong {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.window-controls {
  display: inline-flex;
  gap: 4px;
}

.window-controls span,
.tool-btn,
.win95-btn,
.taskbar-tab,
.start-button {
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-deep);
  border-bottom: 2px solid var(--window-deep);
  box-shadow: inset -1px -1px 0 var(--window-dark), inset 1px 1px 0 var(--window-mid);
}

.window-controls span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #000;
  font-size: 0.7rem;
  background: var(--window-face);
}

.window-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-bottom: 1px solid #8f8f8f;
}

.window-body {
  padding: 18px;
}

.tool-btn,
.win95-btn,
.taskbar-tab,
.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  background: var(--window-face);
  cursor: pointer;
}

.tool-btn:hover,
.win95-btn:hover,
.taskbar-tab:hover,
.start-button:hover {
  filter: brightness(1.02);
}

.tool-btn:active,
.win95-btn:active,
.taskbar-tab:active,
.start-button:active,
.theme-btn.active,
.start-button.is-open,
.taskbar-tab.active {
  border-top-color: var(--window-deep);
  border-left-color: var(--window-deep);
  border-right-color: var(--window-light);
  border-bottom-color: var(--window-light);
  box-shadow: inset 1px 1px 0 var(--window-dark);
}

.tool-btn,
.win95-btn.small {
  min-height: 34px;
}

.win95-btn.primary {
  font-weight: 700;
}

.address-bar {
  flex: 1;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  white-space: nowrap;
  border-top: 2px solid var(--window-dark);
  border-left: 2px solid var(--window-dark);
  border-right: 2px solid var(--window-light);
  border-bottom: 2px solid var(--window-light);
  background: #fff;
  font-size: 0.84rem;
}

.hero-body {
  display: grid;
  gap: 16px;
}

.hero-badge {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.74rem;
  color: var(--title-a);
}

.hero-body h1 {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(1.5rem, 3.4vw, 2.45rem);
  line-height: 1.2;
}

.hero-copy,
.info-tile p,
.memo-paper p,
.settings-note {
  margin: 0;
  line-height: 1.6;
  color: var(--text-muted);
}

.hero-actions,
.hero-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-actions {
  margin-top: 16px;
}

.hero-status {
  margin-top: 2px;
}

.status-chip {
  min-width: 150px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--panel-white);
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-dark);
  border-bottom: 2px solid var(--window-dark);
}

.chip-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.memo-paper {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #696969;
  background:
    linear-gradient(var(--panel-white), var(--panel-white)) padding-box,
    repeating-linear-gradient(180deg, transparent 0 24px, rgba(0, 0, 128, 0.11) 24px 25px) border-box;
}

.lined-paper {
  min-height: 184px;
}

.status-table {
  display: grid;
  gap: 8px;
}

.status-table div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  background: #efefef;
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-dark);
  border-bottom: 2px solid var(--window-dark);
}

.status-table span {
  color: var(--text-muted);
}

.explorer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-tile {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel-white);
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-dark);
  border-bottom: 2px solid var(--window-dark);
}

.info-tile h2,
.settings-group h2 {
  margin: 0;
  font-size: 1rem;
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  gap: 16px;
}

.settings-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel-white);
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-dark);
  border-bottom: 2px solid var(--window-dark);
}

.theme-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sound-row {
  display: grid;
  gap: 10px;
}

.start-menu {
  position: fixed;
  left: 6px;
  bottom: 46px;
  z-index: 50;
  width: min(320px, calc(100% - 12px));
  display: none;
  align-items: stretch;
  border-top: 2px solid var(--window-light);
  border-left: 2px solid var(--window-light);
  border-right: 2px solid var(--window-deep);
  border-bottom: 2px solid var(--window-deep);
  box-shadow: inset -1px -1px 0 var(--window-dark), inset 1px 1px 0 var(--window-mid), 10px 10px 0 rgba(0, 0, 0, 0.18);
  background: var(--window-face);
}

.start-menu.is-open {
  display: flex;
}

.start-side-label {
  width: 42px;
  display: grid;
  place-items: end center;
  padding: 14px 0;
  color: #fff;
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: linear-gradient(180deg, var(--title-b), var(--title-a));
}

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

.start-menu-list a,
.start-menu-list button {
  padding: 12px 14px;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}

.start-menu-list a:hover,
.start-menu-list button:hover {
  color: #fff;
  background: #000080;
}

.taskbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  background: var(--window-face);
  border-top: 2px solid var(--window-light);
  box-shadow: inset 0 1px 0 var(--window-mid);
}

.start-button {
  min-width: 86px;
  justify-content: flex-start;
  font-weight: 700;
}

.start-logo {
  width: 18px;
  height: 18px;
  background:
    linear-gradient(90deg, #ef3d2d 0 50%, #2aa748 50% 100%),
    linear-gradient(90deg, #f8d14a 0 50%, #17a6eb 50% 100%);
  background-size: 50% 50%;
  background-position: top left, bottom right;
  background-repeat: no-repeat;
  transform: skew(-10deg);
}

.taskbar-tray {
  display: flex;
  gap: 6px;
  overflow: auto hidden;
}

.taskbar-tab {
  min-width: 132px;
  justify-content: flex-start;
  white-space: nowrap;
}

.clock-box {
  min-width: 86px;
  padding: 7px 12px;
  text-align: center;
  border-top: 2px solid var(--window-dark);
  border-left: 2px solid var(--window-dark);
  border-right: 2px solid var(--window-light);
  border-bottom: 2px solid var(--window-light);
  background: #e9e9e9;
  font-size: 0.86rem;
}

.reveal-window {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  animation: windowIn 420ms steps(8) forwards;
  animation-delay: calc(var(--window-order, 1) * 120ms + 300ms);
}

.desktop-ready .reveal-window {
  opacity: 1;
}

code {
  padding: 2px 5px;
  font-family: var(--pixel);
  font-size: 0.8em;
  background: rgba(255, 255, 255, 0.55);
}

@keyframes bootload {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes windowIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1180px) {
  .desktop-stage {
    width: min(1040px, calc(100% - 96px));
  }

  .hero-window {
    left: 50px;
  }

  .projects-window {
    left: 96px;
  }

  .settings-window {
    left: 124px;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .desktop-shell {
    padding: 14px 12px 74px;
  }

  .desktop-icons {
    position: relative;
    top: 0;
    left: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
  }

  .desktop-stage {
    width: 100%;
    height: auto;
    display: grid;
    gap: 14px;
  }

  .win95-window {
    position: relative;
    inset: auto;
    width: 100%;
  }

  .explorer-grid {
    grid-template-columns: 1fr;
  }
}

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

  .hero-actions,
  .hero-status,
  .taskbar,
  .theme-switcher {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .hero-status,
  .theme-switcher {
    display: grid;
  }

  .taskbar {
    gap: 6px;
  }

  .taskbar-tray {
    width: 100%;
  }

  .taskbar-tab,
  .start-button,
  .clock-box,
  .win95-btn,
  .tool-btn {
    width: 100%;
  }

  .window-toolbar {
    flex-wrap: wrap;
  }

  .start-menu {
    left: 4px;
    right: 4px;
    width: auto;
  }
}
