@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/BarlowCondensed-800i.woff2') format('woff2');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/BarlowCondensed-700i.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('fonts/BarlowSemiCondensed-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('fonts/BarlowSemiCondensed-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('fonts/BarlowSemiCondensed-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('fonts/BarlowSemiCondensed-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0a0f18;
  --panel: #0f1622;
  --card: #141d2c;
  --card-hover: #1a2638;
  --line: #22304a;
  --text: #e8eef8;
  --muted: #8a9ab3;
  --navy: #183a72;
  --blue: #2a5ea8;
  --sky: #5b9be8;
  --ice: #8fc0ff;
  --live: #ff4655;
  --radius: 14px;
  --radius-sm: 10px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow Semi Condensed', 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(24, 58, 114, 0.55), rgba(10, 15, 24, 0) 60%), var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { display: block; border-radius: 10px; }
.brand-text { display: flex; align-items: baseline; gap: 8px; font-family: var(--display); font-style: italic; font-weight: 800; text-transform: uppercase; line-height: 1; }
.brand-name { font-size: 28px; letter-spacing: 0.01em; }
.brand-sub { font-size: 28px; color: var(--ice); }

.stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chip b { font-weight: 800; color: #fff; }
.chip-live { border-color: rgba(255, 70, 85, 0.45); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.2); }

.updated { color: var(--muted); font-size: 13px; margin-left: 4px; }

.actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--card-hover); border-color: var(--blue); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.on { background: var(--blue); border-color: var(--sky); }
.btn-primary { background: var(--blue); border-color: var(--sky); padding: 10px 18px; }
.btn-primary:hover:not(:disabled) { background: var(--sky); }

.shell { flex: 1; min-height: 0; display: flex; }

.side {
  width: 370px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.side-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; }

.input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--sky); }

.tabs { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--blue); color: #fff; }

.list:empty { display: none; }
.list { list-style: none; margin: 0; padding: 0 10px 12px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

.card {
  display: grid;
  grid-template-columns: 48px 1fr 36px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-top: 6px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.card:hover { background: var(--card-hover); }
.card.selected, .card.selected:hover { border-color: rgba(255, 255, 255, 0.3); background: #1e2a3d; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 20px;
  color: var(--ice);
  overflow: hidden;
}

.meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name { font-weight: 700; font-size: 18px; color: #fff; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewers { margin-left: auto; flex-shrink: 0; font-size: 14px; font-weight: 600; color: #c9d5e8; display: inline-flex; align-items: center; gap: 5px; }
.viewers::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.char { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; color: var(--ice); }
.char span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { flex-shrink: 0; padding: 1px 7px; border-radius: 6px; background: rgba(91, 155, 232, 0.18); border: 1px solid rgba(91, 155, 232, 0.4); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ice); }
.title { font-size: 14px; color: #b4c2d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.add {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.card:hover .add { border-color: var(--blue); }
.card.selected .add { background: #fff; border-color: #fff; color: #0a0f18; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 19px; }
.add:disabled { opacity: 0.35; cursor: default; }

.list-empty, .notice { margin: 8px 14px 14px; padding: 14px; border-radius: var(--radius); background: var(--card); color: var(--muted); text-align: center; font-family: var(--display); font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.notice { border: 1px solid rgba(255, 70, 85, 0.4); color: #ffb3b9; }

.stage { flex: 1; min-width: 0; min-height: 0; position: relative; padding: 12px; display: flex; align-items: center; justify-content: center; }

.grid { display: grid; gap: 10px; justify-content: center; align-content: center; }

.tile { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); }
.tile iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.tile-bar {
  position: absolute;
  top: 8px;
  left: 44px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.tile:hover .tile-bar, .tile.offline .tile-bar { opacity: 1; }
.tile-slot { position: absolute; top: 8px; left: 8px; width: 30px; height: 30px; border-radius: 8px; background: #fff; border: 2px solid #0a0f18; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 17px; color: #0a0f18; pointer-events: none; }
.tile-name { padding: 4px 10px; border-radius: 8px; background: rgba(10, 15, 24, 0.85); font-family: var(--display); font-style: italic; font-weight: 700; text-transform: uppercase; font-size: 14px; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-off { padding: 4px 8px; border-radius: 8px; background: rgba(255, 70, 85, 0.85); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.tile-btn { pointer-events: auto; margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(10, 15, 24, 0.85); cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: background-color 0.15s; }
.tile-btn + .tile-btn { margin-left: 0; }
.tile-btn:hover { background: var(--blue); }

.stage-empty { position: absolute; inset: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; border-radius: var(--radius); border: 1px dashed var(--line); background: radial-gradient(ellipse at center, rgba(24, 58, 114, 0.35), transparent 70%); }
.stage-empty h2 { margin: 0; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 40px; text-transform: uppercase; letter-spacing: 0.01em; }

.chat { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.chat[hidden] { display: none; }
.chat-head { padding: 12px; }
.chat iframe { flex: 1; width: calc(100% - 24px); margin: 0 12px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #18181b; }

@media (max-width: 1100px) {
  .chat { width: 300px; }
  .side { width: 330px; }
}

@media (max-width: 860px) {
  body { overflow: auto; height: auto; }
  .top { padding: 10px 16px; gap: 10px; }
  .brand-name, .brand-sub { font-size: 24px; }
  .actions { margin-left: 0; width: 100%; }
  .actions .btn { flex: 1; }
  .shell { flex-direction: column; }
  .stage { order: 1; padding: 12px 16px; min-height: 220px; }
  .side { order: 3; width: 100%; border-right: 0; border-top: 1px solid var(--line); }
  .side-head { padding: 14px 16px 10px; }
  .list { padding: 0 16px 16px; overflow: visible; }
  .chat { order: 2; width: 100%; height: 520px; border-left: 0; border-top: 1px solid var(--line); }
  .chat-head { padding: 12px 16px; }
  .chat iframe { width: calc(100% - 32px); margin: 0 16px 16px; }
  .stage-empty { position: static; width: 100%; padding: 28px 16px; }
  .stage-empty h2 { font-size: 30px; }
}
