* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #020617 url("images/canal.jpg") center/cover fixed no-repeat;
  color: #e5e7eb;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* GÓRNY PASEK */

.topbar {
  width: 100%;
  max-width: 900px;
  margin: 16px auto 0;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  border: 1px solid #1f2937;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-main {
  height: 40px;
}

.topbar-text {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
}

.topbar-subtitle {
  font-size: 0.8rem;
  color: #9ca3af;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* GŁÓWNA KARTA */

.app {
  width: 100%;
  max-width: 900px;
  margin: 16px 16px 32px;
  background: rgba(2, 6, 23, 0.95);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid #1f2937;
}

h1 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 1.6rem;
  text-align: center;
}

.subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #9ca3af;
  margin-bottom: 20px;
}

.config {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .config {
    grid-template-columns: 1fr;
  }
}

.card {
  background: #020617;
  border-radius: 12px;
  padding: 14px 14px 16px;
  border: 1px solid #111827;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: #f9fafb;
}

label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #d1d5db;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s, background 0.15s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6);
  background: #020617;
}

textarea {
  min-height: 160px;
  resize: vertical;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.35;
}

.small {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 4px;
}

.row {
  margin-bottom: 10px;
}

.row-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.row-inline label {
  margin-bottom: 0;
}

/* Wiersze z selectami */

.preset-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #15803d; /* zielony wojskowy */
  color: white;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

button:hover {
  background: #166534;
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.9);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

button.secondary {
  background: transparent;
  border: 1px solid #374151;
  box-shadow: 0 0 6px rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
}

button.secondary:hover {
  background: #111827;
}

.buttons-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

#results {
  background: #020617;
  border-radius: 12px;
  padding: 14px 14px 16px;
  border: 1px solid #111827;
  max-height: 430px;
  overflow-y: auto;
}

#results.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.9rem;
  font-style: italic;
}

.tournament-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #f9fafb;
}

.meta {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 12px;
}

.match-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 6px;
  color: #e5e7eb;
}

/* kolory sekcji */

.match-section-title.poule-a {
  border-left: 4px solid #22c55e;
  padding-left: 6px;
}

.match-section-title.poule-b {
  border-left: 4px solid #3b82f6;
  padding-left: 6px;
}

.match-section-title.phase-finale {
  border-left: 4px solid #facc15;
  padding-left: 6px;
}

.match-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #111827;
  background: #020617;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.match-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #111827;
  color: #9ca3af;
}

.error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #f97373;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.7rem;
  background: #111827;
  color: #9ca3af;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
}

/* --- tableaux de classement --- */

.standings-card {
  margin-top: 16px;
}

.standings-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.standings-table thead {
  background: #020617;
}

.standings-table th,
.standings-table td {
  border: 1px solid #111827;
  padding: 4px 6px;
  text-align: center;
}

.standings-table th {
  font-weight: 600;
  color: #e5e7eb;
}

.standings-table td.team-name {
  text-align: left;
}

/* małe logo drużyny w tabeli */

.team-logo {
  height: 18px;
  width: 18px;
  object-fit: contain;
  margin-right: 4px;
  vertical-align: middle;
  border-radius: 999px;
  background: #020617;
}

.standings-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #e5e7eb;
}

/* pola na wyniki */

.score-input {
  width: 40px;
  padding: 3px 4px;
  border-radius: 6px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  text-align: center;
  font-size: 0.8rem;
}

.score-input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6);
}

.score-separator {
  margin: 0 4px;
  font-size: 0.8rem;
  color: #9ca3af;
}
