:root {
  --ink: #182335;
  --muted: #66758a;
  --line: #dfe8f2;
  --paper: #ffffff;
  --wash: #f3f7fb;
  --blue: #3568a5;
  --blue-soft: #e9f2fb;
  --green: #19a974;
  --green-soft: #e8f7f0;
  --gold: #f3b23a;
  --rose: #e85d75;
  --shadow: 0 22px 60px rgba(31, 47, 70, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--wash);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* ─── WIP banner ─────────────────────────────────────────── */

.wip-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffbea;
  border-bottom: 1px solid #f3b23a;
  padding: 10px 24px;
  font-size: 0.85rem;
  color: #7a5a00;
}

.wip-tag {
  background: #f3b23a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ─── Blur utilities ──────────────────────────────────────── */

.blur-wrap {
  display: inline-flex;
  border-radius: 8px;
}

.section-blurred {
  position: relative;
}

.section-blurred::before {
  content: "COMING SOON!";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #a85f08;
  background: rgba(255, 246, 220, 0.97);
  padding: 7px 16px;
  border-radius: 6px;
  border: 1.5px solid #f3b23a;
  white-space: nowrap;
  pointer-events: none;
}

.section-blurred::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  backdrop-filter: blur(8px) saturate(0.6);
  background: rgba(243, 247, 251, 0.5);
  z-index: 4;
}

/* ─── Topbar ──────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(223, 232, 242, 0.9);
  backdrop-filter: blur(18px);
}

.brand,
.profile-chip,
.top-actions,
.nav-links,
.hero-actions,
.stat-row,
.section-heading,
.rank-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  font-size: 1.08rem;
}

.brand-mark,
.avatar,
.quest-icon,
.card-icon,
.rank {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--green);
  color: white;
}

.nav-links {
  gap: clamp(16px, 3vw, 34px);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-links a:hover {
  color: var(--blue);
}

.top-actions {
  gap: 12px;
}

.profile-chip {
  gap: 9px;
  padding: 7px 12px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.75rem;
}

/* ─── Layout ──────────────────────────────────────────────── */

main {
  padding-bottom: 56px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding: clamp(30px, 6vw, 72px) clamp(18px, 5vw, 72px) 34px;
}

.dashboard-copy {
  max-width: 620px;
}

.eyebrow,
.mini-label,
.difficulty {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 660px;
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 8vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.26rem);
  line-height: 1.6;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  padding: 0 22px;
  background: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(25, 169, 116, 0.24);
  transition: box-shadow 0.15s, transform 0.15s;
}

.primary-button:hover {
  box-shadow: 0 16px 32px rgba(25, 169, 116, 0.32);
  transform: translateY(-1px);
}

.secondary-button {
  padding: 0 20px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--blue);
}

.stat-row {
  flex-wrap: wrap;
  gap: 14px;
}

.stat-row div {
  min-width: 118px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.stat-row strong {
  display: block;
  font-size: 1.45rem;
}

.stat-row span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.learning-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.learning-card img {
  display: block;
  width: 100%;
  height: auto;
}

.workspace,
.two-column,
.account-profile-grid {
  display: grid;
  gap: 22px;
  padding: 22px clamp(18px, 5vw, 72px);
}

.workspace {
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  align-items: stretch;
}

.side-panel,
.practice-board,
.leaderboard,
.meet-plan,
.account-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 14px 36px rgba(31, 47, 70, 0.08);
}

.side-panel {
  padding: 22px;
}

.panel-heading {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.panel-heading strong {
  font-size: 1.25rem;
}

.quest-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quest-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quest-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
}

.quest-list strong,
.quest-list span {
  display: block;
}

.quest-list span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.quest-list .is-done .quest-icon {
  background: var(--green-soft);
  color: var(--green);
}

.quest-list .is-active {
  border-color: rgba(53, 104, 165, 0.45);
  background: var(--blue-soft);
}

/* ─── Practice board ──────────────────────────────────────── */

.practice-board {
  padding: clamp(20px, 3vw, 30px);
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.compact {
  margin-bottom: 16px;
}

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.challenge-card {
  display: grid;
  min-height: 260px;
  align-content: start;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  transition: box-shadow 0.2s ease;
}

.challenge-card.featured {
  background: #f5fbf8;
  border-color: rgba(25, 169, 116, 0.35);
}

@keyframes card-highlight {
  0%   { box-shadow: 0 0 0 0 rgba(53, 104, 165, 0.55); }
  25%  { box-shadow: 0 0 0 8px rgba(53, 104, 165, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(53, 104, 165, 0); }
}

.challenge-card.is-highlighted {
  animation: card-highlight 1.8s ease-out forwards;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: white;
  font-size: 1.35rem;
  font-weight: 900;
}

.blue  { background: var(--blue); }
.green { background: var(--green); }
.gold  { background: var(--gold); }
.rose  { background: var(--rose); }

.challenge-card h3 {
  margin-bottom: 0;
  font-size: 1.18rem;
}

.challenge-card p {
  color: var(--muted);
  line-height: 1.55;
}

.coming-soon-chip {
  display: inline-flex;
  align-items: center;
  align-self: start;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wash);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: auto;
}

/* ─── Account & profile ───────────────────────────────────── */

.two-column {
  grid-template-columns: 1fr 1fr;
}

.account-profile-grid {
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.08fr);
}

.account-panel,
.profile-panel {
  padding: clamp(20px, 3vw, 30px);
}

.account-form,
.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-form label,
.profile-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.account-form input,
.account-form select,
.profile-form input,
.profile-form select,
.profile-form textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 0 12px;
  outline: none;
}

.profile-form textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
}

.form-button,
.form-note,
.wide-field {
  grid-column: 1 / -1;
}

.form-button {
  border: 0;
  cursor: pointer;
}

.secondary-button.form-button {
  border: 1px solid var(--line);
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.profile-summary {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.profile-summary h2,
.profile-summary p {
  margin-bottom: 4px;
}

.profile-avatar-large {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.35rem;
  font-weight: 900;
}

/* ─── Teams & events ──────────────────────────────────────── */

.leaderboard,
.meet-plan {
  padding: clamp(20px, 3vw, 28px);
}

.text-button {
  min-width: 78px;
  min-height: 46px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--blue);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 800;
}

.rank-row {
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.rank {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
}

.rank-row strong {
  flex: 1;
}

.rank-row span:last-child {
  color: var(--muted);
  font-weight: 800;
}

.date-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 900;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline div {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 14px;
  align-items: start;
  padding-top: 2px;
}

.timeline span {
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border: 3px solid var(--green);
  border-radius: 50%;
}

.timeline p {
  margin-bottom: 0;
  color: var(--muted);
}

.timeline strong {
  color: var(--ink);
}

/* ─── Challenge modal ─────────────────────────────────────── */

.challenge-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 35, 53, 0.55);
  backdrop-filter: blur(6px);
}

.challenge-modal.is-open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 40px 100px rgba(24, 35, 53, 0.28);
  padding: clamp(24px, 4vw, 48px);
  animation: modal-in 0.2s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.modal-header h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.modal-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--wash);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.modal-close:hover {
  background: var(--line);
  color: var(--ink);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.modal-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 22px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.modal-card:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 28px rgba(53, 104, 165, 0.14);
  transform: translateY(-2px);
}

.modal-card.featured {
  background: #f5fbf8;
  border-color: rgba(25, 169, 116, 0.3);
}

.modal-card.featured:hover {
  border-color: var(--green);
  box-shadow: 0 8px 28px rgba(25, 169, 116, 0.16);
}

.modal-card h3 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.modal-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0;
}

.modal-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
}

.modal-card.featured .modal-card-cta {
  color: var(--green);
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 940px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .dashboard,
  .workspace,
  .two-column,
  .account-profile-grid {
    grid-template-columns: 1fr;
  }

  .learning-card {
    order: -1;
  }
}

@media (max-width: 720px) {
  .profile-chip span:last-child {
    display: none;
  }

  .dashboard {
    padding-top: 22px;
  }

  .challenge-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .account-form,
  .profile-form {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-row div {
    flex: 1 1 130px;
  }

  .modal-panel {
    padding: 24px 20px;
  }
}

@media (max-width: 460px) {
  .topbar {
    gap: 14px;
  }

  .brand {
    font-size: 1rem;
  }

  .top-actions {
    margin-left: auto;
  }

  .hero-actions a,
  .hero-actions button {
    width: 100%;
  }

  .rank-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}
