:root {
  --grad-pink: #ff5e9a;
  --grad-purple: #a855f7;
  --grad-blue: #00c8ff;
  --grad-lime: #b8ff3c;
  --grad-orange: #ff9f43;
  --grad-yellow: #ffe566;
  --text-dark: #1e1b4b;
  --text-mid: #5b5675;
  --text-light: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(255, 255, 255, 0.8);
  --radius: 22px;
  --shadow: 0 20px 50px rgba(99, 60, 180, 0.18);
  --shadow-lg: 0 28px 70px rgba(255, 94, 154, 0.25);
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Outfit", var(--font);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text-dark);
  line-height: 1.5;
}

/* Animated bright mesh background */
.court-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(135deg, #fff5f8 0%, #f0f9ff 40%, #f5fff0 100%);
}

.court-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 45% at 10% 20%, rgba(255, 94, 154, 0.55), transparent),
    radial-gradient(circle 40% at 90% 15%, rgba(0, 200, 255, 0.5), transparent),
    radial-gradient(circle 50% at 85% 85%, rgba(184, 255, 60, 0.45), transparent),
    radial-gradient(circle 42% at 15% 80%, rgba(168, 85, 247, 0.45), transparent),
    radial-gradient(circle 35% at 50% 50%, rgba(255, 229, 102, 0.35), transparent);
  animation: meshShift 14s ease-in-out infinite alternate;
}

.court-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23a855f7' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.7;
}

@keyframes meshShift {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.08) translate(-2%, 2%); }
}

.shell {
  width: min(1200px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

body.screen-mode .shell {
  width: min(1920px, 98vw);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 2px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text-dark);
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--grad-pink), var(--grad-purple), var(--grad-blue));
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 10px 28px rgba(168, 85, 247, 0.45);
}

.logo-icon i {
  font-size: 1.6rem;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--grad-purple), var(--grad-pink), var(--grad-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.logo-sub i {
  color: var(--grad-orange);
}

.page-hero {
  margin-bottom: 2rem;
  padding: 2rem 2.25rem;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(125deg, var(--grad-pink) 0%, var(--grad-purple) 35%, var(--grad-blue) 70%, var(--grad-lime) 100%);
  box-shadow: var(--shadow-lg);
  color: var(--text-light);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.page-hero h1 {
  color: white;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  margin-bottom: 0.5rem;
  position: relative;
}

.page-hero .lead {
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
  max-width: 56ch;
  font-size: 1.05rem;
  position: relative;
}

.page-hero .hero-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 4.5rem;
  opacity: 0.25;
  display: none;
}

@media (min-width: 768px) {
  .page-hero .hero-icon { display: block; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  color: var(--text-dark);
}

h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
}

h2 .section-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: white;
  flex-shrink: 0;
}

.section-icon.pink { background: linear-gradient(135deg, var(--grad-pink), var(--grad-orange)); }
.section-icon.purple { background: linear-gradient(135deg, var(--grad-purple), var(--grad-pink)); }
.section-icon.blue { background: linear-gradient(135deg, var(--grad-blue), var(--grad-purple)); }
.section-icon.lime { background: linear-gradient(135deg, var(--grad-lime), var(--grad-blue)); }
.section-icon.gold { background: linear-gradient(135deg, var(--grad-yellow), var(--grad-orange)); }

.lead {
  color: var(--text-mid);
  font-size: 1.05rem;
  max-width: 52ch;
  margin: 0 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  font-family: inherit;
}

.btn i { font-size: 1.1rem; }

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--grad-pink), var(--grad-purple));
  color: white;
  box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 36px rgba(255, 94, 154, 0.45);
}

.btn-ghost {
  background: white;
  color: var(--text-dark);
  border: 2px solid rgba(168, 85, 247, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.btn-ghost:hover {
  border-color: var(--grad-purple);
  background: #faf8ff;
}

.btn-gold {
  background: linear-gradient(135deg, var(--grad-orange), var(--grad-yellow));
  color: var(--text-dark);
  box-shadow: 0 10px 28px rgba(255, 159, 67, 0.45);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--grad-blue), var(--grad-lime));
  color: var(--text-dark);
  box-shadow: 0 10px 28px rgba(0, 200, 255, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
  color: white;
  border: none;
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
  min-width: 32px;
  min-height: 32px;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.35);
}

.card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255, 94, 154, 0.4), rgba(0, 200, 255, 0.4), rgba(184, 255, 60, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card + .card { margin-top: 1.25rem; }

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label i { color: var(--grad-purple); }

.form-input,
.form-file {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 2px solid rgba(168, 85, 247, 0.2);
  background: #fafbff;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-file:focus {
  outline: none;
  border-color: var(--grad-blue);
  box-shadow: 0 0 0 4px rgba(0, 200, 255, 0.2);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.message {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.message.success {
  background: linear-gradient(135deg, rgba(184, 255, 60, 0.25), rgba(0, 200, 255, 0.15));
  border: 2px solid rgba(184, 255, 60, 0.5);
  color: #2d6a1e;
}

.message.error {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 159, 67, 0.15));
  border: 2px solid rgba(255, 107, 107, 0.45);
  color: #b91c1c;
}

.message.info {
  background: white;
  border: 2px solid rgba(168, 85, 247, 0.25);
  color: var(--text-mid);
}

.tournament-list {
  display: grid;
  gap: 1rem;
}

.tournament-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  border-radius: 18px;
  background: var(--card-bg);
  border: 2px solid white;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tournament-item:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.tournament-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: white;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--grad-blue), var(--grad-purple));
}

.tournament-item-body {
  flex: 1;
  min-width: 0;
}

.tournament-item strong {
  font-size: 1.05rem;
  color: var(--text-dark);
}

.tournament-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-mid);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}

.tournament-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-setup {
  background: linear-gradient(135deg, #e8e8f0, #f5f5fa);
  color: var(--text-mid);
}

.badge-active {
  background: linear-gradient(135deg, var(--grad-lime), var(--grad-blue));
  color: var(--text-dark);
}

.badge-finished {
  background: linear-gradient(135deg, var(--grad-yellow), var(--grad-orange));
  color: var(--text-dark);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.player-chip {
  text-align: center;
  padding: 1.15rem 1rem;
  border-radius: 18px;
  background: linear-gradient(160deg, #fff 0%, #f8f4ff 100%);
  border: 2px solid rgba(168, 85, 247, 0.15);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.player-chip:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(168, 85, 247, 0.2);
}

.player-chip img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid transparent;
  background: linear-gradient(white, white) padding-box,
    linear-gradient(135deg, var(--grad-pink), var(--grad-blue), var(--grad-lime)) border-box;
  box-shadow: 0 8px 24px rgba(255, 94, 154, 0.25);
}

.player-chip .name {
  margin-top: 0.7rem;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text-dark);
}

.player-chip .delete-form {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.95));
  border: 2px solid white;
  box-shadow: var(--shadow);
}

.stats-bar .round-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}

.stats-bar .round-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--grad-purple), var(--grad-pink));
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.progress-wrap {
  flex: 1;
  min-width: 200px;
}

.progress-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.4rem;
}

.progress-label i { color: var(--grad-blue); }

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--grad-pink), var(--grad-purple), var(--grad-blue), var(--grad-lime));
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
  animation: gradMove 3s linear infinite;
}

@keyframes gradMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.35rem;
}

.match-card {
  border-radius: var(--radius);
  background: white;
  border: 2px solid rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.match-card:hover {
  box-shadow: var(--shadow-lg);
}

.match-card.is-done {
  border-color: rgba(184, 255, 60, 0.6);
}

.match-card.is-done .match-status {
  background: linear-gradient(90deg, var(--grad-lime), var(--grad-blue));
  color: var(--text-dark);
}

.match-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  min-height: 210px;
}

.match-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.75rem;
  text-align: center;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  width: 100%;
}

.match-player:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(255, 94, 154, 0.12), rgba(0, 200, 255, 0.08));
}

.match-player.is-winner {
  background: linear-gradient(180deg, rgba(255, 229, 102, 0.35), rgba(255, 159, 67, 0.15));
}

.match-player img {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #eee;
  margin-bottom: 0.65rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.match-player:hover:not(:disabled) img {
  border-color: var(--grad-pink);
  box-shadow: 0 0 0 4px rgba(255, 94, 154, 0.25);
  transform: scale(1.05);
}

.match-player.is-winner img {
  border-color: var(--grad-orange);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.4);
}

.match-player .p-name {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dark);
}

.match-player .p-surname {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-top: 0.15rem;
}

.vs-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  background: linear-gradient(180deg, var(--grad-purple), var(--grad-pink));
  min-width: 52px;
}

.vs-badge i {
  font-size: 1.5rem;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.vs-badge span {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.75rem;
  color: white;
  letter-spacing: 0.1em;
  margin-top: 0.15rem;
}

.match-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #f3f0ff, #fff5f8);
  color: var(--text-mid);
}

.match-status i { font-size: 1rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-dots {
  font-weight: 800;
  color: var(--text-dark);
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.champion-hero {
  text-align: center;
  padding: 3rem 1.5rem;
  background: linear-gradient(145deg, #fff9e6 0%, #fff 40%, #f0fff4 100%) !important;
}

.champion-hero::before {
  background: linear-gradient(135deg, var(--grad-yellow), var(--grad-orange), var(--grad-pink)) !important;
}

.champion-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--grad-yellow), var(--grad-orange));
  color: var(--text-dark);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.champion-hero img {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid transparent;
  background: linear-gradient(white, white) padding-box,
    linear-gradient(135deg, var(--grad-yellow), var(--grad-pink), var(--grad-purple)) border-box;
  box-shadow: 0 20px 50px rgba(255, 159, 67, 0.4);
  margin-bottom: 1.5rem;
}

.champion-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  background: linear-gradient(135deg, var(--grad-orange), var(--grad-pink), var(--grad-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-mid);
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--grad-purple), var(--grad-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  margin-bottom: 1rem;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

.hint-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-mid);
  font-size: 0.9rem;
}

.hint-text i { color: var(--grad-blue); }

.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }

/* Pairs picker (create tournament) */
.field-help {
  font-size: 0.88rem;
  color: var(--text-mid);
  margin: 0 0 0.75rem;
}

.pairs-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.65rem;
}

.pairs-option {
  cursor: pointer;
}

.pairs-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pairs-option-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.9rem 0.5rem;
  border-radius: 14px;
  border: 2px solid rgba(168, 85, 247, 0.25);
  background: #fafbff;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  text-align: center;
}

.pairs-option-inner i {
  font-size: 1.4rem;
  color: var(--grad-purple);
}

.pairs-option-inner strong {
  font-size: 0.95rem;
  color: var(--text-dark);
}

.pairs-option-inner small {
  font-size: 0.72rem;
  color: var(--text-mid);
}

.pairs-option input:checked + .pairs-option-inner {
  border-color: var(--grad-pink);
  background: linear-gradient(160deg, #fff5f9, #f0f9ff);
  box-shadow: 0 8px 24px rgba(255, 94, 154, 0.25);
  transform: translateY(-2px);
}

/* Tables overview */
.tables-overview-card {
  margin-bottom: 1.5rem;
}

.tables-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.table-overview-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: 14px;
  border: 2px solid rgba(168, 85, 247, 0.2);
  background: linear-gradient(160deg, #fff, #f8f4ff);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.table-overview-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(168, 85, 247, 0.2);
}

.table-overview-item.is-active {
  border-color: var(--grad-pink);
  box-shadow: 0 0 0 3px rgba(255, 94, 154, 0.2);
}

.table-overview-item.is-complete {
  border-color: rgba(184, 255, 60, 0.6);
  background: linear-gradient(160deg, #f5fff0, #fff);
}

.table-overview-num {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.table-overview-pairs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mini-pair {
  font-size: 0.78rem;
  color: var(--text-mid);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
}

.mini-pair.done {
  color: #2d6a1e;
  background: rgba(184, 255, 60, 0.2);
  font-weight: 600;
}

.table-overview-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--grad-purple);
}

.table-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-mid);
}

/* Bracket HTML table */
.bracket-table-card {
  margin-bottom: 1.5rem;
}

.bracket-table-scroll {
  overflow-x: auto;
  margin-top: 1rem;
}

.bracket-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
}

.bracket-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: white;
  background: linear-gradient(90deg, var(--grad-purple), var(--grad-pink));
}

.bracket-table thead th:first-child {
  border-radius: 12px 0 0 0;
}

.bracket-table thead th:last-child {
  border-radius: 0 12px 0 0;
}

.bracket-row td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(168, 85, 247, 0.12);
  vertical-align: middle;
  background: white;
}

.bracket-row:last-child td:first-child {
  border-radius: 0 0 0 12px;
}

.bracket-row:last-child td:last-child {
  border-radius: 0 0 12px 0;
}

.bracket-row.is-done td {
  background: linear-gradient(90deg, rgba(184, 255, 60, 0.12), white);
}

.bracket-row.is-bye td {
  background: #fafafa;
}

.col-num {
  width: 48px;
  text-align: center;
  font-weight: 800;
  color: var(--grad-purple);
}

.col-vs {
  width: 44px;
  text-align: center;
  color: var(--grad-pink);
  font-size: 1.1rem;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.player-cell img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(168, 85, 247, 0.3);
  flex-shrink: 0;
}

.player-cell strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.player-cell em {
  display: block;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--text-mid);
}

.col-player.is-winner .player-cell img {
  border-color: var(--grad-orange);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.35);
}

.bye-label {
  font-size: 0.85rem;
  color: var(--text-mid);
  font-weight: 600;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.result-badge.done {
  background: linear-gradient(135deg, var(--grad-lime), var(--grad-blue));
  color: var(--text-dark);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.7rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}

.btn-pick:active {
  transform: scale(0.96);
}

.btn-pick-a {
  background: linear-gradient(135deg, var(--grad-pink), var(--grad-purple));
  color: white;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-pick-b {
  background: linear-gradient(135deg, var(--grad-blue), var(--grad-lime));
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0, 200, 255, 0.25);
}

.import-card {
  margin-bottom: 1.25rem;
}

.import-card code {
  background: rgba(168, 85, 247, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}

.name-order-picker {
  grid-template-columns: 1fr 1fr;
}

.import-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
}

.checkbox-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--grad-purple);
}

/* ===== Big screen: 6 pairs as square cards (3×2 grid) ===== */
.screen-top {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.2rem 0.35rem 0.4rem;
}

.screen-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2vw, 1.35rem);
  font-weight: 800;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-top-meta {
  font-size: clamp(0.75rem, 1.4vw, 0.95rem);
  font-weight: 700;
  color: var(--text-mid);
  white-space: nowrap;
}

.screen-exit {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.12);
  color: var(--text-dark);
  text-decoration: none;
}

.screen-board {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.35rem;
}

.screen-progress {
  flex-shrink: 0;
  height: 5px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.15);
  overflow: hidden;
}

.screen-progress .progress-fill {
  height: 100%;
}

.screen-table-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-table-label {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--grad-purple);
  margin-bottom: 0.25rem;
  padding-left: 0.15rem;
}

/* Сетка квадратов */
.pair-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: clamp(0.35rem, 1vh, 0.65rem);
  padding: 0.15rem;
  overflow: hidden;
}

.pair-grid-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.pair-grid-5 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.pair-grid-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.pair-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr;
}

.pair-grid-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.pair-grid-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  max-width: 50%;
  margin: 0 auto;
  width: 100%;
}

.screen-board.tables-2 .screen-table-block {
  flex: 1;
}

.screen-board.tables-2 .pair-grid-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* Карточка пары — квадрат */
.pair-card {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff 0%, #f3eeff 100%);
  border: 3px solid rgba(168, 85, 247, 0.25);
  box-shadow: 0 6px 24px rgba(99, 60, 180, 0.12);
  overflow: hidden;
}

.pair-card.is-done {
  border-color: rgba(184, 255, 60, 0.75);
  background: linear-gradient(160deg, #f8fff2, #fff);
}

.pair-card-num {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--grad-purple), var(--grad-pink));
  color: white;
  font-weight: 800;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
}

.pair-card-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  padding: 1.75rem 0.35rem 0.5rem;
}

.pair-player {
  margin: 0;
  min-width: 0;
  min-height: 0;
}

.pair-player-hit {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.25rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}

.pair-player-hit:hover:not(:disabled) {
  background: rgba(255, 94, 154, 0.12);
}

.pair-player-hit:disabled {
  cursor: default;
}

.pair-player.is-winner .pair-player-hit {
  background: rgba(255, 159, 67, 0.2);
}

.pair-player-hit img {
  width: clamp(3.5rem, 11vh, 7.5rem);
  height: clamp(3.5rem, 11vh, 7.5rem);
  max-width: 85%;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  border: 3px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.pair-player.is-winner .pair-player-hit img {
  border-color: var(--grad-orange);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.45);
}

.pair-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  padding: 0 0.15rem;
}

.pair-name strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.85rem, 2.2vh, 1.35rem);
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.pair-name em {
  font-style: normal;
  font-weight: 600;
  font-size: clamp(0.75rem, 1.8vh, 1.1rem);
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.pair-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(0.85rem, 2vh, 1.25rem);
  color: var(--grad-pink);
  letter-spacing: 0.05em;
  padding: 0 0.15rem;
}

.pair-bye {
  display: grid;
  place-items: center;
}

.pair-bye-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-mid);
  text-align: center;
}

.pair-card.is-bye .pair-card-body {
  grid-template-columns: 1fr;
}

.pair-card.is-bye .pair-vs,
.pair-card.is-bye .pair-player:last-child {
  display: none;
}

.pair-won {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1.35rem;
  color: var(--grad-orange);
  z-index: 2;
}

/* Один стол — крупнее фото на 6 квадратах */
.screen-board.tables-1 .pair-player-hit img {
  width: clamp(4rem, 14vh, 8.5rem);
  height: clamp(4rem, 14vh, 8.5rem);
}

.screen-board.tables-1 .pair-name strong {
  font-size: clamp(1rem, 2.6vh, 1.5rem);
}

.screen-board.tables-1 .pair-name em {
  font-size: clamp(0.85rem, 2.1vh, 1.2rem);
}
