:root {
  --bg: #0b0c0f;
  --card: #15171c;
  --card2: #1c1f26;
  --line: #292d36;
  --tx: #eeece6;
  --mu: #a0a6b1;
  --am: #f6a623;
  --amd: #2d210a;
  --rd: #ff9b8a;
  --ink: #1a1204;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font-family: var(--sans); font-size: 16px; line-height: 1.45; }
a { color: var(--am); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--am); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--am); color: var(--ink); padding: 10px 14px; z-index: 30; border-radius: 10px; }
.skip:focus { top: 8px; }
.small { font-size: 13px; color: var(--mu); }
.hint { color: var(--mu); font-size: 13px; }
.garble, .tally, .stage, .tm, .wd, #clock, #clock-splash { font-family: var(--mono); }

.screen { max-width: 1100px; margin: 0 auto; padding: 14px 16px 0; }
.session { display: flex; justify-content: space-between; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; letter-spacing: 0.08em; color: var(--mu); padding: 2px 2px 10px; font-weight: 600; }
.session > span:first-child::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--am); box-shadow: 0 0 0 4px rgba(246, 166, 35, 0.18); margin-right: 8px; animation: pulse 2.4s ease-in-out infinite; }
.session.closed > span:first-child::before { background: var(--rd); box-shadow: none; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(246, 166, 35, 0); } }
.audio { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2); color: var(--tx); font: 600 12px var(--mono); letter-spacing: 0.04em; cursor: pointer; }
.audio[aria-pressed=true] { border-color: rgba(246, 166, 35, 0.55); color: var(--am); background: var(--amd); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin: 0 0 16px; padding: 20px 16px; }
.card h1 { font-size: 20px; line-height: 1.25; margin: 8px 0 12px; letter-spacing: 0.02em; }
.card h2 { font-size: 17px; }
.brandline { display: block; font-size: 13px; color: var(--am); letter-spacing: 0.14em; text-transform: uppercase; }
.sigil { display: inline-block; width: 96px; height: 96px; vertical-align: middle; }
.cherub { display: inline-block; width: 64px; height: 64px; vertical-align: middle; margin-left: 12px; }
.will-line { background: #101216; border: 1px solid var(--line); border-radius: 12px; color: var(--tx); padding: 8px 12px; font-size: 14px; font-family: var(--mono); }
.will-line::before { content: 'w  '; color: var(--am); font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 18px; background: var(--card2); color: var(--tx); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-decoration: none; font-weight: 700; }
.btn:hover { background: #232730; }
.btn.primary { background: var(--am); color: var(--ink); border-color: var(--am); }
.btn.primary:hover { background: #ffb53c; }
.small-btn { min-height: 48px; padding: 4px 14px; font-size: 14px; }
.linkish { background: none; border: 0; color: var(--tx); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 10px; }

.codeform, .saveform { margin-top: 18px; }
.codeform label, .saveform label { display: block; font-weight: 600; margin: 12px 0 8px; }
.row { display: flex; gap: 10px; }
input[type=text], input[type=email], input[type=search], textarea { font: inherit; font-size: 16px; min-height: 52px; padding: 8px 14px; border: 1px solid var(--line); background: var(--card2); color: var(--tx); width: 100%; border-radius: 14px; }
textarea { min-height: 88px; }
input::placeholder, textarea::placeholder { color: var(--mu); opacity: 1; }
.row input { flex: 1; min-width: 0; }
.codeout, .formout { min-height: 1.5em; margin: 6px 0; color: var(--rd); }
.codeout.ok { color: var(--am); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; margin: 16px 0 !important; }
.check input { width: 22px; height: 22px; flex: none; margin: 2px 0 0; accent-color: var(--am); }
.saveform .btn { width: 100%; margin-top: 8px; }

.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-bottom: 6px; }
.count { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 16px; }
.tally { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.stage { grid-column: 2; grid-row: 1; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--mu); }
.stage.hot { background: var(--am); border-color: var(--am); color: var(--ink); }
.pips { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pips i { display: block; height: 8px; border-radius: 4px; background: #2a2e37; }
.pips i.on { background: var(--am); box-shadow: 0 0 12px rgba(246, 166, 35, 0.45); }
.net { margin-top: 8px; background: #101216; border: 1px solid var(--line); border-radius: 18px; color: var(--tx); font-family: var(--mono); font-size: 14px; max-height: 6.6em; min-height: 2.6em; overflow-y: auto; padding: 8px 14px; }
.net p { margin: 0; padding: 3px 0; }
.net .w, .net .u { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: var(--amd); color: var(--am); font-size: 12px; font-weight: 700; margin-right: 10px; overflow: hidden; white-space: nowrap; vertical-align: 1px; }
.net .sys { color: var(--mu); padding-left: 30px; }
.checkin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin-top: 8px; padding: 8px 12px; }
.checkin label { font-weight: 700; }
.checkin input { flex: 1; min-width: 120px; }
.checkin .btn { background: var(--am); color: var(--ink); border-color: var(--am); }

.desk { margin-top: 8px; padding-bottom: 88px; min-height: calc(100vh - 260px); }
.search { position: relative; margin-bottom: 12px; }
.search input { height: 54px; border-radius: 27px; padding: 0 16px 0 48px; }
.search::before { content: ''; position: absolute; left: 18px; top: 17px; width: 20px; height: 20px; background: var(--mu); -webkit-mask: var(--i-search) center / contain no-repeat; mask: var(--i-search) center / contain no-repeat; pointer-events: none; }
.search.off input { opacity: 0.55; }
.closed-tag { position: absolute; right: 10px; top: 10px; font-size: 12px; font-weight: 700; color: var(--am); background: var(--amd); border: 1px solid rgba(246, 166, 35, 0.4); padding: 6px 10px; border-radius: 999px; }
.files, .files ul { list-style: none; margin: 0; padding: 0; }
.files { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.files > li { border-bottom: 1px solid var(--line); }
.files > li:last-child { border-bottom: 0; }
.files ul { margin: 0 0 10px 38px; border-left: 2px solid var(--line); }
.item { display: flex; width: 100%; min-height: 56px; align-items: center; gap: 14px; padding: 6px 16px; background: none; border: 0; font: inherit; color: var(--tx); text-align: left; cursor: pointer; }
.item::before { content: ''; flex: none; width: 22px; height: 22px; background: var(--mu); -webkit-mask: var(--i-doc) center / contain no-repeat; mask: var(--i-doc) center / contain no-repeat; }
.item[data-key^="folder:"]::before { background: var(--am); -webkit-mask-image: var(--i-folder); mask-image: var(--i-folder); }
.item:hover { background: var(--card2); }
.item.current { background: var(--card2); box-shadow: inset 4px 0 0 var(--am); }
.item[aria-disabled=true] { color: #8b919c; cursor: not-allowed; }
.item .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item .meta { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.tag { font-size: 12px; font-weight: 600; border: 1px solid #343944; background: #242830; color: #c8cdd6; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tag.lock { color: var(--rd); border-color: rgba(255, 155, 138, 0.4); background: #2a1a18; }
.files .codeform { padding: 0 16px 14px !important; margin-top: 0; }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 8px 16px 14px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card2); cursor: pointer; min-height: 44px; position: relative; display: block; width: 100%; }
.thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumb span { display: block; font-size: 12px; padding: 6px 8px; text-align: left; overflow-wrap: anywhere; color: var(--tx); }
.thumb.withheld img { filter: grayscale(1) brightness(0.35); }
.thumb.withheld::after { content: 'withheld'; position: absolute; top: 8px; left: 8px; background: #2a1a18; color: var(--rd); font-size: 12px; padding: 2px 8px; border-radius: 999px; }
#results { margin-bottom: 12px; }
#results p { margin: 6px 4px; }

.viewer { background: var(--card); border: 1px solid var(--line); border-radius: 18px; min-height: 40vh; }
.vhead { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vhead h2 { font-size: 15px; margin: 0; overflow-wrap: anywhere; }
.vtag { margin-left: auto; color: var(--am); font-weight: 700; font-size: 13px; }
.vbody { padding: 14px 16px 24px; }
.vbody pre { margin: 0; font: 14px/1.5 var(--mono); white-space: pre; overflow-x: auto; }
.ln { display: block; min-height: 1.5em; }
.ln.red { background: #000; color: transparent; user-select: none; box-shadow: inset 0 0 0 1px #3a3f4b; }
.vbody figure { margin: 0; }
.vbody img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.vbody figcaption { margin-top: 8px; color: var(--mu); }
.vbody.withheld img { filter: grayscale(1) brightness(0.3); }
.empty { display: none; padding: 24px 16px; color: var(--mu); }

.mbody .ln { min-height: 0; }
.del .ln { display: contents; }
.del .ln.cf { display: flex; grid-column: 1 / -1; grid-row: 3; }
.del .ln.red { display: block; grid-column: 1 / -1; grid-row: 2; }
.mbody h3 { margin: 4px 0 2px; font: 700 22px/1.25 var(--sans); letter-spacing: -0.01em; }
.mbody .one { margin: 0 0 14px; color: var(--mu); }
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-bottom: 16px; }
.segs i { height: 6px; border-radius: 3px; background: #2a2e37; }
.segs i.on { background: var(--am); }
.dels { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.del { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; border-radius: 18px; padding: 16px; border: 1px solid var(--line); background: var(--card2); }
.del .mk { grid-column: 2; grid-row: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed #4a505c; }
.del.done { border-color: rgba(246, 166, 35, 0.55); background: linear-gradient(180deg, #1e1a10, #15171c); }
.del.done .mk { background: var(--am); border: 0; color: var(--ink); font-weight: 700; font-size: 16px; }
.del .tm { grid-column: 1; grid-row: 1; font-size: 22px; font-weight: 700; letter-spacing: 0.04em; white-space: pre; }
.del.done .tm { color: var(--am); }
.del .pl { grid-column: 1 / -1; grid-row: 2; font-size: 17px; font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; }
.del .cf { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 10px; white-space: pre; }
.del .cl { color: var(--mu); font-size: 14px; }
.del .wd { font-size: 16px; font-weight: 700; letter-spacing: 0.1em; padding: 8px 14px; border-radius: 10px; color: #8b919c; border: 1.5px dashed #4a505c; font-weight: 400; }
.del.done .wd { background: var(--amd); color: var(--am); border: 1px solid rgba(246, 166, 35, 0.45); font-weight: 700; }
.mbody .closedline { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--amd); color: var(--am); font-weight: 600; }
.mbody .due { margin: 18px 4px 0; color: var(--mu); text-align: center; font-size: 15px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(14, 15, 19, 0.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); max-width: 1100px; margin: 0 auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabs button { min-height: 60px; background: none; color: var(--mu); border: 0; border-radius: 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600; padding: 4px; }
.tabs button::before { content: ''; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.tabs button[data-tab=files] { --ic: var(--i-files); }
.tabs button[data-tab=search] { --ic: var(--i-search); }
.tabs button[data-tab=images] { --ic: var(--i-image); }
.tabs button[data-tab=logout] { --ic: var(--i-out); }
.tabs button:hover { background: var(--card2); color: var(--tx); }
.tabs button small { font-size: 11px; font-weight: 400; color: var(--rd); min-height: 1em; margin-top: -2px; }
.tabs button[aria-disabled=true] { color: #737a86; cursor: not-allowed; }
.tabs button[aria-disabled=true] span { text-decoration: line-through; }
.tabs button[data-tab=logout] { color: var(--am); }

.khead { font-size: 22px !important; letter-spacing: 0.04em; }
.ksub { font-weight: 700; }
.big { font-size: 22px; font-weight: 700; }
.log { background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.log p { margin: 0 0 10px; }
#code { letter-spacing: 0.12em; font-size: 18px; font-family: var(--mono); color: var(--am); }

#wag-stage { display: flex; justify-content: center; margin: 8px 0 0; pointer-events: none; }
#wag-stage video, #wag-stage img { width: min(100%, 260px); aspect-ratio: 1 / 1; border-radius: 22px; border: 1px solid var(--line); object-fit: cover; background: #000; }
body.plain #wag-stage { display: none; }

.fiction { color: var(--mu); font-size: 13px; text-align: center; padding: 16px 16px 96px; max-width: 760px; margin: 0 auto; }
.fiction p { margin: 4px 0; }
.noscript { color: var(--tx); text-align: center; padding: 16px; }

body.plain { font-family: var(--sans); font-size: 18px; line-height: 1.6; }
body.plain .vbody pre, body.plain .net { font-family: var(--sans); }
body.plain .vbody pre { white-space: pre-wrap; font-size: 18px; }

.plainpage .sheet { background: var(--card); border: 1px solid var(--line); border-radius: 18px; max-width: 560px; margin: 32px 16px; padding: 24px 20px; }
@media (min-width: 600px) { .plainpage .sheet { margin: 32px auto; } }
.plainpage .sheet h1 { font-size: 20px; }
.plainpage form { margin: 16px 0; }

:root {
  --i-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l5 5v13H6z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E");
  --i-folder: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h6l2 2h10v11H3z'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
  --i-files: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h8l4 4v10H7z'/%3E%3Cpath d='M4 7v14h11'/%3E%3C/svg%3E");
  --i-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='1.7'/%3E%3Cpath d='M4 18l5-5 4 4 3-3 4 4'/%3E%3C/svg%3E");
  --i-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H5v16h5'/%3E%3Cpath d='M14 8l5 4-5 4'/%3E%3Cpath d='M19 12H9'/%3E%3C/svg%3E");
}

@media (min-width: 900px) {
  .screen { padding-top: 24px; }
  .card { max-width: 560px; margin: 32px auto; padding: 28px; }
  .desk { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
  .desk .viewer[hidden] ~ .empty { display: block; }
  .vhead #back { display: none; }
  .viewer { position: sticky; top: var(--bar, 180px); align-self: start; max-height: calc(100vh - var(--bar, 180px) - 100px); overflow-y: auto; }
  .net { max-height: 7em; }
}
@media (max-width: 899px) {
  .desk.reading .tree { display: none; }
}
@media (max-width: 480px) {
  .net { max-height: 6.2em; padding: 6px 12px; }
  .count { padding: 10px 14px; }
  .stage { padding: 5px 10px; }
  .stage .sn { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .thumbs { padding: 8px 12px 12px; }
  .row { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.eyes-mark { width: 24px; height: 12px; }
.eyes-trail { position: fixed; left: 0; top: 0; width: 24px; height: 12px; pointer-events: none; z-index: 50; }
