/* Same tokens and console layout as the sengaseisyo server console. */
:root { color-scheme:light dark; --bg:light-dark(#fff,#191b23); --side:light-dark(#f6f5f9,#16171e); --fg:light-dark(#292535,#eae6f0); --muted:light-dark(#746b80,#b5aabd); --line:light-dark(#e6e1eb,#413b49); --accent:light-dark(#72508d,#c7a4e8); --accent-bg:light-dark(#f0eaf7,#382b43); --red:light-dark(#b53640,#ff9a9c); --red-bg:light-dark(#fff0f0,#492b31); --blue:light-dark(#285ec1,#a1c3ff); --blue-bg:light-dark(#eaf1ff,#243751); --amber:light-dark(#866322,#e4c37e); --amber-bg:light-dark(#f8f0df,#403725); --green:light-dark(#2f7a45,#8fd6a4); --green-bg:light-dark(#e8f5ec,#1f3a29); }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:14px/1.6 system-ui,"Yu Gothic UI","Hiragino Sans",sans-serif; }
[hidden] { display:none!important; }
a { color:var(--accent); }
button,input,select,textarea { font:inherit; color:inherit; }
button { cursor:pointer; border:1px solid var(--line); border-radius:5px; padding:6px 12px; background:var(--bg); max-width:100%; }
button:hover { background:var(--side); } button:disabled { cursor:default; opacity:.5; }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
input,select,textarea { padding:8px; border:1px solid var(--line); background:var(--bg); border-radius:5px; min-width:0; max-width:100%; }
label { display:grid; gap:5px; margin:12px 0; } input:not([type=checkbox]):not([type=radio]),select,textarea { width:100%; } textarea { resize:vertical; }
label.check,label.choice { display:flex; gap:8px; align-items:center; margin:8px 0; }
h1 { font-size:25px; font-weight:600; margin:22px 0 4px; } h2 { font-size:15px; font-weight:600; margin:0 0 12px; } h3 { font-size:13px; font-weight:600; margin:22px 0 8px; }
p { margin:0; } .muted,.heading p { color:var(--muted); font-size:12px; }
.link { border:0; padding:3px 0; color:var(--accent); background:transparent; text-decoration:none; cursor:pointer; }
.primary { background:var(--accent); color:var(--bg); border-color:var(--accent); font-weight:600; } .primary:hover { background:var(--accent); filter:brightness(.95); }
.danger { color:var(--red); border-color:var(--red); }
#console { display:grid; grid-template-columns:200px minmax(0,1fr); min-height:100vh; }
aside { background:var(--side); border-right:1px solid var(--line); padding:25px 14px; display:flex; flex-direction:column; }
.brand { padding:0 9px 28px; font-size:18px; font-weight:600; letter-spacing:.06em; }
.brand small { display:block; font-size:10px; letter-spacing:.12em; font-weight:400; color:var(--muted); }
aside nav { display:grid; gap:5px; } aside nav a { display:block; padding:11px; color:inherit; text-decoration:none; border-radius:5px; }
aside nav a:hover { background:var(--bg); } aside nav a[aria-current=page] { background:var(--accent-bg); color:var(--accent); font-weight:600; }
.worker-card { margin:28px 4px 0; padding:10px; border:1px solid var(--line); border-radius:6px; font-size:12px; display:flex; gap:8px; align-items:flex-start; background:var(--bg); }
.worker-card .dot { flex:none; width:8px; height:8px; margin-top:6px; border-radius:50%; background:var(--muted); }
.worker-card.online .dot { background:var(--green); } .worker-card.busy .dot { background:var(--blue); } .worker-card.offline .dot { background:var(--red); }
.nav-footer { margin-top:28px; font-size:11px; color:var(--muted); display:grid; gap:8px; justify-items:start; overflow-wrap:anywhere; }
main { min-width:0; padding:20px 32px 40px; max-width:1500px; width:100%; }
header,.heading { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
header { padding-bottom:15px; border-bottom:1px solid var(--line); color:var(--muted); font-size:12px; }
.heading { margin-bottom:22px; } .heading h1 { margin-bottom:4px; }
#notice:not(:empty) { padding:10px 12px; background:var(--side); margin:12px 0; border-radius:4px; font-size:13px; }
#notice.error:not(:empty) { background:var(--red-bg); }
.error { color:var(--red); } .error:empty { display:none; }
.row { display:flex; gap:14px; flex-wrap:wrap; } .row>* { flex:1 1 160px; min-width:0; }
.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.empty { color:var(--muted); padding:30px 15px; background:var(--side); text-align:center; border-radius:4px; }
.split { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr); gap:32px; align-items:start; }

/* new job */
.steps { display:grid; gap:28px; }
.step h2 { display:flex; align-items:center; gap:10px; font-size:16px; }
.num { display:inline-grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--accent); color:var(--bg); font-size:13px; }
.filter-row { max-width:420px; }
.material-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr)); gap:14px; margin:10px 0; }
.material { display:grid; gap:6px; text-align:left; padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--bg); }
.material:hover { border-color:var(--accent); }
.material[aria-pressed=true] { border:2px solid var(--accent); background:var(--accent-bg); padding:7px; }
.material .thumb { width:100%; aspect-ratio:16/9; object-fit:contain; background:#fff; border-radius:3px; border:1px solid var(--line); }
.material .thumb.none { display:grid; place-items:center; color:var(--muted); font-size:12px; background:var(--side); }
.material strong { font-size:13px; overflow-wrap:anywhere; } .material span { font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.selected-material { display:flex; gap:12px; align-items:center; padding:10px; background:var(--side); border-radius:6px; margin-bottom:6px; }
.selected-material img { width:120px; aspect-ratio:16/9; object-fit:contain; background:#fff; border-radius:3px; }
fieldset.gpu { border:1px solid var(--line); border-radius:5px; margin:12px 0; padding:4px 12px; display:flex; gap:16px; flex-wrap:wrap; align-items:center; }
fieldset.gpu legend { font-size:14px; padding:0 4px; }
details.advanced { margin:10px 0; border-top:1px solid var(--line); padding-top:10px; } details.advanced summary { cursor:pointer; font-weight:600; }
.submit-bar { position:sticky; bottom:0; background:var(--bg); border-top:1px solid var(--line); padding:12px 0; margin-top:16px; display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.submit-bar .summary { flex:1 1 300px; font-size:13px; }

/* jobs */
.job-row { display:grid; grid-template-columns:minmax(200px,1.4fr) 110px minmax(180px,1fr) 150px; gap:14px; align-items:center; padding:12px 6px; border-bottom:1px solid var(--line); color:inherit; text-decoration:none; }
.job-row:hover { background:var(--side); } .job-row .title strong { display:block; overflow-wrap:anywhere; } .job-row .title span,.job-row .when { color:var(--muted); font-size:12px; }
.status { display:inline-flex; gap:5px; align-items:center; width:max-content; padding:3px 8px; border-radius:4px; font-size:12px; background:var(--side); color:var(--muted); }
.status:before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.status.succeeded { background:var(--green-bg); color:var(--green); } .status.running { background:var(--blue-bg); color:var(--blue); }
.status.failed { background:var(--red-bg); color:var(--red); } .status.queued,.status.submitted { background:var(--amber-bg); color:var(--amber); }
.status.waiting_review { background:var(--accent-bg); color:var(--accent); }
.bar { display:grid; grid-template-columns:repeat(12,1fr); gap:2px; height:8px; margin-top:5px; }
.bar i { border-radius:2px; background:var(--line); } .bar i.succeeded { background:var(--green); } .bar i.running { background:var(--blue); animation:pulse 1.4s infinite; }
.bar i.failed { background:var(--red); } .bar i.waiting_review { background:var(--accent); } .bar i.cancelled { background:var(--muted); }
@keyframes pulse { 50% { opacity:.45; } }
.stage-text { font-size:12px; overflow-wrap:anywhere; }

/* job detail */
.back { display:inline-block; margin-top:12px; }
.job-head { display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; align-items:flex-start; margin:10px 0 18px; }
.job-head h1 { margin:6px 0; overflow-wrap:anywhere; } .job-head p { color:var(--muted); font-size:13px; }
.callout { border:1px solid var(--accent); background:var(--accent-bg); border-radius:6px; padding:12px 14px; margin:14px 0; }
.callout.bad { border-color:var(--red); background:var(--red-bg); }
.callout h2 { margin-bottom:6px; } .callout .actions { margin-top:10px; } .callout input { max-width:420px; }
.facts { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; margin:14px 0 24px; }
.fact { background:var(--side); border-radius:6px; padding:10px 12px; } .fact span { display:block; font-size:11px; color:var(--muted); } .fact strong { font-size:15px; overflow-wrap:anywhere; }
.stage-list { list-style:none; padding:0; margin:0 0 26px; border-top:1px solid var(--line); }
.stage-list li { display:grid; grid-template-columns:28px minmax(170px,1fr) 100px minmax(0,2fr) 60px; gap:10px; align-items:center; padding:9px 4px; border-bottom:1px solid var(--line); font-size:13px; }
.stage-list .idx { color:var(--muted); font-size:12px; text-align:right; } .stage-list .detail { color:var(--muted); font-size:12px; overflow-wrap:anywhere; } .stage-list .secs { color:var(--muted); font-size:12px; text-align:right; }
.key-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr)); gap:16px; margin-bottom:26px; }
.key { border:1px solid var(--line); border-radius:6px; padding:8px; } .key.bad { border-color:var(--red); }
.key .pair { display:grid; grid-template-columns:1fr 1fr; gap:6px; } .key img { width:100%; aspect-ratio:auto; background:#fff; border-radius:3px; cursor:zoom-in; border:1px solid var(--line); }
.key .meta { display:flex; justify-content:space-between; gap:8px; font-size:12px; margin-top:6px; flex-wrap:wrap; }
.key .tries { display:flex; gap:4px; flex-wrap:wrap; margin-top:6px; } .key .tries button { padding:2px 6px; font-size:11px; }
.key .tries button[aria-pressed=true] { background:var(--accent-bg); color:var(--accent); border-color:var(--accent); }
.ok { color:var(--green); } .ng { color:var(--red); }
.videos { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(360px,100%),1fr)); gap:16px; margin-bottom:26px; }
.videos figure { margin:0; } .videos video { width:100%; background:#000; border-radius:4px; } .videos figcaption { font-size:12px; color:var(--muted); }
.download { display:flex; gap:12px; align-items:center; flex-wrap:wrap; padding:12px; border:1px solid var(--line); border-radius:6px; margin-bottom:26px; }
pre.log { white-space:pre-wrap; overflow-wrap:anywhere; background:var(--side); padding:12px; max-height:420px; overflow:auto; font:12px/1.6 ui-monospace,monospace; border-radius:4px; }
dl.spec { display:grid; grid-template-columns:160px minmax(0,1fr); gap:6px 12px; font-size:13px; margin:0 0 26px; } dl.spec dt { color:var(--muted); } dl.spec dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.history { font-size:12px; color:var(--muted); } .history li { margin:3px 0; }

/* materials */
.add-tile { border:2px dashed var(--line); background:var(--side); color:var(--accent); display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:90px; margin:10px 0; }
.add-tile:hover,.add-tile.drag-over { border-color:var(--accent); background:var(--accent-bg); }
.add-symbol { font-size:30px; line-height:1; } progress { width:100%; }
table { width:100%; border-collapse:collapse; font-size:13px; } th,td { text-align:left; padding:7px 6px; border-bottom:1px solid var(--line); vertical-align:top; overflow-wrap:anywhere; } th { color:var(--muted); font-weight:500; font-size:12px; }

dialog { color:var(--fg); background:var(--bg); border:1px solid var(--line); border-radius:6px; padding:16px; }
dialog::backdrop { background:rgb(0 0 0 / .6); }
.image-viewer { width:calc(100vw - 24px); height:calc(100dvh - 24px); max-width:none; max-height:none; }
.image-viewer[open] { display:flex; flex-direction:column; gap:10px; }
.dialog-head { display:flex; justify-content:space-between; gap:12px; align-items:center; } .dialog-head h2 { margin:0; overflow-wrap:anywhere; }
.viewer-stage { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; background:var(--side); }
.viewer-stage img { max-width:100%; max-height:100%; background:#fff; }

@media(max-width:1000px) { .split { grid-template-columns:1fr; } .job-row { grid-template-columns:minmax(0,1fr) 100px; } .job-row .stage-cell,.job-row .when { grid-column:1/-1; } .stage-list li { grid-template-columns:24px minmax(0,1fr) 90px; } .stage-list .detail { grid-column:2/-1; } .stage-list .secs { display:none; } }
@media(max-width:720px) { #console { grid-template-columns:1fr; } aside { border-right:0; border-bottom:1px solid var(--line); padding:12px; } .brand { padding:0 7px 10px; } .brand small { display:inline; margin-left:12px; } aside nav { display:flex; flex-wrap:wrap; gap:3px; } aside nav a { padding:7px 10px; } .worker-card { margin:10px 0 0; } .nav-footer { display:flex; flex-wrap:wrap; gap:12px; margin-top:10px; } main { padding:12px 16px 30px; } dl.spec { grid-template-columns:1fr; } }
@media(pointer:coarse) { button { min-height:44px; } input,select,textarea { font-size:16px; } }
@media(prefers-reduced-motion:reduce) { .bar i.running { animation:none; } }
.row.images img { display:block; max-width:100%; max-height:160px; margin-top:8px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.plain-list { list-style:none; margin:0; padding:0; display:grid; gap:6px; }
#character-form label { display:block; margin-bottom:12px; }
