:root {
  --bg:          #0b0b12;
  --bg2:         #11111c;
  --bg3:         #191926;
  --bg3h:        #1e1e2d;
  --bginp:       #0d0d18;
  --border:      #252538;
  --borderl:     #2f2f48;
  --accent:      #7c3aed;
  --accenth:     #6d28d9;
  --accentbg:    rgba(124,58,237,.13);
  --green:       #10b981;
  --greenbg:     rgba(16,185,129,.13);
  --red:         #ef4444;
  --redbg:       rgba(239,68,68,.13);
  --yellow:      #f59e0b;
  --yellowbg:    rgba(245,158,11,.13);
  --text:        #e2e8f0;
  --textd:       #94a3b8;
  --textm:       #7a8a9e;
  --sidebar-w:   258px;
  --r:           10px;
  --rs:          6px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
  --trans:       .18s ease;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}



.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.logo i { color: #9147ff; font-size: 20px; }


.nav {
  padding: 10px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--rs);
  color: var(--textd);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--trans);
}
.nav-item i { width: 17px; text-align: center; font-size: 13px; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accentbg); color: #a78bfa; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  display: none;
}
.nav-badge:not(:empty) { display: inline-block; }


.streamers-section {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streamers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--textm);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.add-form {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.add-form input { flex: 1; min-width: 0; }

.sidebar-empty {
  font-size: 12px;
  color: var(--textm);
  padding: 6px 4px;
}

.streamer-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--rs);
  cursor: pointer;
  transition: background var(--trans);
  position: relative;
}
.streamer-item:hover { background: var(--bg3); }
.streamer-item.sel { background: var(--accentbg); }

.streamer-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg3);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--textd);
  border: 2px solid transparent;
  transition: border-color var(--trans);
}
.streamer-avatar.live { border-color: var(--green); }
.streamer-avatar img { width: 100%; height: 100%; object-fit: cover; }

.streamer-info { flex: 1; min-width: 0; }
.streamer-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.streamer-status {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--textm);
}
.streamer-status.live { color: var(--green); }

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.streamer-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.streamer-item:hover .streamer-actions { display: flex; }
.streamer-cfg, .streamer-del {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--textm);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 11px;
  transition: color var(--trans);
}
.streamer-cfg:hover { color: var(--accent); }
.streamer-del:hover { color: var(--red); }


.db-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.db-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  min-width: 110px;
  text-align: center;
}
.db-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.db-stat-label {
  font-size: 11px;
  color: var(--textd);
  margin-top: 3px;
}
.db-browser {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.db-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.db-tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  color: var(--textd);
  cursor: pointer;
  padding: 6px 14px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  transition: all .15s;
}
.db-tab:hover { color: var(--text); background: var(--bg2); }
.db-tab.active {
  color: var(--accent);
  background: var(--bg2);
  border-color: var(--border);
}
.db-table-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
}
.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.db-table th {
  background: var(--bg3);
  color: var(--textd);
  text-align: left;
  padding: 7px 10px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.db-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.db-table tr:hover td { background: var(--bg3h); }
.db-del-btn { font-size: 11px; color: var(--textd); }
.db-del-btn:hover { color: var(--red); }
.db-placeholder {
  padding: 40px;
  text-align: center;
  color: var(--textd);
  font-size: 14px;
}
.db-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--textd);
}


.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.conn-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--textd);
}
.conn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.conn-indicator.err .conn-dot { background: var(--red); }



.main {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.view {
  display: none;
  padding: 32px 36px;
  animation: fadein .2s ease;
}
.view.active { display: block; }

@keyframes fadein {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.view-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 3px;
}
.view-sub { font-size: 13px; color: var(--textd); }

.filters { display: flex; gap: 10px; }



.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.live-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  transition: all var(--trans);
}
.live-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.lc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.lc-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--green);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: var(--textd);
}
.lc-avatar img { width:100%; height:100%; object-fit:cover; }

.lc-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--greenbg);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge-live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}

.lc-title {
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-game { font-size: 12.5px; color: var(--accent); font-weight: 500; margin-bottom: 12px; }

.lc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--textd);
  margin-bottom: 14px;
}

.lc-actions { display: flex; gap: 8px; }



.recordings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.rec-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--trans);
}
.rec-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.rec-card.inactive { cursor: default; }
.rec-card.inactive:hover { transform: none; border-color: var(--border); box-shadow: none; }

.rec-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.rec-thumb img { width:100%; height:100%; object-fit:cover; }
.rec-thumb .nothumb { font-size: 36px; color: var(--border); }

.rec-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans);
}
.rec-card:hover .rec-overlay { background: rgba(0,0,0,.5); }
.rec-overlay i { font-size: 44px; color: #fff; opacity: 0; transition: opacity var(--trans); }
.rec-card:hover .rec-overlay i { opacity: 1; }

.rec-badge-wrap { position: absolute; top: 8px; right: 8px; }

.rec-info { padding: 13px 14px; }
.rec-title {
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.rec-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--textd);
}
.rec-game { font-size: 12px; color: var(--accent); margin-top: 4px; font-weight: 500; }
.rec-dl-row { margin-top: 8px; }
.rec-dl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500;
  color: var(--textd);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
  padding: 4px 10px;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.rec-dl-btn:hover {
  background: rgba(145,71,255,.18);
  color: var(--accent);
  border-color: rgba(145,71,255,.4);
}



.settings-content {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 24px;
}
.settings-section h2 {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 10px;
}

.badge-optional {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--greenbg);
  color: var(--green);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.info-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--accentbg);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: var(--rs);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.info-banner i {
  color: var(--accent);
  font-size: 15px;
  margin-top: 1px;
  flex-shrink: 0;
}
.info-banner strong { color: var(--text); }
.settings-section h2 i { color: var(--accent); }
.settings-desc {
  font-size: 13px; color: var(--text);
  margin-bottom: 16px; line-height: 1.6;
  opacity: .85;
}
.settings-desc a { color: var(--accent); text-decoration: none; }
.settings-desc a:hover { text-decoration: underline; }
.settings-desc code {
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; font-size: 12px;
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 13px; font-weight: 500; color: var(--text);
  margin-bottom: 6px;
}
.form-check {
  display: flex; align-items: center; gap: 9px;
  flex-direction: row;
}
.form-check label { margin: 0; cursor: pointer; }


.oauth-hint {
  margin-top: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--textd);
  line-height: 1.6;
}
.oauth-hint-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.oauth-hint-title i { color: var(--accent); }
.oauth-hint code {
  background: var(--bg2);
  border: 1px solid var(--borderl);
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-block;
  margin: 5px 0;
  word-break: break-all;
  color: #a78bfa;
}
.copyable { cursor: pointer; }
.copyable:hover { border-color: var(--accent); }

.copy-btn {
  background: var(--accentbg);
  color: var(--accent);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--rs);
  padding: 4px 10px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  margin-left: 6px;
  transition: all .15s;
}
.copy-btn:hover { background: var(--accent); color: #fff; }


.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
}
.req-item i { font-size: 16px; flex-shrink: 0; color: var(--textd); }
.req-item.ok i { color: var(--green); }
.req-item.missing i { color: var(--red); }
.req-name { font-weight: 600; margin-bottom: 2px; color: var(--text); }
.req-desc { font-size: 12px; color: var(--textd); }



input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 13px;
  background: var(--bginp);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--trans);
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--textm); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5568' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select option { background: var(--bg3); }

input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}



.btn-primary {
  background: var(--accent); color: #fff;
  border: none; padding: 9px 18px;
  border-radius: var(--rs);
  font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background var(--trans);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary:hover { background: var(--accenth); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary.btn-sm { padding: 7px 12px; font-size: 12px; }

.btn-secondary {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); padding: 9px 18px;
  border-radius: var(--rs);
  font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all var(--trans);
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.btn-danger {
  background: var(--redbg); color: var(--red);
  border: 1px solid rgba(239,68,68,.25); padding: 9px 18px;
  border-radius: var(--rs);
  font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all var(--trans);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-icon {
  background: none; border: none; color: var(--textd);
  cursor: pointer; padding: 5px 8px;
  border-radius: var(--rs); font-size: 13px;
  transition: all var(--trans);
  display: inline-flex; align-items: center;
}
.btn-icon:hover { background: var(--bg3); color: var(--text); }



.bdg {
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px;
}
.bdg-recording { background: var(--redbg);    color: var(--red);    }
.bdg-completed  { background: var(--accentbg); color: #a78bfa;       }
.bdg-converting { background: var(--yellowbg); color: var(--yellow);  }
.bdg-failed     { background: var(--redbg);    color: var(--red);    }



.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--textm);
}
.empty-state i { font-size: 44px; display: block; margin-bottom: 14px; color: var(--borderl); }
.empty-state p { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.empty-state small { font-size: 13px; color: var(--textd); }



.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(5px);
  padding: 20px;
}

.modal-box {
  background: var(--bg3);
  border: 1px solid var(--borderl);
  border-radius: var(--r);
  width: 100%; max-width: 980px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  animation: fadein .2s ease;
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; margin-bottom: 5px; }
.modal-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--textd);
}

.player-wrap { background: #000; flex-shrink: 0; }

.modal-footer {
  display: flex; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border);
}



.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 11px 16px;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: slidein .25s ease;
  min-width: 240px;
}
@keyframes slidein {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast.success { border-color: var(--green); }
.toast.success i { color: var(--green); }
.toast.error   { border-color: var(--red);   }
.toast.error i   { color: var(--red);   }
.toast.info    { border-color: var(--accent); }
.toast.info i    { color: var(--accent); }



::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--borderl); }



.live-rec-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: rgba(239,68,68,.12);
  border-bottom: 1px solid rgba(239,68,68,.25);
  font-size: 12.5px;
  color: var(--text);
  flex-shrink: 0;
}



.player-box {
  max-width: 1180px;
  height: 92vh;
}

.modal-title-wrap { flex: 1; min-width: 0; }
.modal-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }


.stream-events {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ev-timeline-hdr {
  font-size: 11px;
  color: var(--textd);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ev-timeline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ev-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--textd);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  max-width: 320px;
}
.ev-chip:hover {
  background: rgba(145,71,255,.2);
  border-color: rgba(145,71,255,.5);
  color: #fff;
}
.ev-chip i { color: var(--accent); font-size: 10px; flex-shrink: 0; }
.ev-chip-time {
  font-size: 10.5px;
  color: var(--textd);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.ev-chip-val {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-and-chat {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}


.player-wrap {
  flex: 1;
  background: #000;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  min-height: 0;
  flex: 1;
}



.chat-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  min-height: 0;
  transition: width .2s ease;
}
.chat-panel.hidden {
  width: 0;
  border-left: none;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}
.chat-header-right { display: flex; gap: 2px; }

.chat-count {
  font-size: 11.5px;
  color: var(--textd);
  font-weight: 400;
}


.chat-dl-form {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-status-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  font-size: 11.5px;
  color: var(--textd);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}


.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 4px 0;
  scroll-behavior: smooth;
}


.chat-messages::-webkit-scrollbar        { width: 5px; }
.chat-messages::-webkit-scrollbar-track  { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--textd); }

.chat-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--textd);
  font-size: 13px;
  line-height: 1.6;
}
.chat-empty i {
  font-size: 28px;
  display: block;
  margin-bottom: 10px;
  color: var(--borderl);
}
.chat-empty div { font-weight: 600; color: var(--text); margin-bottom: 5px; }


.chat-msg {
  display: grid;
  grid-template-columns: minmax(34px, max-content) max-content minmax(0, 1fr);
  grid-template-areas: "ts meta text";
  align-items: start;
  column-gap: 6px;
  row-gap: 0;
  padding: 4px 10px 4px 8px;
  font-size: 12.5px;
  line-height: 1.45;
  border-left: 2px solid transparent;
  transition: background .1s, border-color .1s;
  min-width: 0;
}
.chat-msg:hover { background: rgba(255,255,255,.035); }


.chat-msg-current {
  background: rgba(145, 71, 255, 0.10) !important;
  border-left-color: var(--accent) !important;
}

.chat-ts {
  grid-area: ts;
  font-size: 10px;
  color: var(--textd);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  cursor: pointer;
  padding: 2px 2px 0 0;
  border-radius: 3px;
  transition: color .12s, background .12s;
  white-space: nowrap;
  text-align: right;
  line-height: 1.5;
}
.chat-ts:hover {
  color: var(--accent);
  background: var(--accentbg);
}


.chat-meta {
  grid-area: meta;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.45;
}
.chat-name {
  font-weight: 700;
  font-size: 12.5px;
  max-width: min(9.5rem, 28vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}
.chat-colon {
  color: var(--textd);
  flex-shrink: 0;
  margin-right: 0;
}


.chat-text {
  grid-area: text;
  color: var(--text);
  font-size: 12.5px;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.45;
}


.chat-badge {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  border-radius: 2px;
  flex-shrink: 0;
}


.chat-emote {
  height: 22px;
  width: auto;
  vertical-align: middle;
  display: inline-block;
  margin: 0 1px;
  border-radius: 2px;
}


.chat-jump-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s;
  flex-shrink: 0;
}
.chat-jump-btn:hover { background: var(--accenth); }


.modal-footer-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.chat-sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--green);
}
.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}



.plyr--video .plyr__control--overlaid { background: var(--accent); }
.plyr--full-ui input[type=range]      { color: var(--accent); }
.plyr__menu__container                { background: var(--bg3); border: 1px solid var(--border); }


.plyr { flex: 1; min-height: 0; height: 100%; }
.plyr--video { height: 100%; }
.plyr__video-wrapper { height: 100%; }


.plyr--fullscreen-active,
.plyr:-webkit-full-screen,
.plyr:fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  z-index: 99999 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.plyr--fullscreen-active video,
.plyr--fullscreen-active .plyr__video-wrapper,
.plyr:-webkit-full-screen video,
.plyr:-webkit-full-screen .plyr__video-wrapper,
.plyr:fullscreen video,
.plyr:fullscreen .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
}


video:-webkit-full-screen { width: 100vw !important; height: 100vh !important; max-height: 100vh !important; }
video:fullscreen          { width: 100vw !important; height: 100vh !important; max-height: 100vh !important; }
