:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #20242b;
  --text: #f2f4f8;
  --muted: #a5adba;
  --line: #303641;
  --kick: #53fc18;
  --twitch: #9146ff;
  --danger: #ff5a6a;
  --accent: #4db4ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(16,17,20,.56), rgba(16,17,20,.72)),
    var(--banner-url),
    var(--bg);
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(16,17,20,.12);
  z-index: 0;
}

header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(20,22,26,.82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo-img { width: 32px; height: 32px; object-fit: contain; }
h1 { margin: 0; font-size: 22px; }

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
}

.status { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--kick); box-shadow: 0 0 12px rgba(83,252,24,.55); }

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
  flex: 1;
  animation: fadeIn .22s ease both;
  position: relative;
  z-index: 1;
}

.panel-section, .card, .wins-card, .empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25,27,32,.62);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0,0,0,.2);
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  text-align: left;
}
.section-title h2 { margin: 0; font-size: 24px; }
.section-title p { margin: 5px 0 0; color: var(--muted); }

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
button:hover { transform: scale(1.035); border-color: var(--accent); box-shadow: 0 0 18px rgba(77,180,255,.18); background: #2a2f38; }
button:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }
button:disabled:hover { transform: none; border-color: var(--line); box-shadow: none; background: var(--panel-2); }
.move-button {
  min-width: 86px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  line-height: 1;
  font-weight: 850;
  color: #ffffff;
  background: #123047;
  border-color: var(--accent);
  text-shadow: 0 0 10px rgba(255,255,255,.42);
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}
.move-button span[aria-hidden="true"] { font-size: 22px; line-height: 1; }
.move-button:disabled {
  opacity: .62;
  color: rgba(255,255,255,.78);
  background: rgba(18,48,71,.64);
}
.move-button:hover {
  transform: scale(1.08);
  box-shadow: 0 0 18px rgba(77,180,255,.34);
  background: #17415f;
}
.queue-actions { overflow: visible; }
.tab { white-space: nowrap; background: transparent; }
.tab.active, .primary-action { background: #123047; border-color: #1e4d70; }
.subtabs { display: flex; justify-content: center; gap: 8px; margin: 0 0 16px; padding: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; background: rgba(25,27,32,.52); backdrop-filter: blur(8px); }
.subtab { min-height: 36px; }
.subtab.active { background: #123047; border-color: #1e4d70; box-shadow: 0 0 18px rgba(77,180,255,.16); }
.danger { background: #40161d; border-color: var(--danger); color: #ffdce1; }
.success { background: #123d1e; border-color: #2d8f46; }
.warning { background: #3d2f12; border-color: #caa03a; }

.grid { display: grid; gap: 12px; }
.cards { display: grid; gap: 12px; }
.card { padding: 16px; animation: rise .18s ease both; }
.row { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 14px; }
.position { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-weight: 800; }
.actions, .controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.empty { display: grid; place-items: center; min-height: 220px; color: var(--muted); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.title { font-size: 19px; font-weight: 850; }
.meta { color: var(--muted); overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 850; border: 1px solid transparent; }
.badge.everyone { color: #cbffd3; background: #123d1e; border-color: #2d8f46; }
.badge.mods { color: #ffe9ba; background: #3d2f12; border-color: #caa03a; }
.badge.streamer { color: #ffdce1; background: #40161d; border-color: #ff5a6a; }

.form-grid { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label, .field span { color: var(--muted); font-size: 13px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }

.wins-number { font-size: clamp(58px, 12vw, 132px); line-height: .9; font-weight: 900; text-align: center; }
.wins-card { display: grid; gap: 18px; padding: 22px; }
.wins-count { display: grid; place-items: center; min-height: 190px; border-radius: 8px; background: linear-gradient(145deg, rgba(77,180,255,.16), rgba(83,252,24,.08)); }
.counter-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

.toast { position: fixed; right: 16px; bottom: 20px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 8px; background: #242a32; border: 1px solid var(--line); opacity: 0; transform: translateY(10px); transition: opacity .15s ease, transform .15s ease; z-index: 100; }
.toast.visible { opacity: 1; transform: translateY(0); }

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.modal-overlay.visible { display: grid; animation: fadeIn .16s ease both; }
.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(25,27,32,.98);
  box-shadow: 0 24px 90px rgba(0,0,0,.45), 0 0 30px rgba(77,180,255,.08);
  animation: rise .18s ease both;
}
.modal h2 { margin: 0 0 16px; color: var(--accent); }
.modal-close { float: right; min-height: 34px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.login-page { display: grid; place-items: center; }
.login-card { width: min(420px, calc(100vw - 32px)); background: rgba(25,27,32,.72); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 24px; text-align: center; position: relative; z-index: 1; }
.login-logo { width: 130px; animation: levitacion 3.5s ease-in-out infinite; }
.error { color: #ff6b6b; margin-bottom: 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes levitacion { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }

@media (max-width: 780px) {
  header { grid-template-columns: 1fr; }
  .top-nav { justify-content: flex-start; }
  main { padding: 14px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .row { grid-template-columns: 48px 1fr; }
  .actions { grid-column: 1 / -1; justify-content: stretch; }
  .counter-actions { grid-template-columns: 1fr; }
}
