:root {
  --bg: #0b1020; --panel: #131a2e; --panel2: #1b2440; --line: #26314f;
  --text: #e6ebf5; --muted: #8a96b3; --accent: #3b82f6; --danger: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: #fca5a5; min-height: 1.2em; margin: 0; }
button, select, input, textarea { font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 6px; }
button, select { padding: 5px 10px; cursor: pointer; white-space: nowrap; }
button:hover, select:hover { border-color: #3b4a75; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: #fca5a5; }
button.on { background: #1e3a8a; border-color: var(--accent); }
input, textarea { padding: 7px 9px; }

/* login */
#login { height: 100%; display: grid; place-items: center; }
.card { width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.card h1 { margin: 0; font-size: 22px; }
.card p { margin: 0; }
.logo { font-size: 40px; color: var(--accent); line-height: 1; }
.card button { padding: 9px; }

/* main */
#main { height: 100%; display: flex; flex-direction: column; }
#bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; z-index: 5; }
#bar .brand { color: var(--accent); margin-right: 4px; }
#bar .brand b { color: var(--text); }
.spacer { flex: 1; }
#stats { font-variant-numeric: tabular-nums; font-size: 12px; }
:fullscreen #bar { position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%);
  transition: transform .15s; border: 1px solid var(--line); border-radius: 0 0 10px 10px; }
:fullscreen #bar:hover, :fullscreen #bar.peek { transform: translate(-50%, 0); }

.menuwrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px; display: flex; flex-direction: column; min-width: 210px; z-index: 20;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.menu.right { left: auto; right: 0; }
.menu button { text-align: left; border: 0; background: transparent; }
.menu button:hover { background: var(--panel2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

#stage { flex: 1; position: relative; overflow: hidden; display: grid; place-items: center; background: #000; }
#stage.actual { overflow: auto; place-items: start; }
#screen { display: block; outline: none; image-rendering: auto; cursor: default; touch-action: none; }
#overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,8,18,.7); }
#overlayMsg { background: var(--panel); padding: 14px 20px; border-radius: 10px; border: 1px solid var(--line); }
#dropHint { position: absolute; inset: 12px; border: 3px dashed var(--accent); border-radius: 14px;
  display: grid; place-items: center; font-size: 18px; background: rgba(59,130,246,.12); pointer-events: none; }
#mobileKb { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* panels */
.panel { position: absolute; top: 48px; right: 8px; bottom: 8px; width: 340px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column;
  gap: 8px; z-index: 10; box-shadow: 0 10px 40px rgba(0,0,0,.55); }
.panel.wide { width: min(720px, calc(100vw - 16px)); }
.phead { display: flex; justify-content: space-between; align-items: center; }
.phead button { border: 0; background: transparent; }
.row { display: flex; align-items: center; gap: 6px; }
.row.gap > input { flex: 1; min-width: 0; }
#clipText { flex: 1; resize: none; }
#fsList { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.fsrow { display: grid; grid-template-columns: 24px 1fr 90px 70px; gap: 6px; align-items: center;
  padding: 5px 8px; border-bottom: 1px solid #1a2240; cursor: pointer; }
.fsrow:hover { background: var(--panel2); }
.fsrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsrow .sz { text-align: right; color: var(--muted); font-size: 12px; }
.fsrow .act { display: flex; gap: 2px; justify-content: flex-end; opacity: .0; }
.fsrow:hover .act { opacity: 1; }
.fsrow .act button { padding: 0 5px; border: 0; background: transparent; }
.fshead { padding: 6px 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
#fsList.drag { outline: 2px dashed var(--accent); outline-offset: -4px; }
#term { flex: 1; min-height: 0; background: #0c0c0c; border-radius: 6px; padding: 4px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 90vw; }

@media (max-width: 700px) {
  #bar select { max-width: 110px; }
  .panel, .panel.wide { left: 6px; right: 6px; width: auto; }
}
