/* PickleballPOA — Master Tournament UI */
:root {
  --mt-bg: #0f172a;
  --mt-surface: #1e293b;
  --mt-card: #334155;
  --mt-border: rgba(148, 163, 184, 0.22);
  --mt-text: #f8fafc;
  --mt-muted: #94a3b8;
  --mt-accent: #e11d48;
  --mt-accent-2: #f97316;
  --mt-ok: #22c55e;
  --mt-radius: 14px;
  --mt-font: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.mt-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--mt-font);
  background: linear-gradient(165deg, var(--mt-bg) 0%, #1a1030 45%, var(--mt-bg) 100%);
  color: var(--mt-text);
  line-height: 1.5;
}

body.mt-admin-body {
  background: linear-gradient(165deg, #0c1222 0%, #1a1428 50%, #0f172a 100%);
}

a {
  color: #fda4af;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.mt-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--mt-border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.mt-brand {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
}
.mt-brand span {
  color: var(--mt-accent);
}

.mt-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mt-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.mt-hero {
  margin-bottom: 28px;
}

.mt-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  letter-spacing: -0.03em;
}

.mt-hero .sub {
  color: var(--mt-muted);
  margin: 0;
  font-size: 0.95rem;
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.18);
  color: #fecdd3;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 6px;
}

.phase-registration {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
}
.phase-groups {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}
.phase-knockout {
  background: rgba(249, 115, 22, 0.22);
  color: #fed7aa;
}
.phase-finished {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

label.lbl-inline {
  font-size: 0.85rem;
  color: var(--mt-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

select.inp,
input.inp {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--mt-border);
  background: var(--mt-surface);
  color: var(--mt-text);
  font-size: 0.95rem;
  min-width: 200px;
}

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

.tab-btn,
.admin-tab {
  border: 1px solid var(--mt-border);
  background: transparent;
  color: var(--mt-muted);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn.active,
.admin-tab.active {
  background: linear-gradient(135deg, var(--mt-accent), #fb7185);
  border-color: transparent;
  color: #fff;
}

.tab-panel,
.admin-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-panel.active,
.admin-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 22px;
  margin-bottom: 18px;
}

.card-inner {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--mt-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.hint {
  color: var(--mt-muted);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--mt-border);
}

.data-table th {
  color: var(--mt-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.vs-cell {
  color: var(--mt-accent);
  font-weight: 700;
  width: 42px;
}

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
}
.tag-done {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}
.tag-wait {
  background: rgba(148, 163, 184, 0.2);
  color: var(--mt-muted);
}

.group-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(51, 65, 85, 0.35);
  border: 1px solid var(--mt-border);
}

.group-card h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #fecdd3;
}

.group-card ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Bracket */
.bracket-flow {
  display: flex;
  flex-wrap: nowrap;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}

.bracket-col {
  flex: 0 0 auto;
  min-width: 200px;
  scroll-snap-align: start;
}

.bracket-col h5 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mt-muted);
}

.ko-match {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--mt-border);
  margin-bottom: 10px;
  background: rgba(15, 23, 42, 0.65);
}

.ko-done {
  border-color: rgba(34, 197, 94, 0.35);
}

.ko-pair {
  font-size: 0.88rem;
  padding: 6px 0;
}

.ko-pair.is-winner {
  color: #fef08a;
  font-weight: 700;
}

.ko-score {
  display: block;
  text-align: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--mt-accent);
  margin: 4px 0;
}

footer.mt-footer {
  text-align: center;
  padding: 28px;
  color: var(--mt-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--mt-border);
}

/* Admin */
.gate-box {
  max-width: 420px;
  margin: 48px auto;
  padding: 32px;
  text-align: center;
  border-radius: var(--mt-radius);
  border: 1px solid var(--mt-border);
  background: var(--mt-surface);
}

.login-gate {
  text-align: left;
  max-width: 400px;
}

.login-form {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field.lbl-inline {
  margin-bottom: 0;
}

.login-input.inp {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
}

.btn-login-submit {
  width: 100%;
  margin-top: 8px;
  padding-top: 12px;
  padding-bottom: 12px;
  justify-content: center;
}

.login-gate h2 {
  text-align: center;
}

.login-gate > .hint {
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: filter 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--mt-accent), #fb7185);
  color: #fff;
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.25);
  color: var(--mt-text);
  border: 1px solid var(--mt-border);
}

.btn-ghost {
  background: transparent;
  color: #fecdd3;
  border: 1px solid rgba(225, 29, 72, 0.45);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-google {
  background: #fff;
  color: #1f2937;
  width: 100%;
  justify-content: center;
}

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.user-chip {
  font-size: 0.82rem;
  color: var(--mt-muted);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--mt-border);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.row-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--mt-border);
  margin-bottom: 8px;
  background: rgba(15, 23, 42, 0.45);
}

.row-line span {
  font-size: 0.9rem;
}

.match-admin .match-names {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.match-admin .vs {
  color: var(--mt-accent);
  font-weight: 800;
  padding: 0 6px;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.match-grid label {
  font-size: 0.78rem;
  color: var(--mt-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inp-score-a,
.inp-score-b,
.inp-ko-a,
.inp-ko-b {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--mt-border);
  background: var(--mt-bg);
  color: var(--mt-text);
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rnd-title {
  margin: 20px 0 12px;
  color: #fdba74;
  font-size: 1rem;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--mt-surface);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
}

.modal-card h3 {
  margin-top: 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: 24px;
  max-width: 400px;
  margin-left: auto;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 200;
  pointer-events: none;
}

.toast-ok {
  background: rgba(34, 197, 94, 0.92);
  color: #052e16;
}

.toast-err {
  background: rgba(225, 29, 72, 0.95);
  color: #fff;
}

code {
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 8px;
  border-radius: 6px;
  word-break: break-all;
}

@media (max-width: 640px) {
  .mt-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .mt-nav-links {
    justify-content: center;
  }
}
