:root {
  --bg: #090909;
  --bg-mid: #15101d;
  --bg-end: #101513;
  --bg-glow: rgba(139, 92, 246, 0.18);
  --panel: #151515;
  --panel-strong: #1e1e1e;
  --ink: #f8f7f4;
  --muted: #bbb7ad;
  --line: #31302c;
  --brand: #a855f7;
  --brand-strong: #7c3aed;
  --teal: #c084fc;
  --amber: #ffca3a;
  --green: #8bd450;
  --danger: #ff5a7a;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --container: 1180px;
  color-scheme: dark;
}

html[data-theme="violet"] {
  --bg: #090909;
  --bg-mid: #15101d;
  --bg-end: #101513;
  --bg-glow: rgba(139, 92, 246, 0.18);
  --panel: #151515;
  --panel-strong: #1e1e1e;
  --ink: #f8f7f4;
  --muted: #bbb7ad;
  --line: #37313d;
  --brand: #a855f7;
  --brand-strong: #7c3aed;
  --teal: #c084fc;
  --amber: #ffca3a;
  --green: #8bd450;
  --danger: #ff5a7a;
}

html[data-theme="cyberpunk"] {
  --bg: #060608;
  --bg-mid: #111023;
  --bg-end: #061b1d;
  --bg-glow: rgba(255, 43, 214, 0.18);
  --panel: #101019;
  --panel-strong: #17172b;
  --ink: #f9fbff;
  --muted: #aab8ce;
  --line: #30324d;
  --brand: #ff2bd6;
  --brand-strong: #9d4edd;
  --teal: #00f5d4;
  --amber: #f9f871;
  --green: #7cff6b;
  --danger: #ff3864;
}

html[data-theme="moderne"] {
  --bg: #0d0f12;
  --bg-mid: #141820;
  --bg-end: #101417;
  --bg-glow: rgba(59, 130, 246, 0.14);
  --panel: #171b22;
  --panel-strong: #202631;
  --ink: #f7f8fb;
  --muted: #aeb7c6;
  --line: #303745;
  --brand: #3b82f6;
  --brand-strong: #2563eb;
  --teal: #14b8a6;
  --amber: #f59e0b;
  --green: #22c55e;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--bg-glow), transparent 280px),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-mid) 45%, var(--bg-end) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 9, 9, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--teal) 50%, transparent);
  border-radius: var(--radius);
  color: var(--teal);
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--teal) 18%, transparent),
      color-mix(in srgb, var(--brand) 16%, transparent)
    );
  font-weight: 800;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.brand-copy strong,
.brand-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.topnav a {
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--muted);
}

.topnav a:hover,
.topnav a[aria-current="page"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.shell {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.summary {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-strong), var(--brand));
  font-weight: 750;
  cursor: pointer;
}

.button img,
.button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button:hover {
  filter: brightness(1.08);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-muted {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.button-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.9rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: center;
  margin: 22px 0 12px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 7px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.tab.is-active {
  color: #06110f;
  border-color: transparent;
  background: var(--teal);
}

.search-field,
.admin-login label,
.field,
.checkbox {
  display: grid;
  gap: 6px;
}

.search-field span,
.admin-login label span,
.field span,
.checkbox span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--ink);
  background: #101010;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--teal) 82%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

input[type="color"] {
  width: 52px;
  min-height: 40px;
  padding: 4px;
}

.checkbox {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stream-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.stream-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.stream-card.is-selected {
  border-color: color-mix(in srgb, var(--teal) 82%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent), 0 18px 40px rgba(0, 0, 0, 0.28);
}

.stream-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050505;
}

.stream-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.stream-thumb iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.play-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 8, 8, 0.78);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.play-button::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid currentColor;
}

.live-pill,
.forced-pill,
.preview-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--radius);
  padding: 4px 8px;
  color: #fff;
  background: rgba(8, 8, 8, 0.86);
  font-size: 0.78rem;
  font-weight: 800;
}

.preview-badges {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 120px);
}

.live-pill {
  left: 10px;
  background: #e21d3b;
}

.viewer-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--radius);
  padding: 4px 8px;
  color: #fff;
  background: rgba(8, 8, 8, 0.86);
  font-size: 0.78rem;
  font-weight: 800;
}

.forced-pill {
  color: #14110a;
  background: var(--amber);
}

.stream-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.stream-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.stream-name {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-title {
  min-height: 48px;
  margin: 0;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border: 1px solid color-mix(in srgb, var(--badge-bg) 70%, transparent);
  border-radius: var(--radius);
  padding: 4px 8px;
  color: var(--badge-text);
  background: var(--badge-bg);
  font-size: 0.78rem;
  font-weight: 800;
}

.stream-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: auto;
}

.stream-controls .button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
}

.twitch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #9146ff;
}

.twitch-button:hover {
  background: #7a32e6;
}

.language-flag,
.language-code {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.language-code {
  width: auto;
  min-width: 30px;
  padding: 0 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 800;
}

.language-fr {
  background: linear-gradient(90deg, #1c3f94 0 33.33%, #ffffff 33.33% 66.66%, #d72432 66.66%);
}

.language-en {
  background:
    linear-gradient(90deg, transparent 42%, #ffffff 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 38%, #ffffff 38% 62%, transparent 62%),
    linear-gradient(90deg, transparent 46%, #c8102e 46% 54%, transparent 54%),
    linear-gradient(0deg, transparent 44%, #c8102e 44% 56%, transparent 56%),
    #012169;
}

.language-es {
  background: linear-gradient(180deg, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%);
}

.language-de {
  background: linear-gradient(180deg, #000000 0 33.33%, #dd0000 33.33% 66.66%, #ffce00 66.66%);
}

.language-it {
  background: linear-gradient(90deg, #008c45 0 33.33%, #ffffff 33.33% 66.66%, #cd212a 66.66%);
}

.language-pt {
  background: linear-gradient(90deg, #006600 0 40%, #ff0000 40%);
}

.select-button.is-active {
  color: #06110f;
  background: var(--teal);
}

.empty-state,
.admin-login,
.admin-section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(21, 21, 21, 0.82);
}

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: min(980px, calc(100% - 32px));
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--teal) 42%, transparent);
  border-radius: var(--radius);
  background: rgba(15, 18, 17, 0.94);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.selection-bar strong,
.selection-bar span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-bar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
}

.selection-actions {
  display: flex;
  gap: 8px;
}

.multiplayer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(9, 9, 9, 0.94), rgba(9, 9, 9, 0.98)),
    #090909;
}

.multiplayer-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.multiplayer-header h2 {
  margin-bottom: 0;
}

.multiplayer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  grid-auto-rows: minmax(240px, 1fr);
  gap: 10px;
  min-height: 0;
}

.multiplayer-grid[data-layout="1"] {
  grid-template-columns: 1fr;
}

.multiplayer-grid[data-layout="2"],
.multiplayer-grid[data-layout="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.multiplayer-grid[data-layout="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.multiplayer-player {
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: #050505;
}

.multiplayer-player iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border: 0;
}

.multiplayer-player span {
  display: block;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
  font-weight: 750;
}

.empty-state {
  margin-top: 20px;
  padding: 28px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.admin-section {
  padding: 16px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.settings-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.settings-list div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.settings-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-list dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.texts-form,
.appearance-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-wide {
  grid-column: 1 / -1;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.editor-list {
  display: grid;
  gap: 10px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.5fr 72px 72px 120px 88px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.editor-row.streamer-row {
  grid-template-columns: 1fr 1fr 120px 120px 120px 1.3fr 88px;
}

.multi-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  align-items: center;
}

.multi-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.danger-button {
  border: 1px solid rgba(255, 90, 122, 0.4);
  color: #ffd7df;
  background: rgba(255, 90, 122, 0.12);
}

@media (max-width: 860px) {
  .control-band,
  .filters,
  .admin-login {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }

  .settings-list {
    grid-template-columns: 1fr;
  }

  .texts-form,
  .appearance-form {
    grid-template-columns: 1fr;
  }

  .editor-row,
  .editor-row.streamer-row {
    grid-template-columns: 1fr;
  }

  .stream-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selection-bar {
    grid-template-columns: 1fr;
  }

  .selection-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .multiplayer-header {
    align-items: stretch;
    flex-direction: column;
  }

  .multiplayer-grid,
  .multiplayer-grid[data-layout] {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .topnav {
    width: 100%;
  }

  .topnav a {
    flex: 1;
    text-align: center;
  }

  .shell {
    width: min(var(--container), calc(100% - 20px));
    padding-top: 18px;
  }

  .control-band {
    padding: 16px;
  }

  .stream-grid {
    grid-template-columns: 1fr;
  }

  .stream-controls {
    grid-template-columns: 1fr;
  }

  .selection-actions {
    grid-template-columns: 1fr;
  }

  .multiplayer {
    padding: 10px;
  }

  .multiplayer-grid {
    grid-auto-rows: minmax(220px, 45vh);
  }
}
