:root {
  --text: #f0f4ff;
  --text-dim: rgba(240, 244, 255, 0.62);
  --glass: rgba(12, 16, 32, 0.55);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(18, 24, 48, 0.72);
  --accent: #7c5cff;
  --accent-2: #00e5ff;
  --ok: #3dff9a;
  --warn: #ffc14a;
  --bad: #ff5c7a;
  --radius: 18px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Outfit", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: #06070f;
  overflow-x: hidden;
}
.bg-aurora {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 20%, #1a0a3a 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, #0a1a3a 0%, transparent 50%),
    linear-gradient(160deg, #06070f 0%, #0d1020 40%, #120818 100%);
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(60px);
  opacity: 0.65; mix-blend-mode: screen; will-change: transform;
}
.blob-1 {
  width: 55vmax; height: 55vmax; top: -15%; left: -20%;
  background: radial-gradient(circle, #7c5cff 0%, transparent 70%);
  animation: drift1 14s ease-in-out infinite alternate;
}
.blob-2 {
  width: 50vmax; height: 50vmax; bottom: -20%; right: -15%;
  background: radial-gradient(circle, #00e5ff 0%, transparent 70%);
  animation: drift2 18s ease-in-out infinite alternate;
}
.blob-3 {
  width: 40vmax; height: 40vmax; top: 40%; left: 30%;
  background: radial-gradient(circle, #ff4ecd 0%, transparent 70%);
  animation: drift3 12s ease-in-out infinite alternate; opacity: 0.45;
}
.blob-4 {
  width: 30vmax; height: 30vmax; top: 10%; right: 10%;
  background: radial-gradient(circle, #5b8cff 0%, transparent 70%);
  animation: drift1 20s ease-in-out infinite alternate-reverse; opacity: 0.4;
}
.noise {
  position: absolute; inset: 0; opacity: 0.04; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}
@keyframes drift1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, 12%) scale(1.12); }
  100% { transform: translate(-5%, 6%) scale(0.95); }
}
@keyframes drift2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12%, -8%) scale(1.08); }
  100% { transform: translate(6%, -4%) scale(1.15); }
}
@keyframes drift3 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(-10%, 15%) scale(1.2) rotate(25deg); }
}
#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 32px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 10px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.5), rgba(0, 229, 255, 0.35));
  border: 1px solid var(--glass-border); box-shadow: 0 0 24px rgba(124, 92, 255, 0.35);
}
.brand-text h1 {
  margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 0%, #b8c0ff 40%, #00e5ff 100%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 5s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.subtitle { font-size: 0.7rem; color: var(--text-dim); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.badge {
  font-size: 0.72rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-dim);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.badge.admin { color: var(--ok); border-color: rgba(61, 255, 154, 0.35); box-shadow: 0 0 16px rgba(61, 255, 154, 0.15); }
nav { display: flex; gap: 8px; padding: 4px 16px 14px; }
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--glass-border); background: var(--glass); color: var(--text-dim);
  padding: 11px 10px; border-radius: 14px; font-weight: 600; font-size: 0.88rem; font-family: inherit;
  cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: all 0.25s ease;
}
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.85), rgba(0, 229, 255, 0.55));
  border-color: rgba(255, 255, 255, 0.22); box-shadow: 0 4px 24px rgba(124, 92, 255, 0.4);
}
.tab:active { transform: scale(0.97); }
main { padding: 0 16px 24px; }
.card {
  position: relative; background: var(--glass-strong); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow); overflow: hidden;
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 700; }
.meta { color: var(--text-dim); font-size: 0.8rem; line-height: 1.5; }
.status {
  display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 3px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06); margin-bottom: 8px; border: 1px solid transparent;
}
.status.open { color: var(--ok); background: rgba(61, 255, 154, 0.1); border-color: rgba(61, 255, 154, 0.25); }
.status.in_progress { color: var(--warn); background: rgba(255, 193, 74, 0.1); border-color: rgba(255, 193, 74, 0.25); }
.status.finished { color: var(--text-dim); }
button.action {
  margin-top: 12px; width: 100%; border: none;
  background: linear-gradient(135deg, #7c5cff, #4a9fff); color: #fff;
  padding: 12px 14px; border-radius: 12px; font-weight: 700; font-size: 0.9rem; font-family: inherit;
  cursor: pointer; box-shadow: 0 4px 20px rgba(124, 92, 255, 0.35);
}
button.danger { background: linear-gradient(135deg, #ff5c7a, #ff3d5e); box-shadow: 0 4px 20px rgba(255, 92, 122, 0.35); }
button.ghost { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--glass-border); box-shadow: none; color: var(--text); }
.back { margin-bottom: 12px; }
.bracket {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.72rem;
  white-space: pre-wrap; line-height: 1.45; overflow-x: auto; color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.06);
}
.empty { color: var(--text-dim); text-align: center; padding: 48px 16px; font-weight: 500; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 56px 16px; color: var(--text-dim); font-weight: 500; }
.loader-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1); border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }



/* ===== BRACKET TREE ===== */
.card-bracket { padding-bottom: 18px; }

.bracket-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 24px 8px;
  font-size: 0.85rem;
}

.bracket-scroll {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 12px 4px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.bracket-tree {
  display: flex;
  gap: 28px;
  align-items: stretch;
  min-width: min-content;
  padding: 4px 8px 12px;
}

.round {
  display: flex;
  flex-direction: column;
  min-width: 160px;
  flex-shrink: 0;
  position: relative;
}

.round-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #00e5ff;
  text-align: center;
  margin-bottom: 14px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.round-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 18px;
  flex: 1;
}

.match {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 24, 48, 0.95), rgba(8, 10, 24, 0.95));
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}

.match.played {
  border-color: rgba(61, 255, 154, 0.35);
  box-shadow: 0 6px 24px rgba(61, 255, 154, 0.12);
}

.match.pending {
  border-color: rgba(255, 255, 255, 0.1);
}

.match-num {
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 700;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 11px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  min-height: 40px;
}

.slot:last-of-type { border-bottom: none; }

.slot.winner {
  background: linear-gradient(90deg, rgba(61, 255, 154, 0.22), transparent 80%);
  color: #3dff9a;
}

.slot.empty, .slot.bye-slot {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 500;
  font-style: italic;
}

.slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.crown {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #3dff9a;
}

/* connector stub on the right of match */
.match::after {
  content: "";
  position: absolute;
  right: -15px;
  top: 50%;
  width: 14px;
  height: 2px;
  background: rgba(124, 92, 255, 0.45);
  transform: translateY(-50%);
  pointer-events: none;
}

.round:last-child .match::after { display: none; }

.participants {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.p-idx {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.5), rgba(0, 229, 255, 0.35));
  color: #fff;
  flex-shrink: 0;
}


/* ===== PROFILE ===== */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  text-align: center;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.55), rgba(0, 229, 255, 0.35));
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 28px rgba(124, 92, 255, 0.35);
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-info { width: 100%; }
.profile-name {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.profile-row .label {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}
.profile-row .value {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

/* tags */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.tag-gold {
  color: #ffd56a;
  background: rgba(255, 200, 60, 0.15);
  border-color: rgba(255, 200, 60, 0.4);
  box-shadow: 0 0 12px rgba(255, 200, 60, 0.2);
}
.tag-silver {
  color: #d7dde8;
  background: rgba(200, 210, 230, 0.12);
  border-color: rgba(200, 210, 230, 0.35);
}
.tag-purple {
  color: #d4a4ff;
  background: rgba(160, 80, 255, 0.18);
  border-color: rgba(180, 100, 255, 0.4);
  box-shadow: 0 0 14px rgba(160, 80, 255, 0.25);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-pick-btn {
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.25);
  color: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.tag-pick-btn.selected { outline: 2px solid #00e5ff; }
.badge-silver { color: #d7dde8; border-color: rgba(200,210,230,0.4); }
.badge-winner { color: #d4a4ff; border-color: rgba(180,100,255,0.45); }

.champion-card {
  text-align: center;
  background: linear-gradient(135deg, rgba(160,80,255,0.25), rgba(255,200,60,0.12));
  border: 1px solid rgba(180,100,255,0.4);
}
.champion-title { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: #d4a4ff; font-weight: 800; }
.champion-name { font-size: 1.3rem; font-weight: 800; margin-top: 6px; }

.participant.is-champion {
  border-color: rgba(180,100,255,0.45);
  background: rgba(160,80,255,0.12);
}

.hist-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hist-row:last-child { border-bottom: none; }
.hist-name { font-weight: 700; }
.hist-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

.app-footer {
  margin-top: 20px;
  padding: 16px 8px 28px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
}
.link-btn {
  margin-top: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #9ecbff;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}
.fb-input {
  width: 100%;
  margin: 10px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: #fff;
  padding: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.slot-win {
  background: linear-gradient(90deg, rgba(61, 255, 154, 0.28), transparent 85%);
  color: #3dff9a;
  font-weight: 700;
}
.slot-lose {
  background: linear-gradient(90deg, rgba(255, 80, 100, 0.22), transparent 85%);
  color: #ff8a9a;
  opacity: 0.85;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 120, 140, 0.5);
}
.slot-gold {
  background: linear-gradient(90deg, rgba(255, 200, 60, 0.35), rgba(255, 160, 40, 0.08));
  color: #ffd56a;
  font-weight: 800;
  box-shadow: inset 0 0 20px rgba(255, 200, 60, 0.15);
}
.match-final {
  border-color: rgba(255, 200, 60, 0.45) !important;
  box-shadow: 0 6px 24px rgba(255, 200, 60, 0.15);
}
.champion-card.missing {
  opacity: 0.7;
  border-style: dashed;
}

.tag-cyan {
  color: #5ef0ff !important;
  background: linear-gradient(135deg, rgba(0, 220, 255, 0.35), rgba(0, 140, 255, 0.15)) !important;
  border: 1px solid rgba(90, 240, 255, 0.65) !important;
  box-shadow: 0 0 16px rgba(0, 220, 255, 0.35);
}
.tag-pick-btn.tag-cyan.selected,
.tag-chip.tag-cyan.tag-active {
  box-shadow: 0 0 20px rgba(0, 230, 255, 0.5);
}
.badge-streamer { color: #5ef0ff; border-color: rgba(90, 240, 255, 0.55); }
/* Перелив ТОЛЬКО у Telegram-имени (.tg-name), не у ника MLBB */
.tg-name.nick-gold,
.badge .nick-gold {
  background: linear-gradient(90deg, #8b6914, #ffd56a, #fff3c4, #ffb800, #ffd56a, #8b6914);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  animation: nick-shimmer 3s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.45));
  font-weight: 800;
}
.profile-row .value {
  color: #e8eef8 !important;
  -webkit-text-fill-color: #e8eef8 !important;
  background: none !important;
  animation: none !important;
  filter: none !important;
}
.tag-violet {
  color: #e0a0ff !important;
  background: linear-gradient(135deg, rgba(180, 60, 255, 0.35), rgba(120, 40, 200, 0.2)) !important;
  border: 1px solid rgba(200, 120, 255, 0.65) !important;
  box-shadow: 0 0 16px rgba(180, 80, 255, 0.4);
}
.tag-chip.tag-violet {
  background: linear-gradient(90deg, #6b2db5, #d080ff, #f0d0ff, #a050e8, #6b2db5);
  background-size: 300% 100%;
  animation: nick-shimmer 3.5s linear infinite;
  color: #fff !important;
  border-color: rgba(220, 160, 255, 0.7) !important;
}
.nick-cyan {
  color: #5ef0ff !important;
  text-shadow: 0 0 12px rgba(0, 220, 255, 0.45);
  font-weight: 800;
}
.nick-purple {
  color: #d4a4ff !important;
  text-shadow: 0 0 12px rgba(180, 100, 255, 0.4);
  font-weight: 800;
}
.nick-silver {
  color: #dfe6f2 !important;
  text-shadow: 0 0 10px rgba(200, 210, 230, 0.35);
  font-weight: 800;
}
@keyframes nick-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
.profile-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
/* бейдж в шапке тоже */
.badge .nick-gold {
  background: linear-gradient(90deg, #8b6914, #ffd56a, #fff3c4, #ffb800, #ffd56a, #8b6914);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: nick-shimmer 3s linear infinite;
}

.tg-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-block;
}
.tg-name.nick-gold {
  background: linear-gradient(90deg, #8b6914, #ffd56a, #fff8e0, #ffb800, #ffe08a, #8b6914);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  animation: nick-shimmer 2.5s linear infinite;
  filter: drop-shadow(0 0 10px rgba(255, 200, 80, 0.55));
}
.tg-name.nick-cyan {
  color: #5ef0ff !important;
  text-shadow: 0 0 14px rgba(0, 220, 255, 0.55);
}
.tg-name.nick-purple {
  color: #d4a4ff !important;
  text-shadow: 0 0 14px rgba(180, 100, 255, 0.5);
}
.tg-name.nick-silver {
  color: #e8eef8 !important;
  text-shadow: 0 0 10px rgba(200, 210, 230, 0.4);
}
