:root {
  --fg: #111;
  --bg: #fff;
  --muted: #666;
  --border: #ddd;
  --accent: #111;
  --accent-contrast: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e8;
    --bg: #111;
    --muted: #999;
    --border: #333;
    --accent: #e8e8e8;
    --accent-contrast: #111;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
}

#sport-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

#sport-tabs-scroll {
  flex: 1 1 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  min-width: 0;
}

.settings-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.settings-overlay.hidden {
  display: none;
}

.settings-panel {
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.settings-panel h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  margin-bottom: 16px;
}

.settings-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0;
}

.sport-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
}

.settings-section-title {
  margin: 24px 0 4px 0 !important;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 18px;
}

.source-group {
  margin-bottom: 14px;
}

.source-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 10px 0 4px 0;
}

.source-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.settings-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 15px;
  cursor: pointer;
}

.settings-save {
  background: var(--accent) !important;
  color: var(--accent-contrast) !important;
  border-color: var(--accent) !important;
}

.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 20px;
  transition: height 0.15s ease-out;
}

.pull-indicator.dragging {
  transition: none;
}

.pull-indicator.spinning #pull-indicator-text {
  display: inline-block;
  animation: pull-spin 0.7s linear infinite;
}

@keyframes pull-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sport-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
}

.sport-tab.active {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 rgba(46, 204, 113, 0.6);
  animation: live-pulse 1.6s infinite;
  vertical-align: middle;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

.badge-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--bg);
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

#news-list {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px;
}

.news-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.news-item .title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.news-item .meta {
  font-size: 13px;
  color: var(--muted);
}

.new-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.load-more-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  text-align: center;
}

.load-more-btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}

.sport-badge {
  display: inline-block;
  padding: 1px 8px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--muted);
}

.sport-badge-fussball { background: #2e7d32; }
.sport-badge-eishockey { background: #1565c0; }
.sport-badge-tennis { background: #9e9d24; }
.sport-badge-basketball { background: #e65100; }
.sport-badge-motorsport { background: #c62828; }
.sport-badge-baseball { background: #6d4c41; }
.sport-badge-boxen-mma { background: #4a148c; }

#detail-view {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.hidden {
  display: none;
}

#detail-view .back {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#detail-view {
  padding-top: calc(56px + env(safe-area-inset-top));
}

#detail-view h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

#detail-view .meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

#detail-view .body {
  font-size: 17px;
  line-height: 1.65;
}

#detail-view .body p {
  margin: 0 0 1em 0;
}

#detail-view .body p:first-of-type {
  font-weight: 600;
}

#detail-view a.original-link {
  display: inline-block;
  margin-top: 12px;
}

.empty {
  color: var(--muted);
  padding: 24px 0;
  text-align: center;
}
