:root {
  --bg: #d7d7d7;
  --paper: #ffffff;
  --ink: #000000;
  --line: #000000;
  --font-size: 15px;
  --menu-h: 30px;
}

* {
  box-sizing: border-box;
  image-rendering: pixelated;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f0f0f;
  color: var(--ink);
  font-family: "Chicago", "Geneva", "Monaco", "Courier New", monospace;
  font-size: var(--font-size);
}

.hidden {
  display: none !important;
}

.boot-screen,
.shutdown-screen,
.os {
  width: 100%;
  height: 100%;
}

.boot-screen,
.shutdown-screen {
  display: grid;
  place-items: center;
  background: #000;
  color: #fff;
}

.boot-sequence {
  width: min(92vw, 980px);
  height: min(92vh, 680px);
  display: grid;
  place-items: center;
}

#boot-sequence-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 2px solid #fff;
}

.boot-window {
  width: 320px;
  background: #1d1d1d;
  border: 2px solid #fff;
}

.boot-title {
  padding: 8px;
  text-align: center;
  border-bottom: 2px solid #fff;
  font-weight: 700;
}

.boot-content {
  padding: 16px;
  text-align: center;
}

.boot-icon {
  width: 100%;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.progress {
  border: 1px solid #fff;
  height: 12px;
}

#boot-progress {
  width: 0;
  height: 100%;
  background: #fff;
}

.shutdown-screen button {
  margin-top: 8px;
  border: 2px solid #fff;
  background: #000;
  color: #fff;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.os {
  background: var(--bg);
  border: 3px solid #000;
}

.menu-bar {
  height: var(--menu-h);
  border-bottom: 2px solid #000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  position: relative;
  z-index: 1200;
}

.menu-left,
.menu-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-item {
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  min-height: 24px;
  font: inherit;
  cursor: pointer;
}

.menu-item.apple {
  width: 32px;
  padding: 2px;
  display: grid;
  place-items: center;
}

.menu-item.apple img {
  width: auto;
  height: 17px;
  max-width: 24px;
  object-fit: contain;
  object-position: center;
  display: block;
  image-rendering: auto;
}

.boot-icon img {
  width: auto;
  height: 44px;
  max-width: 44px;
  object-fit: contain;
  object-position: center;
  display: block;
  image-rendering: auto;
}

.menu-item:hover,
.menu-item.active {
  border-color: #000;
  background: #ececec;
}

.dropdown {
  position: absolute;
  top: var(--menu-h);
  min-width: 190px;
  display: flex;
  flex-direction: column;
  border: 2px solid #000;
  background: #fff;
  z-index: 2000;
}

#menu-apple { left: 8px; }
#menu-file { left: 48px; }
#menu-edit { left: 100px; }
#menu-view { left: 150px; }
#menu-special { left: 206px; }

.dropdown button {
  border: 0;
  border-bottom: 1px solid #c8c8c8;
  background: #fff;
  text-align: left;
  font: inherit;
  padding: 7px 10px;
  cursor: pointer;
}

.dropdown button:hover {
  background: #000;
  color: #fff;
}

.desktop {
  position: relative;
  height: calc(100% - var(--menu-h));
  overflow: hidden;
}

.desktop.grid-mode {
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 85px 70px;
  background-position: 24px 18px;
}

.wallpaper {
  background-color: #000;
  background-image: url('assets/wallpaper.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.desktop-icons {
  position: absolute;
  inset: 0;
}

.pattern-grid {
  background-color: #d6d6d6;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px);
  background-size: 8px 8px;
}

.pattern-dots {
  background-color: #d6d6d6;
  background-image: radial-gradient(#777 1px, transparent 1px);
  background-size: 8px 8px;
}

.pattern-stripes {
  background: repeating-linear-gradient(45deg, #d8d8d8 0 6px, #cecece 6px 12px);
}

.pattern-plain {
  background: #d6d6d6;
}

.desktop-icon {
  position: absolute;
  width: 86px;
  padding: 4px;
  text-align: center;
  border: 1px solid transparent;
  cursor: default;
  transition: transform 90ms linear, background 90ms linear;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.45);
}

.desktop-icon:active {
  transform: translateY(1px);
}

.desktop-icon.selected {
  border-color: #000;
  background: rgba(255, 255, 255, 0.45);
}

.icon-image {
  height: 36px;
  display: grid;
  place-items: center;
}

.icon-image img {
  width: 34px;
  height: 34px;
}

.icon-label {
  margin-top: 4px;
  font-size: 12px;
}

.window {
  position: absolute;
  min-width: 220px;
  min-height: 130px;
  border: 2px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 #8d8d8d;
  opacity: 1;
  transform: scale(1);
  transition: opacity 120ms linear, transform 120ms linear;
}

.window.opening {
  opacity: 0;
  transform: scale(0.96);
}

.window.closing {
  opacity: 0;
  transform: scale(0.96);
}

.title-bar {
  height: 28px;
  border-bottom: 2px solid #000;
  background: #f6f6f6;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  text-align: center;
  cursor: move;
  font-weight: 700;
}

.w-btn {
  width: 22px;
  height: 22px;
  margin: 2px;
  border: 2px solid #000;
  background: #fff;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.w-btn:active {
  transform: translateY(1px);
}

.window-content {
  height: calc(100% - 28px);
  overflow: auto;
  padding: 10px;
  user-select: text;
}

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 46%, #000 46% 54%, transparent 54% 100%);
}

.finder-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finder-header,
.finder-row {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 0.8fr;
  gap: 6px;
  align-items: center;
}

.finder-header {
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  font-weight: 700;
}

.finder-files {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.finder-row {
  border: 1px solid #c8c8c8;
  padding: 4px 6px;
}

.finder-row:hover {
  border-color: #000;
  background: #f3f3f3;
}

.finder-open {
  border: 2px solid #000;
  background: #fff;
  padding: 2px 6px;
  font: inherit;
  cursor: pointer;
}

#notes-area,
#download-url,
#calc-display {
  width: 100%;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font: inherit;
}

#notes-area {
  height: calc(100% - 2px);
  resize: none;
  padding: 8px;
}

.download-wrap {
  display: grid;
  gap: 8px;
}

.download-wrap button,
#empty-trash-btn,
.paint-toolbar button,
.pattern-buttons button,
.calc-grid button {
  border: 2px solid #000;
  background: #fff;
  font: inherit;
  padding: 4px 8px;
  cursor: pointer;
}

.download-wrap button:active,
.paint-toolbar button:active,
.pattern-buttons button:active,
.calc-grid button:active,
#empty-trash-btn:active {
  transform: translateY(1px);
}

.paint-wrap {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  height: 100%;
}

.paint-toolbar {
  display: grid;
  gap: 6px;
  align-content: start;
}

.paint-toolbar button.active {
  background: #000;
  color: #fff;
}

.paint-canvas-wrap {
  border: 2px solid #000;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    #fff;
  background-size: 8px 8px;
  overflow: auto;
  display: grid;
  place-items: center;
}

#paint-canvas {
  border: 1px solid #000;
  width: min(100%, 512px);
  height: auto;
  background: #fff;
  cursor: crosshair;
}

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

.control-panel {
  display: grid;
  gap: 8px;
}

.pattern-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
