:root {
  --bg: #0f1115; --panel: #171a21; --line: #262b36; --text: #e8eaf0; --muted: #8b93a7;
  --accent: #e5484d; --accent-2: #ff6369; --ok: #30a46c; --warn: #f5a524;
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- Bağlanma ekranı ---- */
.home { max-width: 420px; margin: 0 auto; padding: 48px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.brand h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.card input:not([type=checkbox]) { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: none; }
#deviceId { font-size: 22px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.card input:focus { border-color: var(--accent); }
.card .check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.card button[type=submit] { margin-top: 10px; background: var(--accent); border: 0; border-radius: 10px; padding: 13px; font-weight: 600; cursor: pointer; }
.card button[type=submit]:hover { background: var(--accent-2); }
.card button[disabled] { opacity: .6; cursor: wait; }
.status { min-height: 1.2em; margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.status.err { color: var(--accent-2); }
.recent h2 { font-size: 14px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.recent li:first-child { border-top: 0; }
.recent li .id { font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.recent li .nm { color: var(--muted); font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent li .x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.brand .acct { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); cursor: pointer; font: inherit; font-size: 13px; }
.link:hover { text-decoration: underline; }
.recent h2 { display: flex; align-items: center; }
.recent h2 .link { margin-left: auto; }
.recent li .st { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.recent li .st.on { background: #3fb950; }
.recent li .x.fav { color: var(--accent-2); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.history summary { list-style: none; cursor: pointer; }
.history summary::-webkit-details-marker { display: none; }
.history summary h2::after { content: ' ▾'; }
.history[open] summary h2::after { content: ' ▴'; }
.history li { cursor: default; flex-wrap: wrap; }
.history li .when { color: var(--muted); font-size: 12px; width: 100%; }
.foot { text-align: center; color: var(--muted); font-size: 13px; }
.credit { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }
.credit a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.credit a:hover { color: var(--accent-2); border-color: var(--accent-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--accent); }

/* ---- Oturum ekranı ---- */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.toolbar > * { flex-shrink: 0; }
.toolbar button, .toolbar select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; min-height: 34px; }
.toolbar button:hover { border-color: var(--muted); }
.toolbar .danger { background: var(--accent); border-color: var(--accent); }
.peer { font-weight: 600; margin-right: 4px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.menu { position: relative; }
.menu-pop { position: fixed; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.menu-pop button { text-align: left; }
.workspace { flex: 1; display: flex; min-height: 0; position: relative; }
.stage { position: relative; flex: 1; overflow: hidden; outline: none; touch-action: none; display: flex; align-items: center; justify-content: center; }
.stage video { width: 100%; height: 100%; object-fit: contain; cursor: default; user-select: none; -webkit-user-select: none; }
.stage.actual { overflow: auto; display: block; touch-action: pan-x pan-y; }
.stage.actual video { width: auto; height: auto; max-width: none; object-fit: none; }
.drop { position: absolute; inset: 16px; border: 3px dashed var(--accent); border-radius: 16px; display: grid; place-items: center; background: rgb(0 0 0 / .6); font-size: 18px; pointer-events: none; }
.oskb { position: fixed; left: -1000px; bottom: 0; width: 10px; height: 10px; opacity: 0; }
.toasts { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 30; max-width: calc(100vw - 24px); }
.toast { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; box-shadow: 0 6px 24px rgb(0 0 0 / .4); }
.toast progress { width: 100%; accent-color: var(--accent); }
.downloads h2 { font-size: 14px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
.downloads .ver { color: var(--text); font-variant-numeric: tabular-nums; }
.dl-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.dl-list a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; background: var(--bg); }
.dl-list a:hover { border-color: var(--accent); }
.dl-list a.mine { border-color: var(--accent); }
.dl-list small { color: var(--muted); font-size: 12px; }

/* ---- Uzak imleç, rozet ---- */
.rcursor { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .5)); transition: transform 50ms linear; }
.toolbar button { position: relative; }
.badge { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }

/* ---- Yan panel: dosyalar / sohbet ---- */
.panel { width: 340px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.panel-head button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px 8px; }
.files, .chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.fbar { display: flex; gap: 6px; padding: 8px; }
.fbar input, .fbar select, .fbar button, .factions button, .chatform input, .chatform button {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.fbar input { flex: 1; font-size: 13px; }
.fbar button, .factions button, .chatform button { cursor: pointer; }
.flist { list-style: none; margin: 0; padding: 0 4px; overflow-y: auto; flex: 1; font-size: 14px; }
.flist li { display: flex; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.flist li:hover { background: var(--bg); }
.flist .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flist .sz { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.flist .msg { color: var(--muted); cursor: default; }
.factions { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.factions button:first-child { flex: 1; }
.chatlog { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.chatlog .m { max-width: 85%; padding: 7px 10px; border-radius: 10px; background: var(--bg); align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.chatlog .m.me { align-self: flex-end; background: var(--accent); }
.chatlog .m.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; }
.chatform { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chatform input { flex: 1; }
@media (max-width: 720px) {
  .panel { position: absolute; inset: 0; width: auto; z-index: 15; border-left: 0; }
}
