/* ============================================================
   Macintosh System 7 recreation — stylesheet
   ============================================================ */

@font-face {
  font-family: 'ChiKareGo2';
  src: url('../fonts/ChiKareGo2.woff2') format('woff2'),
       url('../fonts/ChiKareGo2.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'ChicagoFLF';
  src: url('../fonts/ChicagoFLF.woff2') format('woff2'),
       url('../fonts/ChicagoFLF.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

:root {
  --chicago: 'ChiKareGo2', 'ChicagoFLF', monospace;
  --geneva: 'ChicagoFLF', 'ChiKareGo2', sans-serif;
  --monaco: 'Monaco', 'Courier New', monospace;
  --menubar-h: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #808080;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  user-select: none;
  -webkit-user-select: none;
}

body { font-family: var(--chicago); font-size: 16px; line-height: 1; }

img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

button { font-family: inherit; }

/* ------------------------------------------------------------
   Boot screen
   ------------------------------------------------------------ */
#boot {
  position: fixed; inset: 0; z-index: 9000;
  background: #aaaaaa;
  display: flex; align-items: center; justify-content: center;
}
#boot.gone { display: none; }
.boot-inner { text-align: center; }
.boot-mac { width: 64px; height: 64px; margin: 0 auto 18px; }
.boot-mac img { width: 64px; height: 64px; }
.boot-welcome {
  font-family: var(--geneva); font-style: italic; font-size: 26px;
  color: #000; letter-spacing: 1px;
}
.boot-sub { font-family: var(--geneva); font-size: 13px; margin-top: 10px; color: #222; }
.boot-extensions {
  position: absolute; left: 8px; bottom: 8px; display: flex; gap: 2px;
  height: 34px; align-items: flex-end;
}
.boot-extensions img { width: 32px; height: 32px; }

/* ------------------------------------------------------------
   Menu bar
   ------------------------------------------------------------ */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--menubar-h);
  background: #fff;
  border-bottom: 1px solid #000;
  display: flex; align-items: stretch;
  z-index: 5000;
  font-size: 16px;
}
.mb-title {
  padding: 0 11px;
  display: flex; align-items: center;
  cursor: default;
  white-space: nowrap;
  position: relative;
}
.mb-title img { height: 15px; width: auto; display: block; }
.mb-title.open { background: #000; color: #fff; }
.mb-title.open img { filter: invert(1); }
.mb-spacer { flex: 1; }
.mb-clock { padding: 0 12px; display: flex; align-items: center; white-space: nowrap; }
.mb-app {
  padding: 0 10px 0 8px; display: flex; align-items: center; gap: 6px;
  border-left: 1px solid #fff;
  white-space: nowrap;
}
.mb-app img { width: 15px; height: 15px; }
.mb-app.open { background: #000; color: #fff; }
.mb-app.open img { filter: invert(1); }

/* ------------------------------------------------------------
   Pull-down menus
   ------------------------------------------------------------ */
#menuLayer { position: fixed; inset: 0; z-index: 6000; pointer-events: none; }
.menu {
  position: absolute;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.25);
  min-width: 190px;
  pointer-events: auto;
  padding: 2px 0;
}
.menu-item {
  position: relative;
  padding: 3px 14px 3px 26px;
  font-size: 16px;
  white-space: nowrap;
  display: flex; justify-content: space-between; gap: 24px;
}
.menu-item .mi-mark { position: absolute; left: 8px; top: 3px; width: 14px; }
.menu-item .mi-key { color: inherit; }
.menu-item.disabled { color: #9a9a9a; }
.menu-item.hilite:not(.disabled) { background: #000; color: #fff; }
.menu-sep { height: 1px; background: #000; margin: 3px 0; opacity: .55; }
/* selection flash */
@keyframes miFlash { 0%,100% { background:#000; color:#fff; } 50% { background:#fff; color:#000; } }
.menu-item.flash { animation: miFlash 90ms linear 3; }

/* ------------------------------------------------------------
   Desktop
   ------------------------------------------------------------ */
#desktop {
  position: fixed;
  top: calc(var(--menubar-h) + 1px); left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, #fff 0 1px, #d7d7d7 1px 2px);
  z-index: 1;
  overflow: hidden;
}

/* ------------------------------------------------------------
   Windows
   ------------------------------------------------------------ */
#windows { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.window {
  position: absolute;
  pointer-events: auto;
  background: #fff;
  border: 1px solid #000;
  border-radius: 5px;
  display: flex; flex-direction: column;
  min-width: 120px;
  overflow: hidden;
}
.window.collapsed { min-height: 0; }
.titlebar {
  height: 24px;
  flex: 0 0 24px;
  position: relative;
  display: flex; align-items: center;
  background: repeating-linear-gradient(0deg, #fff 0 2px, #000 2px 3px);
  border-bottom: 1px solid #000;
  cursor: default;
}
.window.inactive .titlebar {
  background: repeating-linear-gradient(0deg, #fff 0 2px, #b9b9b9 2px 3px);
}
.tb-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: #fff; padding: 1px 7px 0;
  font-size: 16px; white-space: nowrap;
  max-width: calc(100% - 70px); overflow: hidden;
}
.closebox, .zoombox, .shadebox {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px;
  background: #fff; border: 1px solid #000;
  z-index: 2;
}
.closebox { left: 8px; }
.zoombox { right: 8px; }
.zoombox::after {
  content: ''; position: absolute; left: 2px; top: 2px; width: 6px; height: 6px;
  border: 1px solid #000; background: #fff;
}
.closebox:active, .zoombox:active { background: #000; }
.zoombox:active::after { background: #000; border-color: #fff; }
.window.inactive .closebox:active, .window.inactive .zoombox:active { background: #fff; }

/* window header strip (Finder "N items, K available") */
.winheader {
  flex: 0 0 17px;
  border-bottom: 1px solid #000;
  font-family: var(--geneva); font-size: 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: #000;
  overflow: hidden; white-space: nowrap;
}
.winheader .wh-rule { flex: 1; height: 0; border-top: 1px solid #000; margin: 0 6px; opacity: .6; }

.content {
  flex: 1 1 auto;
  position: relative;
  overflow: auto;
  background: #fff;
}
.window.collapsed .content,
.window.collapsed .winheader,
.window.collapsed .growbox { display: none; }

/* grow box */
.growbox {
  position: absolute; right: 0; bottom: 0;
  width: 15px; height: 15px; z-index: 5;
  background:
    linear-gradient(135deg, transparent 0 55%, #fff 55%);
  cursor: crosshair;
}
.growbox::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), #000 calc(50% - 1px), #000 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to top right, transparent calc(50% - 5px), #000 calc(50% - 5px), #000 calc(50% - 3px), transparent calc(50% - 3px)),
    linear-gradient(to top right, transparent calc(50% + 3px), #000 calc(50% + 3px), #000 calc(50% + 5px), transparent calc(50% + 5px));
  border-left: 1px solid #000; border-top: 1px solid #000;
}

/* drag outline (window + icon drags) */
#dragOutline {
  position: fixed; z-index: 8000; pointer-events: none;
  border: 1px dotted #000;
  outline: 1px dotted #fff;
  outline-offset: -2px;
  background: transparent;
}

/* ------------------------------------------------------------
   Icons (desktop + finder icon view)
   ------------------------------------------------------------ */
.icon {
  position: absolute;
  width: 76px;
  display: flex; flex-direction: column; align-items: center;
  cursor: default;
  padding-top: 2px;
}
.icon .glyph { width: 32px; height: 32px; }
.icon .glyph img { width: 32px; height: 32px; display: block; }
.icon .label {
  margin-top: 3px;
  font-family: var(--geneva); font-size: 10px;
  padding: 1px 3px 0;
  max-width: 76px; text-align: center;
  word-wrap: break-word; overflow-wrap: break-word;
  line-height: 1.15;
}
.icon.selected .glyph img { filter: invert(1); }
.icon.selected .label { background: #000; color: #fff; }
.icon.drop-target .glyph img { filter: invert(1); }
.icon.drop-target .label { background: #000; color: #fff; }
.icon .label-edit {
  margin-top: 3px;
  font-family: var(--geneva); font-size: 10px;
  width: 76px; text-align: center;
  border: 1px solid #000; background: #fff; color: #000;
  outline: none; padding: 0 2px;
}

/* ------------------------------------------------------------
   Finder list view
   ------------------------------------------------------------ */
.listview {
  font-family: var(--geneva); font-size: 10px;
  min-width: 100%;
  display: inline-block;
}
.lv-head, .lv-row {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) 56px 76px 70px 96px;
  align-items: center;
  white-space: nowrap;
}
.lv-head {
  border-bottom: 1px solid #000;
  color: #000;
  position: sticky; top: 0; background: #fff;
}
.lv-head > div { padding: 2px 6px; }
.lv-row { cursor: default; }
.lv-row > div { padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; }
.lv-row.selected { background: #000; color: #fff; }
.lv-row .lv-name { display: flex; align-items: center; gap: 6px; }
.lv-row .lv-name img { width: 16px; height: 16px; }
.lv-row.selected .lv-name img { filter: invert(1); }

/* ------------------------------------------------------------
   Note Pad
   ------------------------------------------------------------ */
.notepad-body { display: flex; flex-direction: column; height: 100%; }
.notepad-text {
  flex: 1 1 auto;
  width: 100%; height: 100%;
  border: none; outline: none; resize: none;
  font-family: var(--monaco); font-size: 12px; line-height: 14px;
  padding: 4px 5px;
  background: #fff; color: #000;
  caret-color: #000;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.notepad-text::selection { background: #000; color: #fff; }
.notepad-pages {
  flex: 0 0 22px;
  border-top: 1px solid #000;
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px;
  background: #fff;
  font-family: var(--geneva); font-size: 10px;
}
.np-btn {
  width: 14px; height: 14px; border: 1px solid #000; background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; padding: 0; cursor: default;
}
.np-btn:active { background: #000; color: #fff; }
.np-btn.disabled { border-color: #9a9a9a; color: #9a9a9a; }

/* ------------------------------------------------------------
   Calculator
   ------------------------------------------------------------ */
.calc { padding: 8px; font-family: var(--geneva); }
.calc-lcd {
  border: 1px solid #000; background: #fff;
  text-align: right; font-family: var(--monaco); font-size: 13px;
  padding: 3px 6px; margin-bottom: 8px; min-height: 20px;
  overflow: hidden;
}
.calc-grid {
  display: grid; grid-template-columns: repeat(4, 34px); gap: 4px;
}
.calc-grid .btn { padding: 3px 0; text-align: center; font-size: 12px; font-family: var(--geneva); }

/* ------------------------------------------------------------
   Dialogs / alerts / info windows
   ------------------------------------------------------------ */
#modalLayer {
  position: fixed; inset: 0; z-index: 7000;
  background: transparent;
}
.alert {
  position: absolute; left: 50%; top: 34%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid #000;
  border-radius: 7px;
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px #000, 3px 4px 0 rgba(0,0,0,.28);
  padding: 14px 16px 12px;
  min-width: 300px; max-width: 420px;
  display: flex; gap: 14px;
}
.alert .alert-icon { width: 32px; height: 32px; flex: 0 0 32px; }
.alert .alert-icon img { width: 32px; height: 32px; }
.alert .alert-main { flex: 1; }
.alert .alert-text { font-size: 16px; line-height: 1.25; margin-bottom: 12px; white-space: pre-line; }
.alert .alert-buttons { display: flex; justify-content: flex-end; gap: 12px; }

.btn {
  font-family: var(--chicago); font-size: 16px;
  background: #fff; border: 1px solid #000; border-radius: 5px;
  padding: 2px 14px 3px;
  cursor: default;
}
.btn:active { background: #000; color: #fff; }
.btn.default { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #000; margin: 3px; }
.btn:focus { outline: none; }

/* About This Macintosh */
.about { padding: 12px 16px; font-size: 16px; }
.about h1 { font-size: 16px; font-weight: normal; margin-bottom: 2px; }
.about .ab-sub { font-family: var(--geneva); font-size: 10px; margin-bottom: 10px; }
.about .ab-row { display: flex; justify-content: space-between; gap: 18px; font-family: var(--geneva); font-size: 11px; margin: 3px 0; }
.about .ab-hr { border-top: 1px solid #000; margin: 8px 0; opacity: .6; }
.about .ab-mem { font-family: var(--geneva); font-size: 11px; }
.about .ab-bar { height: 10px; border: 1px solid #000; margin: 2px 0 8px; position: relative; }
.about .ab-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-conic-gradient(#000 0 25%, #fff 0 50%); background-size: 2px 2px; }

/* Get Info */
.getinfo { padding: 10px 12px; font-family: var(--geneva); font-size: 11px; min-width: 300px; }
.gi-top { display: flex; gap: 12px; margin-bottom: 8px; }
.gi-top img { width: 32px; height: 32px; }
.gi-top .gi-name { font-family: var(--chicago); font-size: 16px; margin-bottom: 4px; }
.gi-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin-bottom: 8px; }
.gi-grid .k { color: #000; }
.gi-comments { width: 100%; height: 54px; border: 1px solid #000; resize: none; outline: none;
  font-family: var(--monaco); font-size: 11px; padding: 3px; }
.gi-comments::selection { background: #000; color: #fff; }
.gi-locked { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.gi-locked input { appearance: none; width: 11px; height: 11px; border: 1px solid #000; background: #fff; }
.gi-locked input:checked { background:
  linear-gradient(to top right, transparent calc(50% - 1px), #000 calc(50% - 1px), #000 50%, transparent 50%),
  linear-gradient(to bottom right, transparent calc(50% - 1px), #000 calc(50% - 1px), #000 50%, transparent 50%), #fff; }

/* ------------------------------------------------------------
   Shutdown screen
   ------------------------------------------------------------ */
#shutdown {
  position: fixed; inset: 0; z-index: 9500;
  background: #aaaaaa;
  display: flex; align-items: center; justify-content: center;
}
#shutdown[hidden] { display: none; }
.shutdown-dialog {
  background: #fff; border: 2px solid #000; border-radius: 7px;
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px #000, 3px 4px 0 rgba(0,0,0,.28);
  padding: 18px 22px; text-align: center;
}
.shutdown-mac { width: 48px; height: 48px; margin: 0 auto 10px; }
.shutdown-mac img { width: 48px; height: 48px; }
.shutdown-text { font-size: 16px; line-height: 1.3; margin-bottom: 14px; }

/* ------------------------------------------------------------
   Classic scrollbars (webkit)
   ------------------------------------------------------------ */
::-webkit-scrollbar { width: 15px; height: 15px; }
::-webkit-scrollbar-track {
  background: repeating-conic-gradient(#d0d0d0 0 25%, #fff 0 50%);
  background-size: 2px 2px;
  border-left: 1px solid #000;
}
::-webkit-scrollbar-track:horizontal { border-left: none; border-top: 1px solid #000; }
::-webkit-scrollbar-thumb { background: #fff; border: 1px solid #000; }
::-webkit-scrollbar-button { width: 15px; height: 15px; background: #fff; border: 1px solid #000; background-repeat: no-repeat; background-position: center; }
::-webkit-scrollbar-button:vertical:decrement { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="7" height="5"><path d="M0 5 L3.5 0 L7 5 Z" fill="black"/></svg>'); }
::-webkit-scrollbar-button:vertical:increment { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="7" height="5"><path d="M0 0 L3.5 5 L7 0 Z" fill="black"/></svg>'); }
::-webkit-scrollbar-button:horizontal:decrement { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="7"><path d="M5 0 L0 3.5 L5 7 Z" fill="black"/></svg>'); }
::-webkit-scrollbar-button:horizontal:increment { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="7"><path d="M0 0 L5 3.5 L0 7 Z" fill="black"/></svg>'); }
::-webkit-scrollbar-corner { background: #fff; border-top: 1px solid #000; border-left: 1px solid #000; }

/* cursor classes are injected at runtime by bitmaps.js */
