/* Windows 95-ish chrome for the 3D Maze screen saver remake. */

:root {
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --white: #ffffff;
  --shadow: #808080;
  --dark: #000000;
  --navy: #000080;
  --teal: #008080;
  --font: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--teal);
  color: #000;
  font-family: var(--font);
  font-size: 11px;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

[hidden] { display: none !important; }

.noscript {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  padding: 12px 16px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--face-light) var(--dark) var(--dark) var(--face-light);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow);
  z-index: 9999;
}

button, select, input {
  font-family: inherit;
  font-size: inherit;
}

button { color: #000; }

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

/* ---------------------------------------------------------------- desktop */

#desktop {
  position: fixed;
  inset: 0 0 30px 0;
  background: var(--teal);
}

.desktop-icons {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.desktop-icon {
  width: 84px;
  padding: 2px;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.desktop-icon img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .45));
}

.desktop-icon .icon-label {
  max-width: 100%;
  padding: 1px 2px;
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}

.desktop-icon.is-selected {
  border-color: rgba(255, 255, 255, .5);
}

.desktop-icon.is-selected .icon-label {
  background: var(--navy);
  outline: 1px dotted #fff;
  outline-offset: -1px;
}

.desktop-icon:focus-visible {
  outline: 1px dotted #fff;
  outline-offset: 1px;
}

.start-hint {
  position: absolute;
  top: 22px;
  left: 104px;
  width: 208px;
  padding: 6px 8px;
  background: #ffffe1;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
  color: #000;
  line-height: 15px;
  transition: opacity .5s ease, visibility .5s;
}

.start-hint.is-gone {
  opacity: 0;
  visibility: hidden;
}

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

.window {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  z-index: 60;
  max-width: calc(100vw - 16px);
  padding: 2px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--face-light) var(--dark) var(--dark) var(--face-light);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow);
}

#settingsWindow { width: 408px; }
#aboutWindow { width: 392px; }

.window.is-dragging { cursor: default; }

.titlebar {
  height: 19px;
  padding: 0 2px 0 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
  color: #fff;
  font-weight: 700;
  cursor: default;
  touch-action: none;
}

.titlebar-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  flex: none;
}

.titlebar-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: .1px;
  padding-top: 1px;
}

.titlebar-button {
  width: 17px;
  height: 15px;
  padding: 0 0 1px;
  background: var(--face);
  border: 1px solid;
  border-color: var(--white) var(--dark) var(--dark) var(--white);
  box-shadow: inset 1px 1px 0 var(--face-light), inset -1px -1px 0 var(--shadow);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  cursor: default;
}

.titlebar-button:active {
  border-color: var(--dark) var(--white) var(--white) var(--dark);
  box-shadow: none;
  padding: 1px 0 0;
}

.window-body {
  padding: 8px 10px 10px;
}

/* tabs */

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin: 1px 0 0 4px;
  position: relative;
  z-index: 1;
}

.tab {
  position: relative;
  height: 21px;
  margin-bottom: -1px;
  padding: 2px 11px 2px;
  background: var(--face);
  border: 1px solid var(--dark);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  box-shadow: inset 1px 1px 0 var(--white), inset -1px 0 0 var(--shadow);
  cursor: default;
}

.tab.is-active {
  height: 23px;
  z-index: 2;
  padding-top: 3px;
  font-weight: 700;
  box-shadow: inset 1px 1px 0 var(--white), inset -1px 0 0 var(--face-light);
}

.tab-panel {
  position: relative;
  z-index: 0;
  padding: 11px 10px 8px;
  background: var(--face);
  border: 1px solid var(--dark);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow);
}

/* form bits */

.group {
  margin: 0 0 9px;
  padding: 7px 10px 6px;
  border: 1px solid var(--shadow);
  box-shadow: inset 1px 1px 0 var(--white), 1px 1px 0 var(--white);
}

.group legend {
  padding: 0 4px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
}

.field-row > label {
  width: 88px;
  flex: none;
}

select {
  width: 176px;
  max-width: 100%;
  height: 21px;
  padding: 1px 20px 1px 3px;
  background-color: #fff;
  border: 1px solid var(--dark);
  border-color: var(--shadow) var(--white) var(--white) var(--shadow);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M4 6l4 4 4-4z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  cursor: default;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 2px;
  cursor: default;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  flex: none;
  position: relative;
  background: #fff;
  border: 1px solid var(--dark);
  border-color: var(--shadow) var(--white) var(--white) var(--shadow);
  border-radius: 0;
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 7px;
  height: 4px;
  border-left: 2px solid #000;
  border-bottom: 2px solid #000;
  transform: rotate(-45deg);
}

.note {
  margin: 2px 0 0;
  color: #303030;
  line-height: 15px;
}

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

.btn {
  min-width: 76px;
  height: 23px;
  padding: 2px 8px;
  background: var(--face);
  border: 1px solid var(--dark);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow);
  cursor: default;
}

.btn:active {
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--white);
  padding: 3px 7px 1px 9px;
}

.btn-default {
  outline: 1px solid var(--dark);
  outline-offset: 1px;
}

/* about */

.about-body { padding-top: 10px; }

.about-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.about-head img {
  image-rendering: pixelated;
  flex: none;
}

.about-head h1 {
  margin: 0;
  font-size: 17px;
  line-height: 20px;
  letter-spacing: -.2px;
}

.about-sub {
  margin: 2px 0 0;
  color: #303030;
}

.about-body > p {
  margin: 0 0 8px;
  line-height: 15px;
}

.about-list {
  margin: 0 0 9px;
  padding-left: 18px;
  line-height: 16px;
}

.about-credit {
  padding-top: 8px;
  border-top: 1px solid var(--shadow);
  color: #303030;
}

.about-credit a { color: #0000c0; }

/* ---------------------------------------------------------------- pinball */

#pinballWindow {
  width: min(430px, calc(62.5vh - 76px), calc(100vw - 8px));
}

.pinball-body {
  padding: 4px 5px 5px;
}

.pinball-hud {
  display: flex;
  gap: 2px;
  margin-bottom: 4px;
  padding: 3px 4px;
  background: #070b14;
  border: 1px solid;
  border-color: var(--shadow) var(--white) var(--white) var(--shadow);
}

.pb-stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 1px 3px 2px;
  text-align: center;
  border-right: 1px solid #1c2a40;
}

.pb-stat:last-child { border-right: 0; }

.pb-stat span {
  display: block;
  color: #61728d;
  font-size: 8px;
  letter-spacing: .7px;
  line-height: 10px;
  text-transform: uppercase;
}

.pb-stat b {
  display: block;
  overflow: hidden;
  color: #ff6242;
  font-family: "Courier New", Courier, monospace;
  font-size: 15px;
  font-weight: 700;
  line-height: 17px;
  text-overflow: ellipsis;
  text-shadow: 0 0 7px rgba(255, 74, 40, .75);
  white-space: nowrap;
}

.pinball-stage {
  position: relative;
  background: #02050a;
  border: 1px solid;
  border-color: var(--dark) var(--white) var(--white) var(--dark);
  line-height: 0;
  overflow: hidden;
}

#pinballCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 640;
  cursor: default;
  outline: none;
  touch-action: none;
}

#pinballCanvas:focus-visible {
  outline: 1px dotted #7fd9ff;
  outline-offset: -3px;
}

.pinball-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.pb-tip {
  flex: 1 1 120px;
  min-width: 92px;
  color: #303030;
  font-size: 10px;
  line-height: 12px;
}

.pb-button {
  min-width: 0;
  height: 19px;
  padding: 1px 5px;
  font-size: 9px;
}

.pb-button:active {
  padding: 2px 4px 0 6px;
}

/* -------------------------------------------------------------- start menu */

.start-menu {
  position: fixed;
  left: 2px;
  bottom: 29px;
  z-index: 300;
  display: flex;
  padding: 2px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--face-light) var(--dark) var(--dark) var(--face-light);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow), 3px 3px 0 rgba(0, 0, 0, .25);
}

.start-menu-rail {
  width: 21px;
  flex: none;
  background: linear-gradient(180deg, #000080, #1084d0);
  color: #c0c0c0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 0;
}

.start-menu-rail span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
}

.start-menu-items {
  width: 188px;
  padding: 2px 2px 2px 3px;
  display: flex;
  flex-direction: column;
}

.start-item {
  height: 34px;
  width: 100%;
  padding: 2px 8px 2px 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: default;
}

.start-item img,
.start-item .menu-glyph {
  width: 24px;
  height: 24px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

.start-item:hover,
.start-item:focus-visible {
  background: var(--navy);
  color: #fff;
  outline: none;
}

.menu-separator {
  height: 2px;
  margin: 3px 2px;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--white);
}

/* ---------------------------------------------------------------- taskbar */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  height: 30px;
  padding: 2px 3px 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--face);
  border-top: 1px solid var(--white);
  box-shadow: inset 0 1px 0 var(--face-light);
}

.start-button {
  height: 24px;
  min-width: 57px;
  padding: 1px 6px 1px 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  background: var(--face);
  border: 1px solid;
  border-color: var(--white) var(--dark) var(--dark) var(--white);
  box-shadow: inset 1px 1px 0 var(--face-light), inset -1px -1px 0 var(--shadow);
  cursor: default;
}

.start-button.is-open,
.start-button:active {
  border-color: var(--dark) var(--white) var(--white) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shadow);
  padding: 2px 5px 0 4px;
}

.win-flag {
  width: 17px;
  height: 17px;
  flex: none;
}

.taskbar-divider {
  width: 2px;
  height: 22px;
  margin: 0 2px;
  border-left: 1px solid var(--shadow);
  border-right: 1px solid var(--white);
}

.taskbar-tasks {
  display: flex;
  gap: 3px;
  min-width: 0;
}

.task-button {
  height: 23px;
  max-width: 176px;
  min-width: 118px;
  padding: 1px 6px 1px 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  background: var(--face);
  border: 1px solid;
  border-color: var(--white) var(--dark) var(--dark) var(--white);
  box-shadow: inset 1px 1px 0 var(--face-light), inset -1px -1px 0 var(--shadow);
  cursor: default;
  white-space: nowrap;
}

.task-button img {
  width: 16px;
  height: 16px;
  flex: none;
  image-rendering: pixelated;
}

.task-button span {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
}

.task-button.is-active {
  border-color: var(--dark) var(--white) var(--white) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shadow);
  padding: 2px 5px 0 4px;
  background:
    repeating-conic-gradient(var(--face) 0% 25%, var(--face-light) 0% 50%)
    0 0 / 2px 2px;
}

.taskbar-spacer { flex: 1; }

.clock {
  height: 23px;
  min-width: 64px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  border-color: var(--shadow) var(--white) var(--white) var(--shadow);
  white-space: nowrap;
}

/* ------------------------------------------------------------ screen saver */

#screensaver {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  overflow: hidden;
  cursor: default;
}

#mazeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#screensaver::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, .4) 100%);
}

.ss-exit {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  height: 23px;
  min-width: 58px;
  padding: 2px 10px;
  background: var(--face);
  border: 1px solid var(--dark);
  box-shadow: inset 1px 1px 0 var(--white), inset -1px -1px 0 var(--shadow);
  color: #000;
  cursor: default;
  opacity: .82;
}

.ss-exit:hover,
.ss-exit:focus-visible {
  opacity: 1;
}

.ss-exit:active {
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--white);
  padding: 3px 9px 1px 11px;
}

.ss-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 2;
  transform: translateX(-50%);
  padding: 5px 10px;
  background: #ffffe1;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  color: #000;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  transition: opacity .7s ease;
}

.ss-hint.is-dim { opacity: .55; }

.ss-hint.is-gone { opacity: 0; }

/* ---------------------------------------------------------------- shutdown */

.shutdown-screen {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #000;
  color: #ffa000;
  text-align: center;
  cursor: default;
}

.shutdown-message {
  margin: 0;
  font-family: "MS Sans Serif", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 400;
  letter-spacing: .2px;
}

.shutdown-hint {
  margin: 54px 0 0;
  color: #5c5c5c;
  font-family: var(--font);
  font-size: 11px;
}

/* ------------------------------------------------------------- small screens */

@media (max-width: 560px) {
  .window { top: 44%; }
  #settingsWindow, #aboutWindow { width: calc(100vw - 12px); }
  #pinballWindow {
    width: min(calc(100vw - 12px), calc(62.5vh - 76px));
  }
  .field-row > label { width: 78px; }
  select { width: 160px; }
  .start-hint { left: 96px; width: 190px; }
  .ss-hint { white-space: normal; width: 80vw; text-align: center; }
  .task-button { min-width: 0; max-width: 120px; }
}

@media (max-height: 640px), (max-width: 340px) {
  .pb-tip { display: none; }
  .pinball-bar { justify-content: flex-end; }
}

@media (max-height: 430px) {
  .start-hint { display: none; }
  .window-body { padding: 5px 7px 7px; }
  .group { padding-top: 3px; }
  .field-row { margin: 3px 0; }
  .check-row { margin: 4px 0 1px; }
  .dialog-buttons { margin-top: 6px; }
}
