/* ── Custom properties ───────────────────────────────────────────────────── */
:root {
  --glass-bg: rgba(255, 255, 255, 0.10);
  --glass-bg-hover: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.20);
  --accent: #7c9ef8;
  --accent-dark: #4a6cf7;
  --liverpool: #f56565;
  --text: #f0f4ff;
  --text-muted: rgba(240, 244, 255, 0.65);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --transition: 0.2s ease;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  background-color: #181426;
}

body {
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
  background-color: #181426;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    url('assets/bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Glass card ──────────────────────────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
header {
  padding: 2.5rem 2rem 1rem;
  text-align: center;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header / Welcome + Clock ────────────────────────────────────────────── */
.welcome {
  font-size: clamp(0.85rem, 4.5vw, 2rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.welcome-main {
  white-space: nowrap;
}

.welcome strong {
  font-weight: 700;
  color: var(--accent);
}

.header-sync-led {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.35rem;
  position: relative;
  top: -0.06em;
  cursor: help;
}

.welcome-clock {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1.4rem;
  color: var(--text-muted);
}

#welcome-clock-time {
  font-weight: 500;
  letter-spacing: 0.04em;
}

#welcome-clock-date {
}

@media (max-width: 767px) {
  .welcome {
    flex-direction: column;
    align-items: center;
  }

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

  .welcome-clock {
    justify-content: center;
    font-size: 0.95rem;
  }
}

@media (min-width: 768px) {
  .welcome {
    gap: 2.25rem;
  }
}

/* ── Search bar ──────────────────────────────────────────────────────────── */
#search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 158, 248, 0.25), var(--shadow);
}

.search-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}
#search-bar.has-value .search-clear-btn {
  opacity: 1;
  pointer-events: auto;
}
.search-clear-btn:hover {
  color: var(--text);
  background: var(--glass-bg-hover);
}

.search-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 0.85rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition), background var(--transition);
}
.search-google-btn:hover { opacity: 1; background: var(--glass-bg-hover); }
.search-google-btn img { display: block; }

.search-settings-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 0.72rem 0.72rem;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow);
  cursor: pointer; flex-shrink: 0; color: var(--text-muted); opacity: 0.7;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.search-settings-btn:hover { opacity: 1; background: var(--glass-bg-hover); color: var(--text); }
.search-settings-btn.active { opacity: 1; color: var(--accent); }
.search-settings-btn svg { width: 18px; height: 18px; display: block; }

@media (max-width: 600px) {
  #search-input { padding: 0.6rem 1rem; font-size: 1rem; }
  .search-clear-btn { min-width: 40px; min-height: 40px; padding: 0.4rem; font-size: 1.1rem; }
  .search-google-btn { padding: 0.52rem 0.65rem; }
  .search-settings-btn { padding: 0.52rem 0.52rem; }
}

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
#tab-bar {
  display: flex; gap: 0.5rem; padding: 0.25rem;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  padding: 0.45rem 1.1rem; border: none;
  border-radius: calc(var(--radius) - 2px); background: transparent;
  color: var(--text-muted); font-family: inherit; font-size: 0.88rem;
  font-weight: 500; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.tab-btn.active {
  background: var(--glass-bg-hover); color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 1.5rem; }

@media (max-width: 600px) {
  .tab-btn { padding: 0.3rem 0.75rem; font-size: 0.82rem; }
}

/* ── Sort bar ────────────────────────────────────────────────────────────── */
#sort-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
}
#sort-bar.visible { display: flex; }
.sort-toggle-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  flex: 1;
  padding: 0.35rem 0.85rem; background: var(--glass-bg);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  color: var(--text-muted); font-family: inherit; font-size: 0.82rem;
  cursor: pointer; backdrop-filter: blur(14px); white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.sort-toggle-btn:hover { background: var(--glass-bg-hover); color: var(--text); }
.sort-icon { font-size: 1rem; line-height: 1; }

.sort-mode-btn { justify-content: flex-start; }

@media (max-width: 600px) {
  .sort-toggle-btn { font-size: 0.72rem; padding: 0.28rem 0.6rem; }
}

/* ── Click stat ──────────────────────────────────────────────────────────── */
.click-stat {
  display: inline-flex; align-items: center; gap: 0.15rem;
  font-size: 0.68rem; color: var(--text-muted); white-space: nowrap;
  flex-shrink: 0; cursor: default;
}
.click-icon-svg { width: 10px; height: 10px; display: block; flex-shrink: 0; }
.click-value { font-weight: 600; }

/* ── Links section ───────────────────────────────────────────────────────── */
#links {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.category-group {}

.category-header {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .links-grid { grid-template-columns: 1fr; }
  main { padding: 0 0.75rem 4rem; gap: 1rem; }
  .glass-card { padding: 1rem 0.9rem; }
  .link-card { padding: 0.5rem 0.75rem; min-height: 44px; }
  .tab-panel.active { gap: 1rem; }
}

/* ── Link card ───────────────────────────────────────────────────────────── */
.link-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  min-height: 48px;
}

.link-card:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.link-card:active {
  transform: translateY(0);
}

.link-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
}

.link-logo-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(124, 158, 248, 0.25);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.link-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.link-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.link-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.link-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.link-project {
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.85;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-project:hover {
  opacity: 1;
}

/* ── Umami stats ─────────────────────────────────────────────────────────── */
.umami-stat {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.7rem; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  cursor: default;
}
.umami-stat.umami-clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--glass-border);
  background-color: var(--glass-bg);
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}
.umami-stat.umami-clickable:hover {
  background-color: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.55);
}
.umami-icon { font-size: 0.8rem; }
.umami-value { color: var(--text); }
.umami-diff.up, .umami-arrow.up { color: #4cdb87; }
.umami-diff.down, .umami-arrow.down { color: #f56565; }
.umami-diff.neutral, .umami-arrow.neutral { color: var(--text-muted); }

/* ── Weather widget ──────────────────────────────────────────────────────── */
#weather {
  overflow: hidden;
  cursor: pointer;
  padding-top: 0.4rem;
  padding-bottom: 0.7rem;
}

/* Summary row — always visible */
.weather-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.weather-summary-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.weather-location {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.weather-summary-now {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.weather-summary-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

.weather-summary-temp {
  font-weight: 700;
  font-size: 1.1rem;
}

.weather-summary-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Chevron toggle button */
.weather-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform var(--transition), color var(--transition);
}

.weather-toggle:hover {
  color: var(--text);
}

#weather.weather-expanded .weather-toggle {
  transform: rotate(180deg);
}

/* Collapsible detail */
.weather-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, margin-top 0.35s ease;
}

#weather.weather-expanded .weather-detail {
  max-height: 900px;
  margin-top: 1rem;
}

.weather-updated {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* 24-hour strip */
.weather-hourly {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.weather-hourly::-webkit-scrollbar {
  height: 4px;
}

.weather-hourly::-webkit-scrollbar-track {
  background: transparent;
}

.weather-hourly::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.hour-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 52px;
  padding: 0.4rem 0.3rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.hour-item.current-hour {
  background: rgba(124, 158, 248, 0.18);
  border: 1px solid rgba(124, 158, 248, 0.35);
}

.hour-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.hour-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.hour-temp {
  font-weight: 600;
}

.hour-precip {
  color: #7ec8f4;
  font-size: 0.68rem;
}

/* 7-day grid */
.weather-daily-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.weather-daily {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

/* iPhone 14 (390px) — keep all 7 days on one row with compact sizing */
@media (max-width: 480px) {
  .weather-daily {
    gap: 0.25rem;
  }

  .day-item {
    padding: 0.3rem 0.1rem;
    gap: 0.1rem;
    font-size: 0.65rem;
  }

  .day-name {
    font-size: 0.58rem;
  }

  .day-icon {
    font-size: 1rem;
  }

  .day-temps {
    flex-direction: column;
    gap: 0;
    font-size: 0.62rem;
  }
}

.day-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.2rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  text-align: center;
}

.day-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-icon {
  font-size: 1.3rem;
}

.day-temps {
  display: flex;
  gap: 0.25rem;
  font-size: 0.75rem;
}

.day-high {
  font-weight: 600;
}

.day-low {
  color: var(--text-muted);
}

.weather-error {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem 0;
}

.weather-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem 0;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ── Loading / empty states ──────────────────────────────────────────────── */
.links-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.no-results {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
}

.section-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
  font-style: italic;
}

/* ── Reset stats button ──────────────────────────────────────────────────── */
#links-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}
.sync-auth-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
  max-width: 28rem;
}
.sync-auth-led {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: help;
}
.sync-auth-led--signed-in {
  background: #22c55e;
}
.sync-auth-led--signed-out {
  background: #ef4444;
}
.sync-auth-label {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.65rem;
  opacity: 0.85;
}
.sync-auth-email {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: var(--text-main, #e8e6f0);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  min-width: 10rem;
  max-width: 14rem;
}
.sync-auth-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.sync-auth-btn:hover {
  border-color: rgba(129, 140, 248, 0.45);
  color: #a5b4fc;
}
.sync-auth-status {
  flex-basis: 100%;
  width: 100%;
  font-size: 0.7rem;
  opacity: 0.9;
  text-align: center;
}

.sync-debug-panel {
  flex-basis: 100%;
  width: 100%;
  max-width: 36rem;
  margin-top: 0.5rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.65rem;
  color: rgba(230, 230, 250, 0.9);
}
.sync-debug-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.35rem;
}
.sync-debug-title {
  font-size: 0.7rem;
}
.sync-debug-hint {
  flex: 1 1 100%;
  opacity: 0.75;
  font-size: 0.6rem;
  line-height: 1.35;
}
.sync-debug-hint code {
  font-size: 0.58rem;
  opacity: 0.95;
}
.sync-debug-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: inherit;
  font-family: inherit;
  font-size: 0.6rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}
.sync-debug-log {
  margin: 0;
  max-height: 14rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 0.58rem;
  line-height: 1.4;
  color: rgba(200, 220, 255, 0.95);
}
.reset-stats-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.reset-stats-btn:hover {
  border-color: rgba(245, 101, 101, 0.5);
  color: #f56565;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ── Football ────────────────────────────────────────────────────────────── */
#premier-league { overflow-x: auto; }

.pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.pl-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}
.pl-table th.num, .pl-table td.num { text-align: right; width: 36px; }
.pl-table th.pts, .pl-table td.pts { text-align: right; width: 36px; font-weight: 700; }
.pl-table th.pos, .pl-table td.pos { width: 28px; color: var(--text-muted); font-size: 0.76rem; }
.pl-table td {
  padding: 0.38rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.pl-table tr:last-child td { border-bottom: none; }
.pl-table tr.liverpool-row {
  background: rgba(245, 101, 101, 0.08);
  border-left: 3px solid var(--liverpool);
}
.pl-table tr.liverpool-row td:first-child { padding-left: calc(0.5rem - 3px); }
.team-crest {
  width: 16px; height: 16px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.4rem;
}
.team-name-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

@media (max-width: 600px) {
  .pl-table { font-size: 0.72rem; }
  .pl-table th, .pl-table td { padding: 0.25rem 0.25rem; }
  .pl-table th.num, .pl-table td.num { width: 24px; }
  .pl-table th.pts, .pl-table td.pts { width: 24px; }
  .pl-table th.pos, .pl-table td.pos { width: 18px; font-size: 0.72rem; }
  .team-name-cell { max-width: 90px; }
  .pl-table .team-crest { width: 14px; height: 14px; margin-right: 0.25rem; }
}

/* ── Liverpool fixtures ──────────────────────────────────────────────────── */
.fixtures-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.fixtures-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.fixture-countdown {
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
}
.fixture-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
}
.fixture-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.fixture-time { opacity: 0.8; }

@media (max-width: 600px) {
  .fixture-date {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    min-width: 66px;
  }
}

/* ── GitHub heatmap ──────────────────────────────────────────────────────── */
.heatmap-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.heatmap-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  margin-left: 26px; /* width of weekday label column */
  font-size: 0.65rem;
  color: var(--text-muted);
}

.heatmap-month-label {
  text-align: left;
}

.heatmap-body {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.heatmap-weekdays {
  width: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding-top: 2px;
  padding-bottom: 2px;
}

.heatmap-weekday-label {
  line-height: 1;
}

.heatmap-grid {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  /* Each column stretches to share the full width */
  grid-auto-columns: minmax(0, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
}

.heatmap-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.heatmap-cell.level-0 { background: rgba(255, 255, 255, 0.04); }
.heatmap-cell.level-1 { background: rgba(124, 158, 248, 0.20); }
.heatmap-cell.level-2 { background: rgba(124, 158, 248, 0.35); }
.heatmap-cell.level-3 { background: rgba(124, 158, 248, 0.55); }
.heatmap-cell.level-4 { background: rgba(124, 158, 248, 0.8); }

@media (max-width: 600px) {
  .heatmap-months {
    font-size: 0.55rem;
  }

  .heatmap-weekdays {
    font-size: 0.55rem;
  }

  /* On small screens, only show every 3rd month label to reduce clutter */
  .heatmap-months .heatmap-month-label {
    visibility: hidden;
  }

  .heatmap-months .heatmap-month-label:nth-child(3n + 1) {
    visibility: visible;
  }
}

.heatmap-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.heatmap-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.heatmap-updated {
  opacity: 0.8;
}

/* ── BBC headlines ───────────────────────────────────────────────────────── */
.headline-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.headline-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.headline-source {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.headline-title {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  flex: 1;
  min-width: 0;
}

.headline-title:hover {
  color: var(--accent);
}

.headline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.headline-missing {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.headline-logo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  background: #ffffff1a;
  color: #fff;
}
.headline-logo-pill.news {
  background: #bb19191f;
}
.headline-logo-pill.sport {
  background: #ffe0001f;
  color: #ffe000;
}

@media (min-width: 768px) {
  .headline-source {
    margin-right: 2rem;
  }
}

@media (max-width: 600px) {
  .headline-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "source time"
      "title title";
    align-items: baseline;
    row-gap: 0.15rem;
  }

  .headline-source {
    grid-area: source;
    margin-right: 0;
  }

  .headline-title {
    grid-area: title;
  }

  .headline-time {
    grid-area: time;
    justify-self: end;
    margin-left: 0;
  }
}

/* ── Crypto BTC → GBP ───────────────────────────────────────────────────── */
.crypto-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.crypto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.crypto-header-main {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.crypto-label {
  font-weight: 600;
}

.crypto-price {
  font-weight: 600;
}

.crypto-delta {
  font-size: 0.8rem;
}

.crypto-delta.up { color: #4cdb87; }
.crypto-delta.down { color: #f56565; }
.crypto-delta.flat { color: var(--text-muted); }

.crypto-range-bar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.crypto-range-btn {
  flex: 0 0 auto;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.crypto-range-btn.active {
  background: var(--glass-bg-hover);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.6);
}

.crypto-chart {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 2;
  margin-top: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.crypto-line {
  stroke: rgba(124, 158, 248, 0.95);
  stroke-width: 0.9;
  stroke-linejoin: round;
  stroke-linecap: round;
}

@media (max-width: 600px) {
  .crypto-header {
    flex-wrap: wrap;
  }

  .crypto-range-bar {
    flex-wrap: wrap;
  }
}

.crypto-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  display: flex;
  align-items: center;
}

.crypto-toggle:hover {
  color: var(--text);
}

#crypto-btc-gbp:not(.crypto-expanded) .crypto-chart {
  display: none;
}

.fixture-teams {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: wrap;
}
.fixture-team { display: flex; align-items: center; gap: 0.3rem; font-weight: 500; }
.fixture-team.liverpool { color: var(--liverpool); }
.fixture-vs { color: var(--text-muted); font-size: 0.75rem; flex-shrink: 0; }
.fixture-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

@media (max-width: 600px) {
  .fixture-meta {
    flex-direction: column;
    align-items: flex-end;
    white-space: normal;
    gap: 0;
  }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

footer a {
  color: var(--text-muted);
  transition: color var(--transition);
}

footer a:hover {
  color: var(--text);
}

.footer-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* ── Scroll-to-top FAB ───────────────────────────────────────────────────── */
#scroll-top-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  z-index: 100;
}

#scroll-top-fab.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#scroll-top-fab:hover {
  background: var(--glass-bg-hover);
}

#scroll-top-fab svg {
  width: 20px;
  height: 20px;
}

/* ── Reset stats modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  max-width: 360px;
  width: calc(100% - 3rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
}
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.modal-option-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
}
.modal-option-btn:hover { background: var(--glass-bg-hover); }
.modal-option-danger { border-color: rgba(245, 101, 101, 0.4); color: #f56565; }
.modal-option-danger:hover { background: rgba(245, 101, 101, 0.1); border-color: rgba(245, 101, 101, 0.7); }
.modal-cancel-btn {
  width: 100%;
  padding: 0.5rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.modal-cancel-btn:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--text); }
