/* Retro desktop theme (Windows 9x-style). System fonts only: CSP forbids external fonts. */
:root {
  --desktop: #008080;
  --face: #c0c0c0;
  --hilite: #ffffff;
  --light: #dfdfdf;
  --shadow: #808080;
  --dark: #000000;
  --field: #ffffff;
  --text: #000000;
  --muted: #404040;
  --title-a: #000080;
  --title-b: #1084d0;
  --title-text: #ffffff;
  --ok: #007000;
  --warn: #7a5a00;
  --danger: #b00000;
  --tip: #ffffe1;
  --ui: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", Geneva, Verdana, "DejaVu Sans", sans-serif;
  --mono: "Fixedsys", "Lucida Console", "Courier New", Courier, ui-monospace, monospace;
  /* Bevels */
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hilite), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --sunken: inset -1px -1px var(--hilite), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --pressed: inset -1px -1px var(--hilite), inset 1px 1px var(--dark), inset -2px -2px var(--light), inset 2px 2px var(--shadow);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--desktop);
  color: var(--text);
  font: 14px/1.45 var(--ui);
  -webkit-font-smoothing: none;
}
[hidden] { display: none !important; }

.shell {
  max-width: 580px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 28px;
  display: flex; flex-direction: column; gap: 18px;
}

/* App header styled as a desktop icon label */
.brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: 15px;
  text-shadow: 1px 1px 0 #000;
}
.logo {
  width: 32px; height: 32px; padding: 4px;
  fill: #ffff00; background: var(--face);
  box-shadow: var(--raised);
  filter: drop-shadow(1px 1px 0 #000);
}

/* Window */
.card {
  position: relative;
  background: var(--face);
  box-shadow: var(--raised), 3px 3px 0 rgba(0, 0, 0, .35);
  padding: 34px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.card::before {
  content: attr(data-title);
  position: absolute; top: 3px; left: 3px; right: 3px; height: 22px;
  padding: 0 52px 0 6px;
  display: flex; align-items: center;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: var(--title-text); font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Decorative title-bar buttons: minimise + close */
.card::after {
  content: "_  \2715";
  position: absolute; top: 6px; right: 6px; height: 16px;
  padding: 0 3px; letter-spacing: 1px;
  font: 700 10px/16px var(--ui); color: #000;
  background: var(--face);
  box-shadow: var(--raised);
  white-space: pre;
}

h1 { font-size: 17px; margin: 0; line-height: 1.25; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.label { font-size: 13px; font-weight: 700; margin-bottom: -6px; }
.label::after { content: ":"; }
code { font-family: var(--mono); background: var(--field); padding: 0 3px; box-shadow: var(--sunken); }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 140px;
  background: var(--field);
  color: var(--text);
  border: 0; border-radius: 0;
  box-shadow: var(--sunken);
  padding: 8px 10px;
  font: 15px/1.4 var(--mono);
  outline: none;
}
textarea:focus { outline: 1px dotted #000; outline-offset: -5px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1 1 140px; }
.between { justify-content: space-between; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 16px;
  border: 0; border-radius: 0;
  background: var(--face); color: var(--text);
  box-shadow: var(--raised);
  font: 700 14px var(--ui);
  text-decoration: none;
  cursor: pointer;
}
.btn:active:not(:disabled) { box-shadow: var(--pressed); padding-top: 2px; padding-left: 18px; }
.btn:disabled { color: var(--shadow); text-shadow: 1px 1px 0 var(--hilite); cursor: not-allowed; }
/* Default button: extra black frame, like the classic "OK" button */
.btn-primary { outline: 1px solid #000; outline-offset: 0; }
.btn:focus-visible { outline: 1px solid #000; box-shadow: var(--raised), inset 0 0 0 4px var(--face), inset 0 0 0 5px #000; }
.btn-primary:focus-visible { outline: 1px solid #000; }
.btn-link {
  background: none; border: 0; padding: 4px;
  color: #0000ee; font: inherit; text-decoration: underline; cursor: pointer;
}
.btn-link:hover { color: #551a8b; }
.btn-link:focus-visible, .linkbox:focus-visible { outline: 1px dotted #000; outline-offset: 2px; }

.pill {
  font-size: 11px; font-weight: 700; padding: 1px 6px;
  background: var(--face); color: #000; text-shadow: none;
  box-shadow: var(--raised);
}
.pill-ok { color: var(--ok); }

/* Status lines with square "LED" indicators */
.status { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--danger); }
.dot { width: 12px; height: 12px; flex: none; background: var(--shadow); box-shadow: var(--sunken); }
.dot-ok { background: #00c000; }
.dot-warn { background: #ffcc00; }
.dot-bad { background: #ff0000; }
.dot-wait { background: #ffcc00; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { background: #806600; } }

.linkbox, .secret {
  background: var(--field);
  box-shadow: var(--sunken);
  padding: 10px 12px;
  font: 14px/1.4 var(--mono);
  word-break: break-all;
  overflow-wrap: anywhere;
  user-select: all;
}
.secret { margin: 0; white-space: pre-wrap; max-height: 50vh; overflow: auto; min-height: 44px; }
.secret.masked { user-select: none; color: var(--shadow); letter-spacing: .1em; }

.error { color: var(--danger); font-size: 13px; font-weight: 700; }

/* "How it works" as a group box */
.explain {
  margin-top: 4px; padding: 8px 12px 10px;
  border: 1px solid var(--shadow); box-shadow: 1px 1px 0 var(--hilite), inset 1px 1px 0 var(--hilite);
  font-size: 13px;
}
.explain summary { cursor: pointer; font-weight: 700; }
.explain summary:focus-visible { outline: 1px dotted #000; }
.explain ul { padding-left: 18px; margin: 8px 0 0; display: grid; gap: 5px; }

/* Checkbox-style switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none; position: relative; width: 18px; height: 18px;
  background: var(--field); box-shadow: var(--sunken);
}
.switch-thumb { display: none; }
.switch input:checked + .switch-track::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #000; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.switch input:focus-visible ~ .switch-text > span:first-child { outline: 1px dotted #000; outline-offset: 1px; }
.switch-text { display: flex; flex-direction: column; font-weight: 700; line-height: 1.3; }
.switch-text .small { font-weight: 400; }

/* Footer on the desktop */
.foot { text-align: center; padding: 0 8px; color: #fff; text-shadow: 1px 1px 0 #000; }
.foot.muted { color: #e0ffff; }
.foot-meta { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.foot-meta > span {
  display: inline-block; padding: 3px 10px;
  background: var(--face); color: #000; text-shadow: none; font-weight: 700;
  box-shadow: var(--raised);
}
.foot-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 12px; font-weight: 700; color: #fff; text-decoration: underline; }
.foot-link:hover { color: #ffff00; }
.foot-link svg { width: 22px; height: 22px; fill: currentColor; }
.foot-link:focus-visible { outline: 1px dotted #fff; outline-offset: 2px; }

/* Tooltip-style toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--tip); color: #000;
  border: 1px solid #000;
  padding: 6px 12px; font-size: 13px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .4);
}

@media (max-width: 420px) {
  .card { padding: 32px 12px 14px; }
  h1 { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
