body {
  overflow: hidden;
}

#desktop-viewport {
  height: calc(100dvh - var(--taskbar-height, 64px));
  overflow-y: auto;
}

.has-maximized-window #desktop-viewport {
  overflow: hidden;
}

#desktop-viewport > .site-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

#desktop-viewport > .site-shell > * {
  flex-shrink: 0;
}

#desktop-viewport > .site-shell > footer {
  margin-top: auto;
}

.site-shell > header {
  margin-bottom: 28px;
}

.taskbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  background: silver;
  color: #222;
  box-shadow:
    inset 0 1px #dfdfdf,
    inset 0 2px #fff;
  font:
    14px/1.3 Tahoma,
    Arial,
    sans-serif;
}

#start-menu {
  flex: none;
}

#start-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  list-style: none;
  cursor: pointer;
  font:
    bold 18px/1.2 "Pixelated MS Sans Serif",
    Arial,
    sans-serif;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #fff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

#start-toggle::-webkit-details-marker {
  display: none;
}

#start-menu[open] > summary,
.task.is-active:not(.is-minimized) {
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px #0a0a0a,
    inset -2px -2px #dfdfdf,
    inset 2px 2px grey;
  background: #dfdfdf;
}

.start-panel {
  position: absolute;
  bottom: 100%;
  left: 8px;
  display: flex;
  width: min(300px, calc(100vw - 16px));
  max-height: calc(100dvh - 64px - env(safe-area-inset-bottom));
  padding: 3px;
  background: silver;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #fff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

.start-brand {
  padding: 14px 6px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: linear-gradient(to top, #000080, #1084d0);
  color: #fff;
  font:
    bold 24px/1.2 Tahoma,
    Arial,
    sans-serif;
  letter-spacing: 1px;
}

#start-navigation {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  flex: 1;
  margin: 0;
  padding: 0;
  min-width: 0;
  overflow-y: auto;
}

#start-navigation a,
#start-navigation button {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 44px;
  width: 100%;
  padding: 8px 10px;
  gap: 10px;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
  color: #222;
  text-shadow: none;
  font:
    16px/1.3 Tahoma,
    Arial,
    sans-serif;
  text-decoration: none;
}

#start-navigation #restore {
  margin-top: 6px;
  border-top: 1px solid grey;
}

#start-navigation a:hover,
#start-navigation a:focus-visible,
#start-navigation button:hover,
#start-navigation button:focus-visible {
  background: #000080;
  color: #fff;
  outline: none;
}

.tasks {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  padding: 3px;
}

.task {
  display: flex;
  align-items: center;
  flex: 1 0 125px;
  max-width: 210px;
  min-width: 0;
  padding: 3px;
  background: silver;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #fff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

.task a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 4px;
  flex: 1;
  min-width: 0;
  min-height: 28px;
  padding: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  box-shadow: none;
  font:
    14px/1.3 Tahoma,
    Arial,
    sans-serif;
}

.task a:active {
  box-shadow: none;
}

#taskbar-clock {
  flex: none;
  padding: 9px 12px;
  white-space: nowrap;
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px grey;
}

.title-bar-controls button[data-minimize],
.title-bar-controls button[data-maximize] {
  min-width: 24px;
  min-height: 24px;
}

.has-maximized-window {
  overflow: hidden;
}

.window.maximized {
  position: fixed;
  inset: 8px 8px calc(var(--taskbar-height, 64px) + 8px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  margin: 0;
  width: auto;
  height: auto;
  overflow: auto;
}

.window.maximized > .title-bar {
  position: sticky;
  top: 0;
  flex: none;
  z-index: 1;
}

.window.maximized .publication-scroll,
.window.maximized .blog-scroll {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
}

@media (max-width: 600px) {
  .tasks {
    display: none;
  }

  #taskbar-clock {
    margin-left: auto;
  }
}

@media print {
  #desktop-viewport {
    height: auto;
    overflow: visible;
  }

  .taskbar {
    display: none;
  }

  .window.maximized {
    position: static;
    display: block;
  }

  body {
    padding-bottom: 0;
    overflow: visible;
  }
}

#task-actions {
  position: fixed;
  z-index: 110;
  width: 180px;
  padding: 4px;
}

#task-actions button {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 14px;
  text-align: left;
  color: #222;
  text-shadow: none;
  box-shadow: none;
  font:
    14px/1.3 Tahoma,
    Arial,
    sans-serif;
}

#task-actions button:disabled {
  color: grey;
}

#task-actions button:not(:disabled):hover,
#task-actions button:focus-visible {
  background: #000080;
  color: #fff;
  outline: none;
}

@media print {
  #task-actions {
    display: none;
  }
}

[data-start-status] {
  margin-left: auto;
  padding-left: 14px;
  font-size: 12px;
}

#task-actions {
  max-width: calc(100vw - 8px);
}

#start-navigation .power-action {
  border-top: 1px solid gray;
  margin-top: 6px;
}

.portrait-image {
  margin: 10px;
}

.portrait.maximized .portrait-image {
  flex: 1;
  min-height: 0;
}

.portrait.maximized img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}

#shutdown {
  max-width: none;
  width: 100vw;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 20vh 24px 24px;
  text-align: center;
  background: #000;
  color: #eaa852;
  font-family: "VT323", monospace;
}

#shutdown h2 {
  font: inherit;
  font-size: 36px;
}

#shutdown p {
  font-size: 24px;
}

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

#start-navigation .program-icon {
  width: 24px;
  height: 24px;
}

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

#start-navigation .power-action {
  border-top: 2px groove #fff;
}

.start-brand {
  text-align: left;
}

@media (min-width: 601px) and (max-width: 1200px) {
  .tasks {
    overflow-x: visible;
  }

  .task {
    flex: 0 0 40px;
    max-width: 40px;
  }

  .task a {
    justify-content: center;
    padding: 5px 0;
  }

  .task-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

button.portrait-image,
button.portrait-image:active {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
}

button.portrait-image:focus-visible {
  outline: 3px solid #a33912;
  outline-offset: 2px;
}

.portrait.maximized button.portrait-image {
  cursor: zoom-out;
}
