/* 16 Colors — shared greyscale Windows 95-style chrome.
   Deliberately single-theme: the classic light chrome. */
:root {
  --desk: #5e5e5e;
  --face: #c0c0c0;
  --light: #dfdfdf;
  --white: #ffffff;
  --shadow: #808080;
  --black: #000000;
  --ink: #000000;
  --ink-off: #808080;
  --title: #2a2a2a;
  --title-off: #808080;
  --title-ink: #ffffff;
  --field: #ffffff;
  --font-ui: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", Geneva, Verdana, sans-serif;
  --font-tile: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --raised: inset -1px -1px var(--black), inset 1px 1px var(--white), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --sunken: inset -1px -1px var(--white), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--black);
  --pressed: inset -1px -1px var(--white), inset 1px 1px var(--black), inset -2px -2px var(--light), inset 2px 2px var(--shadow);
  --thin-in: inset -1px -1px var(--white), inset 1px 1px var(--shadow);
  --thin-out: inset -1px -1px var(--shadow), inset 1px 1px var(--white);
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--desk); }
body {
  margin: 0;
  padding-block: 24px 40px;
  padding-inline: 16px;
  background: var(--desk);
  color: var(--ink);
  font: 12px/1.35 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }

/* ---------- window ---------- */
.win {
  max-width: 1000px;
  margin-inline: auto;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised);
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 2px 0 3px;
  background: var(--title);
  color: var(--title-ink);
}
.titlebar.inactive { background: var(--title-off); color: var(--face); }
.titlebar h1, .titlebar h2 { flex: 1; margin: 0; font: 700 12px/1 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-icon { width: 14px; height: 14px; flex: none; }
.app-icon svg { display: block; width: 100%; height: 100%; }
.caption-btns { display: flex; }
.caption-btns > * {
  display: grid;
  place-items: center;
  width: 16px;
  height: 14px;
  background: var(--face);
  box-shadow: var(--raised);
  color: var(--ink);
  font: 700 10px/1 var(--font-ui);
  text-decoration: none;
}
.caption-btns > :last-child { margin-left: 2px; }
.caption-btns > a:active { box-shadow: var(--pressed); }
.caption-btns > a:focus-visible { outline: 1px dotted var(--ink); outline-offset: -3px; }

/* ---------- menu bar ---------- */
.menubar { display: flex; flex-wrap: wrap; padding: 1px 0; position: relative; z-index: 40; }
.menu { position: relative; }
.menu-title {
  appearance: none;
  border: 0;
  background: none;
  font: 12px/1 var(--font-ui);
  color: var(--ink);
  padding: 4px 8px;
  cursor: default;
}
.menu-title u, .mi u { text-decoration: underline; text-underline-offset: 1px; }
.menu.open .menu-title { background: var(--title); color: var(--title-ink); }
.menu-title:focus-visible { outline: 1px dotted var(--ink); outline-offset: -2px; }
.menu.right { margin-left: auto; }
.menu.right .dropdown { left: auto; right: 0; }
.dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 190px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised);
  display: none;
}
.menu.open .dropdown { display: block; }
.mi {
  appearance: none;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  padding: 4px 10px 4px 2px;
  font: 12px/1.2 var(--font-ui);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: default;
}
.mi .chk { text-align: center; font-size: 11px; }
.mi .key { padding-left: 20px; }
.mi:hover:not(:disabled), .mi:focus-visible { background: var(--title); color: var(--title-ink); outline: none; }
.mi:disabled { color: var(--ink-off); text-shadow: 1px 1px 0 var(--white); }
.mi-note { padding: 4px 10px 4px 20px; color: var(--ink-off); white-space: nowrap; }
.sep { height: 2px; margin: 3px 1px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--white); }

/* ---------- controls ---------- */
.btn {
  appearance: none;
  min-width: 75px;
  padding: 5px 12px;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised);
  font: 12px/1 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:active { box-shadow: var(--pressed); padding: 6px 11px 4px 13px; }
.btn:focus-visible { outline: 1px dotted var(--ink); outline-offset: -5px; }
.btn.default { box-shadow: 0 0 0 1px var(--black), var(--raised); }

/* ---------- message box ---------- */
.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  z-index: 30;
  width: min(330px, calc(100% - 8px));
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised), 2px 2px 0 rgba(0, 0, 0, .35);
}
.dlg-body { display: flex; align-items: flex-start; gap: 14px; padding: 16px 14px 8px; }
.dlg-icon { flex: none; width: 34px; height: 34px; }
.dlg-icon svg { display: block; width: 100%; height: 100%; }
.dlg-copy { min-width: 0; display: grid; gap: 6px; }
.dlg-copy p { margin: 0; }
.dlg-big { font-weight: 700; }
.dlg-actions { display: flex; justify-content: center; gap: 8px; padding: 8px 14px 12px; }

/* ---------- status bar ---------- */
.statusbar { display: flex; flex-wrap: wrap; gap: 2px; padding-top: 2px; }
.field {
  padding: 3px 6px;
  box-shadow: var(--thin-in);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.field.grow { flex: 1 1 10rem; min-width: 0; white-space: normal; }
@media (max-width: 480px) { .field.grow { flex-basis: 3rem; } }

/* ---------- running inside a desktop window: the desktop draws the frame and title bar ---------- */
html.embedded, html.embedded body { height: 100%; }
html.embedded { padding: 0; }
html.embedded body { padding: 0; background: var(--face); }
html.embedded .win {
  display: flex;
  flex-direction: column;
  max-width: none;
  height: 100%;
  padding: 0 2px 2px;
  box-shadow: none;
}
html.embedded .win > .titlebar { display: none; }
html.embedded .win > .client { flex: 1; min-height: 0; overflow: auto; }
