/* Desktop shell styles layered on top of 98.css. */

:root {
  --taskbar-h: 28px;
  --silver: #c0c0c0;
  --navy: #000080;
  --teal: #008080;
  --raised: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --pressed: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  --sunken: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  --dither: repeating-conic-gradient(#fff 0 25%, var(--silver) 0 50%) 0 0 / 2px 2px;
}

/* ---------- Page: no scrolling, no text selection on chrome ---------- */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
}

body {
  background: var(--teal);
  color: #000;
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

textarea,
input[type="text"],
.selectable {
  user-select: text;
  -webkit-user-select: text;
}

img {
  -webkit-user-drag: none;
}

.muted {
  color: #808080;
}

.error {
  color: #a00000;
  margin: 0;
}

.pre-line {
  white-space: pre-line;
}

.sunken {
  background: #fff;
  box-shadow: var(--sunken);
}

/* ---------- Desktop ---------- */

.desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
  /* `hidden` can still be scrolled by focus/caret movement; `clip` cannot. */
  overflow: clip;
  background: var(--teal);
}

.desk-icons {
  position: absolute;
  inset: 0;
  pointer-events: none; /* empty space belongs to the wallpaper */
}

/* Each icon is placed by its own left/top, so it can be dragged anywhere. */
.desk-icon {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  outline: none;
}

.desk-icon img {
  width: 32px;
  height: 32px;
}

.desk-icon span {
  color: #fff;
  text-align: center;
  line-height: 13px;
  padding: 0 2px;
  border: 1px dotted transparent;
}

.desk-icon.selected span {
  background: var(--navy);
  border-color: #ffff80;
}

.desk-icon.selected img {
  filter: brightness(0.55) sepia(1) hue-rotate(190deg) saturate(6);
}

.desk-icon.dragging {
  z-index: 1;
  opacity: 0.75;
}

/* ---------- Windows ---------- */

.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0;
}

.win.minimized {
  display: none;
}

.win.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.win > .title-bar {
  flex: none;
  touch-action: none;
}

.title-bar-text {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.title-bar-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.title-bar-controls {
  flex: none;
}

.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 2px;
}

/* Resize handles sit just outside/along the window edge. */
.rz {
  position: absolute;
  z-index: 2;
  touch-action: none;
}
.rz.n { top: -3px; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.rz.s { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.rz.e { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.rz.w { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.rz.ne { top: -3px; right: -3px; width: 11px; height: 11px; cursor: nesw-resize; }
.rz.nw { top: -3px; left: -3px; width: 11px; height: 11px; cursor: nwse-resize; }
.rz.se { bottom: -3px; right: -3px; width: 11px; height: 11px; cursor: nwse-resize; }
.rz.sw { bottom: -3px; left: -3px; width: 11px; height: 11px; cursor: nesw-resize; }

.win.maximized .rz {
  display: none;
}

/* ---------- Popup menus (menu bar dropdowns, Start menu) ---------- */

.popup {
  background: var(--silver);
  box-shadow: var(--raised);
  padding: 2px;
  margin: 0;
  list-style: none;
}

.popup li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.popup li:hover:not(.disabled):not(.sep),
.popup li.open {
  background: var(--navy);
  color: #fff;
}

.popup li.disabled {
  color: #808080;
  text-shadow: 1px 1px #fff;
}

.popup li.disabled:hover {
  background: none;
}

.popup li.sep {
  height: 0;
  padding: 0 !important;
  margin: 3px 2px;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
}

.menu-catcher {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.menubar {
  position: relative;
  z-index: 101;
  display: flex;
  flex: none;
  padding: 1px 0 2px;
}

.menubar-item {
  position: relative;
}

.menubar-label {
  display: block;
  padding: 2px 6px;
}

.menubar-item:hover:not(.open) > .menubar-label {
  box-shadow: inset -1px -1px #808080, inset 1px 1px #fff;
}

.menubar-item.open > .menubar-label {
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff;
}

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 150px;
}

.menubar-item.open > .dropdown {
  display: block;
}

.dropdown li {
  padding: 3px 16px 3px 4px;
}

.dropdown .check {
  width: 12px;
  text-align: center;
}

.dropdown .shortcut {
  margin-left: auto;
  padding-left: 24px;
}

/* ---------- Dialogs ---------- */

.win-modal {
  position: absolute;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog {
  min-width: 260px;
  max-width: calc(100% - 16px);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-body p {
  margin: 0;
}

.dialog-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.dialog-icon {
  width: 32px;
  height: 32px;
  flex: none;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.shutdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(rgba(0, 0, 0, 0.55) 0 25%, transparent 0 50%) 0 0 / 2px 2px;
}

.listbox {
  height: 120px;
  overflow: auto;
  margin: 0;
  padding: 2px;
  list-style: none;
}

.listbox li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 3px;
}

.listbox li img {
  width: 16px;
  height: 16px;
}

.listbox li .muted {
  margin-left: auto;
}

.listbox li.sel {
  background: var(--navy);
  color: #fff;
}

.listbox li.sel .muted {
  color: #c0c0c0;
}

/* ---------- Notepad ---------- */

.notepad {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.notepad.busy,
.notepad.busy * {
  cursor: progress !important;
}

.notepad-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  resize: none;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.25;
  -webkit-font-smoothing: auto;
  white-space: pre-wrap;
  overflow: auto;
}

.notepad-text.nowrap {
  white-space: pre;
}

/* ---------- Folder windows ---------- */

.folder {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.folder-items {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px 4px;
  padding: 10px;
}

.folder-item {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.folder-item img {
  width: 32px;
  height: 32px;
}

.folder-item span {
  text-align: center;
  padding: 0 2px;
  border: 1px dotted transparent;
}

.folder-item.selected span {
  background: var(--navy);
  color: #fff;
  border-color: #ffff80;
}

.folder-item.selected img {
  filter: brightness(0.55) sepia(1) hue-rotate(190deg) saturate(6);
}

.folder .status-bar {
  margin-top: 2px;
}

/* ---------- About Me ---------- */

.about {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 0;
}

.about menu[role="tablist"] {
  flex: none;
}

.about-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-bottom: 8px;
}

.about-panel .window-body {
  margin: 12px;
}

.about-general {
  display: flex;
  gap: 16px;
}

.about-general p {
  margin: 0 0 10px;
  line-height: 1.4;
}

.about-art {
  width: 96px;
  height: 96px;
  flex: none;
  image-rendering: pixelated;
}

.about-name {
  font-weight: bold;
  font-size: 13px;
}

.about-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1.4;
}

.about-panel fieldset {
  margin-bottom: 10px;
}

.about-panel fieldset p {
  margin: 0;
}

/* ---------- Hiscores ---------- */

.hiscores {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hiscores.busy,
.hiscores.busy * {
  cursor: progress !important;
}

.hs-summary {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 8px 10px;
  margin: 0 2px 6px;
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px #fff;
}

.hs-summary p {
  margin: 0 0 3px;
}

.hs-art {
  width: 48px;
  height: 48px;
  flex: none;
}

.hs-who {
  flex: 1;
  min-width: 110px;
}

.hs-name {
  font-weight: bold;
  font-size: 13px;
}

.hs-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 10px;
  margin: 0;
}

.hs-stats dt {
  color: #404040;
}

.hs-stats dd {
  margin: 0;
  text-align: right;
  font-weight: bold;
}

.hiscores > .hs-tabs {
  flex: none;
  margin: 0 6px;
}

.hs-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  margin: 0 6px 4px;
  padding: 8px;
}

.hs-list {
  flex: 1;
  min-height: 0;
}

.hs-table {
  width: 100%;
}

.hs-table th {
  cursor: pointer;
}

.hs-table th:active {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}

.hs-table .num {
  text-align: right;
}

.hs-table tr.hs-overall td {
  font-weight: bold;
}

.hs-table tr.hs-maxed td:first-child::after {
  content: " \2605";
  color: #b8860b;
}

.hs-table tr.highlighted.hs-maxed td:first-child::after {
  color: #ffff80;
}

.hs-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  white-space: normal;
}

.hs-message p {
  margin: 0 0 10px;
}

.hiscores .status-bar {
  margin-top: 2px;
}

.hiscores .status-bar-field:first-child {
  flex: 0 0 90px;
}

/* ---------- GitHub (reuses the Hiscores list-view styles) ---------- */

.gh-avatar {
  border: 1px solid #808080;
  image-rendering: pixelated;
}

.gh-row-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -3px;
}

.gh-lang {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border: 1px solid #404040;
  vertical-align: -1px;
}

.gh-details {
  flex: none;
  margin: 2px 6px 4px;
}

.gh-details p {
  margin: 0 0 6px;
}

.gh-actions {
  display: flex;
  gap: 6px;
}

/* ---------- Taskbar ---------- */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  height: var(--taskbar-h);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 2px 1px;
  background: var(--silver);
  box-shadow: inset 0 1px #dfdfdf, inset 0 2px #fff;
}

.taskbar button {
  min-width: 0;
  min-height: 0;
  height: 22px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.taskbar button img {
  width: 16px;
  height: 16px;
  flex: none;
}

.start-btn {
  font-weight: bold;
  padding: 0 6px 0 3px !important;
}

.start-btn.active,
.task.active {
  box-shadow: var(--pressed);
}

.start-btn.active > *,
.task.active > * {
  transform: translate(1px, 1px);
}

.tb-sep {
  flex: none;
  width: 0;
  height: 20px;
  margin: 0 2px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
}

.quick-launch {
  display: flex;
  gap: 1px;
}

.quick-launch button {
  width: 23px;
  justify-content: center;
  box-shadow: none;
  background: transparent;
}

.quick-launch button:hover {
  box-shadow: inset -1px -1px #808080, inset 1px 1px #fff;
}

.quick-launch button:active {
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff;
}

.tasks {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 3px;
  overflow: hidden;
}

.task {
  flex: 0 1 160px;
  min-width: 0 !important;
  justify-content: flex-start;
  overflow: hidden;
}

.task span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task.active {
  background: var(--dither);
  font-weight: bold;
}

.tray {
  flex: none;
  height: 22px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080;
}

/* ---------- Start menu ---------- */

.start-catcher {
  position: fixed;
  inset: 0;
  z-index: 1001;
}

.start-menu {
  position: fixed;
  left: 2px;
  bottom: calc(var(--taskbar-h) - 3px);
  z-index: 1002;
  display: flex;
  padding: 3px;
}

.start-banner {
  width: 22px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: linear-gradient(to top, var(--navy), #1084d0);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: Arial, sans-serif;
  font-size: 18px;
  -webkit-font-smoothing: auto;
  color: #c0c0c0;
}

.start-banner b {
  font-weight: 900;
}

.start-banner span {
  color: #fff;
}

.start-items {
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 170px;
}

.start-items > li {
  height: 32px;
  padding: 0 20px 0 4px;
  gap: 10px;
}

.start-items > li > img {
  width: 24px;
  height: 24px;
}

.start-items .arrow {
  margin-left: auto;
  margin-right: -12px;
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.submenu {
  display: none;
  position: absolute;
  left: calc(100% - 3px);
  top: -3px;
  min-width: 150px;
}

li.open > .submenu {
  display: block;
}

.submenu li {
  height: 22px;
  padding: 0 20px 0 4px;
  color: #000;
}

.submenu li img {
  width: 16px;
  height: 16px;
}

/* ---------- Boot / shutdown screens ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.bios {
  position: absolute;
  inset: 0;
  background: #000;
  color: #aaa;
  padding: 24px;
  cursor: none;
}

.bios pre {
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font-family: "Courier New", monospace;
  font-size: clamp(11px, 2.2vw, 16px);
  line-height: 1.35;
  white-space: pre-wrap;
  -webkit-font-smoothing: auto;
}

.bios-logo {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 72px;
  height: 56px;
  border: 2px solid #3c3;
  color: #3c3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: bold;
}

.bios-logo small {
  font-size: 11px;
  letter-spacing: 3px;
}

.bios-footer {
  position: absolute;
  left: 24px;
  bottom: 20px;
  font-family: "Courier New", monospace;
  font-size: 14px;
}

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background:
    radial-gradient(ellipse 30% 12% at 18% 28%, rgba(255, 255, 255, 0.9), transparent 70%),
    radial-gradient(ellipse 22% 9% at 72% 18%, rgba(255, 255, 255, 0.85), transparent 70%),
    radial-gradient(ellipse 38% 14% at 62% 72%, rgba(255, 255, 255, 0.8), transparent 70%),
    radial-gradient(ellipse 26% 10% at 14% 82%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(ellipse 20% 8% at 90% 50%, rgba(255, 255, 255, 0.7), transparent 70%),
    linear-gradient(#2a62c4, #6fa6e6 55%, #b6d4f4);
  cursor: progress;
}

.splash-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.splash-flag {
  width: clamp(48px, 10vw, 96px);
  height: auto;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.3));
}

.splash-word {
  font-family: "Franklin Gothic Medium", "Arial Black", Arial, sans-serif;
  font-size: clamp(36px, 8vw, 76px);
  font-style: italic;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
  -webkit-font-smoothing: auto;
}

.splash-word .ver {
  margin-left: 0.2em;
  color: #ff7a1a;
  font-weight: bold;
}

.splash-status {
  margin: 0;
  min-height: 1em;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 16px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  -webkit-font-smoothing: auto;
}

.splash-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: linear-gradient(90deg, var(--navy), #1084d0, #fff, #1084d0, var(--navy)) 0 0 / 50% 100% repeat-x;
  animation: splash-slide 1.2s linear infinite;
}

@keyframes splash-slide {
  to {
    background-position: 100% 0;
  }
}

.safe-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: #000;
  color: #ff8c1a;
  text-align: center;
  font-family: "Arial Black", Arial, sans-serif;
  -webkit-font-smoothing: auto;
}

.safe-screen p {
  margin: 0;
  font-size: clamp(22px, 4.5vw, 44px);
  line-height: 1.3;
}

.safe-screen small {
  color: #555;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .splash-bar {
    animation: none;
  }
}

/* ---------- Privacy ---------- */

.privacy {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 8px;
}

.privacy-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 0 2px;
  line-height: 1.4;
}

.privacy-scroll > p {
  margin: 0 0 10px;
}

.privacy fieldset {
  margin-bottom: 10px;
}

.privacy fieldset p {
  margin: 0 0 8px;
}

.privacy .about-list {
  gap: 6px;
  list-style: disc;
  padding-left: 16px;
}

.privacy-note {
  padding: 6px 8px;
  background: #ffffe1;
  border: 1px solid #000;
}

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

/* ---------- Tray balloon (return-visit consent) ---------- */

.balloon {
  position: fixed;
  right: 6px;
  bottom: calc(var(--taskbar-h) + 10px);
  z-index: 1500;
  box-sizing: border-box;
  width: 280px;
  max-width: calc(100vw - 12px);
  padding: 8px 10px 10px;
  background: #ffffe1;
  border: 1px solid #000;
  border-radius: 6px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  line-height: 1.4;
}

/* The tail pointing at the tray. */
.balloon::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -10px;
  border-width: 10px 0 0 12px;
  border-style: solid;
  border-color: #000 transparent transparent transparent;
}

.balloon p {
  margin: 0 0 8px;
}

.balloon-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 18px;
  font-weight: bold;
}

.balloon-title img {
  width: 16px;
  height: 16px;
}

.balloon-close {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 0;
  min-height: 0;
  width: 16px;
  height: 14px;
  padding: 0;
  line-height: 10px;
}

.balloon-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.balloon-buttons button {
  min-width: 0;
  padding: 0 10px;
}

.balloon-buttons .balloon-link {
  margin-left: auto;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: #00f;
  text-decoration: underline;
  cursor: pointer;
}
