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

:root {
  --bg-dark: #0a0a12;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --glass-hover: rgba(255,255,255,0.07);
  --neon-cyan: #00f0ff;
  --neon-purple: #a855f7;
  --neon-pink: #f472b6;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(.4,0,.2,1);

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --discord: #5865F2;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(168,85,247,0.15), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(0,240,255,0.10), transparent),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(244,114,182,0.08), transparent),
    var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

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

/* ── Nav Island ───────────────────────────────────────── */
.nav-bar {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
  max-width: calc(100% - 2rem);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem 0.4rem 0.65rem;
  background: rgba(15,15,25,0.7);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-decoration: none;
  padding-right: 0.4rem;
  margin-right: 0.15rem;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.nav-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-link {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.07);
  text-decoration: none;
}

.nav-link.active {
  color: var(--neon-cyan);
  background: rgba(0,240,255,0.1);
}

.nav-logout {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.15rem;
  padding-left: 0.4rem;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.nav-username {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.45rem;
  flex-direction: column;
  gap: 3.5px;
}

.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Container ───────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 1.25rem 4rem;
}

/* ── Page Header ─────────────────────────────────────── */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pcw-logo {
  max-width: clamp(80px, 20vw, 130px);
  height: auto;
  filter: drop-shadow(0 0 20px rgba(0,240,255,0.3));
}

.page-title {
  font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #0a0a12;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover { background: var(--glass-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-discord {
  background: var(--discord);
  color: #fff;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  border-radius: 12px;
}
.btn-discord:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-remove {
  color: var(--danger);
  opacity: 0.6;
}
.btn-remove:hover { opacity: 1; background: rgba(239,68,68,0.1); }

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0;
}

.tab {
  padding: 0.6rem 1.2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.tab:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
}

/* ── Filter Bar ──────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.filter-chip {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  transition: all var(--transition);
}

.filter-chip:hover {
  color: var(--text-primary);
  background: var(--glass-hover);
  text-decoration: none;
}

.filter-chip.active {
  color: var(--neon-cyan);
  border-color: rgba(0,240,255,0.3);
  background: rgba(0,240,255,0.08);
}

/* ── Challenges Grid ─────────────────────────────────── */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.challenge-card {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: all var(--transition);
}

.challenge-card:hover {
  background: var(--glass-hover);
  border-color: rgba(0,240,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,240,255,0.05) inset;
  text-decoration: none;
}

.challenge-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.challenge-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  flex: 1;
}

.challenge-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.challenge-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid var(--glass-border);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meta-apps { color: var(--neon-purple); font-weight: 600; }
.meta-creator { font-size: 0.8rem; }

.challenge-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-wa-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(37,211,102,0.1);
  border: 1px solid rgba(37,211,102,0.2);
  color: #25d366;
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-wa-share:hover {
  background: rgba(37,211,102,0.22);
  border-color: rgba(37,211,102,0.45);
  box-shadow: 0 0 12px rgba(37,211,102,0.15);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-wa-share svg { width: 16px; height: 16px; fill: currentColor; }
.btn-wa-share[role="button"] { cursor: pointer; }

/* ── Game Badges ─────────────────────────────────────── */
.game-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(0,240,255,0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0,240,255,0.2);
}

.game-cod4-promod {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-color: rgba(239,68,68,0.2);
}

.game-cs2 {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
  border-color: rgba(251,191,36,0.2);
}

.game-valorant {
  background: rgba(239,68,68,0.12);
  color: #fb7185;
  border-color: rgba(239,68,68,0.2);
}

.game-fortnite {
  background: rgba(168,85,247,0.12);
  color: var(--neon-purple);
  border-color: rgba(168,85,247,0.2);
}

.badge-sm {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
}

/* ── Status Badges ───────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-open { background: rgba(0,240,255,0.12); color: var(--neon-cyan); }
.status-accepted { background: rgba(34,197,94,0.12); color: var(--success); }
.status-completed { background: rgba(148,163,184,0.12); color: var(--text-secondary); }
.status-cancelled { background: rgba(239,68,68,0.12); color: var(--danger); }
.status-pending { background: rgba(245,158,11,0.12); color: var(--warning); }
.status-rejected { background: rgba(239,68,68,0.12); color: var(--danger); }
.status-withdrawn { background: rgba(100,116,139,0.12); color: var(--text-muted); }

/* ── Detail Page ─────────────────────────────────────── */
.detail-header {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.detail-header-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.detail-title {
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.detail-description {
  color: var(--text-secondary);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
  white-space: pre-wrap;
}

.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.player-count {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── Roster ──────────────────────────────────────────── */
.roster-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  transition: background var(--transition);
}

.roster-item:hover { background: rgba(255,255,255,0.04); }

.mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mini-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.roster-name {
  font-size: 0.9rem;
  flex: 1;
}

.tag-external {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.3rem;
}

/* ── Application Cards ───────────────────────────────── */
.application-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.application-card.app-status-accepted {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.04);
}

.application-card.app-status-rejected,
.application-card.app-status-withdrawn {
  opacity: 0.5;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-team-name { font-size: 1rem; }

.app-actions {
  display: flex;
  gap: 0.4rem;
}

.app-message {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.app-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Apply Section ───────────────────────────────────── */
.apply-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.apply-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--neon-purple);
}

/* ── Add Player Form ─────────────────────────────────── */
.add-player-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.user-search-wrapper {
  position: relative;
  margin-top: 0.4rem;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(15,15,25,0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.search-results.open { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--glass-hover); }

/* ── Forms ───────────────────────────────────────────── */
.form-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.form-group {
  margin-bottom: 1rem;
}

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

.form-inline {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.inline-form {
  display: inline;
}

.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(0,240,255,0.1);
}

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

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

select.input option {
  background: #1a1a2e;
  color: var(--text-primary);
}

textarea.input { resize: vertical; }

.input-group {
  flex: 1;
}

.mt-1 { margin-top: 0.4rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Creator Actions ─────────────────────────────────── */
.creator-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.edit-form-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.edit-form-container h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* ── My Challenges ───────────────────────────────────── */
.my-section {
  margin-bottom: 2rem;
}

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

.application-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.application-row:hover {
  background: var(--glass-hover);
  text-decoration: none;
}

.app-row-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-row-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; }
.empty-text { color: var(--text-muted); font-size: 0.9rem; }
.text-muted { color: var(--text-muted); }

/* ── Flash Messages ──────────────────────────────────── */
.flash-container {
  margin-bottom: 1rem;
}

.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  border-left: 3px solid;
}

.flash-success { background: rgba(34,197,94,0.08); border-color: var(--success); color: var(--success); }
.flash-error { background: rgba(239,68,68,0.08); border-color: var(--danger); color: var(--danger); }
.flash-warning { background: rgba(245,158,11,0.08); border-color: var(--warning); color: var(--warning); }
.flash-info { background: rgba(0,240,255,0.08); border-color: var(--neon-cyan); color: var(--neon-cyan); }

/* ── Login Page ──────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
  padding: 4rem 2rem 2rem;
}

.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-logo {
  width: 100px;
  height: 100px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(0,240,255,0.3));
}

.login-title {
  font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.login-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* ── Dev Mode ────────────────────────────────────────── */
.dev-banner {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #0a0a12;
  background: var(--warning);
  margin-bottom: 1rem;
}

.dev-users {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.btn-dev {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-dev:hover {
  background: var(--glass-hover);
  border-color: var(--neon-cyan);
  transform: translateX(4px);
  text-decoration: none;
}

.dev-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #0a0a12;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── Footer (identico a home/memorial) ──────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  margin-top: 2rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer a:hover { color: var(--neon-cyan); }

.footer-links { margin-top: 0.5rem; }
.footer-links a + a { margin-left: 1.5rem; }

/* ── Policy Modals ───────────────────────────────────── */
.policy-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.policy-modal-overlay.open { display: flex; }

.policy-modal {
  position: relative;
  background: rgba(18,18,30,0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.policy-modal h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.policy-modal h4 {
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
}

.policy-modal a { color: var(--neon-cyan); }

.policy-modal ul {
  padding-left: 1.2rem;
  margin: 0.4rem 0;
}

.policy-modal ul li { margin-bottom: 0.2rem; }

.policy-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.policy-close:hover {
  color: var(--text-primary);
  background: var(--glass-hover);
}

/* ── Home Chip (come memorial) ────────────────────────── */
.home-chip {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition);
}

.home-chip:hover {
  color: var(--neon-cyan);
  border-color: rgba(0,240,255,0.3);
  background: rgba(0,240,255,0.08);
  text-decoration: none;
}

.home-chip svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.challenge-card,
.detail-header,
.detail-section,
.form-card,
.application-card,
.application-row {
  animation: fadeSlideIn 0.6s ease-out;
}

.login-card {
  animation: fadeSlideIn 0.8s ease-out;
}

/* Smooth page & content transitions */
.container {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.container.page-leaving {
  opacity: 0;
  transform: translateY(10px);
}

.container.page-entering {
  animation: fadeSlideIn 0.35s ease-out;
}

.fade-content {
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.fade-content.fade-out {
  opacity: 0;
  transform: translateY(6px);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-bar {
    top: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    z-index: 99;
    background: rgba(15,15,25,0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    padding: 0.6rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    gap: 0.15rem;
  }

  .nav-links.open { display: flex; }

  .nav-link {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
  }

  .nav-user {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 0.6rem;
    margin-top: 0.15rem;
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  .nav-hamburger { display: flex; }

  .container { padding: 5rem 0.75rem 3rem; }

  .page-header {
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.75rem;
    justify-content: center;
  }
  .tab { padding: 0.55rem 0.9rem; font-size: 0.85rem; white-space: nowrap; }

  .filter-bar { gap: 0.3rem; margin-bottom: 1.25rem; justify-content: center; }
  .filter-chip { padding: 0.25rem 0.6rem; font-size: 0.75rem; }

  .challenges-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .challenge-card { padding: 1.1rem; }
  .challenge-card-title { font-size: 0.95rem; }
  .challenge-card-meta { gap: 0.5rem; }

  .detail-header { padding: 1.1rem; margin-bottom: 1rem; }
  .detail-header-top { justify-content: center; }
  .detail-title { text-align: center; }
  .detail-meta { gap: 0.5rem; justify-content: center; }
  .detail-description { text-align: left; }
  .detail-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
  }
  .detail-section { padding: 1.1rem; }
  .section-title { font-size: 0.95rem; margin-bottom: 0.75rem; justify-content: center; }

  .my-section { text-align: center; }
  .my-section .section-title { justify-content: center; }
  .my-section .challenges-grid,
  .my-section .applications-list { text-align: left; }

  .form-row { grid-template-columns: 1fr; }
  .form-card { padding: 1.15rem; }
  .form-group { margin-bottom: 0.85rem; }
  .form-actions { flex-direction: column; margin-top: 1.25rem; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .btn { width: 100%; justify-content: center; }

  .creator-actions { flex-direction: column; gap: 0.5rem; align-items: center; }
  .creator-actions .btn,
  .creator-actions .inline-form { width: 100%; }
  .creator-actions .inline-form .btn { width: 100%; justify-content: center; }

  .application-row { flex-direction: column; align-items: flex-start; }
  .app-row-meta { margin-top: 0.25rem; }

  .app-header { flex-direction: column; align-items: flex-start; }
  .app-actions { width: 100%; }
  .app-actions .btn { flex: 1; justify-content: center; }

  .application-card { padding: 1rem; }
  .app-message { font-size: 0.82rem; }

  .my-section { margin-bottom: 1.5rem; }

  .login-page { padding: 3rem 1rem 2rem; }
  .login-card { padding: 2rem 1.5rem; }
  .login-subtitle { font-size: 0.9rem; margin-bottom: 1.5rem; }

  .empty-state { padding: 2rem 0.75rem; }

  /* Touch-friendly targets (min 44px) */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .roster-item { min-height: 40px; padding: 0.5rem 0.6rem; }
  .search-result-item { min-height: 44px; }
}

@media (max-width: 480px) {
  .container { padding: 4.5rem 0.6rem 2.5rem; }

  .login-page { padding: 2.5rem 0.75rem 1.5rem; }
  .login-card { padding: 1.75rem 1.15rem; }
  .login-logo { width: 80px; height: 80px; margin-bottom: 1.25rem; }

  .challenge-card { padding: 1rem; }
  .challenge-card-meta { flex-direction: column; gap: 0.3rem; }

  .detail-header { padding: 1rem; }
  .detail-meta { flex-direction: column; gap: 0.35rem; }
  .detail-section { padding: 1rem; }

  .form-card { padding: 1rem; }

  .dev-users { gap: 0.4rem; }
  .btn-dev { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
  .dev-avatar { width: 28px; height: 28px; font-size: 0.8rem; }
}
