/* ── Google Fonts loaded in layout.php ───────────────────────────────────────
   Bebas Neue     → headers, labels, nav
   IBM Plex Mono  → data, stats, mono text
   ──────────────────────────────────────────────────────────────────────────── */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */
:root {
  --bg: #080808;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --surface: #141414;
  --border: #242424;
  --border-light: #2e2e2e;

  --red: #cc1111;
  --red-dim: #7a0a0a;
  --red-glow: rgba(204, 17, 17, 0.15);

  --text: #e8e8e8;
  --text-dim: #b8b8b8;
  --text-muted: #969696;

  --ff-veryhigh: #4aaa5a;
  --ff-high: #7acc7a;
  --ff-low: #cc1111;

  --ff-display: "Bebas Neue", Impact, sans-serif;
  --ff-mono: "IBM Plex Mono", "Courier New", monospace;

  --radius: 2px;
  --gap: 1.5rem;
  --nav-h: 58px;
}

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

html {
  font-size: 15px;
}

/* ── Minimum readable font-size floors (v1.41) ───────────────────────────── */
/* Raise the smallest text classes so nothing drops below ~10px at 15px base  */
.field-hint,
.faction-tag,
.page-sub,
.form-hint {
  font-size: max(0.72rem, 0.72rem);
  color: var(--text-muted);
}
.badge--sm {
  font-size: 0.64rem !important;
  padding: 0.12rem 0.38rem;
}
.status {
  font-size: 0.67rem;
}
.data-table td,
.data-table th {
  font-size: 0.82rem;
}
/* Ensure dim / mono helpers stay readable inline */
td.mono,
td.dim,
td.mono.dim {
  font-size: 0.8rem;
}

body {
  /* Background image: fixed so it doesn't scroll, dimmed to ~88% so dark
       panels and text remain fully legible. Overlay is a stacked gradient:
       inner vignette fades the edges to near-black, outer layer is the flat dim. */
  background:
    radial-gradient(
      ellipse at center,
      rgba(8, 8, 8, 0.78) 0%,
      rgba(8, 8, 8, 0.96) 100%
    ),
    var(--bg-image, url("assets/fc-background.png")) center center / cover fixed;
  background-color: var(--bg); /* fallback while image loads */
  color: var(--text);
  font-family: var(--ff-mono);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--red);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ── Scanline overlay ─────────────────────────────────────────────────────── */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.07) 2px,
    rgba(0, 0, 0, 0.07) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 1.2rem;
  color: var(--red);
}
.brand-text {
  font-family: var(--ff-display);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  padding-left: 1rem;
}
.nav-link {
  font-family: var(--ff-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0.4rem 0.75rem;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-glow);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  overflow: hidden;
  max-height: var(--nav-h);
}
/* Search button & popup */
.nav-search-btn svg {
  transition: transform 0.12s ease;
}
.nav-search-btn:focus svg,
.nav-search-btn:hover svg {
  transform: scale(1.05);
  stroke: #fff;
}
.search-popup {
  position: fixed;
  right: 120px;
  top: 62px;
  background: rgba(17, 17, 17, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: none;
  min-width: 280px;
  max-width: 320px;
  z-index: 2000;
}
.search-popup input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 3px;
  border: 1px solid var(--border-light);
  background: rgba(24, 24, 24, 0.8);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-popup input:focus {
  border-color: var(--red);
  background: rgba(24, 24, 24, 0.95);
}
.search-popup input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
#searchResults {
  max-height: 280px;
  overflow-y: auto;
}
.search-result {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-direction: column;
  align-items: flex-start;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.1s;
}
.search-result:first-child {
  border-top: none;
}
.search-result:hover {
  background: rgba(204, 17, 17, 0.1);
}
.search-result .sr-name {
  font-weight: 600;
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 0.85rem;
}
.search-result .sr-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--ff-mono);
}
.nav-profile-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
  overflow: hidden;
  max-height: 34px;
}
.nav-profile-link:hover {
  opacity: 0.8;
  text-decoration: none;
}
.nav-avatar {
  display: block;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--red);
  flex-shrink: 0;
}
.user-badge {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  background: var(--red-dim);
  border: 1px solid var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  border-radius: 50%;
}
.user-name {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.btn-exit {
  font-family: var(--ff-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 0.3rem 0.7rem;
  transition: all 0.15s;
}
.btn-exit:hover {
  color: var(--red);
  border-color: var(--red-dim);
  text-decoration: none;
}

/* Fight window timer box */
.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 3px;
  border: 1px solid;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.timer-box--safe {
  background: rgba(42, 122, 42, 0.15);
  color: #4aaa5a;
  border-color: #1a4a1a;
}
.timer-box--warning {
  background: rgba(204, 153, 0, 0.12);
  color: #cc9900;
  border-color: #554400;
}
.timer-box--danger {
  background: rgba(204, 17, 17, 0.15);
  color: var(--red);
  border-color: var(--red-dim);
}
.timer-box--expired {
  background: rgba(80, 80, 80, 0.15);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 2rem 4rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--ff-display);
  letter-spacing: 0.1em;
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.site-footer a {
  color: var(--text-muted);
}
.site-footer a:hover {
  color: var(--red);
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--ff-display);
  font-size: 2.4rem;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--text);
}
.page-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  letter-spacing: 0.15em;
  font-weight: 500;
}

/* ── Stat grid ────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: var(--gap);
}
@media (max-width: 700px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-light);
  padding: 1.25rem 1.5rem;
}
.stat-value {
  font-family: var(--ff-display);
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--text);
}
.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  margin-top: 0.4rem;
  font-weight: 500;
}

/* ── Two-column layout ────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 800px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
}
.panel.mt {
  margin-top: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.panel-title {
  font-family: var(--ff-display);
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--text);
}

/* ── Data table ───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th {
  font-family: var(--ff-display);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-align: left;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.data-table .row--me {
  background: rgba(204, 17, 17, 0.05);
}
.data-table .row--win td:first-child {
  border-left: 3px solid var(--red);
}
.data-table .row--loss td:first-child {
  border-left: 3px solid var(--text-muted);
}

.table-note {
  font-size: 0.7rem;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--ff-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn--primary:hover {
  background: #e01313;
  border-color: #e01313;
  color: #fff;
}

.btn--outline {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-light);
}
.btn--outline:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn--sm {
  font-size: 0.7rem;
  padding: 0.3rem 0.7rem;
}
.btn--block {
  width: 100%;
  justify-content: center;
}

/* ── Form fields ──────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-family: var(--ff-display);
  font-weight: 500;
}
.field-input {
  display: block;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus {
  border-color: var(--red-dim);
}
.field-input option {
  background: var(--bg3);
}
.field-textarea {
  min-height: 80px;
  resize: vertical;
}
.field-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-weight: 500;
}
.field-hint a {
  color: var(--text-dim);
}
.mt {
  margin-top: 0.85rem;
}
.mt-sm {
  margin-top: 0.5rem;
}

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  border-left: 3px solid;
}
.flash--success {
  border-color: #2a7a2a;
  background: rgba(42, 122, 42, 0.1);
  color: #6ec96e;
}
.flash--error {
  border-color: var(--red);
  background: var(--red-glow);
  color: #e07070;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  font-size: 0.6rem;
  font-family: var(--ff-display);
  letter-spacing: 0.1em;
  padding: 0.15rem 0.4rem;
  border: 1px solid;
}
.badge--red {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-glow);
}
.badge--gray {
  color: var(--text-dim);
  border-color: var(--border-light);
}

/* ── Status pills ─────────────────────────────────────────────────────────── */
.status {
  font-size: 0.65rem;
  font-family: var(--ff-display);
  letter-spacing: 0.12em;
  padding: 0.1rem 0.4rem;
}
.status--pending {
  color: #b8940a;
  border: 1px solid #5a4700;
  background: rgba(184, 148, 10, 0.1);
}
.status--accepted {
  color: var(--red);
  border: 1px solid var(--red-dim);
  background: var(--red-glow);
}
.status--completed {
  color: #2a7a2a;
  border: 1px solid #1a4a1a;
  background: rgba(42, 122, 42, 0.1);
}
.status--cancelled,
.status--expired {
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.red {
  color: var(--red);
}
.dim {
  color: var(--text-dim);
}
.mono {
  font-family: var(--ff-mono);
}
/* Fair Fight tier colours — used on profile, rankings, fights log */
.ff-veryhigh {
  color: var(--ff-veryhigh);
}
.ff-high {
  color: var(--ff-high);
}
.ff-mid {
  color: var(--text);
}
.ff-low {
  color: var(--ff-low);
}
.bold {
  font-weight: 600;
}
.empty-state {
  padding: 2rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.body-text {
  padding: 0 1.25rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.7;
  font-weight: 500;
}

/* ── Fighter row (dashboard top 3) ───────────────────────────────────────── */
.fighter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.fighter-row:last-child {
  border-bottom: none;
}
.rank {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  width: 28px;
  flex-shrink: 0;
}
.rank--1 {
  color: #d4af37;
}
.rank--2 {
  color: #a8a8a8;
}
.rank--3 {
  color: #b87333;
}
.fighter-name {
  flex: 1;
  font-size: 0.88rem;
}
.fighter-record {
  font-size: 0.8rem;
}
.win-pct {
  font-size: 0.75rem;
  margin-left: auto;
}

/* ── Challenges ───────────────────────────────────────────────────────────── */
.challenge-form {
  padding: 1.25rem;
}
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.challenge-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.challenge-card:last-child {
  border-bottom: none;
}
.challenge-card--accepted {
  border-left: 2px solid var(--red);
}
.challenge-fighters {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.vs {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--ff-display);
  letter-spacing: 0.15em;
  padding: 0 0.35rem;
}
.challenge-msg {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin: 0.3rem 0;
}
.challenge-meta {
  font-size: 0.7rem;
  margin: 0.4rem 0;
}
.challenge-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

/* ── Challenge sections — horizontal layout ───────────────────────────────── */
.ch-sections {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}
.ch-section {
  background: var(--bg2);
  border: 1px solid var(--border);
}
.ch-section--accepted {
  border-top: 2px solid var(--red);
}
.ch-section--pending {
  border-top: 2px solid var(--text-muted);
}
.ch-section--done {
  border-top: 2px solid #4aaa5a;
}

.ch-section-header {
  font-family: var(--ff-display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ch-section-header--accepted {
  color: var(--red);
}
.ch-section-header--done {
  color: #4aaa5a;
}
.ch-section-count {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.05rem 0.35rem;
}
.ch-section-sub {
  padding: 0.25rem 1rem 0.35rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.15);
}

/* Each challenge row */
.ch-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.ch-row:last-child {
  border-bottom: none;
}
.ch-row--accepted {
  border-left: 3px solid var(--red);
}
.ch-row--pending {
  border-left: 3px solid var(--text-muted);
}
.ch-row--done {
  border-left: 3px solid #4aaa5a;
  opacity: 0.82;
}

.ch-row-fighters {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  flex-wrap: wrap;
  min-width: 0;
}
.ch-name {
  font-size: 0.85rem;
}
.ch-name--me {
  color: var(--red);
  font-weight: 700;
}
.ch-vs {
  font-family: var(--ff-display);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.ch-cross {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.ch-msg {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: italic;
}
.ch-wager-pill {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: var(--amber, #cc9900);
  white-space: nowrap;
}
.ch-ff-pill {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 0.1rem 0.35rem;
  border: 1px solid currentColor;
  opacity: 0.9;
}
.ch-discord-pill {
  font-size: 0.82rem;
  opacity: 0.75;
  cursor: default;
  user-select: none;
  white-space: nowrap;
  title: attr(title);
}
.ch-row-status {
  white-space: nowrap;
  text-align: right;
  min-width: 110px;
}
.ch-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.ch-empty {
  padding: 1.2rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--ff-mono);
}
/* ── Challenge row mobile — collapse at 700px ─────────────────── */
@media (max-width: 700px) {
  .ch-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .ch-row-status {
    text-align: left;
    min-width: 0;
    white-space: normal;
  }
  .ch-row-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  /* Ensure action buttons meet iOS 44px touch target */
  .ch-row-actions .btn {
    min-height: 38px;
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem !important;
  }
  .ch-row-fighters {
    gap: 0.35rem;
  }
  .ch-wager-pill {
    white-space: normal;
    word-break: break-word;
  }
  /* Timer box full width on mobile */
  .ch-row-timer {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }
  .timer-box {
    font-size: 0.7rem !important;
  }
}
/* ── Extra squeeze for small phones (iPhone SE: 375px) ────────── */
@media (max-width: 420px) {
  .ch-row {
    padding: 0.55rem 0.75rem;
  }
  .ch-name {
    font-size: 0.8rem;
  }
  .ch-section-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
  }
  /* Stack wager pill onto its own line */
  .ch-wager-pill {
    display: block;
    margin-top: 0.2rem;
  }
  /* Admin delete popover: pin to left edge on narrow screens */
  #adel-popover {
    right: auto;
    left: 0;
  }
}
.issue-form-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 0;
}
.issue-form-bar-grid {
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1.6fr 1fr 160px 130px;
  gap: 0.65rem;
  align-items: end;
}
@media (max-width: 900px) {
  .issue-form-bar-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .issue-form-bar-grid {
    grid-template-columns: 1fr;
  }
  .issue-form-bar-grid .btn {
    min-height: 44px;
  }
}
/* ── Global mobile touch target floor ────────────────────────── */
@media (max-width: 700px) {
  .btn--sm {
    min-height: 36px;
  }
  /* Wager settlement cards: stack actions vertically */
  .challenge-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .challenge-actions .btn {
    min-height: 40px;
    font-size: 0.82rem;
  }
  .challenge-actions span.dim {
    font-size: 0.7rem;
  }
}

/* ── Leaderboard podium ───────────────────────────────────────────────────── */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--gap);
  height: 200px;
}
.podium-slot {
  flex: 1;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 0;
}
.podium-crown {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}
.podium-badge {
  width: 46px;
  height: 46px;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}
.podium-badge--1 {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
  color: #d4af37;
}
.podium-name {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.2rem;
}
.podium-record {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.podium-bar {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.5rem;
}
.podium-bar--1 {
  height: 90px;
  background: linear-gradient(to top, rgba(212, 175, 55, 0.25), transparent);
  border-top: 2px solid #d4af37;
}
.podium-bar--2 {
  height: 60px;
  background: linear-gradient(to top, rgba(168, 168, 168, 0.15), transparent);
  border-top: 2px solid #888;
}
.podium-bar--3 {
  height: 40px;
  background: linear-gradient(to top, rgba(184, 115, 51, 0.15), transparent);
  border-top: 2px solid #b87333;
}
.podium-rank {
  font-family: var(--ff-display);
  font-size: 1.2rem;
  color: var(--text-muted);
}

.rank-cell {
  font-size: 1rem;
}
.lb-table td,
.lb-table th {
  padding: 0.65rem 1rem;
}

/* ── Sync page ────────────────────────────────────────────────────────────── */
.sync-summary {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.sync-summary .stat-card {
  flex: 1;
}
.sync-log {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sync-entry {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid;
}
.sync-entry--found {
  border-color: #2a7a2a;
  background: rgba(42, 122, 42, 0.07);
}
.sync-entry--stalemate {
  border-color: #555;
  background: rgba(80, 80, 80, 0.07);
}
.sync-entry--notfound {
  border-color: #5a4700;
  background: rgba(90, 71, 0, 0.07);
}
.sync-entry--error {
  border-color: var(--red-dim);
  background: var(--red-glow);
}
.panel > .mt {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.35rem;
  padding: 0.85rem 1.25rem;
  justify-content: center;
}
.page-btn {
  font-family: var(--ff-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  min-width: 32px;
  text-align: center;
}
.page-btn:hover {
  color: var(--text);
  text-decoration: none;
}
.page-btn--active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ── Filter group ─────────────────────────────────────────────────────────── */
.filter-group {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

/* ── Fight log table ──────────────────────────────────────────────────────── */
.fight-log-table {
  font-size: 0.78rem;
}

/* ── Class badges ─────────────────────────────────────────────────────────── */
.class-badge {
  display: inline-block;
  font-family: var(--ff-display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  padding: 0.15rem 0.45rem;
  border: 1px solid;
  white-space: nowrap;
  vertical-align: middle;
}
.badge--sm {
  font-size: 0.64rem;
  padding: 0.12rem 0.38rem;
}

/* ── 6-class colour system ────────────────────────────────────────────────── */
/* Weight-class temperature scale: coldest (Featherweight) → hottest (Heavyweight) */

/* Featherweight — ice blue (coldest) */
.class--feather,
.class--feather-btn:hover {
  color: #5bc8f5;
  border-color: #1a5a78;
  background: rgba(91, 200, 245, 0.08);
}

/* Lightweight — cool teal */
.class--light,
.class--light-btn:hover {
  color: #30c8a8;
  border-color: #0a4a3c;
  background: rgba(48, 200, 168, 0.08);
}

/* Welterweight — temperate lime */
.class--welter,
.class--welter-btn:hover {
  color: #90c840;
  border-color: #3a5c00;
  background: rgba(144, 200, 64, 0.08);
}

/* Middleweight — warm amber */
.class--middle,
.class--middle-btn:hover {
  color: #d4a830;
  border-color: #7a5800;
  background: rgba(212, 168, 48, 0.08);
}

/* Light Heavyweight — hot orange */
.class--lightheavy,
.class--lightheavy-btn:hover {
  color: #d46820;
  border-color: #7a3400;
  background: rgba(212, 104, 32, 0.08);
}

/* Heavyweight — fire red (hottest) */
.class--heavy,
.class--heavy-btn:hover {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-glow);
}

/* ── Flex utilities ───────────────────────────────────────────────────────── */
.flex-row {
  display: flex;
  align-items: center;
}
.gap-sm {
  gap: 0.5rem;
}
.challenge-header-row {
  margin-bottom: 0.35rem;
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(
      ellipse 60% 50% at 50% 60%,
      rgba(140, 0, 0, 0.12) 0%,
      transparent 70%
    ),
    var(--bg);
}
.login-wrap {
  width: 100%;
  padding: 2rem;
  display: flex;
  justify-content: center;
}
.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  padding: 2.5rem 2rem;
  position: relative;
}
.login-emblem {
  font-size: 2.5rem;
  text-align: center;
  display: block;
  margin-bottom: 0.75rem;
  color: var(--red);
}
.login-title {
  font-family: var(--ff-display);
  font-size: 3.5rem;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-align: center;
  margin-bottom: 0.5rem;
}
.login-sub {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
}
.login-rule {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  border: 1px solid var(--border);
  padding: 0.6rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.login-disclaimer {
  margin-top: 1.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Admin nav link ───────────────────────────────────────────────────────── */
.nav-link--admin {
  color: #d4af37 !important;
}
.nav-link--admin:hover,
.nav-link--admin.active {
  color: #d4af37 !important;
  border-color: #7a6310 !important;
  background: rgba(212, 175, 55, 0.08) !important;
}

/* ── Login page ToS notice ────────────────────────────────────────────────── */
.login-box {
  overflow: visible;
}

.tos-notice {
  margin: 1.5rem -2rem 0; /* bleed outside login-box padding */
  border: 1px solid var(--border-light);
  border-left: none;
  border-right: none;
  background: var(--bg3);
}
.tos-notice-title {
  font-family: var(--ff-display);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  padding: 0.6rem 2rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
.tos-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tos-table th {
  font-family: var(--ff-display);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg2);
  word-break: break-word;
  line-height: 1.3;
  width: 20%;
}
.tos-table th:last-child {
  border-right: none;
}
.tos-table td {
  padding: 0.5rem 0.65rem;
  color: var(--text);
  border-right: 1px solid var(--border);
  vertical-align: top;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  word-break: break-word;
  width: 20%;
}
.tos-table td:last-child {
  border-right: none;
}
.tos-notice-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0.35rem 2rem 0.55rem;
  border-top: 1px solid var(--border);
}
.tos-notice-sub a {
  color: var(--text-dim);
}

/* ── Attack button ────────────────────────────────────────────────────────── */
.attack-btn {
  background: var(--red);
  color: #fff !important;
  border-color: var(--red) !important;
  font-family: var(--ff-display);
  letter-spacing: 0.1em;
  animation: pulse-red 2s ease-in-out infinite;
}
.attack-btn:hover {
  background: #e01313;
  text-decoration: none;
}

@keyframes pulse-red {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(204, 17, 17, 0);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(204, 17, 17, 0.4);
  }
}

.attack-link {
  font-family: var(--ff-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  background: var(--red);
  color: #fff !important;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--red);
  text-decoration: none !important;
}
.attack-link:hover {
  background: #e01313;
}

/* ── Challenge fighter side ───────────────────────────────────────────────── */
.fighter-side {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
}

/* ── Admin factions tab ───────────────────────────────────────────────────── */
.admin-tab[href*="factions"].active {
  color: #6ab0d4;
  border-color: #2a5a72;
}

/* ── ELO change arrows ────────────────────────────────────────────────────── */
.elo-arrow {
  font-size: 0.7rem;
  vertical-align: middle;
  font-style: normal;
}
.elo-arrow--up {
  color: #2a7a2a;
}
.elo-arrow--down {
  color: var(--red);
}
.nav-elo {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.stat-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Generate Custom API Key button (blue) ────────────────────────────────── */
.btn-generate-key {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: #1a5fa8;
  color: #fff !important;
  border: 1px solid #2477cc;
  font-family: var(--ff-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-decoration: none !important;
  transition:
    background 0.15s,
    border-color 0.15s;
  cursor: pointer;
}
.btn-generate-key:hover {
  background: #2070c0;
  border-color: #3a8de0;
  text-decoration: none !important;
}

/* ── Fight result row color coding ───────────────────────────────────────── */
.row--win td {
  background: rgba(30, 80, 30, 0.18) !important;
}
.row--loss td {
  background: rgba(120, 20, 20, 0.18) !important;
}
.fight-winner {
  color: #4aaa5a;
} /* green winner name */
.elo-pos {
  color: #4aaa5a;
} /* green positive ELO change */

/* ── Win-rate colour helpers ──────────────────────────────────────────────── */
.wr-green {
  color: #4aaa5a;
}
.wr-amber {
  color: #cc9900;
}
.wr-red {
  color: var(--red);
}
.wr-dim {
  color: var(--text-muted);
}
.wr-border-green {
  border-left-color: #4aaa5a !important;
}
.wr-border-amber {
  border-left-color: #cc9900 !important;
}
.wr-border-red {
  border-left-color: var(--red) !important;
}

/* ── Stat card split value (W · L) ───────────────────────────────────────── */
.stat-value-split {
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  line-height: 1;
}
.stat-split-sep {
  font-family: var(--ff-display);
  font-size: 1.6rem;
  color: var(--border-light);
  padding: 0 0.1rem;
}

/* ── MSG compose popover ──────────────────────────────────────────────────── */
.msg-tip-wrap {
  position: relative;
  display: inline-block;
}
.msg-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  width: min(300px, calc(100vw - 2rem));
  background: var(--bg2);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75);
  z-index: 500;
  padding: 0.7rem;
}
/* On rows near the top of the page, open downward instead */
.msg-popover.open-down {
  bottom: auto;
  top: calc(100% + 6px);
}
.msg-popover.open {
  display: block;
}
.msg-popover-label {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.msg-popover-text {
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 0.2rem;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  max-height: 72px;
  overflow-y: auto;
  cursor: text;
  user-select: all;
}
.msg-popover-copy {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.4rem;
  cursor: pointer;
  margin-bottom: 0.55rem;
  transition:
    color 0.12s,
    border-color 0.12s;
  display: block;
  width: 100%;
}
.msg-popover-copy:hover {
  color: #4aaa5a;
  border-color: #1a5a2a;
}
.msg-popover-copy.copied {
  color: #4aaa5a;
  border-color: #1a5a2a;
}
.msg-popover-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}
.msg-popover-open {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--ff-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 0.35rem;
  background: rgba(106, 176, 212, 0.08);
  border: 1px solid #2a5a72;
  color: #6ab0d4;
  text-decoration: none;
  transition: background 0.15s;
}
.msg-popover-open:hover {
  background: rgba(106, 176, 212, 0.18);
  text-decoration: none;
  color: #6ab0d4;
}
.msg-popover-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0 0.3rem 0.5rem;
  line-height: 1;
}
.msg-popover-close:hover {
  color: var(--text);
}

/* ── Wager payment notification banner ────────────────────────────────────── */
.wager-notif {
  border: 1px solid #7a6310;
  background: rgba(212, 175, 55, 0.07);
  padding: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
}
.wager-notif--collect {
  border-color: #2a5a2a;
  background: rgba(74, 170, 90, 0.06);
}
.wager-notif--owe {
  border-color: var(--red-dim);
  background: rgba(204, 17, 17, 0.06);
}
.wager-notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.wager-notif-text {
  flex: 1;
  min-width: 160px;
  color: var(--text-dim);
}
.wager-notif-text strong {
  color: var(--text);
}
.wager-notif-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Admin level badges ────────────────────────────────────────────────────── */
.badge--superadmin {
  color: #d4af37;
  border-color: #7a6310;
  background: rgba(212, 175, 55, 0.1);
}
.badge--admin {
  color: #6ab0d4;
  border-color: #2a5a72;
  background: rgba(106, 176, 212, 0.1);
}

/* ── Faction tag (inline small label) ────────────────────────────────────── */
.faction-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--ff-mono);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 0.05rem 0.35rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Challenge card enhancements ─────────────────────────────────────────── */
.challenge-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.fight-window-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}
.sync-status-row {
  margin-top: 0.3rem;
  min-height: 1.2rem;
}

/* ── FC ELO delta arrows (inline next to fighter names) ──────────────────── */
.fc-elo-delta {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 600;
  margin-left: 0.3rem;
  vertical-align: middle;
  white-space: nowrap;
}
.elo-neg {
  color: var(--red);
}

/* ── Clickable member / faction links ────────────────────────────────────── */
.member-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--border-light);
  transition:
    color 0.12s,
    border-color 0.12s;
}
.member-link:hover {
  color: var(--red);
  border-color: var(--red-dim);
  text-decoration: none;
}
.member-link.fight-winner {
  color: #4aaa5a;
}
.member-link.fight-winner:hover {
  color: #5acc6a;
}
.member-link.red {
  color: var(--red);
}

.faction-link {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
  font-family: var(--ff-mono);
  border-bottom: 1px dotted var(--border);
  transition: color 0.12s;
}
.faction-link:hover {
  color: #d4af37;
  text-decoration: none;
  border-color: #7a6310;
}

/* ── Podium profile links ─────────────────────────────────────────────────── */
.podium-badge {
  cursor: pointer;
  transition: opacity 0.15s;
}
.podium-badge:hover {
  opacity: 0.75;
}
.podium-name-link {
  color: inherit;
  text-decoration: none;
  font-family: inherit;
  font-size: inherit;
}
.podium-name-link:hover {
  color: var(--red);
  text-decoration: none;
}
.podium-faction {
  font-size: 0.68rem;
  margin-top: 0.15rem;
}
.podium-faction-link {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
}
.podium-faction-link:hover {
  color: #d4af37;
  text-decoration: none;
}

/* ── Greenleaf new-member icon ── */
.greenleaf {
  font-size: 0.8em;
  margin-left: 0.2rem;
  vertical-align: middle;
  cursor: default;
}

/* ── ELO percentile tier classes ──────────────────────────────────────────── */
.elo-elite {
  color: var(--red) !important;
  animation: elo-elite-pulse 2s ease-in-out infinite;
  font-weight: 700;
}
@keyframes elo-elite-pulse {
  0%,
  100% {
    text-shadow:
      0 0 4px rgba(204, 17, 17, 0.4),
      0 0 10px rgba(204, 17, 17, 0.2);
  }
  50% {
    text-shadow:
      0 0 10px rgba(204, 17, 17, 0.8),
      0 0 20px rgba(204, 17, 17, 0.4);
  }
}
.elo-high {
  color: var(--red) !important;
}
.elo-mid {
  color: #a03030 !important;
}
.elo-low {
  color: var(--text-muted) !important;
}

/* Elite badge pip shown beside the value */
.elo-elite-pip {
  display: inline-block;
  font-size: 0.55em;
  letter-spacing: 0.05em;
  font-family: var(--ff-display);
  color: var(--red);
  margin-left: 0.25rem;
  vertical-align: middle;
  opacity: 0.85;
}

/* ── Win / Loss color consistency ─────────────────────────────────────────── */
.stat-wins {
  color: var(--red);
}
.stat-losses {
  color: var(--text-dim);
}

/* ── Table mobile wrapper — all wide tables get horizontal scroll ─────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Tighter panel padding on small screens ───────────────────────────────── */
@media (max-width: 768px) {
  .main {
    padding: 1rem 1rem 3rem;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .stat-card {
    padding: 0.9rem 1rem;
  }
  .stat-value {
    font-size: 2rem;
  }
  .panel-header {
    padding: 0.65rem 1rem;
  }
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.75rem;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .podium {
    height: 160px;
  }
  .podium-bar--1 {
    height: 70px;
  }
  .podium-bar--2 {
    height: 48px;
  }
  .podium-bar--3 {
    height: 32px;
  }
  /* Fight log: collapse to card stack on very small screens */
  .fight-log-card-mode th {
    display: none;
  }
  .fight-log-card-mode td {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: none;
  }
  .fight-log-card-mode td::before {
    content: attr(data-label);
    font-family: var(--ff-display);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    min-width: 70px;
    flex-shrink: 0;
  }
  .fight-log-card-mode tr {
    display: block;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    background: var(--surface);
  }
}

/* ── Calendar ─────────────────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.cal-header-cell {
  font-family: var(--ff-display);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-align: center;
  padding: 0.45rem;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-day {
  min-height: 80px;
  padding: 0.35rem 0.45rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  vertical-align: top;
  cursor: default;
}
.cal-day--empty {
  background: var(--bg);
}
.cal-day--today {
  background: rgba(204, 17, 17, 0.05);
}
.cal-day--today .cal-day-num {
  color: var(--red);
  font-weight: 700;
}
.cal-day-num {
  font-family: var(--ff-display);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.cal-event {
  font-size: 0.65rem;
  font-family: var(--ff-mono);
  padding: 0.1rem 0.3rem;
  margin-bottom: 0.2rem;
  border-left: 2px solid var(--red);
  background: var(--red-glow);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.12s;
}
.cal-event:hover {
  opacity: 0.75;
}
.cal-event--wheel {
  border-left-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
}
@media (max-width: 600px) {
  .cal-day {
    min-height: 54px;
    padding: 0.2rem 0.3rem;
  }
  .cal-event {
    display: none;
  }
  .cal-day.has-events::after {
    content: "●";
    font-size: 0.5rem;
    color: var(--red);
    display: block;
  }
}

/* ── Event modal ─────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-top: 2px solid var(--red);
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
  position: relative;
}
.modal-title {
  font-family: var(--ff-display);
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ── Growth dashboard ────────────────────────────────────────────────────── */
.chart-wrap {
  padding: 1.25rem;
  position: relative;
  height: 280px;
}

/* ── Prize wheel ─────────────────────────────────────────────────────────── */
.wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}
.wheel-canvas-wrap {
  position: relative;
  display: inline-block;
}
.wheel-pointer {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-right: 22px solid var(--red);
  filter: drop-shadow(0 0 4px rgba(204, 17, 17, 0.6));
}
.wheel-result-list {
  width: 100%;
}
.wheel-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.wheel-result-num {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  color: #d4af37;
  width: 24px;
  flex-shrink: 0;
}
.wheel-spinning {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Member avatar ── */
.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 0.5rem;
}
.member-avatar--lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
  margin-bottom: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   v1.58 — Challenge Detail & Issue Modals
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Challenge detail modal backdrop ─────────────────────────────────────── */
.chal-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.chal-modal-backdrop.open {
  display: flex;
}

/* ── Modal box ────────────────────────────────────────────────────────────── */
.chal-modal-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--red);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 1.75rem;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

/* ── Close button ─────────────────────────────────────────────────────────── */
.chal-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chal-modal-close:hover { color: var(--text); }

/* ── Modal header ─────────────────────────────────────────────────────────── */
.chal-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-right: 1.5rem; /* avoid close btn overlap */
}
.chal-modal-title {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

/* ── Fighters strip ───────────────────────────────────────────────────────── */
.chal-modal-fighters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
}
.chal-modal-fighter-name {
  font-family: var(--ff-display);
  font-size: 1rem;
  text-decoration: none;
  color: inherit;
  transition: color 0.15s;
  letter-spacing: 0.04em;
}
.chal-modal-fighter-name:hover { color: var(--red); }
.chal-modal-vs {
  font-family: var(--ff-display);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* ── Meta block ───────────────────────────────────────────────────────────── */
.chal-modal-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

/* ── Action row ───────────────────────────────────────────────────────────── */
.chal-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.chal-modal-actions .btn {
  min-height: 44px;
  flex: 1;
  justify-content: center;
}

/* ── Clickable rows ───────────────────────────────────────────────────────── */
.ch-row--clickable {
  cursor: pointer;
  transition: background 0.12s;
}
.ch-row--clickable:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ── Issue challenge modal (narrower, single column form) ─────────────────── */
.issue-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* ── Nav notification dot (pending action needed) ─────────────────────────── */
.nav-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  position: absolute;
  top: 4px;
  right: -2px;
  pointer-events: none;
  animation: dot-pulse 2s ease-in-out infinite;
}
.nav-item { position: relative; }

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

/* ── History tab toggle (challenge history panel) ─────────────────────────── */
.chal-history-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.chal-history-tab {
  font-family: var(--ff-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 0.45rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.chal-history-tab.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .chal-modal-box {
    padding: 1.25rem;
    max-height: 92vh;
  }
  .chal-modal-fighters {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .chal-modal-actions {
    flex-direction: column;
  }
  .chal-modal-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}
@media (max-width: 420px) {
  .chal-modal-title { font-size: 0.92rem; }
  .chal-modal-fighter-name { font-size: 0.88rem; }
}

/* ── iOS safe-area notch / home-bar ──────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .chal-modal-box {
    padding-bottom: calc(1.75rem + env(safe-area-inset-bottom));
  }
  @media (max-width: 700px) {
    .chal-modal-box {
      padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }
  }
}
