/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: #1e2a4a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 52px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}
.brand-icon { font-size: 1.3rem; line-height: 1; }

.gym-name {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  text-align: right;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Tab nav ─────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  background: #162039;
  padding: 0 0.5rem;
  gap: 0.25rem;
}
.tab-link {
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  border-bottom: 3px solid transparent;
  transition: color 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.tab-link:hover { color: rgba(255,255,255,0.9); }
.tab-link.active { color: #fff; border-bottom-color: #4fc3f7; }

/* ── Main content ────────────────────────────────────────── */
.main-content {
  padding: 1.25rem 1rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}

/* ── Page intro ──────────────────────────────────────────── */
.page-intro {
  margin-bottom: 1.25rem;
}
.page-intro h1 {
  font-size: 1.35rem;
  font-weight: 700;
}
.page-intro p {
  color: #666;
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ── Gym grid ────────────────────────────────────────────── */
.gym-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.gym-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.gym-card:active { transform: scale(0.98); }

.gym-card-body { flex: 1; min-width: 0; }
.gym-card h2 { font-size: 1.1rem; font-weight: 700; }
.gym-location { color: #777; font-size: 0.8rem; margin-top: 0.2rem; }
.gym-meta { margin-top: 0.75rem; }
.boulder-count {
  font-size: 0.8rem;
  background: #f0f2f5;
  padding: 3px 10px;
  border-radius: 20px;
  color: #555;
  font-weight: 500;
}

.gym-card-colors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.1);
  display: block;
}

/* ── Boulder table card ──────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

thead th {
  background: #f7f8fc;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #999;
  border-bottom: 1px solid #eaecf0;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f0f2f5;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:active { background: #f4f6ff; }

td {
  padding: 0.7rem 0.75rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Column sizing */
.col-number { font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.col-sector { color: #555; }
.col-setter { color: #777; font-size: 0.85rem; }
.col-tops { font-weight: 600; color: #1e2a4a; }
.col-date { color: #aaa; font-size: 0.8rem; white-space: nowrap; }

/* ── Sort link ───────────────────────────────────────────── */
.sort-link {
  color: #999;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  min-height: 36px;
}
.sort-link:hover { color: #333; }
.sort-link.active { color: #1e2a4a; font-weight: 700; }

/* ── Difficulty badge ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
  border: 1.5px solid rgba(0,0,0,0.08);
  letter-spacing: 0.02em;
}
.badge-unknown { background: #eee; color: #999; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: #aaa;
  padding: 3rem 1rem;
  font-size: 0.9rem;
}
.empty-state code {
  background: #f0f2f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
}

/* ── Toolbar (title + action buttons) ───────────────────────── */
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.toolbar .page-intro { margin-bottom: 0; }
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  min-height: 44px;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: #1e2a4a; color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  background: transparent;
  color: #555;
  border: 1.5px solid #ddd;
}
.btn-ghost:hover { background: #f0f2f5; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; min-height: 36px; }

/* row-level retire / restore button */
.btn-row-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
  min-width: 32px;
  min-height: 36px;
  transition: background 0.1s;
}
.btn-retire { color: #bbb; }
.btn-retire:hover { background: #fff0f0; color: #e53935; }
.btn-restore { color: #4CAF50; }
.btn-restore:hover { background: #f0fff0; }
.col-action { padding: 0.4rem 0.5rem; width: 40px; }

/* ── Inactive row ────────────────────────────────────────────── */
.row-inactive td { opacity: 0.4; }
.row-inactive .col-action td { opacity: 1; }

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  padding: 0.8rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash-error   { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* ── Boulder form ────────────────────────────────────────────── */
.boulder-form {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 560px;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.required { color: #e53935; }
.optional { color: #aaa; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.78rem; }

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1e2a4a;
  box-shadow: 0 0 0 3px rgba(30,42,74,0.08);
  background: #fff;
}
.form-group textarea { resize: vertical; min-height: 72px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ── Color picker (radio pills) ──────────────────────────────── */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.color-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.color-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color 0.12s, transform 0.1s, box-shadow 0.12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  justify-content: center;
}
.color-pill:active { transform: scale(0.95); }
.cp-name { font-size: 0.8rem; font-weight: 700; text-transform: capitalize; line-height: 1.2; }
.cp-range { font-size: 0.65rem; opacity: 0.8; line-height: 1.2; }
.color-option input[type="radio"]:checked + .color-pill {
  border-color: #1e2a4a;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transform: scale(1.06);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.form-actions .btn { flex: 1; }

/* ── Participant box ─────────────────────────────────────────── */
.participant-box {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 1.25rem;
}
.selector-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.selector-row {
  display: flex;
  gap: 0.5rem;
}
.participant-select,
.participant-add-form input[type="text"] {
  flex: 1;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
  color: #1a1a2e;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}
.participant-select:focus,
.participant-add-form input:focus {
  outline: none;
  border-color: #1e2a4a;
  background: #fff;
}
.participant-divider {
  text-align: center;
  color: #bbb;
  font-size: 0.8rem;
  margin: 0.75rem 0;
  position: relative;
}
.participant-divider::before,
.participant-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 1.5rem);
  height: 1px;
  background: #e8e8e8;
}
.participant-divider::before { left: 0; }
.participant-divider::after  { right: 0; }

/* ── Tops header ─────────────────────────────────────────────── */
.tops-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.tops-who { font-weight: 700; font-size: 1rem; }
.tops-count {
  font-size: 0.82rem;
  background: #e8eaf6;
  color: #3949ab;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Tops table ──────────────────────────────────────────────── */
.col-topped-hdr { width: 2.5rem; text-align: center; }
.col-topped-cell { text-align: center; padding: 0.5rem 0.25rem; }

/* ── 3-state toggle button ───────────────────────────────────── */
.state-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.state-btn:active { transform: scale(0.88); }

/* topped: green circle with white checkmark */
.state-topped {
  background: #16a34a;
  border-color: #16a34a;
}
.state-topped::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -62%) rotate(45deg);
  width: 5px;
  height: 9px;
  border: 2.5px solid #fff;
  border-top: none;
  border-left: none;
}

/* tried: red circle with white × */
.state-tried {
  background: #dc2626;
  border-color: #dc2626;
}
.state-tried::before,
.state-tried::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
}
.state-tried::before { transform: translate(-50%, -50%) rotate(45deg); }
.state-tried::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.row-topped { background: #f0fff4; }
.row-topped td { color: #555; }
.row-tried  { background: #fff5f5; }
.row-tried td  { color: #555; }

/* hide less-important columns on small screens */
@media (max-width: 639px) {
  .col-hide-sm { display: none; }
}

/* ── Sticky save footer ──────────────────────────────────────── */
.tops-footer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, #f0f2f5 20%);
  padding: 1rem 0 1.5rem;
  margin-top: -1rem;
}
.btn-full { width: 100%; }

/* ── Header user area ────────────────────────────────────────── */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.nav-username {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-username:hover { color: #fff; text-decoration: underline; }
.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); }
.logout-form { display: inline; }
.btn-nav-auth {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 12px;
  border-radius: 6px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}
.btn-nav-auth:hover { background: rgba(255,255,255,0.1); }

/* ── Category legend ─────────────────────────────────────────── */
.cat-badge { font-size: 0.75rem; padding: 3px 9px; }

/* ── Leaderboard list ────────────────────────────────────────── */
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lb-card {
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.lb-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: #aaa;
  min-width: 36px;
  flex-shrink: 0;
  padding-top: 2px;
}
.lb-card:nth-child(1) .lb-rank { color: #c9993a; }
.lb-card:nth-child(2) .lb-rank { color: #909090; }
.lb-card:nth-child(3) .lb-rank { color: #a0684a; }

.lb-body { flex: 1; min-width: 0; }

.lb-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.lb-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-age {
  font-size: 0.75rem;
  color: #aaa;
  font-weight: 400;
}
.profile-stats-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.profile-stat {
  font-size: 0.75rem;
  color: #888;
  background: #f3f3f3;
  border-radius: 20px;
  padding: 1px 8px;
}
.profile-ape { font-weight: 600; }
.ape-pos { color: #2e7d32; background: #e8f5e9; }
.ape-neg { color: #c62828; background: #ffebee; }
.lb-cat-badge { font-size: 0.75rem; padding: 3px 9px; flex-shrink: 0; }
.lb-unranked { font-size: 0.8rem; color: #ccc; }

/* per-color score pills */
.lb-colors {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.06);
}
.score-pill.zero { opacity: 0.18; }

.lb-stats {
  font-size: 0.78rem;
  color: #888;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.lb-sep { color: #ddd; }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 420px;
}
.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.auth-sub {
  color: #777;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.auth-form { display: flex; flex-direction: column; }
.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: #777;
  margin-top: 1.25rem;
}
.auth-switch a { color: #1e2a4a; font-weight: 600; }

/* ── Profile page ────────────────────────────────────────── */
.profile-gym-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.profile-gym-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.profile-gym-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1e2a4a;
}
.profile-gym-name:hover { text-decoration: underline; }

.profile-colors { display: flex; flex-direction: column; gap: 0.55rem; }
.profile-color-row {
  display: grid;
  grid-template-columns: 14px 4.5rem 1fr 3rem auto;
  align-items: center;
  gap: 0.5rem;
}
.profile-color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.profile-color-name { font-size: 0.82rem; color: #444; }
.prog-track {
  height: 7px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}
.profile-color-count {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.profile-color-count.zero { color: #bbb; font-weight: 400; }
.profile-color-total { font-weight: 400; color: #aaa; }
.profile-all-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #e6f4ea;
  color: #2e7d32;
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
}

.profile-gym-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f2f5;
  font-size: 0.85rem;
  color: #666;
}
.profile-next { display: flex; align-items: center; gap: 0.3rem; }
.profile-next-badge { font-size: 0.7rem; padding: 1px 7px; }
.profile-top { color: #2e7d32; font-weight: 600; }

/* ── Settings page ───────────────────────────────────────── */
.settings-divider {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  border-top: 1px solid #e5e7eb;
  padding-top: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

/* ── Leaderboard name link ───────────────────────────────── */
a.lb-name { color: inherit; }
a.lb-name:hover { text-decoration: underline; }

/* ── Row action cluster ──────────────────────────────────── */
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-edit {
  color: #1e2a4a;
  background: rgba(30,42,74,0.07);
}
.btn-edit:hover { background: rgba(30,42,74,0.15); }

/* ── Form hints ──────────────────────────────────────────── */
.form-hint {
  display: block;
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.25rem;
}

/* ── Gym color-scheme table ──────────────────────────────── */
.color-scheme-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
}
.color-scheme-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.color-scheme-table th {
  background: #f8f9fb;
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.color-scheme-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #f0f2f5;
}
.color-scheme-table tbody tr:last-child td { border-bottom: none; }
.color-scheme-table input[type="text"],
.color-scheme-table input[type="number"],
.color-scheme-table select {
  padding: 0.3rem 0.4rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 0.82rem;
  background: #fff;
}

/* ── Boulder detail ─────────────────────────────────────── */
.boulder-num-link { color: inherit; font-weight: 700; text-decoration: none; }
.boulder-num-link:hover { text-decoration: underline; }

.badge-lg { font-size: 1rem; padding: 0.35rem 0.9rem; border-radius: 8px; }

.detail-sector {
  margin-left: 0.8rem;
  color: #666;
  font-size: 1rem;
  font-weight: 400;
  vertical-align: middle;
}

.map-card {
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.gym-map { width: 100%; height: auto; border-radius: 8px; display: block; }
.map-sector { fill: #334155; }
.map-sector.active { fill: #dc2626; }
.gym-map.interactive .map-sector { cursor: pointer; }
.gym-map.interactive .map-sector:hover { fill: #475569; }
.gym-map.interactive .map-sector.active:hover { fill: #b91c1c; }
.boulders-map .gym-map { max-height: 260px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.detail-item {
  background: #fff;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.detail-item-full { grid-column: 1 / -1; }
.detail-label {
  display: block;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.detail-value { font-weight: 600; font-size: 0.95rem; }

/* ── Auto-save status ───────────────────────────────────── */
.autosave-status {
  font-size: 0.78rem;
  color: #9ca3af;
  transition: opacity 0.4s;
  min-width: 60px;
  text-align: right;
}
.autosave-status.saving { color: #6b7280; }
.autosave-status.saved  { color: #16a34a; }

/* ── Review pill (compact summary in topped cell) ────────── */
.review-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  color: #555;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  user-select: none;
}
.review-pill:hover { color: #1e2a4a; }

/* ── Review row (flash / stars / keywords) ──────────────── */
.review-hidden { display: none; }

.review-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0 0.6rem 0.2rem;
}

.flash-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.flash-toggle input[type="checkbox"] { display: none; }
.flash-toggle-label {
  font-size: 0.82rem;
  color: #555;
  padding: 3px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.flash-toggle input:checked + .flash-toggle-label {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 600;
}

.flash-badge {
  font-size: 0.82rem;
  margin-left: 3px;
  vertical-align: middle;
}

.star-row {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.star-row .star {
  font-size: 1.3rem;
  color: #d1d5db;
  cursor: pointer;
  line-height: 1;
  transition: color 0.1s;
  user-select: none;
}
.star-row .star.lit   { color: #f59e0b; }
.star-row .star.hover { color: #fbbf24; }

.kw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  background: #fff;
  color: #555;
  transition: all 0.15s;
  user-select: none;
}
.kw-chip:hover { border-color: #94a3b8; }
.kw-chip.selected {
  background: #1e2a4a;
  color: #fff;
  border-color: #1e2a4a;
}
.kw-chip.maxed:not(.selected) { opacity: 0.4; cursor: not-allowed; }

/* ── Compact tag chips in table (read-only) ─────────────── */
.col-tags { white-space: nowrap; }
.kw-sm {
  padding: 2px 7px;
  font-size: 0.72rem;
  background: #f1f5f9;
  border-radius: 12px;
  color: #475569;
  margin-right: 3px;
}

/* ── Boulder detail stats ────────────────────────────────── */
.review-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.review-heading { font-weight: 700; font-size: 0.85rem; color: #444; text-transform: uppercase; letter-spacing: 0.05em; }
.star-hint { font-size: 0.75rem; color: #aaa; margin-left: 6px; }
.community-stats {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #f0f2f5;
}
.community-label {
  display: block;
  font-size: 0.72rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.stats-card {
  background: #fff;
  border-radius: 16px;
  padding: 1rem 1.2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.stats-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.75rem;
}
.flash-big { font-size: 0.9rem; font-weight: 700; color: #92400e; }
.flash-count { font-size: 0.82rem; color: #666; }

.avg-stars { display: flex; align-items: center; gap: 4px; }
.detail-star { font-size: 1.4rem; color: #d1d5db; line-height: 1; }
.detail-star.lit { color: #f59e0b; }
.detail-star.half-lit { color: #fcd34d; }
.avg-rating-num { font-size: 1rem; font-weight: 700; margin-left: 4px; }
.rating-votes { font-size: 0.78rem; color: #888; font-weight: 400; }

.kw-display { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-display-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 0.82rem;
  color: #334155;
}
.kw-count {
  background: #1e2a4a;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 2px;
}

/* ── Grade dot (difficulty, no text) ─────────────────────── */
.grade-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.18);
  vertical-align: middle;
  flex-shrink: 0;
}
.grade-dot-lg {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Hold sphere ─────────────────────────────────────────── */
.hold-sphere {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  cursor: default;
  position: relative;
  overflow: hidden;
  background:
    /* Grey chalk+rubber scatter — same on ALL holds, spreads over full top half */
    radial-gradient(ellipse 90% 88% at 50% 5%,
      rgba(233,230,225,0.88) 0%,
      rgba(233,230,225,0.48) 50%,
      rgba(233,230,225,0)    68%),
    /* Slight bottom darkening */
    linear-gradient(to bottom, transparent 52%, rgba(0,0,0,0.04) 65%, rgba(0,0,0,0.18) 100%),
    /* Spherical dark-edge shading */
    radial-gradient(circle at 50% 46%, transparent 36%, rgba(0,0,0,0.40) 100%),
    var(--hc, #999);
  box-shadow: 0 2px 5px rgba(0,0,0,0.32), inset 0 -2px 3px rgba(0,0,0,0.14);
}
/* Dual-tex: darken lower half ~20% to emphasize glossy depth */
.hold-sphere.dual-tex::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.20) 50%);
}
/* Dual-tex: graffiti glare on smooth lower half, rotated 30° CCW via pseudo-element */
.hold-sphere.dual-tex::after {
  content: '';
  position: absolute;
  /* ~26% × 15% of sphere size, centered at (63%, 69%) */
  width: 26%;
  height: 15%;
  top:  61.5%; /* 69% − 15%/2 */
  left: 50%;   /* 63% − 26%/2 */
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255,255,255,0.99) 0%,
    rgba(255,255,255,0.78) 36%,
    rgba(255,255,255,0)   100%);
  transform: rotate(-30deg); /* CCW on screen */
}
.hc-input-row { display: flex; align-items: center; gap: 0.4rem; }

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.filter-select {
  padding: 0.35rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
}
.filter-select:focus { outline: 2px solid #3b82f6; outline-offset: 1px; }
.filter-clear {
  font-size: 0.8rem;
  color: #6b7280;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.2rem 0;
}
.filter-clear:hover { color: #374151; }
.grade-filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.grade-filter-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}
.grade-filter-dot:hover { transform: scale(1.18); }
.grade-filter-dot.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px #334155;
  transform: scale(1.18);
}

/* ── Hold color editor ──────────────────────────────────── */
.hc-sector-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
  overflow: hidden;
}
.hc-sector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}
.hc-sector-name { font-weight: 600; font-size: 0.88rem; }
.hc-sector-progress { font-size: 0.78rem; color: #6b7280; font-weight: 500; }
.hc-progress-done { color: #16a34a; font-weight: 700; }
.hc-table-scroll { overflow-x: auto; }
.hc-table { width: 100%; border-collapse: collapse; }
.hc-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.hc-table tr:last-child td { border-bottom: none; }
.hc-col-grade { width: 36px; text-align: center; }
.hc-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.18);
  vertical-align: middle;
}
.hc-col-num { font-family: monospace; font-size: 0.82rem; color: #374151; white-space: nowrap; width: 60px; }
.hc-col-input { min-width: 150px; }
.hc-col-status { width: 40px; text-align: right; white-space: nowrap; }
.hc-missing td { background: #fffbeb; }
.hc-input {
  width: 100%;
  padding: 0.28rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #fff;
}
.hc-input:focus { outline: 2px solid #3b82f6; border-color: transparent; }
.hc-status { font-size: 0.75rem; }
.hc-status.hc-saved { color: #16a34a; }
.hc-status.hc-saving { color: #f59e0b; }
.hc-status.hc-err { color: #ef4444; }

/* ── Desktop tweaks (≥640px) ─────────────────────────────── */
@media (min-width: 640px) {
  .main-content { padding: 1.75rem 1.5rem 3rem; }
  .gym-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .gym-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-2px); }
  .header-top { padding: 0 1.5rem; }
  .tab-nav { padding: 0 1rem; }
  .gym-card-colors { flex-direction: row; align-self: center; }
  td { padding: 0.75rem 1rem; }
  thead th { padding: 0.7rem 1rem; }
  .form-actions .btn { flex: unset; }
  .boulder-form { padding: 2rem; }
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.78rem;
  color: #9ca3af;
}
.site-footer a { color: #9ca3af; text-decoration: underline; }
.site-footer a:hover { color: #6b7280; }
