:root {
  --jnd-pink: #dd0057;
  --jnd-pink-dark: #b30046;
  --jnd-ink: #1d1d1d;
  --bg: #1d1d1d;
  --surface: #262626;
  --surface-2: #2f2f2f;
  --surface-3: #3a3a3a;
  --text: #f6f6f7;
  --text-dim: #a8a8ad;
  --border: #383838;
  --green: #34c759;
  --amber: #ff9f0a;
  --radius: 16px;
  --header-h: 60px;
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ---------- Header ---------- */
.app-header {
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--jnd-pink), var(--jnd-pink-dark));
  padding-top: var(--safe-top);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.app-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__badge {
  background: #fff;
  color: var(--jnd-pink);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__title {
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__sub {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
}

/* ---------- Topbar (team-keuze) ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--safe-top)) 14px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.team-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-picker__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
}

.team-picker__select {
  position: relative;
  min-width: 0;
}

.team-picker__select::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--jnd-pink);
  pointer-events: none;
  font-size: 12px;
}

#teamSelect {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 30px 8px 14px;
  max-width: 60vw;
  text-overflow: ellipsis;
  cursor: pointer;
}

#teamSelect:focus {
  outline: none;
  border-color: var(--jnd-pink);
}

#teamSelect option,
#teamSelect optgroup {
  background: var(--surface);
  color: var(--text);
}

/* Banner met gekozen team */
.team-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(221, 0, 87, 0.18), rgba(221, 0, 87, 0.05));
  border: 1px solid rgba(221, 0, 87, 0.4);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.team-banner strong {
  display: block;
  font-size: 15px;
}

.team-banner__sub {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 1px;
}

/* ---------- Main / scroll area ---------- */
.app-main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(20px + var(--safe-bottom));
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  margin: 18px 2px 10px;
  font-weight: 700;
}

.section-title:first-child {
  margin-top: 4px;
}

.section-title .count {
  color: var(--jnd-pink);
  font-weight: 800;
}

.page-title {
  font-size: 22px;
  font-weight: 900;
  margin: 2px 0 14px;
  letter-spacing: -0.3px;
}

/* ---------- Filter chips (Powerweekend-stijl) ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  margin: 0 -2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip.active {
  background: var(--jnd-pink);
  border-color: var(--jnd-pink);
  color: #fff;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(150deg, rgba(221, 0, 87, 0.22), rgba(221, 0, 87, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}

.hero__tagline {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 14px;
}

.hero__meta {
  display: grid;
  gap: 8px;
}

.hero__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.hero__row .ico {
  font-size: 16px;
}

/* highlights */
.highlights {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.highlight {
  flex: 1 1 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.highlight .h-ico {
  font-size: 20px;
}

.highlight .h-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 4px;
}

/* foreword card */
.fw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.fw-card h2 {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 12px;
}

.fw-card p {
  font-size: 14.5px;
  color: #d8d8da;
  margin: 0 0 12px;
  line-height: 1.6;
}

.fw-greeting {
  font-weight: 700;
  color: var(--text);
}

.fw-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.fw-block h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--jnd-pink);
}

.fw-subgroup {
  margin-bottom: 12px;
}

.fw-subgroup h4 {
  font-size: 13.5px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}

.fw-list {
  margin: 0 0 6px;
  padding-left: 18px;
}

.fw-list li {
  font-size: 14px;
  color: #d6d6d8;
  margin-bottom: 6px;
  line-height: 1.5;
}

.fw-note {
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 8px 0 0;
  line-height: 1.55;
}

.fw-sign {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.fw-sign .name {
  font-weight: 800;
  color: var(--jnd-pink);
  font-size: 14px;
}

.fw-sign .role {
  font-size: 12.5px;
  color: var(--text-dim);
}

/* key times */
.keytimes {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.keytimes li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  font-size: 14px;
}

.keytimes li:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.keytimes .kt-time {
  font-weight: 800;
  color: var(--jnd-pink);
  width: 48px;
  flex: 0 0 auto;
}

/* ---------- Matches ---------- */
.match-group {
  margin-bottom: 18px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.match-card.is-live {
  border-color: rgba(52, 199, 89, 0.55);
  box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.25);
}

.match-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.match-card__badge {
  background: var(--surface-3);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.match-card__badge.live {
  background: rgba(52, 199, 89, 0.18);
  color: var(--green);
}

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.match-team.away {
  flex-direction: row-reverse;
  text-align: right;
}

.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--jnd-pink);
}

.match-score {
  font-weight: 900;
  font-size: 18px;
  min-width: 58px;
  text-align: center;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 6px 4px;
}

.match-score.live {
  color: var(--green);
}

.match-score.upcoming {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
}

/* ---------- Poules ---------- */
.poule-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.poule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.poule-card__head {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.poule-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px 8px;
}

.poule-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 0;
  line-height: 1.25;
}

.poule-list .pl-num {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
}

.poule-list .pl-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poule-list .team-dot {
  width: 8px;
  height: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.table th,
.table td {
  padding: 9px 6px;
  font-size: 13px;
  text-align: center;
}

.table th {
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.3px;
}

.table td.team-name,
.table th.team-name {
  text-align: left;
  font-weight: 600;
}

.table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}

.table .pos {
  color: var(--text-dim);
  width: 22px;
}

.table tr.qualify td.pos {
  color: var(--green);
  font-weight: 900;
}

.table td.pts {
  font-weight: 900;
  color: var(--jnd-pink);
}

.legend {
  font-size: 12px;
  color: var(--text-dim);
  margin: 6px 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

/* ---------- Teams ---------- */
.team-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 14px;
}

.team-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.team-row .team-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
}

.team-row__name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-row__poule {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Line-up ---------- */
.lineup-block {
  margin-bottom: 22px;
}

.lineup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  margin: 0 2px 12px;
}

.lineup-head .pin {
  color: var(--jnd-pink);
}

.act-card {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--jnd-pink);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.act-time {
  font-weight: 900;
  font-size: 13px;
  color: var(--jnd-pink);
  white-space: nowrap;
}

.act-main {
  min-width: 0;
}

.act-name {
  font-size: 15px;
  font-weight: 700;
}

.act-card.is-live {
  border-color: var(--green);
  border-left-color: var(--green);
  background: rgba(52, 199, 89, 0.08);
}

.act-card.is-live .act-time {
  color: var(--green);
}

.act-card.is-done {
  opacity: 0.55;
}

.act-badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
}

.act-badge.live {
  background: rgba(52, 199, 89, 0.18);
  color: var(--green);
}

/* ---------- Gekozen team markeren ---------- */
.match-team.is-mine {
  color: var(--jnd-pink);
  font-weight: 800;
}

.poule-list li.is-mine {
  color: var(--jnd-pink);
  font-weight: 800;
}

.poule-list li.is-mine .pl-num {
  color: var(--jnd-pink);
}

.team-row.is-mine {
  background: rgba(221, 0, 87, 0.12);
}

.team-row.is-mine .team-row__name {
  color: var(--jnd-pink);
  font-weight: 800;
}

/* ---------- Rules ---------- */
.rule-intro {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 2px 16px;
  line-height: 1.6;
}

.rule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.rule-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 9px;
}

.rule-card h3 .num {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  background: var(--jnd-pink);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rule-list {
  margin: 0;
  padding-left: 18px;
}

.rule-list li {
  font-size: 14px;
  color: #d2d2d4;
  margin-bottom: 7px;
  line-height: 1.5;
}

/* ---------- Tabbar ---------- */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  background: #161616;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 10;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 8px 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  height: var(--tabbar-h);
  justify-content: center;
  transition: color 0.15s ease;
}

.tab .tab-ico {
  font-size: 19px;
  line-height: 1;
}

.tab .tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active {
  color: var(--jnd-pink);
}

/* ---------- Loader / empty ---------- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 60vh;
  color: var(--text-dim);
}

.loader__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--jnd-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  animation: fade 0.25s ease;
}

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

@media (min-width: 460px) {
  .team-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  .fade-in,
  .loader__spinner {
    animation: none !important;
  }
}
