:root {
  color-scheme: light;
  font-family: Tahoma, "MS Sans Serif", Arial, sans-serif;
  font-size: 12px;
  color: #111;
  background: #080a0c;
  --silver: #c0c0c0;
  --page-controls-height: 38px;
}
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; color: #777; text-shadow: 1px 1px #fff; }
button:focus-visible, a:focus-visible, video:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
button:disabled img { opacity: .4; }
[hidden] { display: none !important; }
.raised, .art-window {
  background: var(--silver);
  border: 1px solid;
  border-color: #fff #111 #111 #fff;
  box-shadow: inset 1px 1px #dfdfdf, inset -1px -1px #808080;
}
.sunken { border: 1px solid; border-color: #808080 #fff #fff #808080; }
.raised:active:not(.art-window) { border-color: #111 #fff #fff #111; box-shadow: inset 1px 1px #808080; }
#popup-stage { position: fixed; inset: 0 0 var(--page-controls-height); overflow: hidden; isolation: isolate; }
.piece-background { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; user-select: none; }
#windows { position: absolute; inset: 0; pointer-events: none; }
.art-window { position: absolute; padding: 3px; max-width: calc(100% - 12px); pointer-events: auto; filter: drop-shadow(3px 3px 0 #0005); }
.art-window.is-new { animation: arrive 130ms steps(2, end); }
.titlebar { display: flex; align-items: center; height: 25px; gap: 5px; padding: 3px; background: #808080; color: #fff; user-select: none; touch-action: none; cursor: move; }
.is-active .titlebar { background: #000080; }
.is-final .titlebar { background: #000080; }
.titlebar > img { width: 15px; height: 15px; padding: 1px; background: #eee; flex-shrink: 0; }
.window-title { font-weight: bold; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; flex: 1; min-width: 0; }
.window-controls { display: flex; gap: 2px; flex-shrink: 0; }
.window-control { width: 20px; height: 19px; padding: 2px; display: grid; place-items: center; }
.window-control img { width: 12px; height: 12px; }
.window-body { margin-top: 3px; background: #c0c0c0; }
.artwork-button { display: block; width: 100%; border: 0; background: none; margin: 0; padding: 0; cursor: pointer; overflow: hidden; }
.artwork-button img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 158px); object-fit: contain; user-select: none; }
.artwork-button:focus-visible { outline: 2px dotted #ff00b7; outline-offset: -5px; }
.window-status { min-height: 21px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 5px; margin-top: 3px; color: #333; }
.window-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-status .connection { font-size: 10px; color: #006400; flex-shrink: 0; }
.is-maximized { inset: 4px !important; width: auto !important; display: flex; flex-direction: column; }
.is-maximized .window-body { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; }
.is-maximized .artwork-button { height: 100%; }
.is-maximized .artwork-button img { height: 100%; max-height: calc(100dvh - 115px); }
.link-page { padding: 18px; background: #fff; min-height: 160px; overflow-wrap: anywhere; }
.link-page img { width: 30px; height: 30px; float: left; margin: 0 12px 12px 0; }
.link-page p { margin: 2px 0 12px; line-height: 1.5; }
.link-page .link-address { clear: both; font: 12px "Courier New", monospace; color: #555; padding: 8px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dialog-actions a, .dialog-actions button { text-align: center; min-width: 84px; padding: 6px 12px; text-decoration: none; color: #000; }
.link-page.link-browser { padding: 0; min-height: 280px; display: flex; flex-direction: column; background: var(--silver); }
.browser-toolbar { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: var(--silver); border-bottom: 1px solid #808080; }
.browser-toolbar > img { width: 16px; height: 16px; float: none; margin: 0; flex-shrink: 0; }
.browser-address-label { font-size: 11px; color: #222; flex-shrink: 0; }
.browser-address-bar { flex: 1; min-width: 0; padding: 2px 6px; background: #fff; border: 1px solid; border-color: #808080 #fff #fff #808080; font: 11px "Courier New", monospace; color: #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-open-link { flex-shrink: 0; min-width: unset !important; padding: 2px 8px !important; font-size: 11px !important; text-decoration: none; color: #000; white-space: nowrap; }
.browser-frame-wrap { position: relative; width: 100%; height: clamp(260px, 48vh, 380px); background: #fff; border: 1px solid; border-color: #808080 #fff #fff #808080; }
.browser-iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.browser-footer { margin-top: 0 !important; padding: 5px 8px; background: var(--silver); border-top: 1px solid #fff; }
.is-maximized .link-browser { height: 100%; flex: 1; }
.is-maximized .browser-frame-wrap { flex: 1; height: 100%; }
.is-final { width: 760px; }
.notepad-video { width: 100%; aspect-ratio: 1078 / 720; max-height: calc(100dvh - 215px); object-fit: contain; display: block; background: #fff; }
.notepad-footer { display: flex; justify-content: flex-end; padding: 8px; gap: 8px; }
.notepad-footer button, .notepad-footer a { padding: 6px 12px; text-decoration: none; color: #000; }
.page-controls { position: fixed; z-index: 100000; bottom: 0; left: 0; width: 100%; height: var(--page-controls-height); background: #c0c0c0; border-top: 1px solid #fff; padding: 3px 12px; display: flex; align-items: center; gap: 18px; }
.page-controls a, .text-link { font: 12px Tahoma, Arial, sans-serif; color: #111; text-decoration: underline; background: none; border: 0; padding: 0; white-space: nowrap; }
.page-controls a:hover, .text-link:hover { color: #c00; }
.playback-controls { display: flex; gap: 5px; margin-left: auto; }
.window-tabs { border-top: 1px solid #ccc; max-height: 34dvh; overflow-y: auto; }
.window-tab { width: 100%; padding: 7px 10px; display: flex; align-items: center; gap: 7px; background: #fff; border: 0; box-shadow: none; color: #00e; text-align: left; text-decoration: underline; }
.window-tab img { width: 15px; height: 15px; flex-shrink: 0; }
.window-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-tab[aria-pressed="true"] { background: #ffffc8; font-weight: bold; }
#window-count { font-variant-numeric: tabular-nums; }
.tray-button { border: 0; background: none; display: grid; place-items: center; width: 23px; height: 25px; padding: 3px; }
.tray-button:hover { outline: 1px solid #808080; }
.tray-button img { width: 17px; height: 17px; }
.site-options { position: fixed; bottom: var(--page-controls-height); left: 12px; z-index: 100001; width: min(300px, calc(100% - 24px)); max-height: calc(100dvh - 60px); overflow-y: auto; border: 1px solid #000080; background: #fff; box-shadow: 3px 3px #0004; }
.site-commands a, .site-commands button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; padding: 10px; text-align: left; background: none; color: #00e; text-decoration: underline; }
.site-commands img { width: 18px; height: 18px; }
.site-commands a:hover, .site-commands button:hover, .window-tab:hover { background: #ffffc8; color: #c00; }
.pause-indicator { position: absolute; z-index: 99999; inset: 10px auto auto 50%; transform: translateX(-50%); padding: 6px 20px; background: #ffffc8; border: 1px solid #111; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.noscript { position: fixed; top: 20%; left: 10%; right: 10%; padding: 25px; }
@keyframes arrive { from { transform: scale(.97); } to { transform: scale(1); } }
@media (max-width: 600px) {
  :root { --page-controls-height: calc(43px + env(safe-area-inset-bottom)); }
  .page-controls { padding: 3px 8px calc(3px + env(safe-area-inset-bottom)); gap: 12px; }
  .page-controls a, .text-link { font-size: 11px; }
  .playback-controls { gap: 0; }
  .tray-button { width: 28px; height: 30px; }
  .titlebar { height: 31px; }
  .window-control { width: 27px; height: 25px; }
  .window-control img { width: 15px; height: 15px; }
  .artwork-button img { max-height: calc(100dvh - 180px); }
  .notepad-video { max-height: calc(100dvh - 240px); }
  .notepad-footer { flex-wrap: wrap; }
}
@media (max-width: 350px) {
  .page-controls { gap: 9px; }
  .page-controls .return-link { max-width: 81px; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) { .art-window.is-new { animation: none; } }
