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

body {
  background: #020617;
  color: #e5e7eb;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
}

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .app-wrapper {
    padding: 16px 12px;
    border-radius: 12px;
  }
}

.app-wrapper {
  width: 100%;
  max-width: 960px;
  background: #020617;
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  border: 1px solid #111827;
}

.app-header {
  margin-bottom: 18px;
}

.app-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.app-subtitle {
  font-size: 13px;
  color: #9ca3af;
}

.card {
  background: #020617;
  border-radius: 14px;
  border: 1px solid #1f2937;
  padding: 14px;
  margin-bottom: 14px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
}

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

input,
button {
  font-size: 14px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border-radius: 9px;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  outline: none;
  margin-bottom: 8px;
}

input:focus,
select:focus {
  border-color: #3b82f6;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  padding-right: 32px;
}

select option {
  background: #1f2937;
  color: #e5e7eb;
}

.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.row > div {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  margin-top: 8px;
  font-size: 13px;
}

.btn.secondary {
  background: #111827;
  color: #e5e7eb;
}

.btn:active {
  transform: translateY(1px);
}

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

.small {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}

.topbar-user {
  color: #9ca3af;
}

.match-list {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #111827;
  overflow: hidden;
}

.match-row {
  display: grid;
  grid-template-columns: 2.1fr 1.7fr 1.1fr 0.9fr;
  gap: 12px;
  padding: 6px 8px;
  font-size: 12px;
  align-items: center;
  border-bottom: 1px solid #111827;
}

.match-row:last-child {
  border-bottom: none;
}

.match-teams {
  font-weight: 500;
}

.match-date {
  color: #9ca3af;
  font-size: 11px;
}

.score-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.score-inputs input {
  width: 50px;
  text-align: center;
  padding: 8px 6px;
  font-size: 16px;
}

.score-separator {
  font-size: 14px;
  color: #9ca3af;
}

.pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #e5e7eb;
  text-align: center;
}

.pill.gray {
  background: #111827;
}

.pill.green {
  background: #15803d;
}

.text-right {
  text-align: right;
}

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

.no-border {
  border: none !important;
  background: transparent !important;
  padding: 4px 2px !important;
  outline: none !important;
  margin-bottom: 0 !important;
  color: #e5e7eb;
}

.no-border:focus {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 14px;
}

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

  .match-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    row-gap: 4px;
  }

  .match-row > div:nth-child(1) {
    grid-column: 1 / span 1;
  }

  .match-row > div:nth-child(4) {
    grid-column: 1 / span 1;
  }
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: #222;
  color: #eee;
  border: 1px solid #333;
  cursor: pointer;
}

.tab-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.round-header {
  display: flex;
  align-items: center;
  justify-content: center;   /* of space-between als je ze breder wilt */
  gap: 8px;
  margin-bottom: 12px;
}

#round-label {
  font-weight: 600;
  font-size: 14px;
}

.round-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;      /* mooie ronde knop */
  border: 1px solid #444;
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.round-btn:hover {
  background: #222;
  border-color: #777;
}

.round-btn:active {
  transform: scale(0.95);
}

.round-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Algemene layout */
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #050505;
  color: #f5f5f5;
}

/* Centrale container */
.app-container {
  max-width: 900px;      /* mooi voor desktop */
  margin: 0 auto;
  padding: 16px;
}

/* Match list / rows */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* kolommen in een rij mogen krimpen */
.match-row > div {
  flex: 1;
  min-width: 0;
}

.score-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.score-inputs input[type="number"] {
  width: 48px;
}

/* Tabs bovenin */
.tab-bar,
.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 600px) {
  .app-container {
    padding: 12px;
  }

  .tabs {
    position: sticky;
    top: 0;
    background: #1a1a2e;
    z-index: 100;
    padding: 12px 0;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .match-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .match-row > div {
    width: 100%;
  }

  .match-teams,
  .match-date {
    text-align: center;
  }

  .text-right {
    text-align: center;
  }

  .score-inputs {
    justify-content: center;
  }

  .pill {
    display: inline-block;
    margin-top: 4px;
  }

  /* Verberg "Jouw voorspellingen" titel op mobiel */
  #tab-predictions .card-title-row {
    display: none;
  }

  /* Rond-knoppen wat kleiner op mobiel */
  .round-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  /* Tabs full-width */
  .tab-btn {
    flex: 1 1 calc(50% - 8px); /* twee naast elkaar */
  }
}

.locked-match {
  opacity: 0.6;
}

.locked-match input[disabled] {
  cursor: not-allowed;
}

.btn.active {
  background: #4c6ef5;
  color: white;
}

/* ===== RANKING TABEL RESPONSIEF ===== */
.ranking-header {
  background: #111827;
  font-weight: 600;
  padding: 8px 8px !important;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid #1f2937;
  font-size: 11px;
}

/* Specifieke styling voor ranking rows in competitie mode */
.match-list .match-row:not(.ranking-header) {
  padding: 10px 8px;
  font-size: 12px;
}

/* Tablet & boven (min 768px) */
@media (min-width: 768px) {
  .match-list .match-row {
    grid-template-columns: 0.5fr 2.5fr 1.5fr 1.5fr 1fr;
    gap: 12px;
  }

  .ranking-header {
    grid-template-columns: 0.5fr 2.5fr 1.5fr 1.5fr 1fr;
  }
}

/* Tablet: tussen 481px en 767px */
@media (max-width: 767px) and (min-width: 481px) {
  .match-list .match-row {
    grid-template-columns: 0.7fr 2.2fr 1.3fr 1.3fr;
    gap: 8px;
  }

  .ranking-header {
    grid-template-columns: 0.7fr 2.2fr 1.3fr 1.3fr;
  }

  .match-row > div:nth-child(2),
  .match-row > div:nth-child(3),
  .match-row > div:nth-child(4) {
    font-size: 13px;
    word-break: break-word;
  }
}

/* Mobiel: onder 481px - 3 kolommen layout voor RANKING ALLEEN */
@media (max-width: 480px) {
  /* Alleen ranking rows - niet predictions */
  #ranking-container .match-list .match-row {
    display: grid !important;
    grid-template-columns: 0.6fr 2fr 1.2fr !important;
    grid-template-rows: auto auto !important;
    gap: 4px 12px !important;
    padding: 12px 8px !important;
  }

  #ranking-container .match-list .ranking-header {
    grid-template-columns: 0.6fr 2fr 1.2fr !important;
    display: grid !important;
  }

  /* Alle headers zelfde grootte */
  #ranking-container .match-list .ranking-header > div {
    font-size: 10px !important;
  }

  /* Punten header rechts uitlijnen */
  #ranking-container .match-list .ranking-header > div:nth-child(4) {
    text-align: right !important;
    justify-self: end;
  }

  /* Position (#) - kolom 1, beide rijen */
  #ranking-container .match-list .match-row > div:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
  }

  /* Naam - kolom 2, rij 1 */
  #ranking-container .match-list .match-row > div:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    font-weight: 600;
    font-size: 14px;
  }

  /* Team - kolom 2, rij 2 */
  #ranking-container .match-list .match-row > div:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    font-size: 11px;
    color: #9ca3af;
  }

  /* Totaal punten - kolom 3, rij 1 */
  #ranking-container .match-list .match-row > div:nth-child(4) {
    grid-column: 3;
    grid-row: 1;
    font-weight: 600;
    font-size: 14px;
    text-align: right !important;
    justify-self: end;
  }

  /* Ronde punten - kolom 3, rij 2 */
  #ranking-container .match-list .match-row > div:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
    font-size: 11px;
    color: #9ca3af;
    text-align: right !important;
    justify-self: end;
  }

  .pill {
    font-size: 10px;
    padding: 2px 6px;
  }

  .text-right {
    text-align: right;
  }
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #1f2937;
}

.player-row:last-child {
  border-bottom: none;
}

.player-row button {
  flex-shrink: 0;
}

/* Profile warning banner */
.profile-warning {
  background: rgba(34, 197, 94, 0.1);
  color: #d1d5db;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.profile-warning a {
  color: #22c55e;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.profile-warning a:hover {
  color: #4ade80;
  text-decoration: underline;
}
