:root {
  color-scheme: light;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  background: #008080;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: #000;
  background-color: #008080;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.05) 1px, transparent 1px);
  background-size: 4px 4px;
}

button, a { font: inherit; }
button { border-radius: 0; }

.skip-link {
  position: fixed;
  left: .5rem;
  top: -4rem;
  z-index: 100;
  padding: .5rem;
  color: #000;
  background: #fff;
}

.skip-link:focus { top: .5rem; }

.desktop-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.notepad-window {
  width: min(980px, 100%);
  height: min(780px, calc(100dvh - 2rem));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  border: 3px outset #dfdfdf;
  background: #c0c0c0;
  box-shadow: 8px 8px 0 rgba(0,0,0,.28);
}

.notepad-window.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100dvh;
  border-width: 2px;
  box-shadow: none;
}

.notepad-window.is-minimized {
  width: min(460px, 100%);
  height: auto;
  min-height: 0;
  grid-template-rows: auto;
}

.notepad-window.is-minimized > :not(.title-bar) { display: none; }

.title-bar {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 3px 4px;
  color: #fff;
  background: #000080;
  font-weight: 700;
}

.notepad-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #fff;
  color: #000080;
  background: #fff;
  font: 700 14px/1 "Courier New", monospace;
}

.window-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 3px;
}

.window-control {
  width: 25px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px outset #dfdfdf;
  color: #000;
  background: #c0c0c0;
  font: 700 15px/1 Arial, sans-serif;
}

.window-control:active { border-style: inset; }

.menu-bar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .15rem;
  padding: 2px 4px;
  border-bottom: 2px groove #fff;
  background: #c0c0c0;
}

.menu { position: relative; }

.menu-button,
.locale-switch {
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid transparent;
  color: #000;
  background: transparent;
  text-decoration: none;
}

.menu-button:hover,
.menu-button[aria-expanded="true"],
.locale-switch:hover,
.locale-switch:focus-visible {
  border-color: #fff #707070 #707070 #fff;
}

.locale-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.menu-panel {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  width: max-content;
  min-width: 210px;
  padding: 3px;
  border: 2px outset #dfdfdf;
  background: #c0c0c0;
  box-shadow: 3px 3px 0 rgba(0,0,0,.3);
}

.menu-panel[hidden] { display: none; }

.menu-panel a,
.menu-panel button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 4px 18px 4px 22px;
  border: 0;
  color: #000;
  background: transparent;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.menu-panel a:hover,
.menu-panel a:focus-visible,
.menu-panel button:hover,
.menu-panel button:focus-visible {
  color: #fff;
  background: #000080;
  outline: 0;
}

.menu-separator {
  height: 2px;
  margin: 3px 2px;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
}

.readme-scroll {
  min-width: 0;
  min-height: 0;
  margin: 4px;
  overflow: auto;
  border: 2px inset #dfdfdf;
  background: #fff;
  scrollbar-color: #808080 #dfdfdf;
}

.readme-content {
  min-height: 100%;
  margin: 0;
  padding: 1rem 1.15rem 3rem;
  color: #111;
  background: #fff;
  font: 15px/1.55 "Courier New", Courier, monospace;
  white-space: pre;
  tab-size: 4;
}

.notepad-window[data-wrap="true"] .readme-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.readme-content a { color: #0000ee; text-decoration: underline; }
.readme-content a:visited { color: #551a8b; }
.language-anchor { color: #000080; font-weight: 700; }

.status-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 3px;
  padding: 3px;
  background: #c0c0c0;
}

.status-bar span {
  min-width: 0;
  padding: 3px 7px;
  overflow: hidden;
  border: 2px inset #dfdfdf;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.about-dialog {
  width: min(420px, calc(100% - 2rem));
  padding: 0;
  border: 3px outset #dfdfdf;
  border-radius: 0;
  background: #c0c0c0;
  box-shadow: 8px 8px 0 rgba(0,0,0,.35);
}

.about-dialog::backdrop { background: rgba(0,0,0,.35); }
.about-body { padding: 1.2rem; line-height: 1.5; }
.about-body strong { display: block; margin-bottom: .4rem; }
.dialog-actions { display: flex; justify-content: center; padding: 0 1rem 1rem; }

.retro-button {
  min-width: 90px;
  min-height: 34px;
  border: 2px outset #dfdfdf;
  background: #c0c0c0;
}

.retro-button:active { border-style: inset; }

@media (max-width: 620px) {
  .desktop-shell { padding: 0; }

  .notepad-window {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border-width: 2px;
    box-shadow: none;
  }

  .menu-bar { overflow-x: auto; scrollbar-width: thin; }
  .menu-button, .locale-switch { padding-inline: 6px; }

  .menu-panel {
    position: fixed;
    top: 61px;
    left: 4px;
    max-width: calc(100vw - 8px);
  }

  .readme-content { padding: .75rem .8rem 2rem; font-size: 14px; }
  .status-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .status-bar span:nth-child(2) { display: none; }
}

@media print {
  body { background: #fff; }
  .desktop-shell { display: block; padding: 0; }
  .notepad-window { width: 100%; height: auto; border: 0; box-shadow: none; }
  .title-bar, .menu-bar, .status-bar { display: none; }
  .readme-scroll { margin: 0; overflow: visible; border: 0; }
  .readme-content { padding: 0; font-size: 11pt; white-space: pre-wrap; }
}
