/* =========================================================
   Live Mod-Tool — Styles
   Dunkles, ruhiges Dashboard. Ein Akzent (Bernstein/Amber)
   für alles, was Aufmerksamkeit braucht (Gifts, Live-Status).
   Mobile-first: unten Tab-Umschalter, ab Tablet drei Spalten.
   ========================================================= */

:root {
  --bg:        #0e1014;
  --bg-2:      #161a21;
  --bg-3:      #1d222b;
  --line:      #262c37;
  --line-2:    #333b48;
  --txt:       #e7ebf1;
  --txt-dim:   #939eb0;
  --txt-faint: #626b7a;
  --accent:    #ffb020;   /* Amber — Gifts, Live */
  --accent-dim:#7a5410;
  --pink:      #ff4d6d;    /* sekundär, sparsam */
  --green:     #3ddc84;
  --radius:    10px;
  --radius-sm: 7px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-name { font-size: 15px; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--txt-faint);
  box-shadow: 0 0 0 0 rgba(61,220,132,0.5);
  transition: background .3s;
}
.dot.live {
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61,220,132,0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(61,220,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}

.conn {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}
.conn input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--txt);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--mono);
}
.conn input:focus { outline: 2px solid var(--accent-dim); outline-offset: -1px; }
.conn input[readonly] { opacity: .7; cursor: not-allowed; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: var(--accent);
  color: #1a1200;
  font-weight: 600;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
button:hover { filter: brightness(1.08); }
button:active { filter: brightness(0.95); }
button.ghost {
  background: transparent;
  color: var(--txt-dim);
  border: 1px solid var(--line-2);
  padding: 8px 10px;
}
button.ghost:hover { color: var(--txt); border-color: var(--txt-faint); filter: none; }
button.danger { background: var(--pink); color: #fff; }

/* Stat-Strip */
.stat-strip {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 2px 6px;
}
.stat-num { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--txt); }
.stat-lbl { font-size: 10px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .04em; }

/* Status-Zeile */
.statusline {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--txt-dim);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}

/* ---------- Mobile Tabs ---------- */
.mobile-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.mobile-tabs button {
  flex: 1;
  background: transparent;
  color: var(--txt-dim);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 11px;
  font-weight: 600;
}
.mobile-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.pane {
  display: none;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1;
  border-right: 1px solid var(--line);
}
.pane.active { display: flex; }
.pane:last-child { border-right: none; }

.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-wrap: wrap;
}
.pane-head h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--txt-dim);
  font-weight: 700;
}
.pane-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}
.pane-tools input[type=text], .pane-tools select {
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--txt);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}
.pane-tools input:focus, .pane-tools select:focus { outline: 2px solid var(--accent-dim); outline-offset: -1px; }
.toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--txt-dim); cursor: pointer; }

/* ---------- Chat-Stream ---------- */
.stream {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}
.row {
  display: flex;
  gap: 8px;
  padding: 5px 12px;
  align-items: flex-start;
}
.row:hover { background: var(--bg-2); }
.row.is-gift { background: rgba(255,176,32,0.07); }
.row.is-gift:hover { background: rgba(255,176,32,0.11); }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-3);
  flex-shrink: 0;
  object-fit: cover;
}
.row-body { min-width: 0; flex: 1; }
.row-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--txt);
  cursor: pointer;
}
.row-name:hover { color: var(--accent); text-decoration: underline; }
.row-uniq { color: var(--txt-faint); font-size: 11px; font-weight: 400; margin-left: 4px; }
.row-text { color: var(--txt); word-break: break-word; }
.row-gift-text { color: var(--accent); font-weight: 500; }
.gift-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,176,32,0.15);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}
.gift-badge img { width: 16px; height: 16px; }

/* ---------- Gift-Queue ---------- */
.queue {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: opacity .2s;
}
.card.handled { opacity: .45; border-left-color: var(--green); }
.card.new { animation: cardin .35s ease; }
@keyframes cardin {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.card-gift {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}
.card-gift img { width: 22px; height: 22px; }
.card-coins { color: var(--txt-faint); font-size: 11px; font-weight: 400; }
.card-note {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--txt);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 34px;
}
.card-note:focus { outline: 2px solid var(--accent-dim); outline-offset: -1px; }
.card-actions { display: flex; gap: 6px; margin-top: 7px; }
.card-actions button { padding: 5px 11px; font-size: 12px; }
.card-msgs {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--line-2);
  font-size: 12px;
  color: var(--txt-dim);
}
.card-msgs .cm { padding: 2px 0; }
.card-msgs .cm b { color: var(--txt); font-weight: 500; }

/* ---------- User-Liste ---------- */
.userlist {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.uitem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.uitem:hover { background: var(--bg-2); }
.uitem .avatar { width: 34px; height: 34px; }
.uitem-id { min-width: 0; flex: 1; }
.uitem-nick { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uitem-uniq { font-size: 11px; color: var(--txt-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uitem-metrics { display: flex; gap: 10px; flex-shrink: 0; text-align: right; }
.metric { display: flex; flex-direction: column; align-items: flex-end; }
.metric-n { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.metric-l { font-size: 9px; color: var(--txt-faint); text-transform: uppercase; }
.metric.coins .metric-n { color: var(--accent); }

/* ---------- User-Detail Overlay ---------- */
.overlay[hidden] { display: none !important; }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.sheet {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: sheetin .25s ease;
}
@keyframes sheetin { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-3); object-fit: cover; }
.sheet-id { flex: 1; min-width: 0; }
.ud-nick { font-weight: 700; font-size: 16px; }
.ud-uniq { color: var(--txt-faint); font-size: 12px; font-family: var(--mono); }
.close { margin-left: auto; }
.ud-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.ud-stat { background: var(--bg-2); padding: 10px; text-align: center; }
.ud-stat .n { font-family: var(--mono); font-size: 17px; font-weight: 700; }
.ud-stat .l { font-size: 10px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .04em; }
.ud-stat.coins .n { color: var(--accent); }
.ud-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ud-tabs button {
  flex: 1; background: transparent; color: var(--txt-dim);
  border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px; font-weight: 600;
}
.ud-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.ud-body { flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 120px; }
.ud-line { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ud-line:last-child { border: none; }
.ud-line .t { color: var(--txt-faint); font-size: 11px; font-family: var(--mono); margin-right: 8px; }
.ud-line .g { color: var(--accent); font-weight: 600; }

.empty { padding: 30px 16px; text-align: center; color: var(--txt-faint); font-size: 13px; }

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--txt-faint); }

/* =========================================================
   Desktop / Tablet: drei Spalten nebeneinander
   ========================================================= */
@media (min-width: 860px) {
  .mobile-tabs { display: none; }
  .pane { display: flex !important; }
  .pane-chat  { flex: 1.3; }
  .pane-queue { flex: 1.1; }
  .pane-users { flex: 1; }
  .overlay { align-items: center; }
  .sheet { border-radius: 16px; }
}
