* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Tahoma, Verdana, Geneva, sans-serif;
  background: #86b8de;
  color: white;
  overflow: hidden;
  font-size: 14px;
}

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

/* DESKTOP */

.desktop {
  height: calc(100vh - 44px);
  padding: 16px;
  position: relative;
  overflow: hidden;

  /* Keep these separate. Do NOT use background: here,
     because background: can erase the image. */
  background-color: var(--desktop-bg, #86b8de);
  background-image: var(--desktop-wallpaper, none);
  background-repeat: repeat;
  background-size: auto;
  background-position: top left;
}

/* DESKTOP ICONS */

.desktop-icon {
  width: 95px;
  min-height: 86px;
  border: 0;
  background: transparent;
  color: white;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 5px;
  margin: 0 8px 12px 0;
  vertical-align: top;
  cursor: default;
}

.desktop-icon:hover span,
.desktop-icon:focus span {
  outline: 1px dotted white;
  background: teal;
}

.desktop-icon img {
  width: var(--desktop-icon-size, 54px);
  height: var(--desktop-icon-size, 54px);
  object-fit: contain;
  image-rendering: pixelated;
}

.desktop-icon span {
  color: white;
  background: rgba(0, 128, 128, 0.9);
  padding: 2px 4px;
  line-height: 1.15;
  word-break: break-word;
}

/* TASKBAR */

.taskbar {
  height: 44px;
  background: #c0c0c0;
  border-top: 2px solid white;
  color: black;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
}

.start-button,
.taskbar-date-time,
.taskbar-program {
  background: #c0c0c0;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  color: black;
  padding: 4px 10px;
  min-height: 30px;
  font-weight: bold;
  cursor: default;
}

.start-button:active,
.taskbar-date-time:active,
.taskbar-program:active,
.taskbar-program.active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.taskbar-programs {
  flex: 1;
  display: flex;
  gap: 5px;
  overflow-x: auto;
}

.taskbar-program {
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.taskbar-date-time {
  font-size: 12px;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  padding: 3px 8px;
}

/* WINDOWS */

.program-window {
  position: absolute;
  display: none;
  background: #c0c0c0;
  color: black;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  min-width: 260px;
  min-height: 180px;
  resize: both;
  overflow: auto;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
}

.program-window.open {
  display: flex;
  flex-direction: column;
}

.program-window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  resize: none;
}

.window-titlebar {
  background: navy;
  color: white;
  padding: 3px 4px 3px 7px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  cursor: move;
  user-select: none;
}

.window-buttons {
  display: flex;
  gap: 2px;
}

.window-buttons button {
  width: 24px;
  height: 22px;
  padding: 0;
  background: #c0c0c0;
  color: black;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  line-height: 1;
  font-weight: bold;
}

.window-buttons button:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.window-content {
  padding: 12px;
  overflow: auto;
  flex: 1;
}

.window-content h1 {
  margin-top: 0;
  font-size: 20px;
}

.window-menubar,
.notepad-tools,
.statusbar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 5px 8px;
}

.notepad-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.notepad-tools button,
.program-list button {
  background: #c0c0c0;
  color: black;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  padding: 4px 8px;
}

.notepad-tools button:active,
.program-list button:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

/* NOTEPAD */

#notepad-text {
  flex: 1;
  width: 100%;
  min-height: 230px;
  border: 0;
  padding: 10px;
  resize: none;
  background: black;
  color: white;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.45;
  caret-color: white;
}

.statusbar {
  border-top: 1px solid #808080;
  border-bottom: 0;
  font-size: 12px;
}

/* GALLERIES */

.icon-gallery,
.site-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.icon-card,
.site-card {
  background: #8f8f8f;
  border-top: 2px solid #d0d0d0;
  border-left: 2px solid #d0d0d0;
  border-right: 2px solid #303030;
  border-bottom: 2px solid #303030;
  color: white;
  text-align: center;
  padding: 10px;
  text-decoration: none;
  min-height: 110px;
}

.icon-card img,
.site-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto 8px;
}

.icon-card code,
.site-card span {
  font-size: 11px;
  word-break: break-word;
}

/* PROGRAM LISTS / FILES */

.program-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.window-content label {
  display: block;
  margin: 10px 0;
}

.window-content input[type="text"] {
  width: 100%;
  padding: 5px;
  margin-top: 4px;
}

.file-tree ul {
  margin-top: 4px;
}

.tiny-note {
  font-size: 12px;
}

/* CONTROL PANEL */

.window-content select,
.window-content input[type="number"] {
  width: 100%;
  padding: 5px;
  margin-top: 4px;
  font-family: inherit;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
}

.background-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin: 12px 0;
  max-height: 110px;
  overflow: auto;
  padding: 8px;
  background: #a8a8a8;
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.background-swatch {
  height: 46px;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  background-repeat: repeat;
  background-size: auto;
  cursor: default;
}

.background-swatch:active,
.background-swatch.selected {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  outline: 2px dotted black;
}

.image-preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: #c0c0c0;
}

#image-preview-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  image-rendering: pixelated;
  background: white;
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  padding: 12px;
}

#image-preview-path {
  color: black;
  background: white;
  border: 1px solid #808080;
  padding: 6px;
  width: 100%;
  word-break: break-word;
}
/* FONT BOOK */

.font-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.font-list button {
  background: #eee;
  color: black;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  padding: 10px;
  text-align: left;
  font-size: 16px;
}

.font-list button:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}
