:root {
  --bg: #0b1a2f; --bg-2: #0f2340; --panel: #132a45; --panel-2: #1a3554;
  --accent: #f5b342; --accent-2: #ffd966; --secondary: #1f3e58;
  --border: #2e5570; --text: #e3eef8; --muted: #8aa3bd;
  --success: #2e7d5e; --danger: #c0392b; --radius: 14px; --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0,0,0,.45); --shadow-sm: 0 4px 12px rgba(0,0,0,.3);
  --font: 'Exo 2', system-ui, sans-serif; --mono: 'Roboto Mono', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; }
body { background: radial-gradient(1200px 600px at 10% -10%, #1b3a5c 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #2a4a6b 0%, transparent 55%), var(--bg); }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: .3px; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.highlight { color: var(--accent-2); font-weight: 600; }

.top-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: linear-gradient(180deg, #0d223c 0%, #0a1a30 100%); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd966, #f5b342 60%, #b87a1e); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 14px rgba(245,179,66,.5); color: #1a1a1a; font-weight: 800; }
.nav-links { display: flex; gap: 8px; margin-left: 10px; }
.nav-links a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text); font-weight: 600; font-size: 14px; transition: .2s; }
.nav-links a:hover { background: var(--secondary); color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; background: var(--secondary); border-radius: 999px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #f5b342, #b87a1e); display: flex; align-items: center; justify-content: center; color: #1a1a1a; font-weight: 800; border: 2px solid var(--accent); overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 34px; border-width: 3px; }
.avatar.xl { width: 140px; height: 140px; font-size: 52px; border-width: 4px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); background: var(--accent); color: #1a1a1a; font-weight: 700; border: none; transition: .2s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--secondary); color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px; position: relative; z-index: 1; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media(max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: .25s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0 0 10px; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.card.lab { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.card.lab .lab-head { display: flex; gap: 14px; align-items: center; }
.card.lab .lab-avatar { width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd966, #b87a1e); display: flex; align-items: center; justify-content: center; font-size: 34px; color: #1a1a1a; font-weight: 800; border: 3px solid var(--accent); flex-shrink: 0; overflow: hidden; }
.card.lab .lab-avatar img { width: 100%; height: 100%; object-fit: cover; }
.card.lab .mentor { color: var(--muted); font-size: 13px; }
.card.lab .tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--secondary); color: var(--accent); font-size: 12px; font-weight: 600; margin-top: 4px; }

.progress { height: 10px; background: var(--secondary); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .6s; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.dialog { display: flex; gap: 14px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); animation: fadeUp .4s ease; }
.dialog .avatar { width: 64px; height: 64px; font-size: 22px; flex-shrink: 0; }
.dialog-body { flex: 1; }
.dialog-name { font-weight: 700; color: var(--accent); font-size: 14px; margin-bottom: 2px; }
.dialog-role { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.dialog-text { line-height: 1.6; font-size: 15px; }
.dialog-text .typed::after { content: "▍"; color: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.lesson-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
@media(max-width: 900px) { .lesson-layout { grid-template-columns: 1fr; } }
.lesson-main { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; min-height: 500px; }
.lesson-side { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 80px; align-self: start; }
.step-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.step-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--secondary); font-size: 13px; cursor: pointer; transition: .2s; border: 1px solid transparent; }
.step-item:hover { border-color: var(--accent); }
.step-item.active { background: var(--accent); color: #1a1a1a; font-weight: 700; }
.step-item.done { background: rgba(46,125,94,.25); color: #a9e7c7; }
.step-item .num { width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.step-item.active .num { background: #1a1a1a; color: var(--accent); }

.test-q { margin: 18px 0; padding: 16px; background: var(--panel-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.test-q h4 { margin: 0 0 12px; color: var(--accent-2); }
.test-opt { display: block; padding: 10px 14px; margin: 6px 0; background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: .2s; }
.test-opt:hover { border-color: var(--accent); }
.test-opt input { margin-right: 8px; }
.test-opt.correct { background: rgba(46,125,94,.3); border-color: var(--success); }
.test-opt.wrong { background: rgba(192,57,43,.25); border-color: var(--danger); }

.match-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item { padding: 12px; background: var(--secondary); border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: .2s; font-size: 14px; }
.match-item:hover { border-color: var(--accent); }
.match-item.selected { border-color: var(--accent); background: rgba(245,179,66,.15); }
.match-item.matched { background: rgba(46,125,94,.3); border-color: var(--success); cursor: default; }
.match-item.wrong { background: rgba(192,57,43,.2); border-color: var(--danger); }

.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.flip { perspective: 800px; height: 140px; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .7s; transform-style: preserve-3d; cursor: pointer; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius-sm); padding: 14px; display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--border); }
.flip-front { background: linear-gradient(135deg, var(--accent), #b87a1e); color: #1a1a1a; font-weight: 700; }
.flip-back { background: var(--panel-2); transform: rotateY(180deg); font-size: 13px; color: var(--text); }

.video-slot { aspect-ratio: 16/9; border-radius: var(--radius); background: linear-gradient(135deg, #0a1a30, #1a3554); border: 2px dashed var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); margin: 14px 0; }
.video-slot i { font-size: 48px; color: var(--accent); }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.ach { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; font-size: 12px; position: relative; cursor: help; transition: .2s; }
.ach i { font-size: 30px; color: var(--muted); }
.ach.earned { border-color: var(--accent); background: rgba(245,179,66,.08); }
.ach.earned i { color: var(--accent); filter: drop-shadow(0 0 6px rgba(245,179,66,.6)); }
.ach:hover .ach-tip { opacity: 1; transform: translateY(0); }
.ach-tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px); background: #000; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 11px; white-space: nowrap; opacity: 0; transition: .2s; pointer-events: none; z-index: 10; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: var(--secondary); color: var(--accent); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(245,179,66,.05); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 10px 18px; background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent; font-weight: 600; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp .3s; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 10px 12px; background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: inherit; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }

.footer { margin-top: 40px; padding: 20px; text-align: center; background: linear-gradient(180deg, transparent, #06111f); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.7; }
.footer strong { color: var(--accent); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); text-align: center; }
.login-logo { width: 100px; height: 100px; margin: 0 auto 16px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd966, #f5b342 60%, #b87a1e); display: flex; align-items: center; justify-content: center; font-size: 44px; color: #1a1a1a; font-weight: 800; box-shadow: 0 0 30px rgba(245,179,66,.5); overflow: hidden; }
.login-title { font-size: 28px; font-weight: 800; margin: 0 0 4px; background: linear-gradient(90deg, #ffd966, #f5b342); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mt2 { margin-top: 24px; }
.mb { margin-bottom: 16px; } .mb2 { margin-bottom: 24px; }
.center { text-align: center; }
.hidden { display: none !important; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--secondary); color: var(--accent); font-size: 12px; font-weight: 600; }
.badge.success { background: rgba(46,125,94,.3); color: #a9e7c7; }