/* ============================================================
   0zacademy.com — Base Design System
   Theme-agnostic. All colours come from CSS vars.
   FPS vars → theme-fps.css
   Hogwarts  → theme-hogwarts.css
   Duolingo  → theme-duolingo.css
   ============================================================ */

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--text-bright); }
.dim { color: var(--text-dim); font-style: italic; }

/* ── Atmosphere ───────────────────────────────────────────── */
.scanlines {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
}
@keyframes scanFlicker {
  0%,94%,100% { opacity: 1; }
  95% { opacity: .85; }
  96% { opacity: 1; }
  97% { opacity: .9; }
}
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
@keyframes gridDrift {
  from { background-position: 0 0; }
  to   { background-position: 0 48px; }
}

/* ── HUD Header ───────────────────────────────────────────── */
.hud-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.hud-logo {
  font-family: var(--hud); font-weight: 900; font-size: 1.25rem;
  letter-spacing: .1em; color: var(--text-bright); text-decoration: none;
}
.logo-bracket { color: var(--text-dim); }
.logo-accent  { color: var(--accent); text-shadow: var(--glow); }
.hud-meta { display: flex; gap: 1.5rem; margin-left: auto; }
.hud-stat { font-family: var(--mono); font-size: .72rem; color: var(--text-dim); }
.hud-val  { color: var(--text); }
.hud-val.online { color: var(--accent); animation: blink 2s step-start infinite; }
@keyframes blink { 50% { opacity: .4; } }

.hud-nav { display: flex; gap: .75rem; }
.btn-hud {
  font-family: var(--mono); font-size: .75rem;
  padding: .35rem .9rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: transparent;
  cursor: pointer; transition: all .2s;
  text-decoration: none; letter-spacing: .05em;
}
.btn-hud:hover, .btn-hud.active {
  border-color: var(--accent);
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent);
}
.btn-hud.accent { border-color: var(--accent3); color: var(--accent3); }
.btn-hud.accent:hover { text-shadow: 0 0 8px var(--accent3); }
.btn-hud.danger { border-color: var(--accent2); color: var(--accent2); }
.btn-hud.danger:hover { text-shadow: 0 0 8px var(--accent2); }

/* ── Flash ────────────────────────────────────────────────── */
.flash {
  position: relative; z-index: 50;
  font-family: var(--mono); font-size: .8rem;
  padding: .75rem 2rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid;
  animation: flashIn .4s ease;
}
@keyframes flashIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.flash-success { background: rgba(0,255,100,.07); border-color: rgba(0,255,100,.3); color: #00ff64; }
.flash-warning { background: rgba(255,184,0,.07); border-color: rgba(255,184,0,.3); color: var(--accent3); }
.flash-info    { border-color: var(--border); color: var(--accent); }

/* ── Hero ─────────────────────────────────────────────────── */

/* Kill body background on the landing page regardless of active theme */
body.landing,
[data-theme] body.landing,
[data-theme="hogwarts"] body.landing,
[data-theme="duolingo"] body.landing {
  background: #2d1172 !important;
  background-image: none !important;
  background-color: #2d1172 !important;
}

/* The hero gradient must win over ALL theme overrides — use body.landing for specificity */
body.landing .hero,
[data-theme] body.landing .hero,
[data-theme="duolingo"] body.landing .hero,
[data-theme="hogwarts"] body.landing .hero,
[data-theme="fps"] body.landing .hero {
  background: linear-gradient(115deg,
    #2d1172 0%,
    #5c1494 22%,
    #9b1a8a 44%,
    #e0266a 64%,
    #f5600a 83%,
    #f98b00 100%
  ) !important;
  border-bottom: none !important;
}

.hero {
  position: relative; z-index: 1;
  padding: 5rem 2rem 5rem; text-align: center;
  overflow: hidden;
  min-height: calc(100vh - 56px);
  border-radius: 0 0 3rem 3rem;
}
/* Subtle left vignette so white text stays legible */
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(20,0,60,.35) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}
.hero-pre {
  font-family: var(--mono); font-size: .78rem;
  color: rgba(255,255,255,.75); letter-spacing: .12em;
  margin-bottom: 1rem; animation: fadeUp .6s ease both;
  position: relative; z-index: 2;
}
/* Hero title — force white regardless of theme */
body.landing .hero-title,
[data-theme] body.landing .hero-title {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
.hero-title {
  font-family: var(--hud); font-weight: 900;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.05; color: #fff;
  letter-spacing: .05em; animation: fadeUp .7s .1s ease both;
  text-shadow: 0 2px 24px rgba(0,0,0,.4);
  position: relative; z-index: 2;
}
/* Hero accent — force yellow regardless of theme */
body.landing .hero-accent,
[data-theme] body.landing .hero-accent {
  color: #ffd600 !important;
  text-shadow: none !important;
}
.hero-accent { color: #ffd600; display: block; }
/* Hero sub — force white regardless of theme */
body.landing .hero-sub,
[data-theme] body.landing .hero-sub {
  color: rgba(255,255,255,.88) !important;
}
.hero-sub {
  margin-top: 1rem; font-size: 1.05rem; color: rgba(255,255,255,.88);
  max-width: 480px; margin-inline: auto; animation: fadeUp .7s .2s ease both;
  position: relative; z-index: 2;
}
/* Girl — full height, flush right, top AND bottom anchored */
.hero-image {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  height: 100%;
  pointer-events: none;
  animation: fadeUp .9s .15s ease both;
  z-index: 1;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%);
  mask-image: linear-gradient(to right, transparent 0%, black 20%);
}
.hero-student-img {
  height: 100%; width: auto;
  display: block;
  object-fit: cover; object-position: top right;
}
/* Hero phase buttons — bottom left */
.hero-phases {
  position: absolute;
  left: 2.5rem; bottom: 2.5rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeUp .8s .3s ease both;
}
.hero-phases-label {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .12em;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  margin-bottom: -.25rem;
}
.hero-phase-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  max-width: 520px;
}
.hero-phase-btn {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .5rem .85rem;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: .6rem;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(6px);
  text-decoration: none;
  transition: background .2s, border-color .2s, transform .15s;
  cursor: pointer;
}
.hero-phase-btn:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.6);
  transform: translateY(-2px);
}
.phase-tag {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .06em;
}
.phase-name {
  font-family: var(--hud);
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .04em;
}
.hero-how-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.2rem;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 2rem;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: .8rem;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  letter-spacing: .06em;
  width: fit-content;
  transition: background .2s, border-color .2s, color .2s;
}
.hero-how-btn:hover {
  background: rgba(255,255,255,.18);
  border-color: #fff;
  color: #fff;
}
.how-icon {
  font-size: .65rem;
  opacity: .8;
}
@media (max-width: 900px) {
  .hero-phases { left: 1.25rem; bottom: 1.5rem; }
  .hero-phase-btns { max-width: 280px; }
  .hero-image { opacity: .22; }
}

/* ── Hero dynamic panel ──────────────────────────────────── */
.hero-panel {
  position: absolute;
  top: 1.5rem; left: 1.5rem;
  width: min(540px, 54%);
  max-height: calc(100% - 210px);
  overflow-y: auto;
  z-index: 4;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.hero-panel.panel-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.hp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.hp-phase-tag {
  font-family: var(--mono);
  font-size: .63rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .15rem;
}
.hp-phase-title {
  font-family: var(--hud);
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .04em;
}
.hp-close {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.hp-close:hover { background: rgba(255,255,255,.28); }
.hp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: .55rem;
}
.hp-card {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  padding: .7rem .8rem;
  background: rgba(0,0,0,.30);
  border: 1px solid rgba(255,255,255,.13);
  border-left: 3px solid var(--cc, rgba(255,255,255,.4));
  border-radius: .5rem;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: background .18s, transform .15s;
}
.hp-card:hover {
  background: rgba(0,0,0,.48);
  transform: translateY(-2px);
}
.hp-card-top { display: flex; justify-content: space-between; align-items: center; }
.hp-num { font-family: var(--mono); font-size: .58rem; color: var(--cc, rgba(255,255,255,.4)); letter-spacing: .06em; }
.hp-icon { font-size: 1.05rem; }
.hp-label { font-family: var(--hud); font-size: .78rem; font-weight: 700; color: #fff; }
.hp-desc { font-size: .67rem; color: rgba(255,255,255,.62); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hp-tags { display: flex; flex-wrap: wrap; gap: .22rem; margin-top: .1rem; }
.hp-tags span { font-family: var(--mono); font-size: .52rem; padding: .08rem .32rem;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.55); border-radius: .2rem; }

/* ── How it works ────────────────────────────────────────── */
.hiw-steps { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: .9rem; }
.hiw-step {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12);
  border-radius: .55rem; padding: .8rem; backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: .22rem;
}
.hiw-num { font-family: var(--mono); font-size: .58rem; color: #ffd600; letter-spacing: .1em; }
.hiw-icon { font-size: 1.35rem; }
.hiw-title { font-family: var(--hud); font-size: .8rem; font-weight: 700; color: #fff; }
.hiw-desc { font-size: .7rem; color: rgba(255,255,255,.63); line-height: 1.45; }
.hiw-cta {
  display: inline-block; padding: .58rem 1.3rem;
  background: #ffd600; color: #1a0050;
  font-family: var(--hud); font-size: .8rem; font-weight: 700;
  border-radius: 2rem; text-decoration: none; letter-spacing: .04em;
  transition: background .2s, transform .15s;
}
.hiw-cta:hover { background: #ffe033; transform: translateY(-2px); color: #1a0050; }

/* Active phase button highlight */
.hero-phase-btn.active {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.75);
}
.hero-phase-btn.active .phase-name { color: #ffd600; }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:none; }
}
@keyframes rotate { to { transform: rotate(360deg); } }

/* ── Class Grid ───────────────────────────────────────────── */
.class-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem; padding: 2rem 2rem 4rem;
  max-width: 1400px; margin: 0 auto;
}
.class-card {
  position: relative; background: var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  padding: 2rem 1.75rem 1.75rem;
  cursor: pointer; text-decoration: none;
  display: flex; flex-direction: column; gap: .75rem;
  overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  animation: fadeUp .5s calc(var(--index, 0) * .08s + .3s) ease both;
}
.class-card:nth-child(1){--index:0;}.class-card:nth-child(2){--index:1;}
.class-card:nth-child(3){--index:2;}.class-card:nth-child(4){--index:3;}
.class-card:nth-child(5){--index:4;}.class-card:nth-child(6){--index:5;}
.class-card:hover {
  transform: translateY(-6px); border-color: var(--card-color);
  box-shadow: 0 0 30px rgba(0,0,0,.5), 0 0 20px color-mix(in srgb, var(--card-color) 20%, transparent);
}
.class-card:hover .card-glow { opacity: 1; }
.class-card:hover .stat-fill { box-shadow: 0 0 8px var(--card-color); }

.card-corner { position: absolute; width: 14px; height: 14px; border-color: var(--card-color); border-style: solid; opacity: .7; }
.tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.card-index { font-family: var(--mono); font-size: .7rem; color: var(--text-dim); margin-bottom: .25rem; }
.card-icon  { font-size: 2.25rem; line-height: 1; }
.card-label { font-family: var(--hud); font-size: 1.2rem; font-weight: 700; color: var(--card-color); letter-spacing: .05em; text-shadow: 0 0 10px var(--card-color); }
.card-desc  { font-size: .88rem; color: var(--text-dim); line-height: 1.5; flex: 1; }

.card-stats { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.stat-row   { display: flex; align-items: center; gap: .5rem; }
.stat-name  { font-family: var(--mono); font-size: .65rem; color: var(--text-dim); width: 70px; flex-shrink: 0; }
.stat-bar   { flex: 1; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; }
.stat-fill  { height: 100%; background: var(--card-color); border-radius: 2px; transition: width .8s ease; }
.stat-num   { font-family: var(--mono); font-size: .65rem; color: var(--text-dim); width: 24px; text-align: right; }

.card-action {
  font-family: var(--mono); font-size: .78rem;
  color: var(--card-color); letter-spacing: .08em;
  margin-top: .5rem; opacity: .7; transition: opacity .2s;
}
.class-card:hover .card-action { opacity: 1; }
.arrow { display: inline-block; transition: transform .2s; }
.class-card:hover .arrow { transform: translateX(6px); }

/* ── Image-based HUD button ───────────────────────────────── */
.btn-img-hud { padding: 0; border: 1px solid var(--border); background: transparent; position: relative; height: 100%; }
.btn-hud-img { height: 56px; width: auto; display: block; object-fit: contain; opacity: 0.85; transition: opacity .2s, filter .2s; filter: drop-shadow(0 0 0px var(--accent)); }
.btn-img-hud:hover .btn-hud-img { opacity: 1; filter: drop-shadow(0 0 6px var(--accent)); }
.btn-img-hud .quiz-badge { position: absolute; top: -4px; right: -6px; }
.quiz-badge-always {
  display: flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  font-family: var(--mono); font-size: .58rem; font-style: normal;
  background: var(--text-dim); color: var(--bg); opacity: 0.45;
  transition: background .3s, opacity .3s;
}
.quiz-badge-always:not([data-zero]) { background: var(--accent2); color: #fff; opacity: 1; box-shadow: 0 0 6px var(--accent2); }
.card-phase {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--card-color); border: 1px solid var(--card-color);
  padding: .15rem .5rem; display: inline-block; opacity: .7; margin-bottom: .25rem;
}

/* ── Subject tags ─────────────────────────────────────────── */
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.card-tag { font-family: var(--mono); font-size: .6rem; letter-spacing: .05em; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: var(--text-dim); padding: .18rem .5rem; }
.card-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--card-color) 10%, transparent) 0%, transparent 70%); opacity: 0; transition: opacity .3s; pointer-events: none; }

/* ── Footer ───────────────────────────────────────────────── */
.hud-footer {
  position: relative; z-index: 1; font-family: var(--mono); font-size: .7rem;
  color: var(--text-dim); text-align: center; padding: 1rem;
  border-top: 1px solid var(--border); display: flex; justify-content: center; gap: 1rem;
}
.sep { opacity: .3; }

/* ── Auth Pages ───────────────────────────────────────────── */
.auth-page body, body.auth-page { display: flex; flex-direction: column; min-height: 100vh; }
.auth-container { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card {
  background: var(--panel); border: 1px solid var(--border);
  padding: 2.5rem; width: 100%; max-width: 560px;
  position: relative; animation: fadeUp .5s ease;
}
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-color, var(--accent)), transparent);
}
.auth-breadcrumb { font-family: var(--mono); font-size: .7rem; color: var(--text-dim); margin-bottom: .5rem; }
.auth-title { font-family: var(--hud); font-weight: 900; font-size: 1.8rem; color: var(--text-bright); letter-spacing: .08em; margin-bottom: 1rem; }
.auth-title .accent { color: var(--accent); }
.selected-class-badge { display: inline-block; font-family: var(--mono); font-size: .75rem; padding: .3rem .9rem; border: 1px solid; margin-bottom: 1.25rem; letter-spacing: .06em; }

.login-anim { position: relative; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.la-ring { position: absolute; border-radius: 50%; border: 1px solid var(--accent); opacity: .4; }
.la-ring { width: 40px; height: 40px; animation: rotate 4s linear infinite; }
.la-ring.r2 { width: 50px; height: 50px; opacity: .2; animation: rotate 7s linear infinite reverse; border-style: dashed; }
.la-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }

.form-error { font-family: var(--mono); font-size: .8rem; background: rgba(255,58,110,.08); border: 1px solid rgba(255,58,110,.3); color: var(--accent2); padding: .75rem 1rem; margin-bottom: 1.25rem; }

/* ── Forms ────────────────────────────────────────────────── */
.hud-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label { font-family: var(--mono); font-size: .72rem; color: var(--text-dim); letter-spacing: .06em; }
.form-input {
  border: 1px solid var(--border); color: var(--text-bright);
  font-family: var(--mono); font-size: .88rem; padding: .6rem .9rem;
  width: 100%; transition: border-color .2s, box-shadow .2s;
  outline: none; -webkit-appearance: none;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-dim); }
textarea.form-input { resize: vertical; min-height: 80px; }
.file-input { padding: .5rem; cursor: pointer; }
.file-input::-webkit-file-upload-button { border: 1px solid var(--border); color: var(--accent); font-family: var(--mono); font-size: .75rem; padding: .3rem .8rem; cursor: pointer; margin-right: .75rem; }

.cat-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.cat-option { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .75rem .5rem; border: 1px solid var(--border); cursor: pointer; transition: all .2s; text-align: center; }
.cat-option input { display: none; }
.cat-option:hover, .cat-option.selected { border-color: var(--opt-color, var(--accent)); }
.cat-option.selected .opt-label { color: var(--opt-color, var(--accent)); text-shadow: 0 0 8px var(--opt-color, var(--accent)); }
.opt-icon  { font-size: 1.5rem; line-height: 1; }
.opt-label { font-family: var(--mono); font-size: .68rem; color: var(--text-dim); letter-spacing: .04em; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--hud); font-size: .9rem; font-weight: 700;
  letter-spacing: .1em; padding: .85rem 1.5rem;
  cursor: pointer; width: 100%; transition: all .25s; margin-top: .5rem;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary .btn-icon { font-size: 1.1rem; transition: transform .2s; }
.btn-primary:hover .btn-icon { transform: translateX(6px); }
.btn-primary.small { padding: .6rem 1.2rem; font-size: .8rem; margin-top: 0; }

.auth-switch { font-family: var(--mono); font-size: .78rem; color: var(--text-dim); text-align: center; margin-top: 1.25rem; }

/* ── Profile Layout ───────────────────────────────────────── */
body.profile-page { display: flex; flex-direction: column; }
.profile-grid {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: 280px 1fr 300px; grid-template-rows: auto;
  align-items: start; gap: 1.25rem; padding: 1.5rem 2rem;
  max-width: 1400px; width: 100%; margin: 0 auto; flex: 1;
}
.panel { background: var(--panel); border: 1px solid var(--border); position: relative; }
.panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--user-color), transparent); opacity: .5;
}
.panel-header {
  font-family: var(--mono); font-size: .72rem; color: var(--accent); letter-spacing: .08em;
  padding: .75rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-header-right { color: var(--text-dim); font-size: .65rem; }
.mt { margin-top: .5rem; }

.panel-identity { padding-bottom: 1.5rem; text-align: center; }
.avatar-container { position: relative; width: 100px; height: 100px; margin: 1.5rem auto 1rem; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Inside NFT card — override ring constraints so canvas drives height */
.anc-img-wrap.avatar-container {
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
.anc-img-wrap.avatar-container .avatar-img {
  width: 100% !important;
  height: auto !important;
  object-fit: unset !important;
  border-radius: 0 !important;
  display: block !important;
}
.anc-img-wrap.avatar-container .avatar-ring {
  display: none !important;
}
.avatar-placeholder {
  width: 100%; height: 100%; border-radius: 50%;
  border: 2px solid var(--user-color);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hud); font-size: 1.75rem; font-weight: 900; color: var(--user-color);
}
.avatar-ring { position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--user-color); opacity: .4; animation: rotate 8s linear infinite; }

.id-name    { font-size: 1.1rem; font-weight: 600; color: var(--text-bright); padding: 0 1rem; }
.id-callsign{ font-family: var(--mono); font-size: .85rem; color: var(--user-color); padding: .1rem 0; }
.id-email   { font-family: var(--mono); font-size: .7rem; color: var(--text-dim); padding: 0 .5rem; word-break: break-all; }
.class-badge { display: inline-block; font-family: var(--mono); font-size: .72rem; padding: .3rem .9rem; border: 1px solid; margin: .75rem auto; letter-spacing: .06em; }

.xp-section { padding: 0 1.5rem; margin-top: .5rem; }
.xp-label   { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .7rem; color: var(--text-dim); margin-bottom: .4rem; }
.xp-track   { position: relative; height: 4px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: visible; }
.xp-fill    { height: 100%; background: var(--user-color); border-radius: 2px; transition: width 1s ease; box-shadow: 0 0 8px var(--user-color); }
.xp-glow    { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px var(--user-color); }
.xp-sub     { font-family: var(--mono); font-size: .66rem; color: var(--text-dim); text-align: right; margin-top: .3rem; }
.member-since { font-family: var(--mono); font-size: .65rem; color: var(--text-dim); margin-top: 1rem; padding: 0 1rem; }

.id-bio-section { width: 100%; margin-top: 1.25rem; padding: 1rem 1.5rem 0; border-top: 1px solid var(--border); text-align: left; }
.id-bio-section .section-label { margin-bottom: .45rem; }
.id-bio-section .bio-text { font-size: .85rem; line-height: 1.55; color: var(--text-dim); word-break: break-word; }

.panel-main { padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.profile-section { display: flex; flex-direction: column; gap: .6rem; }
.section-label { font-family: var(--mono); font-size: .72rem; color: var(--accent); letter-spacing: .08em; }
.bio-text { font-size: .95rem; color: var(--text); line-height: 1.6; }

.achievement-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.achievement-badge { display: flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: .35rem .8rem; font-family: var(--mono); font-size: .72rem; cursor: default; transition: border-color .2s; }
.achievement-badge:hover { border-color: var(--accent); }
.ach-icon { font-size: 1rem; }
.ach-name { color: var(--text); }

.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: .75rem; margin-top: .25rem; }
.stat-card { border: 1px solid var(--border); padding: 1rem .75rem; text-align: center; }
.sc-val   { font-family: var(--hud); font-size: 1.6rem; font-weight: 700; color: var(--user-color); }
.sc-label { font-family: var(--mono); font-size: .62rem; color: var(--text-dim); margin-top: .2rem; letter-spacing: .06em; }

.panel-activity { padding: 0; display: flex; flex-direction: column; }
.activity-list  { flex: 1; padding: .75rem 1.25rem; list-style: none; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; max-height: 240px; }
.activity-item  { display: flex; flex-direction: column; gap: .1rem; padding: .5rem; border-left: 2px solid var(--border); background: rgba(255,255,255,.02); }
.act-action { font-family: var(--mono); font-size: .68rem; color: var(--accent); letter-spacing: .06em; }
.act-detail { font-size: .82rem; color: var(--text-dim); }
.act-time   { font-family: var(--mono); font-size: .63rem; color: var(--text-dim); opacity: .6; }
.panel-activity .hud-form { padding: .75rem 1.25rem 1.25rem; }

/* ── Responsive ───────────────────────────────────────────── */
.profile-tab-bar { display: none; }
.panel-identity, .panel-main, .panel-chat { display: block; }

@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: 240px 1fr; grid-template-rows: auto auto; }
  .panel-activity { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  .class-grid { grid-template-columns: 1fr 1fr; padding: 1rem; gap: 1rem; }
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .cat-selector { grid-template-columns: repeat(3,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .hud-meta { display: none; }
  .auth-card { padding: 1.5rem 1.25rem; }
  .btn-hud-img { height: 36px; }
  .btn-img-hud { padding: 0 2px; }
  .hud-nav { gap: .4rem; }
  .hud-header { overflow-x: auto; overflow-y: visible; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hud-header::-webkit-scrollbar { display: none; }
  .hud-logo, .hud-nav { flex-shrink: 0; }

  .profile-grid { display: block; padding: 0; }
  .profile-tab-bar { display: flex; position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 2px solid var(--border); }
  .profile-tab-btn { flex: 1; font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; padding: .7rem .5rem; border: none; background: transparent; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s, border-color .2s; white-space: nowrap; }
  .profile-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

  .panel-identity, .panel-main, .panel-chat { display: none !important; border: none; border-radius: 0; }
  .panel-identity.tab-active, .panel-main.tab-active, .panel-chat.tab-active { display: flex !important; flex-direction: column; min-height: calc(100vh - 120px); }
  .panel-chat.tab-active { height: calc(100vh - 120px); }
  .panel-chat .chat-history { flex: 1; height: auto; max-height: none; }
  .panel-identity.tab-active { overflow-y: auto; padding-bottom: 2rem; }

  [data-theme="duolingo"] .profile-tab-bar { background: #ffffff; border-bottom-color: #e5e5e5; }
  [data-theme="duolingo"] .profile-tab-btn.active { color: #46a302; border-bottom-color: #58cc02; }
  [data-theme="hogwarts"] .profile-tab-bar { background: var(--bg); border-bottom-color: rgba(196,164,64,0.25); }
  [data-theme="hogwarts"] .profile-tab-btn.active { color: #C4A440; border-bottom-color: #C4A440; }
}
@media (max-width: 480px) {
  .class-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.5rem; }
  .hud-header { padding: .6rem 1rem; gap: .75rem; }
}

/* ── Syllabus selector ────────────────────────────────────── */
.syllabus-selector { display: flex; gap: .6rem; }
.syllabus-option { flex: 1; display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 1px solid var(--border); cursor: pointer; transition: all .2s; position: relative; }
.syllabus-option input { display: none; }
.syllabus-option:hover, .syllabus-option.selected { border-color: var(--accent); }
.syl-icon { font-size: 1.4rem; flex-shrink: 0; }
.syl-body { display: flex; flex-direction: column; gap: .15rem; }
.syl-label { font-family: var(--hud); font-size: .8rem; font-weight: 700; color: var(--text-bright); letter-spacing: .06em; }
.syllabus-option.selected .syl-label { color: var(--accent); }
.syl-sub { font-family: var(--mono); font-size: .62rem; color: var(--text-dim); letter-spacing: .03em; }
[data-theme="hogwarts"] .syllabus-option:hover,
[data-theme="hogwarts"] .syllabus-option.selected { border-color: #C4A440; background: rgba(196,164,64,.05); box-shadow: 0 0 12px rgba(196,164,64,.1); }
[data-theme="hogwarts"] .syllabus-option.selected .syl-label { color: #C4A440; }
@media (max-width: 480px) { .syllabus-selector { flex-direction: column; } }

.syllabus-badge { display: inline-block; font-family: var(--mono); font-size: .68rem; padding: .2rem .75rem; border: 1px solid var(--border); color: var(--text-dim); letter-spacing: .06em; margin-top: .3rem; }
[data-theme="hogwarts"] .syllabus-badge { font-family: 'IM Fell English', serif; font-style: italic; border-color: rgba(196,164,64,0.2); color: var(--text-dim); }
/* ── NFT Avatar Card ──────────────────────────────────────── */
.avatar-nft-card {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 280px;
  margin: .5rem auto 1rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,.12);
  background: #000;
  box-shadow: 0 8px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04);
}

/* XP progress bar — thin strip at very top of card */
.anc-xp-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; z-index: 20; background: rgba(255,255,255,.10);
}
.anc-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00FFD1, #00c4a0);
  border-radius: 0 2px 2px 0;
  transition: width .6s ease;
}

/* Top overlay bar */
.anc-topbar {
  display: flex; justify-content: space-between; align-items: center;
  position: absolute; top: 3px; left: 0; right: 0; z-index: 10;
  padding: .4rem .6rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.75) 0%, rgba(0,0,0,.40) 70%, transparent 100%);
  pointer-events: none;
}
.anc-level-badge {
  font-family: var(--mono, monospace);
  font-size: .60rem; font-weight: 700; letter-spacing: .10em;
  color: var(--accent, #00FFD1);
}
.anc-score {
  font-family: var(--mono, monospace);
  font-size: .60rem; font-weight: 600;
  color: rgba(255,255,255,.80);
  letter-spacing: .04em;
}

/* Canvas wrapper */
.anc-img-wrap {
  display: block; width: 100%; line-height: 0; border: none;
}
.anc-canvas {
  display: block !important; width: 100% !important;
  height: auto !important; border-radius: 0 !important;
}

/* Bottom overlay bar */
.anc-bottombar {
  display: flex; justify-content: space-between; align-items: center;
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: .42rem .60rem;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.55) 55%, transparent 100%);
  pointer-events: none;
}
.anc-username {
  font-family: var(--mono, monospace);
  font-size: .60rem; color: rgba(255,255,255,.70); letter-spacing: .06em;
}
.anc-xp-now {
  font-family: var(--mono, monospace);
  font-size: .60rem; font-weight: 700;
  color: var(--accent, #00FFD1); letter-spacing: .04em;
}

/* Meta section below the card */
.anc-meta {
  text-align: center; padding: .1rem 0 .6rem;
}
.anc-meta-name {
  font-family: var(--hud, sans-serif);
  font-size: .82rem; font-weight: 700; letter-spacing: .06em;
  color: var(--text, #1a2a35); margin-bottom: .18rem;
}
.anc-meta-email {
  font-family: var(--mono, monospace);
  font-size: .58rem; color: var(--text-dim, #4a6a7e);
}
.anc-meta-badges {
  display: flex; flex-wrap: wrap; gap: .3rem;
  justify-content: center; margin: .4rem 0 .3rem;
}

/* Badge overrides inside NFT card meta */
.anc-meta-badges .class-badge,
.anc-meta-badges .syllabus-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
}