/* Widgets of the "Understanding the Fuzix filesystem" post, in the Refuge look:
   Windows 95 windows (grey bevels, navy title bars), Courier for bytes, Arial for labels.
   The opening screen and the closing game stay in EGA text mode on purpose. */
.ffs {
  --ffs-grey: #c0c0c0; --ffs-dark: #808080; --ffs-white: #fff; --ffs-ink: #000; --ffs-navy: #000080; --ffs-teal: #008080;
  --ffs-red: #c00000; --ffs-green: #007000; --ffs-cream: #ffffe0; --ffs-soft: #555;
  --t-start: #e4e4e4; --t-size: #ffe9b8; --t-list: #cfe8e8; --t-ilist: #f2f2f2; --t-time: #d8efd2; --t-code: #d4d4d4;
  --f1: #f2c14e; --f2: #c9b3e6; --f3: #8fd3c7; --f4: #e8a0a0; --z-dir: #a8d5a2;
  --ffs-mono: "Courier New", Courier, monospace; --ffs-sans: Arial, Helvetica, sans-serif;
  --dos-font: "WebPlus IBM VGA 8x16", "Courier New", monospace; --dos-px: 16px;
  margin: 16px 0; min-width: 0; font-family: var(--ffs-sans); font-size: 14px; line-height: 1.4; color: var(--ffs-ink);
}
@font-face { font-family: "WebPlus IBM VGA 8x16"; src: url("/fuzix-fs/vga8x16.woff") format("woff"); font-display: block; }
.ffs * { box-sizing: border-box; }
.ffs [hidden] { display: none !important; }
.ffs :focus-visible { outline: 2px dotted var(--ffs-ink); outline-offset: 2px; }
.ffs code { font-family: var(--ffs-mono); font-size: .95em; background: var(--ffs-cream); padding: 0 3px; border: 1px solid #e0e0b0; }

/* Windows 95 window */
.ffs-win { background: var(--ffs-grey); border: 2px solid; border-color: var(--ffs-white) var(--ffs-dark) var(--ffs-dark) var(--ffs-white); box-shadow: 1px 1px 0 var(--ffs-ink); padding: 2px; }
.ffs-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 3px 2px 6px; background: linear-gradient(90deg, var(--ffs-navy), #1084d0); color: var(--ffs-white); font: bold 13px var(--ffs-sans); }
.ffs-body { margin-top: 2px; background: var(--ffs-white); border: 2px solid; border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); padding: 12px; display: grid; gap: 10px; min-width: 0; }
.ffs-body > * { min-width: 0; }
.ffs-btn { font: bold 12px var(--ffs-sans); color: var(--ffs-ink); background: var(--ffs-grey); padding: 3px 10px; cursor: pointer; border: 2px solid; border-color: var(--ffs-white) var(--ffs-ink) var(--ffs-ink) var(--ffs-white); box-shadow: inset -1px -1px 0 var(--ffs-dark); }
.ffs-btn:active:not(:disabled) { border-color: var(--ffs-ink) var(--ffs-white) var(--ffs-white) var(--ffs-ink); box-shadow: inset 1px 1px 0 var(--ffs-dark); }
.ffs-btn:disabled { color: var(--ffs-dark); text-shadow: 1px 1px 0 var(--ffs-white); cursor: default; }
.ffs-btn.small { font-size: 11px; padding: 0 6px; }
.ffs-btn.primary { outline: 1px solid var(--ffs-ink); }
.ffs-del { font: bold 11px var(--ffs-sans); color: var(--ffs-white); background: var(--ffs-red); padding: 1px 6px; cursor: pointer; border: 2px solid; border-color: #ff8080 #600000 #600000 #ff8080; margin-left: 4px; }

/* tabs */
.ffs-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--ffs-white); box-shadow: 0 1px 0 var(--ffs-dark); padding-left: 4px; }
.ffs-tab { font: 13px var(--ffs-sans); padding: 3px 12px; margin-bottom: -2px; background: var(--ffs-grey); color: var(--ffs-ink); cursor: pointer; border: 2px solid; border-bottom: 0; border-color: var(--ffs-white) var(--ffs-ink) transparent var(--ffs-white); border-radius: 4px 4px 0 0; }
.ffs-tab[aria-selected="true"] { font-weight: bold; padding-top: 5px; margin-top: -2px; position: relative; z-index: 1; background: var(--ffs-grey); }
.ffs-tabwrap { background: var(--ffs-grey); padding: 0 6px 6px; border: 2px solid; border-top: 0; border-color: transparent var(--ffs-dark) var(--ffs-dark) var(--ffs-white); }
.ffs-tabwrap > .ffs-panel { background: var(--ffs-white); border: 2px solid; border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); padding: 10px; margin-top: 6px; min-width: 0; }
.ffs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.ffs-label { font: bold 11px var(--ffs-sans); color: var(--ffs-navy); text-transform: uppercase; letter-spacing: .04em; }
.ffs-inp { font: 13px var(--ffs-mono); width: 6ch; padding: 1px 3px; background: var(--ffs-white); border: 2px solid; border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); }

/* byte segments */
.ffs-hx { font: 12px var(--ffs-mono); display: grid; min-width: 0; }
.ffs-row { display: grid; grid-template-columns: 3.8ch repeat(16, minmax(0, 1fr)); padding-top: 4px; }
.ffs-off { grid-column: 1; align-self: end; margin-bottom: 4px; padding: 0 .5ch .2rem 0; text-align: right; font-size: 10px; color: var(--ffs-soft); }
.ffs-seg { position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0 1px 4px; border: 1px solid #8a8a8a; background: var(--ffs-white); cursor: pointer; }
.ffs-seg.cl { border-left: 1px dashed #8a8a8a; } .ffs-seg.cr { border-right: 1px dashed #8a8a8a; }
.ffs-seg-head { padding: 1px 3px 2px; background: var(--tint, var(--t-start)); line-height: 1.2; overflow: hidden; container-type: inline-size; }
.ffs-seg-head span { font: 10px var(--ffs-sans); color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ffs-seg-head .nm { display: none; text-transform: uppercase; }
@container (min-width: 110px) { .ffs-seg-head .nm { display: block; } .ffs-seg-head .ab { display: none; } }
.ffs-seg-read { padding: 2px 2px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; font-size: 14px; min-height: 1.4em; }
.ffs-seg-chars { display: flex; padding-top: 2px; }
.ffs-seg-chars span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 16px; font-weight: bold; }
.ffs-seg-chars span.pad { font-weight: normal; color: #999; }
.ffs-seg-bytes { display: flex; margin-top: auto; }
.ffs-seg-bytes span { flex: 1 1 0; min-width: 0; text-align: center; padding: 1px 0; }
.ffs-seg-bytes span + span, .ffs-seg-chars span + span { border-left: 1px dotted #ccc; }
.ffs-seg.has-chars .ffs-seg-bytes span { font-size: 10px; color: var(--ffs-soft); }
.ffs-seg.zero { border-style: dashed; }
.ffs-seg.zero .ffs-seg-bytes span, .ffs-seg.zero .ffs-seg-read { color: #888; font-weight: normal; }
.ffs-seg.dim { opacity: .5; }
.ffs-seg.key .ffs-seg-read { color: var(--ffs-navy); }
.ffs-seg.sel { z-index: 2; outline: 2px solid var(--ffs-navy); outline-offset: -1px; }
.ffs-seg:hover { border-color: var(--ffs-ink); }
.ffs-fold { grid-column: 2 / -1; margin: 0 1px 4px; padding: 2px 6px; border: 1px dashed #8a8a8a; background: var(--t-code); color: #333; font-size: 11px; text-align: center; }
.ffs-card { min-height: 6.5rem; padding: 8px 12px; background: var(--ffs-cream); border: 1px dashed var(--ffs-dark); border-left: 4px solid var(--ffs-navy); font-size: 13px; }
.ffs-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.ffs-card-name { font: bold 14px var(--ffs-mono); color: var(--ffs-navy); }
.ffs-card-where { font-size: 11px; color: var(--ffs-soft); }
.ffs-card-value { font: bold 17px var(--ffs-mono); margin-top: 2px; }
.ffs-card-how { font-size: 11px; color: var(--ffs-soft); }
.ffs-card p { margin: 4px 0 0; }

/* listing rows */
.ffs-rl { display: grid; gap: 3px; font-family: var(--ffs-mono); font-size: 13px; }
.ffs-rl-head, .ffs-rl-row { display: grid; grid-template-columns: 1.4rem 3.6ch minmax(10ch, 1.4fr) minmax(8ch, 1fr) minmax(8ch, 1fr) 6.5rem; gap: 0 10px; align-items: center; }
.ffs-rl-head { padding: 0 6px; background: var(--ffs-navy); color: var(--ffs-white); font: bold 11px var(--ffs-sans); }
.ffs-rl-row { padding: 3px 6px; border: 1px solid #b0b0b0; background: var(--ffs-white); cursor: pointer; }
.ffs-rl-row:hover { background: var(--ffs-cream); }
.ffs-rl-row.open { background: #dfe6f5; border-color: var(--ffs-navy); }
.ffs-rl-row.free { color: #777; background: repeating-linear-gradient(45deg, #fff 0 6px, #f0f0f0 6px 12px); }
.ffs-rl-row .nm { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ffs-rl-row .ac { color: var(--ffs-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ffs-rl-row .st { font-size: 11px; color: var(--ffs-soft); justify-self: end; white-space: nowrap; }
.ffs-tw { font-size: 10px; display: inline-block; color: var(--ffs-red); }
.ffs-rl-row.open .ffs-tw { transform: rotate(90deg); }
.ffs-rl-open { padding: 4px 8px 8px; border: 1px solid var(--ffs-navy); border-top: 0; background: #fbfbf3; margin-top: -3px; }
.ffs-rl-fold { padding: 2px 6px; border: 1px dashed #8a8a8a; color: var(--ffs-soft); font-size: 11px; text-align: center; }
@media (max-width: 600px) {
  .ffs-rl-head { display: none; }
  .ffs-rl-head, .ffs-rl-row { grid-template-columns: 1.4rem 3.6ch 1fr 1fr; row-gap: 2px; }
  .ffs-rl-row .st { grid-column: 3 / -1; justify-self: start; }
}

/* block grid */
.ffs-grid { display: grid; grid-template-columns: repeat(8, minmax(32px, 58px)); gap: 4px; }
.ffs-cell { aspect-ratio: 1; max-width: 100%; font: 12px var(--ffs-mono); padding: 2px 3px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; background: var(--ffs-grey); color: var(--ffs-ink); cursor: pointer; border: 2px solid; border-color: var(--ffs-white) var(--ffs-dark) var(--ffs-dark) var(--ffs-white); }
.ffs-cell .ct { align-self: flex-end; font: bold 10px var(--ffs-sans); }
.ffs-cell.read { box-shadow: inset 0 -4px #1084d0; }
.ffs-cell.sel { border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); outline: 2px solid var(--ffs-navy); outline-offset: -4px; }
.ffs-cell.flat { cursor: default; border: 1px solid #8a8a8a; }
.ffs-reading-head { font: bold 11px var(--ffs-sans); color: var(--ffs-navy); text-transform: uppercase; }
.ffs-reading { background: #000; color: #33ff33; padding: 10px 12px; max-height: 260px; overflow: auto; font: 13px/1.3 var(--ffs-mono); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 8; margin: 4px 0 0; border: 2px solid; border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); }
.ffs-reading .np, .ffs-reading .foot { color: #1d991d; }
.ffs-reading .foot { font-style: italic; }

/* checklist, hints, power line */
.ffs .ffs-check { list-style: none; padding: 0; margin: 0; font-size: 14px; display: grid; gap: 2px; }
.ffs .ffs-check li { color: #444; margin: 0; }
.ffs .ffs-check li.done { color: var(--ffs-green); }
.ffs .ffs-check .tick { display: inline-block; width: 2.6em; white-space: nowrap; font-family: var(--ffs-mono); }
.ffs-hint { padding: 6px 10px; background: var(--ffs-cream); border: 1px dashed var(--ffs-dark); font-size: 14px; }
.ffs-hint.good { border: 1px solid var(--ffs-green); background: #eaf7e6; }
.ffs-hint.nudge { border-color: var(--ffs-red); }
.ffs-power { font-size: 14px; border-top: 2px groove var(--ffs-grey); padding-top: 6px; }
.ffs-power .ok { color: var(--ffs-green); font-weight: bold; } .ffs-power .bad { color: var(--ffs-red); font-weight: bold; }
.ffs .ffs-power ul { margin: 4px 0 0; padding-left: 1.3em; }

/* head strip */
.ffs-head-wrap { overflow-x: auto; padding: 12px 2px 0; }
.ffs-strip { position: relative; display: flex; gap: 2px; width: max-content; }
.ffs-hs { width: 9px; height: 16px; border: 1px solid #8a8a8a; background: #eee; }
.ffs-hs.b0 { background: #c0c0c0; } .ffs-hs.b1 { background: var(--ffs-teal); } .ffs-hs.bi { background: var(--ffs-navy); }
.ffs-hs.io { background: #ff0000; border-color: #800000; }
.ffs-arm { position: absolute; left: 0; top: -12px; width: 0; height: 0; margin-left: -1px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 10px solid var(--ffs-ink); transition: transform .25s ease-in-out; }
.ffs-head-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; color: var(--ffs-soft); font-size: 12px; }
.ffs-led { width: 10px; height: 10px; border-radius: 50%; background: #400; border: 1px solid #000; }
.ffs-led.on { background: #ff2020; }
.ffs-head-stats { margin-left: auto; font-family: var(--ffs-mono); }

/* mkfs dialog */
.ffs-dlg { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 8px 20px; font-size: 13px; }
.ffs-dlg label { display: grid; gap: 2px; }
.ffs-dlg input[type=range] { width: 100%; accent-color: var(--ffs-navy); }
.ffs-dlg select { font: 13px var(--ffs-sans); width: 100%; }
.ffs-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--ffs-soft); }
.ffs-zones { display: flex; height: 20px; border: 2px solid; border-color: var(--ffs-dark) var(--ffs-white) var(--ffs-white) var(--ffs-dark); }
.ffs-cmd { font: 13px var(--ffs-mono); background: #000; color: #33ff33; padding: 4px 8px; }
.ffs-stack { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.ffs-stack span { font: 11px var(--ffs-mono); text-align: center; padding: 2px 0; background: #eee; color: #aaa; border: 1px solid #ddd; }
.ffs-stack span.live { background: var(--ffs-white); color: var(--ffs-ink); border-color: #8a8a8a; }
.ffs-stack span.top { outline: 2px solid var(--ffs-red); outline-offset: -1px; }
.ffs-stack span.ch { background: var(--ffs-navy); color: var(--ffs-white); }

/* figures */
.ffs-fig { margin: 18px 0; }
.ffs-fig svg { display: block; width: 100%; height: auto; margin: 0 auto; border: 1px solid #000; box-shadow: 4px 4px 0 #808080; background: #fff; }
.ffs-fig figcaption { text-align: center; font-style: italic; margin-top: 6px; font-size: 14px; color: #333; }

/* EGA text mode: opening screen and closing game */
.ffs-dos { height: 430px; display: flex; flex-direction: column; gap: 8px; padding: 0 10px 8px; background: #0000aa; color: #aaa; font: var(--dos-px)/1.25 var(--dos-font); overflow: hidden; border: 2px solid #000; }
.ffs-dos-menu, .ffs-dos-keys { flex: none; margin: 0 -10px; padding: 2px 1.2ch; display: flex; gap: 2.5ch; white-space: nowrap; overflow: hidden; }
.ffs-dos-menu { background: #aaa; color: #0000aa; } .ffs-dos-menu b { color: #aa0000; font-weight: normal; }
.ffs-dos-keys { background: #00aaaa; color: #0000aa; }
.ffs-dos-key { background: #0000aa; color: #aaa; padding: 0 1ch; }
.ffs-right { margin-left: auto; }
.ffs-dpanel { position: relative; min-width: 0; border: 3px double #00aaaa; padding: 10px 10px 8px; }
.ffs-dpanel-title { position: absolute; top: -.75em; left: 1.5ch; padding: 0 .7ch; background: #0000aa; color: #ffff55; white-space: nowrap; }
.ffs-dmap-panel { flex: 1 1 auto; min-height: 0; display: flex; }
.ffs-dmap { flex: 1; min-width: 0; display: grid; grid-auto-rows: 18px; gap: 1px; align-content: start; overflow: hidden; user-select: none; line-height: 18px; }
.ffs-dc { text-align: center; overflow: hidden; }
.ffs-dc.u { background: #fff; } .ffs-dc.f { color: #3a3ac0; background: repeating-linear-gradient(45deg, #0000aa 0 2px, #2a2ab5 2px 4px); }
.ffs-dc.i { background: #00aaaa; } .ffs-dc.s, .ffs-dc.r { background: #ffff55; color: #0000aa; } .ffs-dc.x { color: #ff5555; }
.ffs-dinfo { flex: none; display: flex; gap: 12px; }
.ffs-dstatus { flex: 1 1 24ch; }
.ffs-dstat { display: flex; justify-content: space-between; gap: 2ch; color: #fff; }
.ffs-dbar { white-space: pre; overflow: hidden; } .ffs-dbar .cap { color: #00aaaa; } .ffs-dbar .fill { color: #00aaaa; } .ffs-dbar .track { color: #555; }
.ffs-dc-c { text-align: center; } .ffs-dmode { color: #ffff55; }
.ffs .ffs-dlegend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, auto); gap: 0 2.5ch; }
.ffs-dlegend li { white-space: nowrap; margin: 0; }
.ffs-card95 { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92%, 46ch); border: 3px double #00aaaa; background: #0000aa; box-shadow: 7px 8px 0 #000033; padding: 14px 20px; text-align: center; }
.ffs-card95 .t { color: #ffff55; font-size: calc(var(--dos-px) * 2); line-height: 1.2; margin: 0 0 8px; overflow-wrap: anywhere; }
.ffs-card95 .s { color: #fff; margin: 0; line-height: 1.5; }
.ffs-cue { margin-top: 12px; display: block; width: 100%; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ffs-cue:hover { color: #ffff55; }
@media (prefers-reduced-motion: no-preference) { .ffs-caret { animation: ffs-caret 1.1s steps(1) infinite; } @keyframes ffs-caret { 50% { opacity: 0; } } }
@media (max-width: 560px) { .ffs-dos { height: 380px; } .ffs-card95 .t { font-size: calc(var(--dos-px) * 1.5); } .ffs-dlegend, .ffs-right { display: none; } }

.ffs-game { background: #0000aa; color: #aaa; font: var(--dos-px)/1.25 var(--dos-font); display: grid; gap: 12px; padding: 8px; border: 2px solid #000; }
.ffs-g-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2ch; background: #aaa; color: #0000aa; padding: 3px 1ch; }
.ffs-g-radio { font: inherit; background: none; color: inherit; border: 0; padding: 0; cursor: pointer; }
.ffs-g-radio[aria-checked="true"] { background: #0000aa; color: #fff; padding: 0 1ch; }
.ffs-g-btn { font: inherit; background: #0000aa; color: #ffff55; border: 0; padding: 0 1.5ch; cursor: pointer; margin-left: auto; }
.ffs-g-main { display: grid; grid-template-columns: minmax(0, 1fr) 26ch; gap: 12px; }
@media (max-width: 680px) { .ffs-g-main { grid-template-columns: minmax(0, 1fr); } }
.ffs-g-map { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.ffs-g-cell { aspect-ratio: 1; min-width: 0; font: inherit; padding: 2px 4px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; border: 0; cursor: pointer; background: #000066; color: #3333aa; }
.ffs-g-cell .gt { align-self: flex-end; }
.ffs-g-cell.used { background: #fff; color: #0000aa; } .ffs-g-cell.meta { background: #00aaaa; color: #0000aa; }
.ffs-g-cell.free { background: repeating-linear-gradient(45deg, #0000aa 0 3px, #2a2ab5 3px 6px); color: #aaa; }
.ffs-g-cell.lost { background: #ff5555; color: #000; } .ffs-g-cell.cur { outline: 3px solid #ffff55; outline-offset: -3px; }
.ffs-g-list { display: grid; gap: 2px; }
.ffs-g-item { font: inherit; text-align: left; background: none; border: 0; color: #aaa; padding: 0 .5ch; cursor: pointer; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.ffs-g-item:hover { color: #fff; } .ffs-g-item.hit { background: #ff5555; color: #000; }
.ffs-g-stat { display: flex; justify-content: space-between; gap: 1ch; color: #fff; }
.ffs .ffs-g-found { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 2px; }
.ffs-g-found li { margin: 0; } .ffs-g-found li.ok { color: #55ff55; }
.ffs-g-msg { background: #00aaaa; color: #0000aa; padding: 3px 1ch; min-height: 2.5em; }
.ffs-game.done .ffs-g-msg { background: #55ff55; }
.ffs-g-term { white-space: pre-wrap; overflow-wrap: anywhere; } .ffs-g-term b { color: #ffff55; font-weight: normal; }
.ffs-game p { margin: 8px 0 0; }
@media (prefers-reduced-motion: reduce) { .ffs-arm { transition: none; } }

/* block grid on the left, stacks on the right; one column on phones */
.ffs-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ffs-split .ffs-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.ffs-split .ffs-cell { font-size: 11px; padding: 1px 2px; }
.ffs-split .ffs-cell .ct { font-size: 9px; }
.ffs-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ffs-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #333; }
.ffs-legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid #808080; margin-right: 4px; vertical-align: -2px; }
@media (max-width: 640px) { .ffs-split { grid-template-columns: minmax(0, 1fr); } }
