@import url("https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --bg: #070a0f;
  --panel: #0f1723;
  --panel-2: #111b2a;
  --muted: #8aa0b3;
  --text: #e9eff6;
  --accent: #fcb040;    /* тёплый янтарный из логотипа */
  --accent-2: #36cfc9;  /* холодный бирюзовый контраст */
  --border: #1c2735;
  --glow: rgba(54, 207, 201, 0.22);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Exo 2", "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(54, 207, 201, 0.12), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(252, 176, 64, 0.12), transparent 32%),
    linear-gradient(130deg, rgba(17, 26, 38, 0.9), rgba(7, 10, 15, 0.95)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 68px 68px, 68px 68px;
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

body::before,
body::after {
  content: "⚙";
  position: fixed;
  color: rgba(252, 176, 64, 0.06);
  font-size: 320px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(252, 176, 64, 0.18));
  mix-blend-mode: screen;
}
body::before {
  top: -120px;
  left: -40px;
  transform: rotate(-10deg);
}
body::after {
  bottom: -160px;
  right: -20px;
  font-size: 260px;
  color: rgba(54, 207, 201, 0.08);
  transform: rotate(18deg);
}

a { color: var(--accent-2); text-decoration: none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(12, 18, 26, 0.9), rgba(15, 21, 30, 0.8));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.topbar nav a {
  margin-left: 16px;
  padding: 8px 10px;
  border-radius: 8px;
}

.topbar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.page {
  max-width: 1100px;
  margin: 32px auto 64px;
  padding: 0 16px;
}

.hero {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(252, 176, 64, 0.16), rgba(54, 207, 201, 0.12)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.2));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08), transparent 50%);
  mix-blend-mode: overlay;
  pointer-events: none;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--accent-2);
  margin: 0 0 6px;
}

h1, h2 {
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

p { margin: 0 0 12px; color: var(--muted); }

.panel {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(18, 26, 36, 0.94), rgba(11, 17, 26, 0.94));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  background:
    radial-gradient(circle at 50% 50%, rgba(252, 176, 64, 0.08), transparent 55%),
    radial-gradient(circle at 40% 40%, rgba(54, 207, 201, 0.06), transparent 60%);
  filter: blur(2px);
  pointer-events: none;
}
.panel::after {
  content: "⚙";
  position: absolute;
  bottom: -110px;
  left: -10px;
  font-size: 200px;
  color: rgba(54, 207, 201, 0.06);
  transform: rotate(-6deg);
  pointer-events: none;
}
.panel.compact { max-width: none; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.actions-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.stream-embed {
  position: relative;
  padding-top: 56.25%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: #000;
}
.stream-embed iframe {
  position: absolute;
  inset: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(16, 24, 36, 0.96), rgba(10, 15, 22, 0.92));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(252, 176, 64, 0.08), transparent 45%);
  pointer-events: none;
}

.card-inner {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.card-main { flex: 1; }

.card-title { font-weight: 600; }
.card-meta { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }

.card-info {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 14px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-left: 8px;
  background: #f48c06;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}
.status-dot.up { background: #36cfc9; }
.status-dot.down { background: #ff6b6b; }

.team-card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 12px;
}

.team-card .team-edit-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.team-card .checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.team-card .team-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.team-card .team-delete-form {
  margin-top: 6px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #0c1a24;
}
.badge-green { background: #36cfc9; }
.badge-red { background: #ff7b7b; color: #0c1a24; }

.card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.logo-wrap {
  perspective: 900px;
}

.logo-tilt {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 30%, rgba(252, 176, 64, 0.2), rgba(54, 207, 201, 0.16)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotateY(-7deg) rotateX(5deg);
  transition: transform 350ms ease, box-shadow 350ms ease;
  animation: tiltPulse 8s ease-in-out infinite alternate;
  position: relative;
  overflow: hidden;
}

.logo-tilt img {
  width: 80%;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.logo-tilt::after,
.logo-tilt::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: no-repeat;
}

.logo-tilt::after {
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.04));
  mix-blend-mode: screen;
  opacity: 0.3;
}

.logo-tilt::before {
  background-image:
    linear-gradient(12deg, rgba(255, 255, 255, 0.45) 0 1px, transparent 1px),
    linear-gradient(-18deg, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px),
    linear-gradient(72deg, rgba(255, 255, 255, 0.4) 0 1px, transparent 1px),
    radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.25), transparent 55%);
  background-size: 140% 140%, 150% 150%, 160% 160%, 100% 100%;
  background-position: center;
  opacity: 0.5;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.25));
}

.card:hover .logo-tilt,
.logo-tilt:hover {
  transform: rotateY(14deg) rotateX(-6deg) scale(1.06);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
  animation: tiltHover 2s ease-in-out infinite alternate;
}

@keyframes tiltPulse {
  0%, 100% { transform: rotateY(-7deg) rotateX(5deg); }
  50% { transform: rotateY(7deg) rotateX(-3deg); }
}

@keyframes tiltHover {
  0% { transform: rotateY(10deg) rotateX(-4deg) scale(1.02); }
  50% { transform: rotateY(16deg) rotateX(-8deg) scale(1.08); }
  100% { transform: rotateY(12deg) rotateX(-5deg) scale(1.05); }
}

.code-row {
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 11px 15px;
  border-radius: 12px;
  font-weight: 600;
  color: #0c1a24;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
}

.btn.primary { background: var(--accent); border-color: rgba(0,0,0,0.08); box-shadow: 0 6px 18px rgba(252, 176, 64, 0.35); }
.btn.secondary { background: var(--accent-2); border-color: rgba(0,0,0,0.08); box-shadow: 0 6px 18px rgba(54, 207, 201, 0.35); }
.btn.ghost { background: rgba(255, 255, 255, 0.03); color: var(--text); border: 1px solid var(--border); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32); }

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.form-inline input, input[type="password"] {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.form-grid label { display: block; margin-bottom: 10px; }
.form-grid span { display: block; margin-bottom: 6px; color: var(--muted); }

.form-grid input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.form-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.pool-flex {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: nowrap;
  margin-top: 12px;
}

.pool-block {
  flex: 1 1 320px;
}

.pool-right {
  flex: 1 1 360px;
}

.pool-search {
  width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.filter-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-inline select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  color: var(--text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  appearance: none;
  position: relative;
  min-width: 180px;
}
.filter-inline select:focus {
  outline: 1px solid var(--accent-2);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32), 0 0 0 2px rgba(54, 207, 201, 0.15);
}

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.available-teams {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.pool-list {
  list-style: none;
  padding: 6px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 260px;
  overflow: auto;
}

.pool-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}
.pool-item:last-child { border-bottom: none; }
.pool-item:active { cursor: grabbing; }

.pool-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pool-counter {
  margin: 4px 0;
}

.muted.small { font-size: 12px; }

.input-with-suggest {
  position: relative;
  width: 100%;
}

.suggest-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(12, 26, 36, 0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  z-index: 10;
  display: none;
}

.suggest-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: rgba(255, 255, 255, 0.06); }

.pool-buttons .btn { flex: 1 1 180px; }

.pool-slot {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.pool-counter {
  margin: 4px 0;
}

@media (max-width: 960px) {
  .pool-flex { flex-wrap: wrap; }
  .pool-right { flex: 1 1 320px; }
}

.flash-area { margin-bottom: 14px; }
.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.flash.success { background: rgba(54, 207, 201, 0.16); }
.flash.error { background: rgba(255, 159, 28, 0.16); }
.flash.info { background: rgba(255, 255, 255, 0.08); }

.list { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.actions.actions-wrap {
  flex-wrap: wrap;
}

.actions.actions-wrap .btn {
  flex: 1 1 160px;
}

.bracket-wrapper {
  position: relative;
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket-wrapper:fullscreen,
.bracket-wrapper.fullscreen-active {
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(10, 16, 24, 0.9), rgba(4, 8, 14, 0.92)),
    url("cs2wall.jpeg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: auto;
}

#admin-bracket-container:fullscreen,
#admin-bracket-container.fullscreen-active {
  overflow: auto;
  height: 100vh;
  background:
    linear-gradient(135deg, rgba(10, 16, 24, 0.9), rgba(4, 8, 14, 0.92)),
    url("cs2wall.jpeg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.bracket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: start;
  justify-content: center;
  width: 100%;
}

.bracket-grid.ti {
  --match-height: 96px;
  --match-gap: 12px;
  --round-gap: 36px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  column-gap: var(--round-gap);
}

.round {
  background: rgba(12, 26, 36, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  justify-self: center;
}

.round-title { font-weight: 600; margin-bottom: 8px; }

.match {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  min-height: var(--match-height, 82px);
}

.match .team {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-word;
}

.match .team.winner {
  border: 1px solid var(--accent-2);
  background: rgba(54, 207, 201, 0.12);
}

.match.admin {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
}

.team-btn.chosen {
  border-color: var(--accent-2);
  background: rgba(54, 207, 201, 0.16);
}

.match-id { color: var(--muted); font-size: 13px; }

.match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.score-row {
  display: grid;
  gap: 6px;
}

.team-btn .left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.champion {
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  font-weight: 700;
  color: var(--accent);
}

.bracket-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.round-title { text-align: center; }

.crown {
  margin-right: 6px;
}

.score-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.score-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  margin-left: 6px;
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.archive-form {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.archive-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.link-row {
  color: inherit;
  text-decoration: none;
}

.link-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 720px) {
  .actions { flex-direction: column; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bracket-grid.ti {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .bracket-grid.ti .round-2,
  .bracket-grid.ti .round-3,
  .bracket-grid.ti .round-4 { margin-top: 0; }
  .card-inner { flex-direction: column; align-items: flex-start; }
  .card-logo { min-width: auto; }
}
