:root {
  --font: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  --mono: "SF Mono", Menlo, "JetBrains Mono", Consolas, monospace;
  --win-bg: #1c1c22;
  --win-bg2: #24242c;
  --win-fg: #e7e7ec;
  --win-muted: #9a9aa6;
  --win-border: rgba(255,255,255,0.10);
  --accent: #5b9dff;
  --accent2: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #06070d; color: var(--win-fg); font-family: var(--font); font-size: 13px; }
button { font-family: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* boot */
#boot { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; z-index: 9999; transition: opacity .6s; }
#boot.out { opacity: 0; pointer-events: none; }
.boot-bar { width: 220px; height: 5px; border-radius: 3px; background: #2a2a2a; overflow: hidden; }
.boot-fill { height: 100%; width: 0; background: #e5e5e5; transition: width .4s; }
.boot-text { color: #888; font-size: 12px; }

/* desktop */
#desktop { position: fixed; inset: 0; }
#wallpaper { position: absolute; inset: 0;
  background:
    radial-gradient(1200px 700px at 15% 10%, #1e3a8a 0%, transparent 60%),
    radial-gradient(900px 600px at 85% 20%, #7c3aed 0%, transparent 55%),
    radial-gradient(800px 700px at 60% 95%, #db2777 0%, transparent 55%),
    radial-gradient(700px 500px at 5% 90%, #0e7490 0%, transparent 55%),
    #0b1020; }
#wallpaper::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"); mix-blend-mode: overlay; pointer-events: none; }

#menubar { position: absolute; top: 0; left: 0; right: 0; height: 28px; z-index: 5000; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: rgba(20,20,28,0.55); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); color: #fff; font-size: 13px; user-select: none; }
.mb-left, .mb-right { display: flex; align-items: center; gap: 16px; }
.mb-logo { font-size: 15px; color: #8ab4ff; }
.mb-app { font-weight: 700; }
.mb-item { cursor: pointer; opacity: .9; }
.mb-item:hover { opacity: 1; }
.mb-status { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mb-speed { cursor: pointer; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.12); }
.mb-clock { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #777; }
.dot.idle { background: #6b7280; }
.dot.busy { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

/* desktop icons */
#desk-icons { position: absolute; top: 44px; right: 18px; display: flex; flex-direction: column; gap: 14px; z-index: 1; }
.desk-icon { width: 84px; text-align: center; cursor: pointer; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); font-size: 11.5px; }
.desk-icon .ic { width: 52px; height: 52px; margin: 0 auto 4px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: rgba(255,255,255,0.12); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.15); }
.desk-icon:hover .ic { background: rgba(255,255,255,0.22); }

/* windows */
#windows { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.win { position: absolute; pointer-events: auto; background: var(--win-bg); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,0.08); display: flex; flex-direction: column; overflow: hidden; min-width: 320px; min-height: 200px; transform-origin: center; animation: winin .18s ease-out; }
@keyframes winin { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: scale(1) } }
.win.focused { box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,0.14); }
.win-title { height: 38px; display: flex; align-items: center; padding: 0 12px; gap: 10px; background: var(--win-bg2); border-bottom: 1px solid var(--win-border); cursor: default; user-select: none; }
.win-title .lights { display: flex; gap: 8px; }
.win-title .lights span { width: 12px; height: 12px; border-radius: 50%; display: inline-block; cursor: pointer; }
.lt-close { background: #ff5f57; } .lt-min { background: #febc2e; } .lt-max { background: #28c840; }
.win:not(.focused) .lights span { background: #4b4b55; }
.win-title .ttl { flex: 1; text-align: center; font-weight: 600; color: var(--win-fg); font-size: 13px; opacity: .9; margin-right: 48px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-body { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.win-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }

/* dock */
#dock { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; z-index: 6000; pointer-events: none; }
.dock-inner { pointer-events: auto; display: flex; gap: 6px; padding: 8px 10px; background: rgba(30,30,40,0.55); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); border: 1px solid rgba(255,255,255,0.14); border-radius: 20px; }
.dock-item { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; cursor: pointer; position: relative; transition: transform .15s; background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.1); }
.dock-item:hover { transform: translateY(-8px) scale(1.12); }
.dock-item.running::after { content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.dock-item .tip { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); padding: 4px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.dock-item:hover .tip { opacity: 1; }
.dock-sep { width: 1px; background: rgba(255,255,255,.2); margin: 6px 4px; }

/* notifications */
#notifications { position: absolute; top: 40px; right: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 7000; width: 340px; }
.notif { background: rgba(40,40,50,0.85); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; animation: notin .25s ease-out; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.notif.out { opacity: 0; transform: translateX(40px); transition: all .3s; }
@keyframes notin { from { opacity: 0; transform: translateX(40px) } to { opacity: 1; transform: none } }
.notif .av { flex: none; }
.notif b { display: block; font-size: 13px; margin-bottom: 2px; }
.notif p { margin: 0; font-size: 12px; color: #cfcfd8; line-height: 1.45; }

/* avatar */
.av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; letter-spacing: -.5px; flex: none; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 48px; height: 48px; font-size: 16px; }

/* generic app ui */
.pane { flex: 1; overflow: auto; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--win-border); background: var(--win-bg2); flex: none; }
.btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--win-fg); padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.btn:hover { background: rgba(255,255,255,.14); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.pink { background: var(--accent2); border-color: transparent; color: #fff; font-weight: 600; }
.muted { color: var(--win-muted); }
.small { font-size: 11.5px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: rgba(255,255,255,.1); }
.tag.ok { background: rgba(52,211,153,.18); color: var(--ok); }
.tag.busy { background: rgba(91,157,255,.2); color: #9cc2ff; }
.tag.review { background: rgba(251,191,36,.18); color: var(--warn); }
input.txt, textarea.txt { width: 100%; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.14); color: var(--win-fg); border-radius: 8px; padding: 9px 11px; font-family: inherit; font-size: 13px; outline: none; }
input.txt:focus, textarea.txt:focus { border-color: var(--accent); }

/* terminal */
.term { flex: 1; background: #0c0c12; color: #d6d6e0; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; padding: 10px 12px; overflow: auto; white-space: pre-wrap; word-break: break-all; cursor: text; }
.term .l { min-height: 1.55em; }
.term .prompt { color: #7dd3fc; }
.term .cmd { color: #fff; }
.term .who { color: #f9a8d4; font-weight: 700; }
.term .sys { color: #9ca3af; }
.term .ok { color: #34d399; }
.term .warn { color: #fbbf24; }
.term .err { color: #f87171; }
.term .dir { color: #93c5fd; }
.term .file { color: #c4b5fd; }
.term .hl { color: #fde68a; }
.term .think { color: #a5b4fc; font-style: italic; }
.term-in { display: flex; }
.term-in input { flex: 1; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; padding: 0; margin: 0; caret-color: #fff; }
.spinner::after { content: "⠋"; display: inline-block; animation: spin 1s steps(10) infinite; color: #7dd3fc; }
@keyframes spin { 10% {content:"⠙"} 20% {content:"⠹"} 30% {content:"⠸"} 40% {content:"⠼"} 50% {content:"⠴"} 60% {content:"⠦"} 70% {content:"⠧"} 80% {content:"⠇"} 90% {content:"⠏"} }

/* finder */
.finder { display: flex; flex: 1; overflow: hidden; }
.finder .side { width: 190px; flex: none; background: rgba(0,0,0,.25); border-right: 1px solid var(--win-border); padding: 10px 6px; overflow: auto; }
.finder .side h5 { margin: 8px 8px 4px; font-size: 10.5px; color: var(--win-muted); text-transform: uppercase; letter-spacing: .06em; }
.finder .side .si { padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder .side .si:hover, .finder .side .si.on { background: rgba(255,255,255,.1); }
.finder .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.finder .crumbs { display: flex; gap: 4px; padding: 6px 12px; font-size: 12px; color: var(--win-muted); border-bottom: 1px solid var(--win-border); overflow: auto; white-space: nowrap; }
.finder .crumbs span { cursor: pointer; } .finder .crumbs span:hover { color: #fff; }
.finder .list { flex: 1; overflow: auto; padding: 6px 0; }
.frow { display: grid; grid-template-columns: 26px 1fr 110px 80px 70px; align-items: center; gap: 8px; padding: 5px 12px; cursor: default; font-size: 12.5px; }
.frow:hover { background: rgba(255,255,255,.06); }
.frow.sel { background: rgba(91,157,255,.28); }
.frow.new { animation: newrow 1.2s; }
@keyframes newrow { 0% { background: rgba(52,211,153,.35) } 100% { background: transparent } }
.frow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .meta { color: var(--win-muted); font-size: 11.5px; }
.frow .dl { justify-self: end; }
.fhead { display: grid; grid-template-columns: 26px 1fr 110px 80px 70px; gap: 8px; padding: 4px 12px; font-size: 11px; color: var(--win-muted); border-bottom: 1px solid var(--win-border); }
.badge { background: var(--ok); color: #052; font-size: 10px; padding: 1px 6px; border-radius: 999px; font-weight: 700; margin-left: 6px; }

/* viewer */
.viewer { flex: 1; overflow: auto; padding: 22px 28px; line-height: 1.7; }
.viewer.md h1, .viewer.md h2, .viewer.md h3 { margin: 1.2em 0 .5em; line-height: 1.3; }
.viewer.md h1 { font-size: 22px; } .viewer.md h2 { font-size: 17px; border-bottom: 1px solid var(--win-border); padding-bottom: 4px; } .viewer.md h3 { font-size: 14.5px; }
.viewer.md p, .viewer.md li { font-size: 13px; }
.viewer.md code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }
.viewer.md pre { background: #0c0c12; padding: 12px; border-radius: 8px; overflow: auto; }
.viewer.md pre code { background: transparent; padding: 0; }
.viewer.md table { border-collapse: collapse; margin: 8px 0; }
.viewer.md th, .viewer.md td { border: 1px solid var(--win-border); padding: 4px 10px; font-size: 12.5px; }
.viewer.md blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 12px; color: #cbd5e1; }
.viewer pre.raw { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; margin: 0; }
.viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer.html { padding: 0; overflow: hidden; }

/* office */
.office { flex: 1; overflow: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-content: start; }
.dept { background: rgba(255,255,255,.04); border: 1px solid var(--win-border); border-radius: 12px; padding: 10px 12px; }
.dept h4 { margin: 0 0 8px; font-size: 12.5px; display: flex; justify-content: space-between; }
.dept h4 .cnt { color: var(--win-muted); font-weight: 400; }
.desks { display: flex; flex-wrap: wrap; gap: 8px; }
.desk { position: relative; width: 44px; text-align: center; cursor: pointer; }
.desk .av { margin: 0 auto; transition: transform .2s; border: 2px solid transparent; }
.desk .nm { font-size: 10px; color: var(--win-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk.busy .av { border-color: var(--ok); box-shadow: 0 0 12px rgba(52,211,153,.6); animation: bob 1s infinite; }
.desk.review .av { border-color: var(--warn); box-shadow: 0 0 12px rgba(251,191,36,.6); animation: bob 1s infinite; }
.desk.done .av { border-color: #64748b; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
.desk .bubble { position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; font-size: 10.5px; padding: 4px 8px; border-radius: 8px; white-space: nowrap; z-index: 2; box-shadow: 0 4px 14px rgba(0,0,0,.4); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.desk .bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #fff; border-bottom: 0; }
.office-head { padding: 10px 16px; border-bottom: 1px solid var(--win-border); display: flex; gap: 16px; align-items: center; font-size: 12.5px; flex: none; background: var(--win-bg2); }

/* messages */
.msgs { display: flex; flex: 1; overflow: hidden; }
.msgs .list { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; animation: winin .2s; }
.msg .body { background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px 12px; max-width: 78%; }
.msg .body b { font-size: 12px; } .msg .body .to { color: var(--win-muted); font-weight: 400; }
.msg .body p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }
.msg .t { font-size: 10.5px; color: var(--win-muted); margin-top: 3px; }
.msg.me { flex-direction: row-reverse; } .msg.me .body { background: rgba(91,157,255,.25); }
.empty { padding: 40px; text-align: center; color: var(--win-muted); }

/* monitor */
.monitor { flex: 1; overflow: auto; padding: 14px 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid var(--win-border); border-radius: 10px; padding: 10px 12px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--win-muted); }
.proc { display: grid; grid-template-columns: 30px 130px 1fr 90px 60px; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 12.5px; }
.proc .bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.proc .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }

/* chat */
.chat { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.chat .head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--win-border); background: var(--win-bg2); }
.chat .head select { background: rgba(0,0,0,.3); color: #fff; border: 1px solid var(--win-border); border-radius: 6px; padding: 4px 6px; }
.chat .log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat .in { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--win-border); }

/* welcome / hire / result */
.doc { padding: 26px 30px; overflow: auto; flex: 1; line-height: 1.7; }
.doc h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.01em; }
.doc h2 { font-size: 15px; margin: 22px 0 8px; color: #c7d2fe; }
.doc p { margin: 6px 0; font-size: 13.5px; }
.doc .lead { font-size: 15px; color: #dbe4ff; }
.doc .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.doc .card { background: rgba(255,255,255,.05); border: 1px solid var(--win-border); border-radius: 10px; padding: 12px 14px; }
.doc .card b { display: block; margin-bottom: 4px; }
.doc .card p { font-size: 12.5px; color: #cbd5e1; margin: 0; }
.doc kbd { font-family: var(--mono); background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.doc .ex { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.doc .ex button { text-align: left; }
.result-hero { display: flex; gap: 14px; margin: 10px 0 16px; }
.result-hero .stat { flex: 1; }
.result-hero .stat .v { font-size: 26px; }
.result-hero .stat .v.pink { color: var(--accent2); }
.result-hero .stat .v.green { color: var(--ok); }
.filelist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.filelist .f { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,.05); border-radius: 8px; font-size: 12.5px; }
.filelist .f .nm { flex: 1; cursor: pointer; } .filelist .f .nm:hover { text-decoration: underline; }
.cta { margin-top: 20px; padding: 16px 18px; border-radius: 12px; background: linear-gradient(135deg, rgba(91,157,255,.25), rgba(244,114,182,.25)); border: 1px solid rgba(255,255,255,.14); }
.cta b { font-size: 15px; display: block; margin-bottom: 4px; }
.cta .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.request { padding: 20px 24px; overflow: auto; flex: 1; }
.request textarea { min-height: 80px; resize: vertical; font-size: 14px; }
.request .ex { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.request .ex button { text-align: left; padding: 8px 12px; }

@media (max-width: 720px) {
  .mb-item, .mb-speed { display: none; }
  #desk-icons { display: none; }
  .win { left: 4px !important; top: 34px !important; width: calc(100vw - 8px) !important; height: calc(100vh - 110px) !important; }
  .stats { grid-template-columns: 1fr 1fr; }
  .doc .grid2 { grid-template-columns: 1fr; }
  .finder .side { display: none; }
  .frow, .fhead { grid-template-columns: 26px 1fr 70px; }
  .frow .meta:nth-child(4), .fhead span:nth-child(4), .frow .meta:nth-child(3), .fhead span:nth-child(3) { display: none; }
}
