:root {
  --bg: #0c0f14; --panel: #151a22; --line: #252c38; --text: #e8edf4; --mute: #8a95a8;
  --acc: #3d7bff; --acc2: #6a5cff; --ok: #2fbf71; --bad: #e5484d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #1c2230; border-radius: 10px; padding: 9px 14px; }
button:hover { border-color: #3a4456; }
button.primary { background: linear-gradient(135deg, var(--acc), var(--acc2)); border: 0; font-weight: 600; width: 100%; margin-top: 16px; padding: 12px; }
button.danger { background: var(--bad); border: 0; }
button.ghost { background: transparent; }
button.link { background: none; border: 0; color: var(--mute); padding: 6px 0; text-decoration: underline; }
input, select { width: 100%; background: #0f131a; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
input:focus { border-color: var(--acc); }
label { display: block; color: var(--mute); font-size: 13px; margin: 14px 0 6px; }

.home { min-height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; }
.brand { font-size: 20px; letter-spacing: .3px; }
.brand b { color: var(--acc); }
.brand span { color: var(--mute); font-weight: 300; }
.net { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: #1c2230; }
.net.on { color: var(--ok); } .net.off { color: var(--bad); }
.cards { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 420px)); gap: 20px; justify-content: center; align-content: start; padding: 12px 16px 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.hint { color: var(--mute); margin: 0; font-size: 13px; }
.big { font-size: 28px; font-weight: 600; letter-spacing: 2px; user-select: all; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.perm { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.perm summary { cursor: pointer; color: var(--mute); }
.perm .row { margin-top: 8px; }
.sessions:not(:empty) { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sess { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
.status { min-height: 22px; margin-top: 12px; color: var(--mute); font-size: 14px; }
.status.err { color: var(--bad); }
.foot { text-align: center; color: var(--mute); font-size: 12px; padding: 12px 16px 20px; }

.view { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar select { width: auto; padding: 6px 8px; }
.bar button { padding: 6px 12px; }
.peer { font-weight: 600; margin-right: 6px; }
.stats { color: var(--mute); font-size: 12px; margin-left: auto; }
.work { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; overflow: hidden; }
.stage.drop { outline: 3px dashed var(--acc); outline-offset: -6px; }
.drawer { width: 300px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 0; }
.drawer.wide { width: 380px; }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead button { padding: 2px 8px; }
.chatlog { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.msg { align-self: flex-start; background: #1f2633; border-radius: 12px 12px 12px 4px; padding: 6px 10px; max-width: 85%; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: #24407a; border-radius: 12px 12px 4px 12px; }
.badge { position: relative; }
.badge::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.fsnav button { padding: 4px 10px; }
.fspath { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; flex: 1; }
.fslist { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; min-height: 120px; }
.fsrow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid #1c222d; cursor: default; }
.fsrow:hover { background: #1a2029; }
.fsrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsrow .sz { color: var(--mute); font-size: 12px; }
.fsrow button { padding: 3px 8px; font-size: 12px; }
.tr { font-size: 12px; margin-top: 6px; }
.trn { display: flex; justify-content: space-between; gap: 6px; }
.trn span { color: var(--mute); }
.bar2 { height: 4px; background: #222a36; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar2 i { display: block; height: 100%; background: var(--acc); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a3242; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; max-width: min(90vw, 520px); z-index: 10; }
.chk { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 13px; margin-top: 16px; }
.chk input { width: auto; margin-top: 2px; }
.svc { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.brand.small { font-size: 15px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pcard.ask { border-color: var(--acc); box-shadow: 0 0 0 3px #3d7bff33; }
.pcard .row { justify-content: space-between; }
.ptitle { font-weight: 600; }
.pcard small { color: var(--mute); font-weight: 400; }
.pbtns button { flex: 1; }
button.ok { background: var(--ok); border: 0; font-weight: 600; }
.plog { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pchat input { padding: 8px 10px; }
.hint.err { color: var(--bad); }
@media (max-width: 700px) { .drawer, .drawer.wide { position: absolute; right: 0; top: 0; bottom: 0; width: min(92vw, 380px); z-index: 5; } .work { position: relative; } }
video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: default; outline: none; }
.wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); pointer-events: none; }
@media (max-width: 600px) { .big { font-size: 24px; } .top { padding: 14px 16px; } }
