:root{
  --face:#c0c0c0; --hi:#fff; --light:#dfdfdf; --shadow:#808080; --dark:#0a0a0a;
  --navy:#000080; --teal:#008080;
  --ui:"MS Sans Serif","Microsoft Sans Serif","Pixelated MS Sans Serif",Tahoma,Geneva,"Segoe UI","DejaVu Sans",Arial,sans-serif;
  --mono:Fixedsys,"Lucida Console","Courier New","DejaVu Sans Mono",monospace;
  --out: inset -1px -1px var(--dark), inset 1px 1px var(--hi), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --in: inset -1px -1px var(--hi), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --flat-in: inset -1px -1px var(--hi), inset 1px 1px var(--shadow);
  --taskbar:30px;
  --vh:100dvh;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden}
body{background:var(--teal);font:12px/1.35 var(--ui);color:#000;-webkit-font-smoothing:none;font-smooth:never;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button{font:inherit;color:inherit}
::selection{background:var(--navy);color:#fff}

/* window chrome */
.window{background:var(--face);box-shadow:var(--out);padding:3px;display:flex;flex-direction:column}
.titlebar{background:var(--navy);color:#fff;display:flex;align-items:center;gap:3px;height:18px;padding:0 2px 0 3px;font-weight:bold;user-select:none;flex:none}
.titlebar .title{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-left:1px}
.tb-icon{image-rendering:pixelated}
.tb-btn{width:16px;height:14px;padding:0;border:0;background:var(--face);box-shadow:var(--out);position:relative;flex:none;cursor:pointer}
.tb-btn:active{box-shadow:var(--in)}
.tb-btn.x{margin-left:2px}
.tb-btn i{position:absolute;inset:0;background-repeat:no-repeat;background-position:center;image-rendering:pixelated}
.tb-btn.x i{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v1h1v1h2V1h1V0h2v1H7v1H6v1H5v1h1v1h1v1h1v1H6V6H5V5H3v1H2v1H0V6h1V5h1V4h1V3H2V2H1V1H0z'/%3E%3C/svg%3E")}
.tb-btn.min i{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='2' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h6v2H0z'/%3E%3C/svg%3E");background-position:4px 8px}
.tb-btn.max i{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h9v9H0zM1 2v6h7V2z'/%3E%3C/svg%3E")}

.btn{min-width:75px;min-height:23px;padding:3px 10px;border:0;background:var(--face);box-shadow:var(--out);cursor:pointer;text-align:center;text-decoration:none;color:#000;display:inline-flex;align-items:center;justify-content:center;gap:4px;white-space:nowrap}
.btn:active,.btn.pressed{box-shadow:var(--in)}
.btn.pressed{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1H0zM1 1h1v1H1z' fill='%23fff'/%3E%3C/svg%3E")}
.btn.default{outline:1px solid var(--dark);outline-offset:0}
.btn:focus-visible{outline:1px dotted #000;outline-offset:-4px}
.btn.default:focus-visible{box-shadow:var(--out),inset 0 0 0 0 #000}
.btn[disabled]{color:var(--shadow);text-shadow:1px 1px var(--hi);cursor:default}
.btn.small{min-width:0;min-height:20px;padding:1px 8px}
.btn.wide{width:100%;justify-content:flex-start;padding-left:12px}
.btn.link{box-shadow:none;background:none;min-width:0;text-decoration:underline;color:#000;padding:3px 4px}
.field{background:#fff;box-shadow:var(--in);padding:2px}
.field-flat{box-shadow:var(--flat-in);padding:2px 5px}

/* desktop + notepad */
.desktop{position:fixed;inset:0 0 var(--taskbar) 0}
.notepad{position:absolute;left:0;right:0;margin:0 auto;top:44px;bottom:16px;width:min(720px,calc(100% - 32px))}
.notepad.maxed{top:0;bottom:0;width:100%}
.menubar{display:flex;align-items:center;gap:0;padding:1px 0 2px;flex:none;position:relative;z-index:5}
.menu-wrap{position:relative}
.menu-btn{border:0;background:none;padding:2px 7px;cursor:pointer}
.menu-btn u{text-decoration:underline}
.menu-btn.open{background:var(--navy);color:#fff}
.menu{position:absolute;top:100%;left:0;min-width:180px;background:var(--face);box-shadow:var(--out);padding:3px;z-index:20;display:flex;flex-direction:column}
.menu[hidden]{display:none}
.menu button{border:0;background:none;text-align:left;padding:3px 20px;display:flex;justify-content:space-between;gap:24px;cursor:pointer}
.menu button span{color:#000;opacity:.75}
.menu button:hover,.menu button:focus-visible{background:var(--navy);color:#fff;outline:0}
.menu button:hover span{color:#fff}
.menu hr{border:0;border-top:1px solid var(--shadow);border-bottom:1px solid var(--hi);margin:3px 1px;width:auto}
.improve{margin-left:auto;margin-right:2px}
.doc-wrap{flex:1;position:relative;min-height:0;display:flex}
#doc{flex:1;width:100%;border:0;outline:0;resize:none;padding:2px 4px;font:16px/1.3 var(--mono);background:#fff;color:#000;border-radius:0;-webkit-appearance:none;appearance:none}
#chip{position:absolute;display:flex;align-items:stretch;background:#ffffe1;border:1px solid #000;font:12px var(--ui);z-index:4;max-width:calc(100% - 12px)}
#chip[hidden]{display:none}
#chip button{border:0;background:none;padding:2px 6px;cursor:pointer;white-space:nowrap}
#chip .ghost{color:var(--shadow);font-family:var(--mono)}
#chip .chip-x{border-left:1px solid var(--shadow)}
kbd{font:inherit;font-size:11px;border:1px solid var(--shadow);padding:0 3px;background:var(--face)}
.actionbar{display:flex;gap:2px;align-items:center;padding-top:3px;flex:none}
.status{height:22px;display:flex;align-items:center;white-space:nowrap;overflow:hidden}
#pos{flex:1}
#keys.bump{background:#ffffe1}
.timer{font-family:var(--mono);font-size:13px;min-width:74px;justify-content:center}
#savebtn{margin-left:2px}

/* taskbar */
.taskbar{position:fixed;left:0;right:0;bottom:0;height:var(--taskbar);background:var(--face);box-shadow:inset 0 1px var(--light),inset 0 2px var(--hi);display:flex;align-items:center;gap:4px;padding:3px 2px 2px;z-index:30}
.taskbar .btn{min-height:22px;height:22px}
.taskbar img{image-rendering:pixelated}
.start{min-width:0;font-weight:bold;padding:2px 5px}
.task{justify-content:flex-start;min-width:0;width:160px;max-width:40vw;overflow:hidden}
.task span{overflow:hidden;text-overflow:ellipsis}
.tray{margin-left:auto;height:22px;display:flex;align-items:center;padding:0 10px}

/* dialogs */
#layer{position:fixed;inset:0;pointer-events:none;z-index:40}
.backdrop{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:auto;padding:12px}
.backdrop.passthru{pointer-events:none}
.backdrop.passthru .dialog{pointer-events:auto}
.dialog{width:min(380px,100%);max-height:calc(var(--vh) - 24px);will-change:transform}
.dialog.wide{width:min(460px,100%)}
.dialog-body{display:flex;gap:12px;padding:12px 10px 6px;overflow:auto;min-height:0}
.dialog-body .msg{flex:1;min-width:0}
.dialog-body p{margin:0 0 8px}
.dialog-btns{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;padding:6px 8px 8px}
.icon{width:32px;height:32px;flex:none;background-repeat:no-repeat;image-rendering:pixelated}
.icon-error{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23f00' stroke='%23800000' stroke-width='2'/%3E%3Cpath d='M10 10l12 12M22 10L10 22' stroke='%23fff' stroke-width='3'/%3E%3C/svg%3E")}
.icon-warn{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath d='M16 2L31 29H1z' fill='%23ff0' stroke='%23000' stroke-width='1.5'/%3E%3Cpath d='M14.5 10h3v11h-3zM14.5 23h3v3h-3z'/%3E%3C/svg%3E")}
.icon-info{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23fff' stroke='%23000' stroke-width='1.5'/%3E%3Cpath d='M14 8h4v4h-4zM13 14h5v9h2v2h-8v-2h2v-7h-1z' fill='%23000080'/%3E%3C/svg%3E")}
.icon-disk{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath d='M3 3h23l3 3v23H3z' fill='%23000080'/%3E%3Cpath d='M8 3h14v9H8z' fill='%23c0c0c0'/%3E%3Cpath d='M17 5h3v5h-3z' fill='%23000080'/%3E%3Cpath d='M7 17h18v12H7z' fill='%23fff'/%3E%3Cpath d='M9 20h14v1H9zM9 23h14v1H9zM9 26h9v1H9z' fill='%23808080'/%3E%3C/svg%3E")}
.big{font-size:15px}
.small{font-size:11px}
.quote{font-family:var(--mono);background:#fff;box-shadow:var(--flat-in);padding:0 4px;word-break:break-word}
.err{min-height:16px;display:flex;gap:6px;align-items:flex-start;margin-top:6px}
.err:empty{display:none}
.stack{display:flex;flex-direction:column;gap:4px;margin:8px 0}
.choices{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:10px 0 2px}
.choices .btn{min-width:0;white-space:normal;line-height:1.2;padding:5px 6px}
.steps{display:flex;justify-content:space-between;align-items:center;margin-top:8px}
.prog{height:22px;box-shadow:var(--flat-in);padding:2px;margin:8px 0}
.prog i{display:block;height:100%;width:0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='1' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h10v1H0z' fill='%23000080'/%3E%3C/svg%3E");background-size:12px 100%}
.log{font:12px/1.45 var(--mono);background:#000;color:#c0c0c0;margin:0;padding:6px 8px;height:170px;overflow:auto;white-space:pre-wrap}
.log .ok{color:#fff}
.dir{font:12px/1.45 var(--mono);background:#000;color:#c0c0c0;margin:0 0 8px;padding:6px 8px;white-space:pre-wrap}
.terms{height:110px;overflow:auto;font-size:11px;margin:4px 0 8px;padding:4px 6px}
.terms p{margin:0 0 6px}
.check{display:flex;gap:6px;align-items:flex-start;cursor:pointer}
.check input{margin:1px 0 0;width:13px;height:13px;flex:none}
.plans{width:100%;border-collapse:collapse;margin:6px 0 4px;font-size:11px;background:#fff;box-shadow:var(--flat-in)}
.plans th,.plans td{text-align:left;padding:3px 5px;border-bottom:1px solid var(--light)}
.plans th{background:var(--face)}
.toggles{display:flex;flex-direction:column;gap:4px;margin:6px 0;max-height:180px;overflow:auto;background:#fff;box-shadow:var(--in);padding:6px}
.end .time{font:bold 34px/1 var(--mono);margin:6px 0 10px;letter-spacing:1px}
.end .bucket{font-weight:bold}

/* cookie banner */
.cookie{position:fixed;left:0;right:0;bottom:0;z-index:35;padding:3px}
.cookie .body{display:flex;gap:12px;align-items:center;padding:8px 10px;flex-wrap:wrap}
.cookie p{margin:0;flex:1 1 300px}
.cookie .btns{display:flex;gap:6px;flex-wrap:wrap}

/* toasts */
#toasts{position:fixed;top:8px;right:8px;z-index:50;display:flex;flex-direction:column;gap:6px;align-items:flex-end;pointer-events:none;max-width:calc(100% - 16px)}
.toast{pointer-events:auto;width:min(300px,100%);background:#ffffe1;border:1px solid #000;box-shadow:2px 2px 0 rgba(0,0,0,.5);padding:6px 8px;display:flex;gap:8px;align-items:flex-start}
.toast .t{flex:1}
.toast button.tx{border:0;background:none;padding:0 2px;cursor:pointer;line-height:1}
.stars button{border:0;background:none;font-size:18px;padding:0 1px;cursor:pointer;line-height:1}
.zoom{position:fixed;border:2px dotted #fff;mix-blend-mode:difference;z-index:60;pointer-events:none}
.noscript{position:fixed;inset:auto 0 50% 0;text-align:center;color:#fff}

@media (max-width:600px){
  :root{--taskbar:32px}
  body{font-size:13px}
  .notepad{top:0;bottom:0;width:100%;padding:2px}
  .titlebar{height:22px}
  .tb-btn{width:20px;height:18px}
  .menu-btn{padding:4px 8px}
  .improve{font-size:12px}
  .status{height:26px}
  #pos{display:none}
  #keys{flex:1}
  .btn{min-height:28px}
  .task{width:auto}
  .cookie .btns{width:100%}.cookie .btns .btn{flex:1 1 0;min-width:0;white-space:normal}
  .end .time{font-size:30px}
}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto}}
.icon.sm{width:16px;height:16px;background-size:16px}
.desktop{bottom:auto;height:calc(var(--vh) - var(--taskbar))}
.btnslot{display:flex;justify-content:center;padding-top:8px}
