:root {
  --bg: #0c0e12;
  --surface: #151920;
  --surface-hover: #1c222b;
  --border: #2a3340;
  --text: #e8ecf1;
  --text-muted: #8b97a8;
  --accent: #e63946;
  --accent-soft: rgba(230, 57, 70, 0.15);
  --boxing: #f4a261;
  --mma: #2a9d8f;
  --kickboxing: #457b9d;
  --muay-thai: #9b5de5;
  --radius: 12px;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --header-height: 5.5rem;
  --mobile-toolbar-height: 3.35rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(230, 57, 70, 0.12), transparent),
    var(--bg);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
  -webkit-tap-highlight-color: rgba(230, 57, 70, 0.2);
}

.touch-target {
  min-height: var(--touch-min);
}

.touch-input {
  min-height: var(--touch-min);
  font-size: 16px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
}

.auth-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.auth-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.auth-signed-in {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 100%;
  min-width: 0;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-name {
  font-size: 0.9rem;
  color: var(--text);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.btn-auth {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
  box-sizing: border-box;
}

.btn-auth:hover {
  background: var(--surface-hover);
  border-color: #3d4a5c;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn-google-label--short {
  display: none;
}

.auth-hint--mobile {
  display: none;
}

.btn-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 700;
  font-size: 0.8rem;
}

.btn-sign-out {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.75rem);
  letter-spacing: 0.04em;
  line-height: 1;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.stats-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-left: auto;
}

.stats-scroll::-webkit-scrollbar {
  display: none;
}

.stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  padding-bottom: 0.15rem;
}

.stat-pill {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  min-height: 2.25rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}

.stat-pill:hover {
  border-color: #3d4a5c;
  color: var(--text);
}

.stat-pill:active {
  transform: scale(0.97);
}

.stat-pill.active {
  background: var(--accent-soft);
  border-color: rgba(230, 57, 70, 0.5);
  color: #ff8a94;
}

.stat-pill.active strong {
  color: inherit;
}

.stat-pill-boxing.active {
  background: rgba(244, 162, 97, 0.18);
  border-color: rgba(244, 162, 97, 0.45);
  color: var(--boxing);
}

.stat-pill-boxing.active strong {
  color: var(--boxing);
}

.stat-pill-mma.active {
  background: rgba(42, 157, 143, 0.18);
  border-color: rgba(42, 157, 143, 0.45);
  color: var(--mma);
}

.stat-pill-mma.active strong {
  color: var(--mma);
}

.stat-pill-kickboxing.active {
  background: rgba(69, 123, 157, 0.18);
  border-color: rgba(69, 123, 157, 0.45);
  color: var(--kickboxing);
}

.stat-pill-kickboxing.active strong {
  color: var(--kickboxing);
}

.stat-pill-muay-thai.active {
  background: rgba(155, 93, 229, 0.18);
  border-color: rgba(155, 93, 229, 0.45);
  color: var(--muay-thai);
}

.stat-pill-muay-thai.active strong {
  color: var(--muay-thai);
}

.stat-pill strong {
  color: var(--text);
  font-weight: 600;
}

.mobile-toolbar {
  display: none;
}

.filters-drawer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--safe-top) + 0.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100dvh - var(--header-height) - var(--safe-top) - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.sidebar-card {
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.run-time-panel > label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.run-time-hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.run-time-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.run-preset {
  padding: 0.65rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.run-preset:hover {
  border-color: var(--accent);
}

.run-preset.active {
  background: var(--accent-soft);
  border-color: rgba(230, 57, 70, 0.5);
  color: #ff8a94;
}

.run-time-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

input[type="number"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input[type="number"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-run-find {
  min-height: var(--touch-min);
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn-run-find:hover {
  opacity: 0.9;
}

.run-time-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.btn-clear-run,
.btn-run-refresh {
  flex: 1;
  min-width: 7rem;
  min-height: var(--touch-min);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-clear-run {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.btn-clear-run:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-run-refresh {
  border: 1px solid rgba(230, 57, 70, 0.45);
  background: var(--accent-soft);
  color: #ff8a94;
}

.btn-run-refresh:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.run-rec-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.run-rec-header .btn-run-refresh {
  flex: 0 0 auto;
  min-width: auto;
  padding: 0.55rem 0.85rem;
}

.run-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.run-rec-actions .btn-clear-run,
.run-rec-actions .btn-run-refresh {
  flex: 1 1 auto;
  min-width: 7rem;
  width: auto;
  margin-top: 0;
}

.run-rec-stack-fights {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.run-rec-stack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.run-rec-stack-row span {
  color: var(--text);
}

.btn-clear-run {
  width: auto;
  margin-top: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  background: transparent;
  text-decoration: none;
}

.btn-clear-run:hover {
  text-decoration: none;
}

.run-recommendations {
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-radius: var(--radius);
}

.run-rec-heading {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  letter-spacing: 0.03em;
}

.run-rec-sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.run-rec-section {
  margin-top: 1rem;
}

.run-rec-section:first-of-type {
  margin-top: 0;
}

.run-rec-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.run-rec-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.run-rec-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.run-rec-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

@media (min-width: 520px) {
  .run-rec-item {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .run-rec-item-body {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    min-width: 12rem;
  }
}

.run-rec-item.best-match {
  border-color: rgba(230, 57, 70, 0.45);
  background: var(--accent-soft);
}

.run-rec-fighters {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-word;
}

.run-rec-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.run-rec-item a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(230, 57, 70, 0.35);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ff8a94;
  text-decoration: none;
  white-space: nowrap;
}

.run-rec-item a:hover {
  background: var(--accent);
  color: #fff;
}

.run-rec-stack {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.fight-card.run-pick {
  border-color: rgba(230, 57, 70, 0.45);
  box-shadow: 0 0 0 1px rgba(230, 57, 70, 0.15);
}

.run-pick-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fight-card.is-watched {
  opacity: 0.55;
}

.fight-card.is-watched .fighters {
  color: var(--text-muted);
}

.watched-filter-group {
  padding-bottom: 0.15rem;
}

.watched-filter-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--touch-min);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
}

.watched-filter-label input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.watched-progress {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-reset-watched {
  margin-top: 0.5rem;
  padding: 0.35rem 0;
  min-height: var(--touch-min);
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-align: left;
}

.btn-reset-watched:hover {
  color: var(--text);
}

.watched-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch-min);
  margin-bottom: 0.65rem;
  padding: 0.15rem 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.watched-control input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.watched-control.is-checked {
  color: #7dcea0;
}

.run-rec-item.is-watched-rec {
  opacity: 0.7;
}

/* Search & filters panel */
.filters-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

input[type="search"],
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input[type="search"]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-reset {
  margin-top: 0.25rem;
  min-height: var(--touch-min);
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-reset:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.content {
  min-width: 0;
}

.results-count {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.fight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

.fight-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, transform 0.15s;
}

@media (hover: hover) and (pointer: fine) {
  .fight-card:hover {
    border-color: #3d4a5c;
    transform: translateY(-2px);
  }
}

.fight-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sport-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sport-badge.boxing { background: rgba(244, 162, 97, 0.2); color: var(--boxing); }
.sport-badge.mma { background: rgba(42, 157, 143, 0.2); color: var(--mma); }
.sport-badge.kickboxing { background: rgba(69, 123, 157, 0.2); color: var(--kickboxing); }
.sport-badge.muay-thai { background: rgba(155, 93, 229, 0.2); color: var(--muay-thai); }

.fight-year {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fighters {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  letter-spacing: 0.02em;
  line-height: 1.15;
  word-break: break-word;
}

.event {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  word-break: break-word;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.meta-item dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.meta-item dd {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.watch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: auto;
  min-height: var(--touch-min);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(230, 57, 70, 0.35);
  color: #ff8a94;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.watch-link:hover {
  background: var(--accent);
  color: #fff;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.site-footer {
  max-width: 1400px;
  margin: 1.5rem auto 0;
  padding: 1.25rem 1.25rem calc(1.25rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Tablet & phone */
@media (max-width: 900px) {
  :root {
    --header-height: 6.5rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    align-items: stretch;
    width: 100%;
  }

  .auth-bar,
  .auth-hint,
  .auth-signed-in {
    align-items: stretch;
  }

  .stats-scroll {
    width: 100%;
    margin-left: 0;
  }

  .mobile-toolbar {
    display: flex;
    gap: 0.5rem;
    position: sticky;
    top: calc(var(--header-height) + var(--safe-top));
    z-index: 18;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    background: rgba(12, 14, 18, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-run-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
  }

  .mobile-run-group .mobile-tool-btn {
    flex: 1;
    min-width: 0;
  }

  .mobile-clear-run {
    flex: 0 0 var(--touch-min);
    width: var(--touch-min);
    min-height: var(--touch-min);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .mobile-clear-run:hover {
    background: var(--surface-hover);
    border-color: #3d4a5c;
    color: var(--text);
  }

  .mobile-tool-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: var(--touch-min);
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    position: relative;
  }

  .mobile-tool-btn:hover {
    background: var(--surface-hover);
    border-color: #3d4a5c;
  }

  .mobile-tool-btn.is-active {
    background: var(--accent-soft);
    border-color: rgba(230, 57, 70, 0.5);
    color: #ff8a94;
  }

  .mobile-tool-btn.is-open {
    background: var(--surface-hover);
    border-color: #4a5a70;
  }

  .mobile-tool-btn.has-active-run:not(.is-open) {
    background: var(--accent-soft);
    border-color: rgba(230, 57, 70, 0.45);
    color: #ff8a94;
  }

  .mobile-tool-icon {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.9;
  }

  .mobile-tool-label {
    white-space: nowrap;
  }

  .mobile-tool-badge {
    position: absolute;
    top: 0.35rem;
    right: 0.55rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
  }

  .main {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem 1rem 1rem;
  }

  .content {
    order: 2;
  }

  .sidebar {
    order: 1;
    position: static;
    max-height: none;
    overflow: visible;
    gap: 0.65rem;
  }

  .sidebar:not(.is-run-open):not(.is-filters-open) {
    display: none;
  }

  .sidebar .run-time-panel,
  .sidebar .filters-drawer {
    display: none;
  }

  .sidebar.is-run-open .run-time-panel {
    display: block;
  }

  .sidebar.is-filters-open .filters-drawer {
    display: flex;
  }

  .run-recommendations:not(.hidden) {
    scroll-margin-top: calc(
      var(--header-height) + var(--safe-top) + var(--mobile-toolbar-height) + 0.75rem
    );
  }
}

/* Phone */
@media (max-width: 640px) {
  .header-inner {
    padding: 0.85rem 1rem;
  }

  .mobile-toolbar {
    padding: 0.5rem 1rem;
  }

  .main {
    padding: 0.65rem 1rem 1rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .auth-bar {
    gap: 0.45rem;
  }

  .auth-hint {
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .auth-hint--desktop {
    display: none;
  }

  .auth-hint--mobile {
    display: block;
  }

  .btn-google {
    width: 100%;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
  }

  .btn-google-label--long {
    display: none;
  }

  .btn-google-label--short {
    display: inline;
  }

  .auth-signed-in {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      "avatar name"
      "signout signout";
    gap: 0.45rem 0.65rem;
    align-items: center;
    width: 100%;
  }

  .auth-avatar,
  .auth-avatar-fallback {
    grid-area: avatar;
    width: 32px;
    height: 32px;
  }

  .auth-name {
    grid-area: name;
    max-width: none;
    font-size: 0.95rem;
  }

  .btn-sign-out {
    grid-area: signout;
    width: 100%;
    margin-top: 0.1rem;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0.85rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    align-items: stretch;
    min-width: 0;
  }

  .auth-bar,
  .auth-hint,
  .auth-signed-in {
    align-items: stretch;
    text-align: left;
  }

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

  .stats-scroll {
    margin-left: 0;
    margin-right: -0.25rem;
  }

  .run-time-input-row {
    grid-template-columns: 1fr;
  }

  .btn-run-find {
    width: 100%;
  }

  .run-time-actions {
    flex-direction: column;
  }

  .btn-clear-run,
  .btn-run-refresh {
    width: 100%;
    min-width: 0;
  }

  .run-rec-header {
    flex-direction: column;
    align-items: stretch;
  }

  .run-rec-actions {
    width: 100%;
  }

  .run-rec-actions .btn-clear-run,
  .run-rec-actions .btn-run-refresh {
    width: 100%;
    min-width: 0;
  }

  .run-rec-item a {
    width: 100%;
  }

  .fight-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    gap: 0.5rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .main {
    grid-template-columns: 300px 1fr;
    gap: 2rem;
  }

  .fight-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
