/* ============================================
   YEEPS WIRING ACADEMY - STYLE.CSS
   Theme: Circuit-board dark with neon accents
   ============================================ */

:root {
  --bg-deep: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --bg-surface: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --border: #30363d;
  --green: #3fb950;
  --green-dim: #238636;
  --green-glow: rgba(63, 185, 80, 0.2);
  --blue: #58a6ff;
  --blue-dim: #1f6feb;
  --purple: #bc8cff;
  --purple-dim: #8957e5;
  --orange: #f0883e;
  --orange-dim: #d47616;
  --teal: #3ddbd9;
  --teal-dim: #2ea7a6;
  --magenta: #f778ba;
  --magenta-dim: #db61a2;
  --gold: #e3b341;
  --gold-dim: #bb8c1a;
  --red: #f85149;
  --red-dim: #da3633;
  --discord: #5865F2;
  --xp-color: #e3b341;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --unit1: #3fb950; --unit2: #58a6ff; --unit3: #bc8cff; --unit4: #f778ba;
  --unit5: #f0883e; --unit6: #e3b341; --unit7: #3ddbd9; --unit8: #da7dff;
  --unit9: #f85149; --unit10: #ff9bce;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: 'Fredoka', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--green); color: #000; font-family: 'Fredoka', sans-serif;
  font-weight: 600; font-size: 1.05rem; border: none; padding: 14px 32px;
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 0 var(--green-dim); position: relative; top: 0;
}
.btn-primary:hover { top: 2px; box-shadow: 0 2px 0 var(--green-dim); }
.btn-primary:active { top: 4px; box-shadow: none; }
.btn-primary.small { padding: 8px 16px; font-size: 0.85rem; box-shadow: 0 2px 0 var(--green-dim); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-surface); color: var(--text-primary); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.95rem; border: 2px solid var(--border);
  padding: 12px 24px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--text-muted); }
.btn-secondary.small { padding: 8px 14px; font-size: 0.8rem; }

.btn-danger {
  background: transparent; color: var(--red); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.85rem; border: 1px solid var(--red-dim);
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: rgba(248,81,73,0.1); }

.btn-back {
  background: transparent; color: var(--text-secondary); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.95rem; border: none; cursor: pointer;
  padding: 8px 4px; transition: color 0.2s;
}
.btn-back:hover { color: var(--text-primary); }

.btn-choice {
  background: var(--bg-surface); color: var(--text-primary); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.95rem; border: 2px solid var(--border);
  padding: 14px 20px; border-radius: var(--radius); cursor: pointer;
  transition: all 0.15s; text-align: left; width: 100%;
}
.btn-choice:hover { border-color: var(--blue); background: var(--bg-card-hover); }
.btn-choice.selected { border-color: var(--blue); background: rgba(88,166,255,0.1); }
.btn-choice.correct { border-color: var(--green); background: rgba(63,185,80,0.15); }
.btn-choice.wrong { border-color: var(--red); background: rgba(248,81,73,0.1); }

.btn-submit {
  background: var(--blue); color: #fff; font-family: 'Fredoka', sans-serif;
  font-weight: 600; font-size: 1rem; border: none; padding: 14px 40px;
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 0 var(--blue-dim); position: relative; top: 0;
}
.btn-submit:hover { top: 2px; box-shadow: 0 2px 0 var(--blue-dim); }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- FORMS ---- */
.form-select {
  width: 100%; background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text-primary);
  font-family: 'Fredoka', sans-serif; font-size: 0.95rem; outline: none;
  transition: border-color 0.2s; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.form-select:focus { border-color: var(--blue); }

textarea {
  width: 100%; background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text-primary);
  font-family: 'Fredoka', sans-serif; font-size: 0.95rem; outline: none;
  transition: border-color 0.2s; resize: vertical;
}
textarea:focus { border-color: var(--blue); }

/* ---- STATS ---- */
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg-surface);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: 99px;
  font-weight: 600; font-size: 0.9rem;
}
.stat-pill.small { padding: 6px 12px; font-size: 0.8rem; }
.xp-pill { color: var(--xp-color); }
.streak-pill { color: var(--orange); }
.progress-pill { color: var(--blue); }
.skill-pill { color: var(--purple); cursor: pointer; }
.skill-pill:hover { border-color: var(--purple-dim); }

/* ---- TOAST ---- */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); color: var(--text-primary); padding: 14px 28px;
  border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow);
  z-index: 9999; font-weight: 500; transition: opacity 0.3s, transform 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-10px); }

/* ---- SECTION LABELS ---- */
.section-label {
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px; margin: 24px 0 12px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  color: var(--text-muted); text-align: center; padding: 40px 20px;
  font-size: 0.95rem;
}
.empty-state.small { padding: 16px; font-size: 0.85rem; }

/* ---- BANNED BANNER ---- */
.banned-banner {
  background: rgba(248,81,73,0.12); border: 1px solid var(--red-dim);
  color: var(--red); text-align: center; padding: 10px 16px;
  border-radius: var(--radius-sm); margin: 12px auto 0; max-width: 500px;
  font-size: 0.85rem; font-weight: 600;
}

/* ---- ADMIN PANEL ---- */
.admin-open-icon {
  position: fixed; bottom: 16px; right: 16px; width: 48px; height: 48px;
  border-radius: 50%; border: none; background: var(--blue); color: #fff;
  font-size: 1.2rem; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 10000;
}
.admin-open-icon.hidden { display: none; }
.admin-panel-root {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,15,25,0.9); z-index: 10000; padding: 20px;
}
.admin-panel-root.hidden { display: none; }
.admin-panel {
  width: min(980px, 100%); max-height: 90vh; overflow-y: auto; background: #060b13;
  border: 1px solid rgba(88,166,255,0.35); border-radius: 20px; padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.admin-panel-header {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px;
}
.admin-panel-header h2 { margin: 0; font-size: 1.25rem; }
.admin-panel-grid {
  display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 18px;
}
.admin-section {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 16px;
}
.admin-section-wide { grid-column: 1 / -1; }
.admin-section h3 { margin-top: 0; font-size: 1rem; margin-bottom: 12px; }
.admin-field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px;
}
.admin-field label {
  font-size: 0.8rem; color: var(--text-secondary);
}
.admin-field input,
.admin-panel textarea {
  width: 100%; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary); padding: 10px 12px;
  font-family: 'Fredoka', sans-serif;
}
.admin-btn {
  width: 100%; border: none; background: var(--blue); color: #fff;
  padding: 12px; border-radius: 12px; font-weight: 600; cursor: pointer; margin-bottom: 10px;
  font-family: 'Fredoka', sans-serif; font-size: 0.9rem;
}
.admin-btn.danger { background: var(--red); }
.admin-btn.success { background: var(--green); color: #000; }
.admin-panel textarea { min-height: 100px; resize: vertical; }

/* ---- SKILL SELECTION ---- */
.skill-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 30px 20px;
  background: radial-gradient(ellipse at center top, rgba(88,166,255,0.06) 0%, transparent 60%);
}
.skill-content {
  text-align: center; max-width: 520px; width: 100%;
  animation: fadeSlideUp 0.5s ease;
}
.skill-content h1 { font-size: 1.7rem; margin-bottom: 4px; }
.skill-options {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;
}
.skill-card {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all 0.2s; text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  font-family: 'Fredoka', sans-serif; color: var(--text-primary);
}
.skill-card:hover { border-color: var(--blue); background: var(--bg-card-hover); transform: translateY(-2px); }
.skill-emoji { font-size: 1.6rem; }
.skill-label { font-size: 1.15rem; font-weight: 700; }
.skill-desc { font-size: 0.88rem; color: var(--text-secondary); }
.skill-range {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.5px; margin-top: 4px;
}
.skill-note { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

/* ---- COMMUNITY / DISCORD CARD ---- */
.community-card {
  display: flex; align-items: center; gap: 14px;
  background: rgba(88, 101, 242, 0.08); border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px;
  text-decoration: none; color: var(--text-primary); transition: all 0.2s;
  cursor: pointer;
}
.community-card:hover {
  background: rgba(88, 101, 242, 0.14); border-color: rgba(88, 101, 242, 0.45);
  transform: translateY(-1px);
}
.community-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: rgba(88, 101, 242, 0.15); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.community-info { flex: 1; min-width: 0; }
.community-name { display: block; font-weight: 700; font-size: 0.95rem; color: var(--discord); }
.community-text { display: block; font-size: 0.8rem; color: var(--text-secondary); }
.community-arrow { font-size: 1.2rem; color: var(--discord); font-weight: 700; flex-shrink: 0; }

/* ============================================
   HOME SCREEN
   ============================================ */
.home-header {
  text-align: center; padding: 40px 20px 20px;
  background: linear-gradient(180deg, rgba(63,185,80,0.08) 0%, transparent 100%);
}
.logo-area { margin-bottom: 20px; }
.logo-icon {
  font-size: 3rem; display: inline-block;
  animation: pulse-glow 2s infinite;
}
@keyframes pulse-glow {
  0%,100% { filter: drop-shadow(0 0 8px rgba(63,185,80,0.6)); }
  50% { filter: drop-shadow(0 0 20px rgba(63,185,80,0.9)); }
}
.home-header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; margin: 8px 0 4px; }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; font-weight: 400; }
.stats-bar { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.home-main { flex: 1; padding: 20px; max-width: 600px; margin: 0 auto; width: 100%; }

/* ---- HOME NAV GRID ---- */
.home-nav-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px;
}
.nav-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 14px; cursor: pointer; transition: all 0.2s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: 'Fredoka', sans-serif; color: var(--text-primary);
}
.nav-card:hover { border-color: var(--blue); background: var(--bg-card-hover); transform: translateY(-2px); }
.nav-icon { font-size: 1.6rem; }
.nav-label { font-size: 0.95rem; font-weight: 600; }
.nav-hint { font-size: 0.72rem; color: var(--text-muted); }

.current-lesson-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 24px; margin-bottom: 24px; text-align: center; position: relative; overflow: hidden;
}
.current-lesson-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--purple));
}
.cl-badge {
  display: inline-block; background: var(--green-glow); color: var(--green);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px; padding: 4px 12px;
  border-radius: 99px; margin-bottom: 12px;
}
.current-lesson-card h2 { font-size: 1.3rem; margin-bottom: 8px; }
.current-lesson-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; }
.cl-meta { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.cl-tag {
  font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border);
}
.btn-continue { width: 100%; }

.home-unit-progress { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.unit-progress-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; position: relative; overflow: hidden;
}
.unit-progress-card .up-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; margin-bottom: 4px; }
.unit-progress-card .up-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.unit-progress-card .up-bar { height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; }
.unit-progress-card .up-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.home-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ============================================
   LESSON MAP SCREEN
   ============================================ */
.map-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--bg-card);
  position: sticky; top: 0; z-index: 10;
}
.map-header h2 { font-size: 1.1rem; }
.map-main { flex: 1; padding: 30px 20px; overflow-y: auto; max-width: 500px; margin: 0 auto; width: 100%; }

.map-unit { margin-bottom: 40px; }
.map-unit-header {
  text-align: center; margin-bottom: 20px; padding: 16px; background: var(--bg-card);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.map-unit-header h3 { font-size: 1.1rem; margin-bottom: 4px; }
.map-unit-header p { color: var(--text-secondary); font-size: 0.8rem; }

.map-path { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.map-node-wrapper {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 360px;
}
.map-node-wrapper:nth-child(odd) { padding-left: 30px; }
.map-node-wrapper:nth-child(even) { padding-right: 30px; align-self: flex-end; flex-direction: row-reverse; }

.map-node {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1rem; cursor: pointer;
  transition: all 0.2s; border: 3px solid; flex-shrink: 0; position: relative;
}
.map-node.completed { background: var(--green-dim); border-color: var(--green); color: #fff; }
.map-node.current { border-color: var(--blue); background: rgba(88,166,255,0.15); color: var(--blue); animation: node-pulse 1.5s infinite; }
@keyframes node-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(88,166,255,0); }
}
.map-node.unlocked { border-color: var(--text-muted); background: var(--bg-surface); color: var(--text-secondary); }
.map-node.unlocked:hover { border-color: var(--blue); }
.map-node.locked { background: var(--bg-surface); border-color: var(--border); color: var(--text-muted); cursor: not-allowed; }
.map-node-label {
  font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; flex: 1;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-node-label.current-label { color: var(--blue); font-weight: 600; }
.map-node .best-star {
  position: absolute; top: -4px; right: -4px; font-size: 0.65rem;
  background: var(--gold); color: #000; border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.map-connector { width: 2px; height: 20px; background: var(--border); margin: 0 auto; }
.map-connector.done { background: var(--green-dim); }

/* ============================================
   LESSON PLAYER SCREEN
   ============================================ */
.lesson-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--bg-card);
  position: sticky; top: 0; z-index: 10;
}
.lesson-progress-bar { flex: 1; height: 10px; background: var(--bg-surface); border-radius: 5px; overflow: hidden; }
.lesson-progress-fill { height: 100%; background: var(--green); border-radius: 5px; transition: width 0.4s ease; width: 0%; }
.lesson-main { flex: 1; padding: 24px 20px; max-width: 640px; margin: 0 auto; width: 100%; overflow-y: auto; }

.lesson-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 24px; margin-bottom: 16px;
}
.lesson-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.lesson-card .lesson-type-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 99px; background: var(--bg-surface);
  color: var(--text-muted); margin-bottom: 12px;
}
.lesson-instructions { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; margin-bottom: 8px; }
.lesson-prompt {
  font-size: 1.05rem; font-weight: 600; padding: 16px; background: var(--bg-surface);
  border-radius: var(--radius); margin: 16px 0; border-left: 3px solid var(--blue); line-height: 1.5;
}
.lesson-hint { color: var(--text-muted); font-size: 0.85rem; font-style: italic; margin-bottom: 12px; }
.lesson-hint::before { content: '💡 '; }
.choices-area { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.submit-area { text-align: center; margin-top: 16px; }

/* Feedback */
.feedback-area { margin-top: 16px; padding: 20px; border-radius: var(--radius); animation: fadeSlideUp 0.3s ease; }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.feedback-area.correct { background: rgba(63,185,80,0.1); border: 1px solid var(--green-dim); }
.feedback-area.wrong { background: rgba(248,81,73,0.1); border: 1px solid var(--red-dim); }
.feedback-area h3 { margin-bottom: 8px; font-size: 1.1rem; }
.feedback-area h3.correct-text { color: var(--green); }
.feedback-area h3.wrong-text { color: var(--red); }
.feedback-area p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }

/* Score Breakdown */
.score-breakdown {
  background: var(--bg-surface); border-radius: var(--radius); padding: 18px;
  margin-top: 14px; display: flex; flex-direction: column; gap: 8px;
}
.score-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.9rem; padding: 4px 0;
}
.score-row .score-label { color: var(--text-secondary); }
.score-row .score-value { font-weight: 700; }
.score-row .score-value.positive { color: var(--green); }
.score-row .score-value.negative { color: var(--red); }
.score-row .score-value.neutral { color: var(--text-primary); }
.score-row .score-value.gold { color: var(--gold); }
.score-divider { height: 1px; background: var(--border); margin: 4px 0; }
.score-total { font-size: 1.05rem; }
.score-total .score-label { color: var(--text-primary); font-weight: 600; }

.perfect-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, rgba(227,179,65,0.15), rgba(63,185,80,0.15));
  border: 1px solid var(--gold-dim); color: var(--gold);
  font-weight: 700; padding: 6px 14px; border-radius: 99px; margin-top: 8px;
  font-size: 0.85rem; animation: xp-pop 0.4s ease;
}
.best-score-note {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; text-align: center;
}
.best-score-note.new-best { color: var(--gold); font-weight: 600; }

.xp-reward {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(227,179,65,0.15); color: var(--xp-color); font-weight: 700;
  padding: 8px 18px; border-radius: 99px; margin-top: 12px; font-size: 1rem;
  animation: xp-pop 0.4s ease;
}
@keyframes xp-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.next-lesson-btns { display: flex; gap: 10px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }

/* Order items */
.order-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.order-item {
  background: var(--bg-surface); border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; cursor: grab; display: flex; align-items: center; gap: 10px;
  font-weight: 500; transition: all 0.15s; user-select: none;
}
.order-item:hover { border-color: var(--blue); }
.order-item .drag-handle { color: var(--text-muted); font-size: 1.2rem; flex-shrink: 0; }
.order-item.dragging { opacity: 0.5; border-color: var(--blue); }

/* Match columns */
.match-area { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.match-column h4 { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.match-item {
  padding: 10px 14px; background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; font-size: 0.9rem; transition: all 0.15s;
}
.match-item:hover { border-color: var(--blue); }
.match-item.selected { border-color: var(--blue); background: rgba(88,166,255,0.1); }
.match-item.matched { border-color: var(--green); background: rgba(63,185,80,0.1); opacity: 0.7; cursor: default; }

/* ============================================
   BLOCK REFERENCE SCREEN
   ============================================ */
.ref-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--bg-card);
  position: sticky; top: 0; z-index: 10;
}
.ref-header h2 { font-size: 1.1rem; flex: 1; }
.ref-controls { padding: 16px 20px; max-width: 700px; margin: 0 auto; width: 100%; }
#ref-search, #community-search {
  width: 100%; background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text-primary);
  font-family: 'Fredoka', sans-serif; font-size: 0.95rem; outline: none;
  transition: border-color 0.2s; margin-bottom: 12px;
}
#ref-search:focus, #community-search:focus { border-color: var(--blue); }
#ref-search::placeholder, #community-search::placeholder { color: var(--text-muted); }
.ref-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  background: var(--bg-surface); color: var(--text-secondary); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.8rem; border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 99px; cursor: pointer; transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--text-muted); }
.filter-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.ref-main { padding: 0 20px 40px; max-width: 700px; margin: 0 auto; width: 100%; }
.ref-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 14px;
}
.ref-card:hover { border-color: var(--text-muted); background: var(--bg-card-hover); }
.ref-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.ref-card-info { flex: 1; min-width: 0; }
.ref-card-info h3 { font-size: 0.95rem; margin-bottom: 2px; }
.ref-card-info p { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-card-tags { display: flex; gap: 6px; flex-shrink: 0; }
.ref-tag { font-size: 0.65rem; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--bg-surface); color: var(--text-muted); }
.ref-tag.basic { color: var(--green); border: 1px solid var(--green-dim); }
.ref-tag.intermediate { color: var(--orange); border: 1px solid var(--orange-dim); }
.ref-tag.advanced { color: var(--red); border: 1px solid var(--red-dim); }

/* ============================================
   LEADERBOARD TABLE
   ============================================ */
.leaderboard-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; }
.leaderboard-table th, .leaderboard-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; }
.leaderboard-table th { color: var(--text-secondary); font-size: 0.9rem; font-weight: 600; }
.leaderboard-row:nth-child(even) { background: rgba(255,255,255,0.04); }
.leaderboard-row td { color: var(--text-primary); }

/* ============================================
   BLOCK DETAIL SCREEN
   ============================================ */
.block-detail-main { flex: 1; padding: 24px 20px; max-width: 700px; margin: 0 auto; width: 100%; overflow-y: auto; }
.bd-hero {
  text-align: center; padding: 30px 20px; background: var(--bg-card);
  border-radius: var(--radius-lg); margin-bottom: 20px; border: 1px solid var(--border);
}
.bd-hero .bd-icon {
  width: 72px; height: 72px; border-radius: var(--radius); display: inline-flex;
  align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 12px;
}
.bd-hero h1 { font-size: 1.5rem; margin-bottom: 4px; }
.bd-hero .bd-category { color: var(--text-secondary); font-size: 0.85rem; }
.bd-specs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.bd-spec {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.bd-spec .spec-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.bd-spec .spec-value { font-size: 1rem; font-weight: 700; margin-top: 4px; }
.bd-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 12px;
}
.bd-section h3 { font-size: 0.95rem; margin-bottom: 8px; color: var(--text-primary); }
.bd-section p, .bd-section li { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.65; }
.bd-section ul { list-style: none; padding: 0; }
.bd-section ul li::before { content: '→ '; color: var(--green); font-weight: 700; }
.bd-related-lessons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bd-lesson-link {
  font-size: 0.75rem; background: var(--bg-surface); color: var(--blue);
  padding: 4px 10px; border-radius: 99px; cursor: pointer; border: 1px solid var(--border);
  font-family: 'Fredoka', sans-serif; transition: all 0.15s;
}
.bd-lesson-link:hover { background: rgba(88,166,255,0.1); border-color: var(--blue-dim); }

/* ============================================
   COMMUNITY SCREEN
   ============================================ */
.community-sort-bar {
  display: flex; gap: 8px; padding: 0 20px 12px; max-width: 700px; margin: 0 auto; width: 100%;
}
.sort-btn {
  background: transparent; color: var(--text-muted); font-family: 'Fredoka', sans-serif;
  font-weight: 500; font-size: 0.8rem; border: none; cursor: pointer;
  padding: 4px 8px; border-bottom: 2px solid transparent; transition: all 0.15s;
}
.sort-btn:hover { color: var(--text-secondary); }
.sort-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Post Card */
.post-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s;
}
.post-card:hover { border-color: var(--text-muted); background: var(--bg-card-hover); }
.post-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.post-category-tag {
  font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: rgba(88,166,255,0.12); color: var(--blue); border: 1px solid rgba(88,166,255,0.25);
}
.post-solved-tag {
  font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: rgba(63,185,80,0.12); color: var(--green); border: 1px solid var(--green-dim);
}
.post-pinned-tag {
  font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: rgba(227,179,65,0.12); color: var(--gold); border: 1px solid var(--gold-dim);
}
.post-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.post-meta {
  display: flex; gap: 12px; font-size: 0.75rem; color: var(--text-muted);
}
.post-meta .author-badge { color: var(--purple); font-weight: 600; }

/* Post Detail */
.post-detail-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 16px;
}
.post-detail-card h2 { font-size: 1.2rem; margin-bottom: 8px; }
.post-detail-body { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; white-space: pre-wrap; }
.post-detail-meta {
  display: flex; gap: 12px; font-size: 0.78rem; color: var(--text-muted); margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; align-items: center;
}
.post-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Reply Card */
.reply-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px;
}
.reply-card.mod-reply { border-left: 3px solid var(--purple); }
.reply-card.admin-reply { border-left: 3px solid var(--gold); }
.reply-body { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.reply-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }
.reply-meta .role-badge {
  font-size: 0.6rem; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  margin-left: 4px;
}
.role-badge.mod { background: rgba(188,140,255,0.2); color: var(--purple); }
.role-badge.admin { background: rgba(227,179,65,0.2); color: var(--gold); }

.reply-form {
  margin-top: 16px; padding: 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.reply-form textarea { margin-bottom: 10px; }

/* ============================================
   LESSON COMMENTS
   ============================================ */
.lesson-comments-section {
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 0;
}
.comments-header {
  font-size: 1rem; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.comment-count-badge {
  font-size: 0.7rem; background: var(--bg-surface); color: var(--text-muted);
  padding: 2px 8px; border-radius: 99px; font-weight: 600;
}
.comments-list { margin-bottom: 14px; }
.comment-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 8px;
}
.comment-body { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.5; }
.comment-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }
.comment-form { display: flex; gap: 8px; align-items: flex-start; }
.comment-form textarea { flex: 1; min-height: 40px; }

/* ============================================
   UNIT COMPLETE / COMPLETION SCREENS
   ============================================ */
.unit-complete-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; }
.uc-content { text-align: center; max-width: 500px; animation: fadeSlideUp 0.5s ease; }
.uc-badge { font-size: 4rem; margin-bottom: 16px; animation: badge-bounce 0.6s ease; }
@keyframes badge-bounce { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.uc-content h1 { font-size: 1.6rem; margin-bottom: 8px; }
.uc-content p { color: var(--text-secondary); margin-bottom: 16px; }
.uc-stats { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }

.complete-main {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px;
  background: radial-gradient(circle at center, rgba(227,179,65,0.08) 0%, transparent 70%);
}
.complete-content { text-align: center; max-width: 500px; animation: fadeSlideUp 0.6s ease; }
.complete-icon { font-size: 5rem; margin-bottom: 20px; }
.complete-content h1 { font-size: 1.8rem; margin-bottom: 12px; color: var(--gold); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .home-header h1 { font-size: 1.4rem; }
  .stats-bar { gap: 6px; }
  .stat-pill { padding: 6px 10px; font-size: 0.8rem; }
  .home-unit-progress { grid-template-columns: 1fr; }
  .home-nav-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bd-specs { grid-template-columns: 1fr 1fr; }
  .match-area { grid-template-columns: 1fr; }
  .skill-content h1 { font-size: 1.4rem; }
  .admin-panel-grid { grid-template-columns: 1fr; }
  .comment-form { flex-direction: column; }
}
