/* =============================================================================
   HexaFalls CTF 2026 — Custom Theme (v2.0 Polished)
   Modern Dark + Gold | Harry Potter Themed | Premium Aesthetic
   
   Inject via: CTFd Admin → Config → Appearance → Theme Header (inside <style>)
   Base: CTFd core theme (unmodified)
   ============================================================================= */

/* ── CSS Custom Properties ─────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --hf-bg-primary: #0b0e13;
  --hf-bg-secondary: #13171e;
  --hf-bg-tertiary: #1a1f2b;
  --hf-bg-elevated: #1e2433;
  --hf-border: #2a3040;
  --hf-border-muted: #1e2330;
  --hf-border-subtle: #161c28;

  /* Gold accent */
  --hf-gold: #c9a84c;
  --hf-gold-bright: #e0c068;
  --hf-gold-muted: #8b7a3e;
  --hf-gold-dim: #6b5e30;
  --hf-gold-glow: rgba(201, 168, 76, 0.12);
  --hf-gold-glow-strong: rgba(201, 168, 76, 0.22);

  /* Crimson accent */
  --hf-crimson: #8b2332;
  --hf-crimson-bright: #c0392b;
  --hf-crimson-glow: rgba(139, 35, 50, 0.15);

  /* Parchment tones */
  --hf-parchment: #f5e6c8;
  --hf-parchment-muted: #d4c5a0;
  --hf-parchment-dim: rgba(245, 230, 200, 0.06);

  /* Functional colors */
  --hf-success: #2ea043;
  --hf-success-muted: rgba(46, 160, 67, 0.12);
  --hf-danger: #da3633;
  --hf-danger-muted: rgba(218, 54, 51, 0.10);
  --hf-info: #58a6ff;
  --hf-info-muted: rgba(88, 166, 255, 0.10);
  --hf-warning: #d29922;
  --hf-warning-muted: rgba(210, 153, 34, 0.10);

  /* Text */
  --hf-text-primary: #e4e8ee;
  --hf-text-secondary: #8b949e;
  --hf-text-muted: #5c6370;
  --hf-text-heading: var(--hf-gold);

  /* Typography */
  --hf-font-heading: 'Cinzel', 'Georgia', serif;
  --hf-font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --hf-font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --hf-radius-sm: 6px;
  --hf-radius-md: 10px;
  --hf-radius-lg: 14px;

  /* Shadows */
  --hf-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --hf-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --hf-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.50);
  --hf-shadow-gold: 0 4px 20px var(--hf-gold-glow);

  /* Transitions */
  --hf-transition: 0.2s ease;
  --hf-transition-slow: 0.35s ease;
}

/* ── Global Reset ──────────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--hf-bg-primary) !important;
  color: var(--hf-text-primary) !important;
  font-family: var(--hf-font-body) !important;
  font-size: 0.95rem;
  line-height: 1.65;
  background-image: linear-gradient(rgba(11, 14, 19, 0.40), rgba(11, 14, 19, 0.40)), var(--bg-image-url) !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Keep the footer in document flow and at the bottom of short pages. */
main[role="main"] {
  flex: 1 0 auto;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6,
.modal-title,
.challenge-name {
  font-family: var(--hf-font-heading) !important;
  color: var(--hf-text-heading) !important;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

h1 { font-weight: 700; font-size: 1.75rem; }
h2 { font-weight: 600; font-size: 1.4rem; }
h3 { font-weight: 600; font-size: 1.15rem; }
h4 { font-weight: 600; font-size: 1.05rem; }

a {
  color: var(--hf-gold) !important;
  transition: color var(--hf-transition);
  text-decoration: none;
}

a:hover {
  color: var(--hf-gold-bright) !important;
  text-decoration: none !important;
}

p { margin-bottom: 0.75rem; }

/* ── Jumbotron / Hero Section ──────────────────────────────────────────────── */
.jumbotron {
  background: linear-gradient(180deg, rgba(19, 23, 30, 0.95), rgba(11, 14, 19, 0.85)) !important;
  border-bottom: 1px solid var(--hf-border) !important;
  padding: 2.5rem 0 2rem !important;
  margin-bottom: 0 !important;
  text-align: center;
}

.jumbotron h1 {
  font-size: 2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  background-color: rgba(11, 14, 19, 0.92) !important;
  border-bottom: 1px solid var(--hf-border) !important;
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 0.6rem 0;
}

.navbar-brand {
  font-family: var(--hf-font-heading) !important;
  font-weight: 700 !important;
  color: var(--hf-gold) !important;
  font-size: 1.25rem !important;
  letter-spacing: 0.06em;
  transition: opacity var(--hf-transition);
}

.navbar-brand:hover {
  opacity: 0.85;
}

.navbar-brand img {
  animation: hf-shimmer 5s ease-in-out infinite;
  transition: filter var(--hf-transition);
}

@keyframes hf-shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

.navbar-nav .nav-link {
  color: var(--hf-text-secondary) !important;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem !important;
  transition: color var(--hf-transition);
  position: relative;
  letter-spacing: 0.01em;
}

.navbar-nav .nav-link:hover {
  color: var(--hf-gold) !important;
}

.navbar-nav .nav-link.active {
  color: var(--hf-gold) !important;
}

/* Active nav indicator — subtle gold underline */
.navbar-nav .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--hf-gold);
  border-radius: 1px;
}

.navbar-toggler {
  border-color: var(--hf-border) !important;
  padding: 0.35rem 0.65rem;
}

.navbar-toggler-icon {
  filter: invert(0.75);
}

/* ── Navbar Dropdown ───────────────────────────────────────────────────────── */
.navbar .dropdown-menu {
  background-color: var(--hf-bg-elevated) !important;
  border: 1px solid var(--hf-border) !important;
  border-radius: var(--hf-radius-md);
  box-shadow: var(--hf-shadow-lg);
  padding: 0.5rem 0;
  min-width: 180px;
  margin-top: 0.35rem;
}

.navbar .dropdown-menu .dropdown-item {
  color: var(--hf-text-secondary) !important;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.55rem 1.15rem;
  transition: all var(--hf-transition);
  border-radius: 0;
}

.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
  color: var(--hf-gold) !important;
  background-color: var(--hf-gold-glow) !important;
}

.navbar .dropdown-menu .dropdown-item i {
  color: var(--hf-gold-muted);
  width: 1.2em;
  text-align: center;
  transition: color var(--hf-transition);
}

.navbar .dropdown-menu .dropdown-item:hover i {
  color: var(--hf-gold-bright);
}

/* ── Cards (Challenge cards, general) ──────────────────────────────────────── */
.card,
.challenge-card,
.modal-content {
  background-color: var(--hf-bg-secondary) !important;
  border: 1px solid var(--hf-border) !important;
  border-radius: var(--hf-radius-md) !important;
  transition: transform var(--hf-transition), box-shadow var(--hf-transition), border-color var(--hf-transition);
  box-shadow: var(--hf-shadow-sm);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--hf-shadow-gold);
  border-color: var(--hf-gold-dim) !important;
}

.card-body {
  background-color: transparent !important;
  padding: 1.25rem !important;
}

.card .card-title,
.card .card-header {
  font-family: var(--hf-font-heading) !important;
  color: var(--hf-gold) !important;
}

.card-header {
  background-color: var(--hf-bg-tertiary) !important;
  border-bottom: 1px solid var(--hf-border) !important;
  padding: 0.9rem 1.25rem !important;
  font-weight: 600;
}

/* ── Challenge Board ───────────────────────────────────────────────────────── */

/* Category column headers */
.category-header,
.challenge-category h3,
.board-category-header {
  color: var(--hf-gold) !important;
  font-family: var(--hf-font-heading) !important;
  border-bottom: 2px solid var(--hf-gold-dim);
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

/* Challenge buttons/tiles */
.challenge-button,
[class*="challenge-tile"],
.board-challenges .btn {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-border) !important;
  border-left: 3px solid var(--hf-gold) !important;
  border-radius: var(--hf-radius-md) !important;
  color: var(--hf-text-primary) !important;
  transition: all var(--hf-transition);
  box-shadow: var(--hf-shadow-sm);
  position: relative;
  overflow: hidden;
}

.challenge-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 60%, var(--hf-gold-glow));
  opacity: 0;
  transition: opacity var(--hf-transition);
  pointer-events: none;
}

.challenge-button:hover::before {
  opacity: 1;
}

.challenge-button:hover,
[class*="challenge-tile"]:hover,
.board-challenges .btn:hover {
  background-color: var(--hf-bg-elevated) !important;
  border-color: var(--hf-gold-muted) !important;
  border-left-color: var(--hf-gold-bright) !important;
  box-shadow: var(--hf-shadow-gold);
  transform: translateY(-2px);
}

.challenge-button .challenge-inner {
  position: relative;
  z-index: 1;
}

.challenge-button .challenge-inner p {
  font-family: var(--hf-font-heading);
  color: var(--hf-text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}

.challenge-button .challenge-inner span {
  color: var(--hf-gold);
  font-weight: 700;
  font-size: 1.1rem;
  font-family: var(--hf-font-body);
}

/* Solved challenges */
.challenge-button.challenge-solved,
.challenge-button.solved,
.solved .challenge-button {
  border-left-color: var(--hf-success) !important;
  opacity: 0.75;
}

.challenge-button.challenge-solved::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--hf-success);
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 1;
}

/* ── Modals (Challenge detail popup) ───────────────────────────────────────── */
.modal-content {
  box-shadow: var(--hf-shadow-lg) !important;
  border: 1px solid var(--hf-gold-dim) !important;
  border-radius: var(--hf-radius-lg) !important;
}

.modal-header {
  background-color: var(--hf-bg-tertiary) !important;
  border-bottom: 1px solid var(--hf-border) !important;
  padding: 1rem 1.5rem !important;
}

.modal-header .modal-title {
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.modal-body {
  background-color: var(--hf-bg-secondary) !important;
  color: var(--hf-text-primary) !important;
  padding: 1.5rem !important;
}

.modal-footer {
  background-color: var(--hf-bg-tertiary) !important;
  border-top: 1px solid var(--hf-border) !important;
  padding: 0.85rem 1.5rem !important;
}

.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.72) !important;
}

.btn-close {
  filter: invert(1) brightness(0.75);
  opacity: 0.7;
  transition: opacity var(--hf-transition);
}

.btn-close:hover {
  opacity: 1;
}

/* ── Challenge Modal — Tabs ────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--hf-border) !important;
}

.nav-tabs .nav-link {
  color: var(--hf-text-secondary) !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  background: transparent !important;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  transition: all var(--hf-transition);
}

.nav-tabs .nav-link:hover {
  color: var(--hf-gold) !important;
  border-bottom-color: var(--hf-gold-dim) !important;
}

.nav-tabs .nav-link.active {
  color: var(--hf-gold) !important;
  border-bottom-color: var(--hf-gold) !important;
  background: transparent !important;
}

/* Challenge value display */
.challenge-value {
  color: var(--hf-gold-bright) !important;
  font-size: 1.4rem !important;
  font-weight: 700;
  font-family: var(--hf-font-body) !important;
}

/* Challenge tags */
.challenge-tag {
  font-size: 0.78rem !important;
  padding: 0.25em 0.65em !important;
  border-radius: 20px !important;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0.15rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  border-radius: var(--hf-radius-sm) !important;
  font-weight: 500;
  transition: all var(--hf-transition);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.btn-primary,
.btn-outline-primary {
  background: linear-gradient(135deg, var(--hf-gold), var(--hf-gold-bright)) !important;
  border: none !important;
  color: #0b0e13 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.2);
}

.btn-primary:hover,
.btn-outline-primary:hover {
  background: linear-gradient(135deg, var(--hf-gold-bright), var(--hf-gold)) !important;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn-outline-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(201, 168, 76, 0.2) !important;
}

.btn-secondary,
.btn-outline-secondary {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-border) !important;
  color: var(--hf-text-primary) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
  border-color: var(--hf-gold-muted) !important;
  color: var(--hf-gold) !important;
  background-color: var(--hf-bg-elevated) !important;
}

.btn-success {
  background-color: var(--hf-success) !important;
  border-color: var(--hf-success) !important;
  color: #fff !important;
}

.btn-danger {
  background-color: var(--hf-danger) !important;
  border-color: var(--hf-danger) !important;
  color: #fff !important;
}

.btn-info {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-info) !important;
  color: var(--hf-info) !important;
}

.btn-info:hover {
  background-color: var(--hf-info-muted) !important;
}

.btn-dark {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-border) !important;
  color: var(--hf-text-primary) !important;
}

/* Submit button enhancement */
.challenge-submit {
  font-family: var(--hf-font-heading) !important;
  letter-spacing: 0.04em;
  font-weight: 600 !important;
  text-transform: uppercase;
  font-size: 0.85rem !important;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-control,
.form-select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
  background-color: var(--hf-bg-primary) !important;
  border: 1px solid var(--hf-border) !important;
  color: var(--hf-text-primary) !important;
  border-radius: var(--hf-radius-sm) !important;
  transition: border-color var(--hf-transition), box-shadow var(--hf-transition);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--hf-gold) !important;
  box-shadow: 0 0 0 3px var(--hf-gold-glow) !important;
  outline: none !important;
  background-color: var(--hf-bg-primary) !important;
}

.form-control::placeholder,
input::placeholder {
  color: var(--hf-text-muted) !important;
  font-style: italic;
  font-size: 0.88rem;
}

label,
.form-label {
  color: var(--hf-text-secondary) !important;
  font-weight: 500;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.form-text {
  font-size: 0.8rem;
  color: var(--hf-text-muted) !important;
}

/* Input groups */
.input-group .form-control {
  border-right: none !important;
}

.input-group .btn {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* ── Tables (Scoreboard, admin) ────────────────────────────────────────────── */
.table {
  color: var(--hf-text-primary) !important;
  border-color: var(--hf-border) !important;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background-color: var(--hf-bg-tertiary) !important;
  color: var(--hf-gold) !important;
  border-bottom: 2px solid var(--hf-gold-dim) !important;
  font-family: var(--hf-font-heading) !important;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 1rem !important;
}

.table tbody tr {
  border-bottom: 1px solid var(--hf-border-muted) !important;
  transition: background-color var(--hf-transition);
}

.table tbody tr:hover {
  background-color: var(--hf-bg-tertiary) !important;
}

.table td {
  padding: 0.7rem 1rem !important;
  vertical-align: middle;
}

.table td,
.table th {
  border-color: var(--hf-border-muted) !important;
}

/* Scoreboard top 3 highlight — elegant medal treatment */
.table tbody tr:nth-child(1) {
  background-color: rgba(201, 168, 76, 0.10) !important;
  border-left: 3px solid var(--hf-gold) !important;
}

.table tbody tr:nth-child(1) th {
  color: var(--hf-gold-bright) !important;
  font-weight: 700;
}

.table tbody tr:nth-child(2) {
  background-color: rgba(192, 192, 192, 0.06) !important;
  border-left: 3px solid #b0b0b0 !important;
}

.table tbody tr:nth-child(3) {
  background-color: rgba(180, 120, 60, 0.06) !important;
  border-left: 3px solid #b4783c !important;
}

/* Striped table override */
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: transparent !important;
  --bs-table-accent-bg: transparent !important;
}

.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: rgba(255, 255, 255, 0.015) !important;
  --bs-table-accent-bg: rgba(255, 255, 255, 0.015) !important;
}

/* ── Scoreboard specific ───────────────────────────────────────────────────── */
#scoreboard .nav-pills .nav-link {
  color: var(--hf-text-secondary) !important;
  background: transparent !important;
  border: 1px solid var(--hf-border) !important;
  border-radius: var(--hf-radius-sm) !important;
  margin: 0 0.25rem;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.45rem 1rem;
  transition: all var(--hf-transition);
}

#scoreboard .nav-pills .nav-link:hover {
  color: var(--hf-gold) !important;
  border-color: var(--hf-gold-muted) !important;
}

#scoreboard .nav-pills .nav-link.active {
  background: linear-gradient(135deg, var(--hf-gold), var(--hf-gold-bright)) !important;
  border-color: var(--hf-gold) !important;
  color: #0b0e13 !important;
  font-weight: 600;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.page-link {
  background-color: var(--hf-bg-secondary) !important;
  border-color: var(--hf-border) !important;
  color: var(--hf-text-primary) !important;
  font-size: 0.88rem;
  transition: all var(--hf-transition);
}

.page-link:hover {
  background-color: var(--hf-bg-tertiary) !important;
  color: var(--hf-gold) !important;
  border-color: var(--hf-gold-dim) !important;
}

.page-item.active .page-link {
  background-color: var(--hf-gold) !important;
  border-color: var(--hf-gold) !important;
  color: #0b0e13 !important;
  font-weight: 600;
}

/* ── Badges & Tags ─────────────────────────────────────────────────────────── */
.badge {
  font-weight: 500;
  border-radius: 4px;
  padding: 0.3em 0.65em;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.badge.bg-primary,
.badge-primary {
  background-color: var(--hf-gold) !important;
  color: #0b0e13 !important;
}

.badge.bg-secondary {
  background-color: var(--hf-bg-tertiary) !important;
  color: var(--hf-text-secondary) !important;
  border: 1px solid var(--hf-border);
}

.badge.bg-success,
.badge-success {
  background-color: var(--hf-success) !important;
}

.badge.bg-danger,
.badge-danger {
  background-color: var(--hf-danger) !important;
}

.badge.bg-info {
  background-color: var(--hf-info-muted) !important;
  color: var(--hf-info) !important;
  border: 1px solid rgba(88, 166, 255, 0.25);
}

/* Badge notification (navbar) */
.badge-notification {
  font-size: 0.65rem !important;
  padding: 0.2em 0.45em !important;
  vertical-align: super;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--hf-radius-sm) !important;
  border: 1px solid var(--hf-border) !important;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
}

.alert-success {
  background-color: var(--hf-success-muted) !important;
  border-color: var(--hf-success) !important;
  color: #3fb950 !important;
}

.alert-danger {
  background-color: var(--hf-danger-muted) !important;
  border-color: var(--hf-danger) !important;
  color: #f85149 !important;
}

.alert-info {
  background-color: var(--hf-info-muted) !important;
  border-color: var(--hf-info) !important;
  color: var(--hf-info) !important;
}

.alert-warning {
  background-color: var(--hf-warning-muted) !important;
  border-color: var(--hf-warning) !important;
  color: var(--hf-warning) !important;
}

/* ── Dropdowns ─────────────────────────────────────────────────────────────── */
.dropdown-menu {
  background-color: var(--hf-bg-elevated) !important;
  border: 1px solid var(--hf-border) !important;
  box-shadow: var(--hf-shadow-lg);
  border-radius: var(--hf-radius-md) !important;
  padding: 0.4rem 0;
}

.dropdown-item {
  color: var(--hf-text-primary) !important;
  transition: all var(--hf-transition);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--hf-gold-glow) !important;
  color: var(--hf-gold) !important;
}

.dropdown-divider {
  border-color: var(--hf-border) !important;
  margin: 0.3rem 0;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer,
.footer {
  position: static !important;
  display: block;
  width: 100%;
  height: auto !important;
  min-height: 0;
  flex: 0 0 auto;
  clear: both;
  background-color: var(--hf-bg-secondary) !important;
  border-top: 1px solid var(--hf-border) !important;
  color: var(--hf-text-muted) !important;
  padding: 1.25rem 0 !important;
  margin-top: auto;
}

.footer .text-muted {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* ── Profile / User Page ───────────────────────────────────────────────────── */
.jumbotron .badge.rounded-pill {
  font-family: var(--hf-font-body) !important;
  font-size: 0.82rem !important;
  padding: 0.35em 0.85em !important;
  font-weight: 500;
  border: 1px solid rgba(201, 168, 76, 0.25);
}

.jumbotron h2 small,
.jumbotron h2 .text-muted {
  font-family: var(--hf-font-body) !important;
  font-size: 0.9rem;
  color: var(--hf-text-secondary) !important;
}

/* Progress bars on profile */
.progress {
  background-color: var(--hf-bg-tertiary) !important;
  border-radius: var(--hf-radius-sm);
  height: 8px !important;
  overflow: hidden;
}

.progress-bar {
  border-radius: var(--hf-radius-sm);
  transition: width 0.6s ease;
}

/* Score graph area */
#score-graph {
  min-height: 200px;
}

/* ── Settings Page ─────────────────────────────────────────────────────────── */
.nav-pills .nav-link {
  color: var(--hf-text-secondary) !important;
  background-color: transparent !important;
  border-radius: var(--hf-radius-sm) !important;
  font-weight: 500;
  padding: 0.55rem 1rem;
  margin-bottom: 0.25rem;
  transition: all var(--hf-transition);
  font-size: 0.9rem;
}

.nav-pills .nav-link:hover {
  color: var(--hf-gold) !important;
  background-color: var(--hf-gold-glow) !important;
}

.nav-pills .nav-link.active {
  color: var(--hf-gold) !important;
  background-color: var(--hf-gold-glow) !important;
  border-left: 2px solid var(--hf-gold);
  font-weight: 600;
}

/* Settings form dividers */
.tab-content hr {
  border-color: var(--hf-border) !important;
  opacity: 0.5;
  margin: 1.5rem 0;
}

/* ── Custom Pages (Rules, Story, FAQ) ──────────────────────────────────────── */
.page-content {
  max-width: 800px;
  margin: 0 auto;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--hf-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--hf-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--hf-gold-muted);
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes hf-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hf-fadeInSlow {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card,
.challenge-button,
.table {
  animation: hf-fadeIn 0.35s ease-out;
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.text-muted {
  color: var(--hf-text-muted) !important;
}

.text-secondary {
  color: var(--hf-text-secondary) !important;
}

.border {
  border-color: var(--hf-border) !important;
}

hr {
  border-color: var(--hf-border) !important;
  opacity: 0.4;
}

/* Override Bootstrap's default focus outline */
*:focus-visible {
  outline: 2px solid var(--hf-gold) !important;
  outline-offset: 2px;
}

/* ── Notification toast ────────────────────────────────────────────────────── */
.toast {
  background-color: var(--hf-bg-elevated) !important;
  border: 1px solid var(--hf-border) !important;
  color: var(--hf-text-primary) !important;
  border-radius: var(--hf-radius-sm) !important;
  box-shadow: var(--hf-shadow-md);
}

/* ── Challenge Description Content ─────────────────────────────────────────── */
.modal-body code,
.challenge-desc code,
.page-content code {
  background-color: var(--hf-bg-primary);
  color: var(--hf-gold-bright);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-family: var(--hf-font-mono);
  font-size: 0.88em;
  border: 1px solid var(--hf-border-muted);
}

.modal-body pre,
.challenge-desc pre,
.page-content pre {
  background-color: var(--hf-bg-primary) !important;
  border: 1px solid var(--hf-border) !important;
  border-radius: var(--hf-radius-md);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: var(--hf-text-primary);
  font-family: var(--hf-font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
}

.modal-body pre code,
.challenge-desc pre code,
.page-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.modal-body img,
.challenge-desc img {
  max-width: 100%;
  height: auto;
  border-radius: var(--hf-radius-sm);
  border: 1px solid var(--hf-border);
  margin: 0.75rem 0;
}

.modal-body blockquote,
.challenge-desc blockquote {
  border-left: 3px solid var(--hf-gold-dim);
  padding: 0.6rem 1.1rem;
  margin: 1rem 0;
  color: var(--hf-text-secondary);
  background-color: var(--hf-bg-tertiary);
  border-radius: 0 var(--hf-radius-sm) var(--hf-radius-sm) 0;
  font-style: italic;
}

.modal-body hr,
.challenge-desc hr {
  border-color: var(--hf-border);
  opacity: 0.4;
}

/* ── Challenge Submit Row ──────────────────────────────────────────────────── */
.submit-row {
  margin-top: 1.25rem;
}

.submit-row .form-control {
  padding: 0.6rem 0.9rem !important;
}

/* ── Hint Details ──────────────────────────────────────────────────────────── */
details {
  background-color: var(--hf-bg-tertiary);
  border: 1px solid var(--hf-border);
  border-radius: var(--hf-radius-sm);
  margin-bottom: 0.6rem;
  overflow: hidden;
}

details summary {
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: var(--hf-warning);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color var(--hf-transition);
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: '▸ ';
  color: var(--hf-gold-muted);
  transition: transform var(--hf-transition);
  display: inline-block;
}

details[open] summary::before {
  content: '▾ ';
  color: var(--hf-gold);
}

details summary:hover {
  background-color: var(--hf-warning-muted);
}

details > div {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--hf-border);
  color: var(--hf-text-primary);
  font-size: 0.9rem;
}

/* ── First Blood Badge ─────────────────────────────────────────────────────── */
.first-blood::after,
[data-first-blood]::after {
  content: '✦';
  color: var(--hf-gold);
  font-size: 0.75rem;
  margin-left: 0.4rem;
  animation: hf-firstBloodPulse 2.5s ease-in-out infinite;
}

@keyframes hf-firstBloodPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 4px var(--hf-gold-glow); }
  50% { opacity: 0.5; text-shadow: 0 0 8px var(--hf-gold); }
}

/* Solve count badge on challenge buttons */
.challenge-button .badge,
[class*="challenge-tile"] .badge,
.board-challenges .badge {
  background-color: var(--hf-bg-primary) !important;
  color: var(--hf-gold) !important;
  border: 1px solid var(--hf-gold-dim);
  font-weight: 600;
  font-size: 0.72rem;
}

/* ── Hint Unlock Button ────────────────────────────────────────────────────── */
.hint-button,
button[data-hint-id],
.btn-hint,
a[href*="hint"] {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-warning) !important;
  color: var(--hf-warning) !important;
  font-weight: 500;
  border-radius: var(--hf-radius-sm);
  transition: all var(--hf-transition);
  position: relative;
}

.hint-button:hover,
button[data-hint-id]:hover,
.btn-hint:hover,
a[href*="hint"]:hover {
  background-color: var(--hf-warning-muted) !important;
  border-color: var(--hf-gold) !important;
  color: var(--hf-gold) !important;
  box-shadow: 0 0 12px rgba(210, 153, 34, 0.12);
}

/* Hint cost warning */
.hint-cost,
.hint-button small,
[data-hint-cost] {
  color: var(--hf-danger) !important;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Already unlocked hints */
.hint-unlocked,
.hint-button.unlocked {
  border-color: var(--hf-success) !important;
  color: var(--hf-success) !important;
  opacity: 0.8;
}

/* ── File Download Buttons ─────────────────────────────────────────────────── */
.btn-file {
  background-color: var(--hf-bg-tertiary) !important;
  border: 1px solid var(--hf-info) !important;
  color: var(--hf-info) !important;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--hf-radius-sm) !important;
  transition: all var(--hf-transition);
}

.btn-file:hover {
  background-color: var(--hf-info-muted) !important;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.12);
}

.btn-file i {
  margin-right: 0.35rem;
  font-size: 0.8rem;
}

/* ── Loading Spinner ───────────────────────────────────────────────────────── */
.spinner-border,
.loading-indicator,
.hf-loading::after {
  border-color: var(--hf-gold-dim) !important;
  border-right-color: var(--hf-gold) !important;
}

/* Spinner icon styling */
.fa-circle-notch.fa-spin,
.spinner {
  color: var(--hf-gold) !important;
}

.hf-loading {
  position: relative;
  pointer-events: none;
}

.hf-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid var(--hf-gold-dim);
  border-right-color: var(--hf-gold);
  border-radius: 50%;
  animation: hf-spin 0.7s linear infinite;
  z-index: 10;
}

@keyframes hf-spin {
  to { transform: rotate(360deg); }
}

/* Page transition — subtle fade on navigation */
.page-transition,
main,
.container:not(.navbar .container) {
  animation: hf-fadeInSlow 0.3s ease-out;
}

/* ── Notifications Page ────────────────────────────────────────────────────── */
.card.bg-body-tertiary {
  background-color: var(--hf-bg-secondary) !important;
}

.card.bg-body-tertiary .blockquote {
  border-left: 3px solid var(--hf-gold-dim);
  padding-left: 1rem;
  margin-top: 0.5rem;
}

/* ── Participant Experience — HUD Widget ───────────────────────────────────── */
.hf-hud-widget .card-header:hover {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

.hf-horcrux-item:hover {
  background-color: rgba(201, 168, 76, 0.05) !important;
  transform: translateX(3px);
}

/* ── Registration Steps ────────────────────────────────────────────────────── */
#step-1,
#step-2 {
  animation: hf-fadeIn 0.35s ease-out;
}

/* ── Container Spacing ─────────────────────────────────────────────────────── */
main > .container {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

/* ── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }

  .jumbotron {
    padding: 1.75rem 0 1.5rem !important;
  }

  .jumbotron h1 {
    font-size: 1.5rem;
  }

  .card:hover {
    transform: none;
    box-shadow: var(--hf-shadow-sm);
  }

  .challenge-button:hover {
    transform: none;
  }

  .navbar-brand {
    font-size: 1.05rem !important;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 0.5rem !important;
    font-size: 0.88rem;
  }

  .navbar-nav .nav-link.active::after {
    display: none;
  }

  .table thead th {
    font-size: 0.78rem;
    padding: 0.55rem 0.6rem !important;
  }

  .table td {
    padding: 0.55rem 0.6rem !important;
    font-size: 0.85rem;
  }

  footer {
    margin-top: 2rem;
  }

  .hf-hud-container {
    width: 220px !important;
    bottom: 12px !important;
    left: 12px !important;
  }

  .modal-body {
    padding: 1rem !important;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .jumbotron h1 {
    font-size: 1.25rem;
  }

  .challenge-button .challenge-inner p {
    font-size: 0.85rem;
  }

  .challenge-button .challenge-inner span {
    font-size: 0.95rem;
  }
}

/* ── Selection / Highlight color ───────────────────────────────────────────── */
::selection {
  background-color: rgba(201, 168, 76, 0.3);
  color: var(--hf-text-primary);
}

::-moz-selection {
  background-color: rgba(201, 168, 76, 0.3);
  color: var(--hf-text-primary);
}

/* ── Print-friendly ────────────────────────────────────────────────────────── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .navbar, footer, .hf-hud-container { display: none !important; }
}
