:root {
  --face: #ece9d8;
  --shade: #aca899;
  --ink: #000;
  --frame: #0a3fd0;
  --frame-off: #7b96e0;
  --select: #316ac5;
  --field: #7f9db9;
  --ui: Tahoma, "DejaVu Sans Condensed", Geneva, Verdana, sans-serif;
  --title: "Trebuchet MS", "Fira Sans", Tahoma, "DejaVu Sans Condensed", sans-serif;
  --taskbar: 30px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: #2d6cc4;
  color: var(--ink);
  font: 11px/1.3 var(--ui);
  user-select: none;
  -webkit-user-select: none;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: default; }
p { margin: 0; }
svg { display: block; }
.sprite { position: absolute; width: 0; height: 0; }

#desktop { position: fixed; inset: 0 0 var(--taskbar); overflow: hidden; }
.wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Desktop icons */
.desk-icons { position: absolute; top: 12px; left: 8px; display: grid; gap: 16px; }
.desk-icon {
  width: 78px; padding: 3px 0; border: 0; background: none; color: #fff;
  display: grid; justify-items: center; gap: 4px; text-shadow: 1px 1px 2px #000;
}
.desk-icon svg { width: 34px; height: 34px; filter: drop-shadow(1px 2px 1px rgb(0 0 0 / .35)); }
.desk-icon span { padding: 1px 3px; }
.desk-icon:focus { outline: none; }
.desk-icon:focus span { background: var(--select); text-shadow: none; outline: 1px dotted #fff; }

/* Windows */
.window {
  position: absolute; display: flex; flex-direction: column;
  padding: 0 3px 3px; border: 0; border-radius: 8px 8px 0 0;
  background: var(--frame-off); color: var(--ink);
  box-shadow: 3px 4px 10px rgb(0 0 0 / .4);
}
.window.active, dialog.window { background: var(--frame); }
dialog.window { position: fixed; margin: auto; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
dialog.window:not([open]) { display: none; }
dialog::backdrop { background: none; }
.window.max { border-radius: 0; inset: 0 !important; width: auto !important; height: auto !important; }

.titlebar {
  flex: none; height: 29px; margin: 0 -3px; padding: 0 5px 0 7px;
  display: flex; align-items: center; gap: 5px;
  border-radius: 8px 8px 0 0; touch-action: none;
  background: linear-gradient(#a9bdf2, #7d97e2 14%, #7690de 70%, #8aa4ee 90%, #6d86d0);
  color: #dce5fb; font: 700 13px var(--title);
}
.window.active > .titlebar, dialog > .titlebar {
  background: linear-gradient(#4aa3ff, #0d5df0 12%, #0550e4 45%, #0a63fb 86%, #0742c4);
  color: #fff; text-shadow: 1px 1px 1px #0b2a86;
}
.window.max > .titlebar { border-radius: 0; }
.titlebar svg { width: 16px; height: 16px; flex: none; }
.titlebar h1 { flex: 1; margin: 0; font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar button {
  position: relative; width: 21px; height: 21px; padding: 0; flex: none;
  border: 1px solid #fff; border-radius: 3px; color: #fff;
  background: radial-gradient(circle at 25% 20%, #86aefc, #2f66e6 55%, #1d4bc8);
}
.titlebar button[data-act=close] { background: radial-gradient(circle at 25% 20%, #f3a58d, #dc4a24 55%, #b5300d); }
.window:not(.active):not(dialog) > .titlebar button { opacity: .65; }
.titlebar button:hover { filter: brightness(1.15); }
.titlebar button:active { filter: brightness(.8); }
.titlebar button::before, .titlebar button::after { content: ""; position: absolute; }
[data-act=min]::before { left: 4px; bottom: 4px; width: 8px; height: 3px; background: #fff; }
[data-act=max]::before { inset: 4px; border: 1px solid #fff; border-top-width: 3px; }
.max [data-act=max]::before { inset: 3px 6px 6px 3px; border-top-width: 2px; }
.max [data-act=max]::after { inset: 7px 3px 3px 7px; border: 1px solid #fff; border-top-width: 2px; background: #2f66e6; }
[data-act=close]::before, [data-act=close]::after { left: 3px; top: 8.5px; width: 13px; height: 2px; background: #fff; transform: rotate(45deg); }
[data-act=close]::after { transform: rotate(-45deg); }

.grip {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: nwse-resize; touch-action: none;
}
.grip::before {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px;
  background: radial-gradient(circle, #a39f8c 1px, transparent 1.4px) 2px 2px / 4px 4px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.max .grip { display: none; }

/* Buttons and fields */
.btn {
  min-width: 78px; height: 23px; padding: 0 9px;
  border: 1px solid #003c74; border-radius: 3px;
  background: linear-gradient(#fff, #f2f1ea 60%, #dcd7c8);
}
.btn:hover:enabled { box-shadow: inset 0 0 0 2px #f8c259; }
.btn:active:enabled { background: linear-gradient(#dad6c9, #eeede5); box-shadow: none; }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; box-shadow: inset 0 0 0 2px #98b5ee; }
.btn:disabled { border-color: #c9c7ba; background: #f5f4ea; color: #8f8d7d; }

.sunken, input:not([type]), input[type=number], select { border: 1px solid var(--field); background: #fff; }
input:not([type]), input[type=number], select { height: 21px; padding: 1px 4px; min-width: 0; }
input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 1px dotted #000; outline-offset: -1px; }

/* Disk Defragmenter */
#win-defrag { width: 640px; height: 470px; min-width: 300px; min-height: 380px; }
.menubar, .toolbar { flex: none; display: flex; align-items: center; background: var(--face); }
.menubar { position: relative; z-index: 2; height: 21px; padding: 0 2px; }
.menu { position: relative; }
.menu > button { height: 20px; padding: 0 7px; border: 0; background: none; }
.menu > button:hover, .menu > button:focus-visible, .menu > button[aria-expanded=true] { background: var(--select); color: #fff; outline: none; }
.menu ul {
  position: absolute; left: 0; top: 100%; min-width: 150px; margin: 0; padding: 2px; list-style: none;
  border: 1px solid var(--shade); background: #fff; box-shadow: 3px 3px 4px rgb(0 0 0 / .35);
}
.menu li.sep { height: 1px; margin: 3px 2px; background: var(--shade); }
.menu li button { width: 100%; padding: 3px 18px 3px 22px; border: 0; background: none; text-align: left; white-space: nowrap; }
.menu li button:hover:enabled, .menu li button:focus-visible { background: var(--select); color: #fff; outline: none; }
.menu li button:disabled { color: var(--shade); }
.menu li button[aria-checked=true]::before { content: "\2713"; float: left; margin-left: -15px; }

.toolbar { height: 27px; padding: 0 4px; gap: 1px; border-top: 1px solid #fff; border-bottom: 1px solid var(--shade); }
.toolbar button { width: 23px; height: 22px; padding: 2px; border: 1px solid transparent; border-radius: 3px; background: none; color: #3c8a2e; }
.toolbar button:disabled { color: #bcb8a6; }
.toolbar button:hover:enabled, .toolbar button:focus-visible { border-color: #cbc7b6; background: #fbfaf5; outline: none; }
.toolbar svg { width: 16px; height: 16px; margin: auto; }
.toolbar i { width: 1px; height: 18px; margin: 0 4px; background: #c5c2b2; }

.volumes { flex: 1 1 90px; min-height: 84px; overflow: auto; background: #fff; border-bottom: 1px solid var(--shade); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 2px 8px; text-align: left; font-weight: 400; }
th {
  position: sticky; top: 0; height: 20px; background: linear-gradient(#f6f5ee, #ebeadb 80%, #d3cfbd);
  border-right: 1px solid #c8c4b2; box-shadow: inset 1px 0 #fff;
}
.num { text-align: right; }
#volume-rows td { height: 17px; padding-block: 1px; }
#volume-rows tr { outline: none; }
#volume-rows tr[aria-selected=true] td { background: var(--face); }
#win-defrag.active #volume-rows tr[aria-selected=true] td { background: var(--select); color: #fff; }
#volume-rows tr:focus-visible td { border-block: 1px dotted #ffd; }
#volume-rows svg { display: inline-block; width: 16px; height: 16px; margin: -2px 3px -3px 0; }

.graphs { flex: none; padding: 12px 16px 10px; background: var(--face); border-top: 3px solid #f6f4ea; }
.graph { position: relative; height: 42px; margin: 4px 0 12px; border: 1px solid; border-color: var(--shade) #fff #fff var(--shade); background: var(--shade); }
.graph svg { width: 100%; height: 100%; background: #fff; shape-rendering: crispEdges; }
.graph .k-frag { fill: #f00; }
.graph .k-contig { fill: #00d; }
.graph .k-fixed { fill: #0e0; }
.graph span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 0; padding: 10px 0 0;
  list-style: none; border-top: 1px solid var(--shade); box-shadow: inset 0 1px #fff;
}
.legend li { display: flex; align-items: center; gap: 5px; }
.legend b { width: 11px; height: 11px; border: 1px solid #000; }
.legend .k-frag { background: #f00; }
.legend .k-contig { background: #00d; }
.legend .k-fixed { background: #0e0; }
.k-free { background: #fff; }

.statusbar { flex: none; display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 20px 0 3px; background: var(--face); border-top: 1px solid #fff; }
.statusbar span { flex: 1; overflow: hidden; white-space: pre; text-overflow: ellipsis; }
.progress { flex: none; width: 130px; height: 15px; padding: 2px; border: 1px solid #77756a; border-radius: 3px; background: #fff; }
.progress div {
  width: 0; height: 100%;
  background: repeating-linear-gradient(90deg, transparent 0 8px, #fff 8px 10px), linear-gradient(#b4f0ae, #35c92e 45%, #7fe078);
}

/* Read Me */
#win-readme { width: 470px; height: 430px; min-width: 260px; min-height: 200px; }
.notepad {
  flex: 1; overflow: auto; padding: 8px 12px 16px; background: #fff;
  font: 13px/1.45 "Lucida Console", "DejaVu Sans Mono", Consolas, monospace;
  user-select: text; -webkit-user-select: text;
}
.notepad h2 { margin: 16px 0 4px; font: inherit; font-weight: 700; }
.notepad h2:first-child { margin-top: 0; }
.notepad p { margin-bottom: 9px; }

/* Dialogs */
.msg-body { display: flex; gap: 14px; padding: 18px 20px 8px; background: var(--face); min-width: min(300px, 80vw); max-width: 430px; overflow: auto; }
.msg-body svg { width: 32px; height: 32px; flex: none; }
#message-text { align-self: center; display: grid; gap: 10px; }
.dlg-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; padding: 12px; background: var(--face); }
#report, #settings { width: 440px; }
.report-body { display: flex; flex-direction: column; min-height: 0; padding: 12px 12px 0; background: var(--face); }
#report-head { margin-bottom: 10px; white-space: pre-line; }
#report-info {
  height: 150px; margin: 3px 0 10px; padding: 4px 6px; overflow: auto; tab-size: 220px;
  font: inherit; user-select: text; -webkit-user-select: text;
}
.report-files { height: 130px; margin-top: 3px; overflow: auto; }
.report-files td { user-select: text; -webkit-user-select: text; }

#settings-form { overflow: auto; padding: 10px 12px 0; background: var(--face); }
#settings-form .dlg-actions { justify-content: flex-end; padding-inline: 0; }
fieldset { min-width: 0; margin: 0 0 10px; padding: 6px 10px 10px; border: 1px solid #d0d0bf; border-radius: 4px; }
legend { padding: 0 4px; color: #0046d5; }
fieldset > label { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
#settings-form label span { order: 1; margin-left: auto; }
#settings-form label b { font-weight: 400; }
fieldset:disabled { color: #8f8d7d; }
input[type=radio], input[type=checkbox] { margin: 0 3px 0 0; accent-color: #21a121; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row.end { justify-content: flex-end; }
.grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; }
.error { min-height: 15px; padding: 6px 0; color: #b00000; }
.note { padding-left: 4px; }

/* Taskbar */
#taskbar {
  position: fixed; inset: auto 0 0; z-index: 9000; height: var(--taskbar); display: flex;
  background: linear-gradient(#3d86f2, #2a63dc 12%, #235adb 55%, #2762e0 88%, #1a43a8);
}
#start {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 0 20px 2px 9px;
  border: 0; border-radius: 0 11px 11px 0; color: #fff;
  font: italic 700 17px var(--title); text-shadow: 1px 1px 2px #123d10;
  background: linear-gradient(#7fca78, #3f9c3b 14%, #37933a 65%, #2d7c30);
  box-shadow: inset -4px 0 6px rgb(0 40 0 / .4), 2px 0 4px rgb(0 0 0 / .35);
}
#start svg { width: 20px; height: 20px; }
#start:hover { filter: brightness(1.1); }
#start[aria-expanded=true] { filter: brightness(.85); }
#start:focus-visible, #tasks button:focus-visible, #speaker:focus-visible { outline: 1px dotted #fff; outline-offset: -4px; }
#tasks { flex: 1; min-width: 0; display: flex; gap: 3px; padding: 3px 8px; }
#tasks button {
  flex: 0 1 160px; min-width: 0; display: flex; align-items: center; gap: 5px; padding: 0 8px;
  border: 0; border-radius: 3px; color: #fff; text-align: left;
  background: linear-gradient(#6ba4fa, #3c7df0 20%, #3a78ea);
}
#tasks button span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#tasks button[aria-pressed=true] { background: #1d4fbd; box-shadow: inset 1px 1px 3px rgb(0 0 0 / .5); }
#tasks svg { width: 16px; height: 16px; flex: none; }
/* In the taskbar because windows never cover it. */
.notice {
  flex: none; align-self: center; padding: 0 10px 0 4px; color: #fff;
  font-size: 10px; line-height: 12px; text-align: right; white-space: nowrap;
}
#tray {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 10px; color: #fff;
  border-left: 1px solid #0f3f9e; box-shadow: inset 1px 0 #5cc1f5;
  background: linear-gradient(#37b6f5, #1496e6 14%, #128fe0 80%, #0d6fb8);
}
#speaker { width: 22px; height: 24px; padding: 3px; border: 0; background: none; }
#speaker svg { width: 16px; height: 16px; }

#volume-pop {
  position: fixed; right: 40px; bottom: calc(var(--taskbar) + 2px); z-index: 9001;
  display: grid; justify-items: center; gap: 8px; padding: 10px;
  border: 1px solid var(--shade); background: var(--face); box-shadow: 2px 2px 5px rgb(0 0 0 / .4);
}
#volume { width: 120px; accent-color: #21a121; }

#start-menu {
  position: fixed; left: 0; bottom: var(--taskbar); z-index: 9001; width: 250px; overflow: hidden;
  border: 1px solid #0d3aa5; border-radius: 7px 7px 0 0; background: #2565dc; box-shadow: 4px 2px 8px rgb(0 0 0 / .45);
}
.sm-head { display: flex; align-items: center; gap: 10px; padding: 9px; color: #fff; font: 700 15px var(--title); text-shadow: 1px 1px 1px #0b2a86; }
.sm-head svg { width: 36px; height: 36px; padding: 4px; border: 2px solid #cfe0ff; border-radius: 4px; background: #5f9c57; }
.sm-body { padding: 6px; border-top: 2px solid #ee9a3a; background: #fff; }
.sm-body button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px; border: 0; background: none; text-align: left; }
.sm-body svg { width: 30px; height: 30px; flex: none; }
.sm-body button:hover, .sm-body button:focus-visible { background: var(--select); color: #fff; outline: none; }
.sm-foot { display: flex; justify-content: flex-end; padding: 6px; }
.sm-foot button { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border: 0; background: none; color: #fff; }
.sm-foot button:hover, .sm-foot button:focus-visible { background: #1a4fc0; outline: none; }
.sm-foot svg { width: 22px; height: 22px; }

#off-screen {
  position: fixed; inset: 0; z-index: 9999; width: 100%; border: 0; background: #000; color: #e08a1e;
  display: grid; place-content: center; gap: 18px; font: 700 22px var(--title);
}
#off-screen small { font: 12px var(--ui); color: #8a8a8a; }

#print-sheet { display: none; }

@media (max-width: 700px) {
  .desk-icons { grid-auto-flow: column; gap: 4px; }
  .btn { height: 30px; }
  .actions .btn { flex: 1 1 28%; min-width: 0; padding: 0 4px; }
  .titlebar button { width: 25px; height: 25px; }
  .titlebar { height: 33px; }
  input:not([type]), input[type=number], select { height: 30px; font-size: 16px; }
  fieldset > label { padding: 6px 0; }
  #start { padding-right: 14px; }
  .notice { width: 88px; padding-right: 6px; white-space: normal; }
  .notice b, .notice br { display: none; }
  #win-defrag { min-height: 490px; }
}

@media (max-height: 500px) {
  #win-defrag { min-height: 0; }
  .volumes { min-height: 40px; }
  .graphs { padding-block: 5px; }
  .graph { height: 22px; margin: 2px 0 5px; }
  .legend { margin-top: 6px; padding-top: 5px; }
}

@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  body > * { display: none !important; }
  body > #print-sheet { display: block !important; font: 11px/1.4 monospace; white-space: pre-wrap; }
}
