@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

* { box-sizing: border-box; }

:root {
  --gray: #c0c0c0;
  --gray-d: #808080;
  --gray-dd: #404040;
  --white: #ffffff;
  --navy1: #000082;
  --navy2: #1084d0;
  --teal: #008080;
  --sys-font: "MS Sans Serif", "Tahoma", "Segoe UI", sans-serif;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--sys-font);
  font-size: 13px;
  background: var(--teal);
  overflow: hidden;
}

.desktop {
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 30% 20%, #0a9a9a 0%, var(--teal) 60%);
  padding: 20px;
  padding-bottom: 60px;
  overflow: auto;
  -webkit-font-smoothing: none;
}

/* ---- generic window ---- */
.w95-window {
  background: var(--gray);
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: 1px 1px 0 #808080 inset, -1px -1px 0 #fff inset;
  padding: 2px;
}

.main-window {
  max-width: 560px;
  margin: 0 auto;
  animation: winOpen .25s ease-out;
}

@keyframes winOpen {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---- title bar ---- */
.w95-title {
  background: linear-gradient(90deg, var(--navy1), var(--navy2));
  color: #fff;
  font-weight: bold;
  padding: 3px 4px;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.title-with-icon { display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mini-icon { font-size: 12px; }
.w95-title-btns { display: flex; gap: 2px; }
.w95-ctl {
  width: 18px; height: 16px; line-height: 1;
  background: var(--gray);
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  font-size: 10px; font-weight: bold;
  cursor: pointer; padding: 0;
  color: #000;
}
.w95-ctl:active { border-color: #000 #fff #fff #000; }

/* ---- menu bar ---- */
.w95-menu {
  display: flex; gap: 2px; padding: 2px 4px;
  position: relative;
  border-bottom: 1px solid var(--gray-d);
}
.w95-menu-item { padding: 2px 8px; cursor: pointer; }
.w95-menu-item:hover, .w95-menu-item.active {
  background: var(--navy1); color: #fff;
}
.w95-dropdown {
  position: absolute; top: 100%; left: 90px;
  background: var(--gray);
  border: 2px solid; border-color: #fff #000 #000 #fff;
  min-width: 180px; z-index: 700; padding: 2px;
}
.w95-drop-item { padding: 4px 18px 4px 22px; cursor: pointer; white-space: nowrap; }
.w95-drop-item:hover { background: var(--navy1); color: #fff; }

/* ---- body ---- */
.main-body { padding: 10px; }

.w95-group {
  border: 1px solid var(--white);
  outline: 1px solid var(--gray-d);
  padding: 10px 12px;
  margin: 0 0 12px 0;
}
.w95-group legend { padding: 0 4px; font-weight: bold; }

.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.field-label { min-width: 100px; }
.sev-row { align-items: center; }
.sev-val { font-weight: bold; color: var(--navy1); min-width: 110px; }

.w95-input {
  flex: 1; min-width: 120px;
  background: #fff;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  padding: 3px 5px;
  font-family: var(--sys-font); font-size: 13px;
}
select.w95-input { flex: 0 0 auto; min-width: 160px; }

.checks { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }

.w95-check { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.w95-check-dis { opacity: .5; }
.w95-check-box {
  width: 14px; height: 14px; background: #fff;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; cursor: pointer; color: #000;
}
.w95-check-box.small { width: 12px; height: 12px; font-size: 9px; }

/* slider */
.w95-slider { flex: 1; min-width: 120px; accent-color: var(--navy1); height: 18px; }

/* ---- asm ---- */
.asm-view {
  background: #000; color: #33ff66;
  font-family: "VT323", monospace; font-size: 16px; line-height: 1.15;
  margin: 0; padding: 8px 10px;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  white-space: pre; overflow-x: auto;
  max-height: 200px; overflow-y: auto;
}

/* ---- buttons ---- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.w95-btn {
  background: var(--gray);
  border: 2px solid; border-color: #fff #000 #000 #fff;
  box-shadow: 1px 1px 0 #808080 inset;
  padding: 5px 14px;
  font-family: var(--sys-font); font-size: 13px;
  cursor: pointer; color: #000;
  min-height: 28px;
}
.w95-btn:active:not(:disabled) {
  border-color: #000 #fff #fff #000;
  box-shadow: 1px 1px 0 #808080;
  padding: 6px 13px 4px 15px;
}
.w95-btn:disabled { cursor: default; color: #808080; text-shadow: 1px 1px 0 #fff; }

.hint { font-size: 12px; color: var(--navy1); margin-bottom: 8px; }

/* ---- status bar ---- */
.w95-statusbar { display: flex; gap: 4px; margin-top: 4px; }
.status-cell {
  border: 1px solid; border-color: #808080 #fff #fff #808080;
  padding: 2px 6px; font-size: 11px; flex: 1;
  display: flex; align-items: center; gap: 5px;
}
.status-cell.mute { flex: 0 0 auto; cursor: pointer; }

/* ---- run window ---- */
.run-window {
  position: fixed; top: 30%; left: 50%; transform: translateX(-50%);
  width: 260px; z-index: 450;
}
.run-body { padding: 18px; display: flex; align-items: center; gap: 12px; }
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--gray-d);
  border-top-color: var(--navy2); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- compile window ---- */
.comp-window {
  position: fixed; top: 35%; left: 50%; transform: translateX(-50%);
  width: min(400px, 92vw);
}
.comp-body { padding: 12px; }
.comp-log {
  background: #fff; border: 2px solid; border-color: #808080 #fff #fff #808080;
  height: 110px; overflow: auto; padding: 4px 6px;
  font-family: "VT323", monospace; font-size: 15px; margin-bottom: 10px;
}
.w95-progress {
  display: flex; gap: 2px; padding: 3px;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  background: #fff;
}
.w95-progress-block { flex: 1; height: 18px; background: transparent; }
.w95-progress-block.filled { background: var(--navy1); }

/* ---- dialog ---- */
.w95-dialog {
  position: fixed;
  transform: translate(-50%, -50%);
  min-width: 300px; max-width: 92vw;
  animation: winOpen .18s ease-out;
}
.w95-dialog-body { padding: 16px; }
.w95-dialog-content { display: flex; gap: 14px; align-items: flex-start; }
.w95-dialog-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }

.w95-icon {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; color: #fff; font-size: 22px;
}
.w95-icon.err { background: radial-gradient(circle at 35% 30%, #ff6b6b, #cc0000); }
.w95-icon.err::after { content: "✕"; font-size: 20px; }
.w95-icon.warn { background: #ffd21e; border-radius: 4px; color: #000; }
.w95-icon.warn::after { content: "!"; font-size: 22px; }
.w95-icon.info { background: radial-gradient(circle at 35% 30%, #6bb6ff, #0055cc); border-radius: 50%; }
.w95-icon.info::after { content: "i"; font-family: Georgia, serif; font-style: italic; font-size: 20px; }

.crash-msg { margin: 0 0 8px; }
.crash-sub { font-size: 11px; color: #444; margin: 0; }
.crash-details {
  margin-top: 12px; background: #fff;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  padding: 8px; font-family: "VT323", monospace; font-size: 15px;
  max-height: 180px; overflow: auto;
}
.crash-details > div { margin-bottom: 3px; }
.reg-dump { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 12px; margin-top: 6px; }
.reg { color: var(--navy1); }
.meltdown-warn { color: #cc0000; font-weight: bold; margin-top: 6px; animation: blink 1s step-end infinite; }

.hourglass { display: inline-block; animation: spin 1.5s linear infinite; }

/* ---- start menu ---- */
.start-menu {
  position: fixed; bottom: 34px; left: 4px;
  display: flex; z-index: 800;
  background: var(--gray);
  border: 2px solid; border-color: #fff #000 #000 #fff;
  box-shadow: 2px 2px 4px rgba(0,0,0,.4);
  animation: slideUp .15s ease-out;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.start-side {
  writing-mode: vertical-rl; transform: rotate(180deg);
  background: linear-gradient(var(--navy1), var(--navy2));
  color: #fff; font-weight: bold; font-size: 18px;
  padding: 10px 6px; letter-spacing: 1px;
}
.start-items { min-width: 200px; padding: 3px; }
.start-item { padding: 7px 14px; cursor: pointer; }
.start-item:hover { background: var(--navy1); color: #fff; }
.start-sep { height: 2px; margin: 3px 4px; border-top: 1px solid #808080; border-bottom: 1px solid #fff; }

/* ---- taskbar ---- */
.taskbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 34px;
  background: var(--gray);
  border-top: 2px solid #fff;
  display: flex; align-items: center; gap: 6px; padding: 3px 5px;
  z-index: 900;
}
.start-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--gray);
  border: 2px solid; border-color: #fff #000 #000 #fff;
  font-weight: bold; font-family: var(--sys-font); font-size: 13px;
  padding: 3px 10px; cursor: pointer; height: 26px;
}
.start-btn.pressed { border-color: #000 #fff #fff #000; }
.flag { color: var(--navy2); font-size: 15px; }
.task-tab {
  border: 2px solid; border-color: #000 #fff #fff #000;
  padding: 3px 10px; font-size: 12px; height: 26px;
  display: flex; align-items: center;
  background: #d4d0c8;
}
.tray {
  margin-left: auto;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  padding: 2px 8px; height: 26px;
  display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.tray-icon { cursor: default; }

/* ---- BSOD ---- */
.bsod {
  position: fixed; inset: 0; background: #0000aa;
  color: #fff; font-family: "VT323", monospace;
  display: flex; align-items: center; justify-content: center;
  z-index: 5000; padding: 20px; cursor: pointer;
  outline: none;
  animation: crtOn .2s ease-out;
}
@keyframes crtOn { from { transform: scaleY(.02); filter: brightness(3); } to { transform: scaleY(1); filter: brightness(1); } }
.bsod-inner { max-width: 640px; font-size: 20px; line-height: 1.35; }
.bsod-inner p { margin: 0; }
.bsod-head {
  background: #c0c0c0; color: #0000aa; text-align: center;
  width: 130px; margin: 0 auto 20px; font-weight: bold; padding: 0 6px;
}
.bsod-blink { margin-top: 20px !important; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- shutdown ---- */
.shutdown {
  position: fixed; inset: 0; background: #000;
  display: flex; align-items: center; justify-content: center;
  z-index: 5000; cursor: pointer;
  animation: fadeBlack .8s ease-out;
}
@keyframes fadeBlack { from { background:#008080; } to { background:#000; } }
.shutdown-text {
  color: #ff9800; font-family: "VT323", monospace; font-size: 34px;
  text-align: center; text-shadow: 0 0 12px rgba(255,152,0,.6);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; } }

/* ---- shake ---- */
.shaking { animation: shake .08s infinite; }
@keyframes shake {
  0% { transform: translate(calc(var(--shake)*-4px), calc(var(--shake)*2px)); }
  50% { transform: translate(calc(var(--shake)*4px), calc(var(--shake)*-3px)); }
  100% { transform: translate(calc(var(--shake)*-2px), calc(var(--shake)*3px)); }
}

/* ---- footer ---- */
.footer {
  position: fixed; bottom: 36px; left: 0; right: 0;
  text-align: center; font-size: 10px; color: #d0f0f0;
  pointer-events: none;
}
.footer a { color: #fff; pointer-events: auto; font-weight: bold; }

@media (max-width: 600px) {
  html, body { font-size: 12px; }
  .field-label { min-width: 80px; }
  .w95-dropdown { left: 4px; }
  .footer { font-size: 9px; }
}