:root {
  --g-dark:   #1b5e20;
  --g-med:    #2e7d32;
  --g-light:  #4caf50;
  --g-bg:     #e8f5e9;
  --text:     #212121;
  --text-dim: #757575;
  --bg:       #f0f4f0;
  --card:     #ffffff;
  --border:   #e0e0e0;
  --shadow:   0 1px 3px rgba(0,0,0,.12);
  --radius:   8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

/* ── Header ── */
.app-header {
  background: var(--g-dark);
  color: #fff;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
}
h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: .2px; }
.subtitle { font-size: .72rem; opacity: .75; margin-top: 2px; }

.refresh-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.refresh-btn:hover { background: rgba(255,255,255,.28); }
.refresh-btn.spinning .ri { display: inline-block; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tab Bar ── */
.tab-bar {
  background: var(--g-med);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 58px;
  z-index: 9;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  min-width: 80px;
  padding: 11px 6px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.65);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.tab.active { color: #fff; border-bottom-color: #fff; }
.tab:not(.active):hover { color: rgba(255,255,255,.88); }

/* ── Content ── */
.content {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 10px 10px 24px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Status Banner ── */
.banner {
  background: #fff8e1;
  border-left: 4px solid #f9a825;
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 8px;
  font-size: .83rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.banner.err { background: #ffebee; border-left-color: #c62828; }
.banner.hidden { display: none; }

/* ── Spinner / Loading ── */
.loading {
  text-align: center;
  padding: 52px 16px;
  color: var(--text-dim);
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--g-light);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto 14px;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  overflow: hidden;
}

/* ── Tabelle ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; min-width: 360px; }
th {
  background: var(--g-dark);
  color: #fff;
  padding: 8px 5px;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
}
th.left, td.left { text-align: left; }
th:first-child, td:first-child { padding-left: 8px; }
td { padding: 8px 5px; text-align: center; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover:not(.hl) { background: #f9f9f9; }
tr.hl { background: var(--g-bg); font-weight: 700; }
tr.hl td { color: var(--g-dark); }
.tname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ── Ergebnisse ── */
.sec-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  padding: 12px 2px 5px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.sec-date {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.filter-btn {
  font-size: .75rem;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--g-med);
  background: transparent;
  color: var(--g-med);
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
}
.filter-btn.active { background: var(--g-med); color: #fff; }

.match-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 7px;
  overflow: hidden;
}
.match-card.mw { border-left: 3px solid var(--g-light); }
.match-meta {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  background: var(--g-bg);
  font-size: .68rem;
  color: var(--text-dim);
  font-weight: 600;
}
.match-body {
  display: flex;
  align-items: center;
  padding: 10px 10px;
  gap: 6px;
}
.mteam {
  flex: 1;
  font-size: .85rem;
  font-weight: 500;
  word-break: break-word;
}
.mteam.home { text-align: right; }
.mteam.away { text-align: left; }
.mteam.bold { font-weight: 700; color: var(--g-dark); }
.mscore {
  flex-shrink: 0;
  min-width: 54px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--bg);
  padding: 4px 6px;
  border-radius: 4px;
}
.mscore.upcoming { font-size: .72rem; font-weight: 400; color: var(--text-dim); background: none; }
.win .mscore  { color: #2e7d32; }
.lose .mscore { color: #c62828; }
.draw .mscore { color: #e65100; }

/* ── Stats lists (Torschützen / Karten) ── */
.stats-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.stats-item:last-child { border-bottom: none; }
.srank { width: 22px; font-size: .75rem; color: var(--text-dim); font-weight: 600; flex-shrink: 0; }
.sicon { font-size: .95rem; flex-shrink: 0; }
.sname { flex: 1; font-size: .88rem; }
.sval  { font-weight: 700; font-size: .95rem; }

.card-group { margin-bottom: 10px; }
.group-title {
  padding: 8px 12px 5px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-dim);
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
  line-height: 1.5;
}

/* ── Footer ── */
.app-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 7px 16px;
  text-align: center;
  font-size: .68rem;
  color: var(--text-dim);
  padding-bottom: calc(7px + env(safe-area-inset-bottom));
}
