@font-face { font-family: "Golos"; src: url("/Golos.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
:root {
  --bg: #12141c; --panel: #1b1e2a; --panel2: #262a39; --line: #333849; --text: #f2f3f8; --dim: #a2a8bd;
  --working: #4fd98a; --thinking: #f5d04f; --waiting: #ff9838; --done: #54aeff; --error: #ff5468; --idle: #c5c9d8; --offline: #7f849a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Golos", system-ui, -apple-system, sans-serif; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: center; gap: 14px; padding: 9px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, #7cf0b0, #38b873); }
.legend { display: flex; gap: 5px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.legend::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--panel2); white-space: nowrap; font-size: 12px; color: var(--dim); }
.chip b { color: var(--text); font-weight: 600; }
.chip.zero { opacity: .55; }
.dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c, var(--idle)); }
.devices { display: flex; gap: 6px; flex-wrap: wrap; }
.dev { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--panel2); font-size: 12px; white-space: nowrap; }
.dev.off { color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.dev small { color: var(--dim); font-size: 11px; }
@media (max-width: 1700px) { .dev small { display: none; } }

.conn { padding: 7px 14px; background: var(--error); color: #2a060c; text-align: center; }

.layout { flex: 1 1 auto; display: flex; min-height: 0; }
.stage { flex: 1 1 auto; min-width: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #2c3142 0%, #161924 75%); touch-action: none; user-select: none; -webkit-user-select: none; }
#office { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#office.hit { cursor: pointer; }
#office.drag { cursor: grabbing; }
.stage.dead #office { filter: grayscale(1) brightness(.65); }
.labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.lb { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: auto; cursor: pointer; will-change: transform; white-space: nowrap; }
.lb .nm { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 999px; background: #12141ce0; font-size: 12px; font-weight: 600; box-shadow: 0 1px 4px #0006; }
.lb .nm i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.lb.codex .nm { color: #a6efe6; }
.lb.auto .nm { color: #c7d7ff; }
.lb.sel .nm { box-shadow: 0 0 0 2px var(--thinking), 0 1px 4px #0006; }
.lb .say { padding: 2px 8px; border-radius: 9px; background: #fff; color: #1b1e2a; font-size: 11px; font-weight: 600; box-shadow: 0 1px 4px #0005; }
.lb .say.waiting { background: var(--waiting); color: #2b1400; animation: pulse 1.1s ease-in-out infinite; }
.lb .say.error { background: var(--error); color: #fff; }
.lb .say.offline { background: var(--offline); color: #fff; }
.lb .say.nap { background: #ffffffd0; }
@keyframes pulse { 50% { transform: scale(1.09); } }
.room-tag { position: absolute; left: 0; top: 0; padding: 1px 8px; border-radius: 6px; background: #12141c99; color: #e7e9f2; font-size: 11px; font-weight: 600; letter-spacing: .02em; will-change: transform; white-space: nowrap; }
.empty { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); padding: 14px 18px; border-radius: 12px; background: #12141ce8; text-align: center; max-width: min(90%, 440px); }
.empty small { display: block; color: var(--dim); margin-top: 6px; }
.hint { position: absolute; left: 12px; bottom: 10px; padding: 3px 9px; border-radius: 8px; background: #12141c99; color: var(--dim); font-size: 11px; transition: opacity .6s; pointer-events: none; }

.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 48%, transparent 58%, #0a0c1266 100%); }
.pad { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; border-radius: 12px; background: #12141cb8; backdrop-filter: blur(6px); }
.pad-row { display: flex; gap: 3px; }
.pad button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #2a2e3ee0; color: var(--text); font-size: 12px; line-height: 1; cursor: pointer; }
.pad button:hover { background: #3b4056; }
.pad button:focus-visible { outline: 2px solid var(--thinking); }
.only-phone { display: none; }
.only-phone-row { display: none; }
.pad.closed > :not(.only-phone-row) { display: none; }
.roster { flex: 0 0 300px; overflow-y: auto; padding: 10px; background: var(--panel); border-left: 1px solid var(--line); }
.roster h2 { margin: 10px 2px 6px; font: inherit; font-size: 12px; color: var(--dim); }
.roster h2:first-child { margin-top: 0; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; width: 100%; padding: 8px 10px; margin-bottom: 5px; border-radius: 10px; background: var(--panel2); border: 0; text-align: left; cursor: pointer; align-items: center; }
.row:hover { background: #30354a; }
.row:focus-visible, .x:focus-visible { outline: 2px solid var(--thinking); outline-offset: 1px; }
.row.sel { box-shadow: inset 0 0 0 2px var(--thinking); }
.row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .k, .k { font-size: 10px; padding: 1px 6px; border-radius: 5px; color: #12141c; font-weight: 600; }
.k.claude { background: #f0a06a; } .k.codex { background: #63d4c8; } .k.auto { background: #a9bff0; }
.row .t { grid-column: 2 / 4; font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.gone { opacity: .55; }
.none { color: var(--dim); font-size: 12px; padding: 4px 2px; }

.card { position: fixed; right: 312px; top: 62px; width: 380px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 80px); overflow-y: auto; padding: 16px; border-radius: 14px; background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 12px 32px #0009; z-index: 5; }
.card-h { display: flex; align-items: center; gap: 8px; }
.card-h h2 { margin: 0; font: inherit; font-size: 19px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.x { background: var(--panel2); border: 0; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.st { display: flex; gap: 8px; align-items: center; margin: 10px 0 2px; padding: 8px 10px; border-radius: 9px; background: var(--panel2); box-shadow: inset 3px 0 0 var(--c); }
.why { font-size: 12px; color: var(--dim); margin: 5px 0 10px; }
dl { margin: 0; display: grid; grid-template-columns: 116px 1fr; gap: 6px 8px; font-size: 13px; }
dt { color: var(--dim); } dd { margin: 0; overflow-wrap: anywhere; }
.card h3 { margin: 14px 0 6px; font: inherit; font-size: 12px; color: var(--dim); }
.acts { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.acts li { display: grid; grid-template-columns: 44px 14px 1fr; gap: 6px; padding: 4px 0; border-top: 1px solid #ffffff12; }
.acts time { color: var(--dim); }
.acts .ok { color: var(--working); } .acts .fail { color: var(--error); } .acts .run { color: var(--thinking); } .acts .wait { color: var(--waiting); }
.acts span:last-child { overflow-wrap: anywhere; }

.login-body { align-items: center; justify-content: center; }
.login { display: flex; flex-direction: column; gap: 10px; padding: 24px; width: min(340px, calc(100vw - 40px)); border-radius: 16px; background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 12px 32px #0008; }
.login label { color: var(--dim); font-size: 12px; margin-top: 6px; }
.login input { padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.login input:focus { outline: none; border-color: var(--thinking); }
.login button { padding: 10px; background: var(--working); color: #0c2a18; font-weight: 600; border: 0; border-radius: 9px; cursor: pointer; }
.login-err { min-height: 18px; color: var(--error); font-size: 13px; }

@media (max-width: 1500px) { .hint { max-width: 62%; } }
@media (max-width: 860px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  .top { gap: 8px; padding: 8px 10px; }
  .legend { order: 3; flex-basis: 100%; }
  .devices { margin-left: auto; }
  .layout { flex-direction: column; }
  .stage { flex: none; height: calc(100dvh - 118px); min-height: 420px; }
  .roster { flex: none; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .card { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; max-height: 62dvh; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .lb .nm { font-size: 10.5px; padding: 1px 6px 1px 5px; }
  .lb .say { font-size: 10px; }
  .hint { display: none; }
  .only-phone { display: block; }
  .only-phone-row { display: flex; }
  .pad button { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) { .lb .say.waiting { animation: none; } }
