/* Vibe Code Academy - ARTEZIQ
   Plain CSS, hardcoded hex colors (no custom properties).
   Palette: bg #0d0b1f  card #17142e  card2 #1f1b3d  border #2d2858
            text #eeeaff  muted #a7a1d4  violet #8b5cf6  cyan #22d3ee
            pink #f472b6  green #34d399  amber #fbbf24  red #f87171 */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #0d0b1f;
  background-image: radial-gradient(circle at 15% 0%, #241a55 0%, #0d0b1f 45%), radial-gradient(circle at 100% 30%, #10294a 0%, #0d0b1f 40%);
  background-attachment: fixed;
  color: #eeeaff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: 84px;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.text-lg { font-size: 19px; }
a { color: #a78bfa; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 10px; }
h1 { font-size: 1.75em; }
h2 { font-size: 1.35em; }
h3 { font-size: 1.12em; }
p { margin: 0 0 12px; }
code {
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  background: #2a2452;
  color: #c4b5fd;
  padding: 1px 6px;
  border-radius: 6px;
}
.noscript { padding: 20px; text-align: center; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(13, 11, 31, 0.92);
  border-bottom: 1px solid #2d2858;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #eeeaff; }
.brand img { border-radius: 9px; }
.brand-text { font-size: 17px; letter-spacing: 0.2px; white-space: nowrap; }
.brand-text b { color: #22d3ee; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.xp-chip {
  text-decoration: none; color: #0d0b1f; font-weight: 700; font-size: 14px;
  background: #fbbf24; background-image: linear-gradient(135deg, #fbbf24, #f472b6);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.icon-btn {
  background: #1f1b3d; border: 1px solid #2d2858; border-radius: 10px;
  min-width: 40px; height: 36px; cursor: pointer; font-weight: 700;
}

/* ---------- Layout ---------- */
#view { display: block; max-width: 860px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
.loading-screen { text-align: center; padding: 60px 0; color: #a7a1d4; }
.section { margin: 26px 0 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.muted { color: #a7a1d4; }
.dim { color: #9d97cf; font-size: 0.9em; }
.center { text-align: center; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: #17142e; border: 1px solid #2d2858; border-radius: 18px;
  padding: 16px; display: block; color: #eeeaff; text-decoration: none;
}
a.card:hover, a.card:focus { border-color: #8b5cf6; }
.card h3 { margin-bottom: 6px; }

/* ---------- Hero ---------- */
.hero {
  border-radius: 22px; padding: 24px 20px; margin-bottom: 8px;
  background: #1b1446;
  background-image: linear-gradient(135deg, #2a1a6e 0%, #1b1446 45%, #0e3550 100%);
  border: 1px solid #3b2f7a;
  position: relative; overflow: hidden;
}
.hero h1 { font-size: 1.9em; margin-bottom: 8px; }
.hero h1 span { color: #22d3ee; }
.hero p { color: #d6d0ff; max-width: 560px; }
.hero .spark { position: absolute; right: -20px; top: -20px; font-size: 110px; opacity: 0.12; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 11px 18px; min-height: 44px;
  font-weight: 700; cursor: pointer; text-decoration: none;
  background: #7c3aed; background-image: linear-gradient(135deg, #7c3aed, #6d28d9); color: #ffffff;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #1f1b3d; background-image: none; border: 1px solid #3b3470; color: #eeeaff; }
.btn.cyan { background: #22d3ee; background-image: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #04121c; }
.btn.green { background: #34d399; background-image: linear-gradient(135deg, #34d399, #059669); color: #03140d; }
.btn.danger { background: #3a1424; background-image: none; border: 1px solid #f87171; color: #fecaca; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 0.88em; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Progress bars ---------- */
.bar { height: 10px; background: #2a2452; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: #22d3ee; background-image: linear-gradient(90deg, #22d3ee, #8b5cf6); }
.level-line { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; font-size: 0.88em; color: #a7a1d4; margin: 6px 0 4px; }

/* ---------- Tracks ---------- */
.track-card { border-left-width: 5px; position: relative; }
.track-card .ticon { font-size: 30px; float: right; margin-left: 10px; }
.track-level { font-size: 0.8em; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.track-card .bar { margin-top: 10px; }
.rec-badge {
  display: inline-block; font-size: 0.72em; font-weight: 800; letter-spacing: 0.5px;
  background: #fbbf24; color: #1b1300; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { margin-bottom: 10px; }
.lesson-item { display: flex; align-items: center; gap: 12px; }
.lesson-num {
  flex: 0 0 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; background: #2a2452; color: #c4b5fd;
}
.lesson-num.done { background: #34d399; color: #03140d; }
.lesson-item .li-body { flex: 1; min-width: 0; }
.lesson-item .li-title { font-weight: 700; }

/* ---------- Lesson ---------- */
.crumbs { font-size: 0.88em; margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.lesson-head { margin-bottom: 18px; }
.pill {
  display: inline-block; font-size: 0.78em; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: #2a2452; color: #c4b5fd; margin-right: 6px;
}
.lesson-body h2 { font-size: 1.12em; margin-top: 22px; color: #c4b5fd; }
.lesson-body ul { padding-left: 22px; margin: 0 0 14px; }
.lesson-body li { margin-bottom: 6px; }
.callout { border-radius: 14px; padding: 12px 14px; margin: 14px 0; border: 1px solid #2d2858; }
.callout .ch { font-weight: 800; font-size: 0.82em; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.callout.tip { background: #0f2633; border-color: #155e75; }
.callout.tip .ch { color: #22d3ee; }
.callout.warn { background: #2e1a10; border-color: #92400e; }
.callout.warn .ch { color: #fbbf24; }
.callout.kid { background: #2a1430; border-color: #9d174d; }
.callout.kid .ch { color: #f472b6; }
.callout.activity { background: #12261e; border-color: #047857; }
.callout.activity .ch { color: #34d399; }
.callout p:last-child { margin-bottom: 0; }

.prompt-box { background: #120f27; border: 1px dashed #6d5bd0; border-radius: 14px; margin: 14px 0; overflow: hidden; }
.prompt-box .pb-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #1c1740; font-size: 0.85em; font-weight: 700; color: #c4b5fd; }
.prompt-box pre { margin: 0; padding: 12px 14px; white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 0.95em; color: #eeeaff; }

.compare { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 14px 0; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare .cbox { border-radius: 14px; padding: 12px 14px; }
.compare .cbad { background: #2a1220; border: 1px solid #7f1d1d; }
.compare .cgood { background: #0f2a20; border: 1px solid #047857; }
.compare .clabel { font-weight: 800; font-size: 0.8em; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.compare .cbad .clabel { color: #f87171; }
.compare .cgood .clabel { color: #34d399; }
.compare .cwhy { grid-column: 1 / -1; font-size: 0.92em; color: #a7a1d4; }

.code-box { margin: 14px 0; border-radius: 14px; overflow: hidden; border: 1px solid #2d2858; background: #0a0818; }
.code-box .cb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: #16122e; font-size: 0.82em; color: #a7a1d4; flex-wrap: wrap; }
.code-box .cb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.code-edit, .code-view {
  display: block; width: 100%; margin: 0; border: 0; resize: vertical;
  background: #0a0818; color: #e2e8f0; padding: 12px 14px;
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 13.5px; line-height: 1.5;
  white-space: pre; overflow-x: auto; tab-size: 4; -moz-tab-size: 4;
}
.code-edit:focus { outline: 2px solid #8b5cf6; outline-offset: -2px; }
body.text-lg .code-edit, body.text-lg .code-view { font-size: 15px; }
.code-out {
  display: none; margin: 0; padding: 10px 14px; border-top: 1px solid #2d2858; background: #050410;
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; max-height: 360px; overflow: auto; color: #d1fae5;
}
.code-out .err { color: #fca5a5; }
.code-out .sys { color: #9d97cf; font-style: italic; }

.takeaways { background: #1b1640; border: 1px solid #4c3d99; border-radius: 16px; padding: 14px 16px; margin: 22px 0; }
.takeaways h2 { font-size: 1.12em; margin-top: 0; color: #fbbf24; }
.takeaways ul { margin: 0; padding-left: 20px; }

/* ---------- Quiz ---------- */
.quiz { background: #17142e; border: 1px solid #2d2858; border-radius: 18px; padding: 16px; margin: 22px 0; }
.quiz h2 { font-size: 1.12em; margin-top: 0; }
.qitem { margin-bottom: 18px; }
.qtext { font-weight: 700; margin-bottom: 8px; }
.qopt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #1f1b3d; border: 2px solid #2d2858; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; min-height: 44px;
}
.qopt.sel { border-color: #8b5cf6; background: #2a2160; }
.qopt.right { border-color: #34d399; background: #0f2a20; }
.qopt.wrong { border-color: #f87171; background: #2a1220; }
.qwhy { font-size: 0.92em; color: #a7a1d4; margin-top: 4px; }
.qresult { border-radius: 14px; padding: 14px; margin-top: 10px; text-align: center; }
.qresult.pass { background: #0f2a20; border: 1px solid #047857; }
.qresult.fail { background: #2e1a10; border: 1px solid #92400e; }
.qresult .big { font-size: 1.4em; font-weight: 800; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Forms / Lab ---------- */
.tabs { display: flex; gap: 6px; background: #17142e; border: 1px solid #2d2858; border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.tabs a { flex: 1; text-align: center; text-decoration: none; color: #a7a1d4; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: 0.92em; }
.tabs a.on { background: #7c3aed; color: #ffffff; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; font-size: 0.92em; margin-bottom: 4px; }
.field .hint { font-weight: 400; color: #9d97cf; font-size: 0.88em; }
.field input[type=text], .field textarea, .field select, .search {
  width: 100%; background: #0f0c22; border: 1px solid #3b3470; border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .search:focus { outline: 2px solid #8b5cf6; outline-offset: 0; border-color: #8b5cf6; }
.checks label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.checks input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 20px; }
.output-box { background: #120f27; border: 1px solid #4c3d99; border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; word-wrap: break-word; min-height: 80px; }
.score-ring { display: flex; align-items: center; gap: 16px; margin: 10px 0 14px; }
.score-num { font-size: 2.4em; font-weight: 800; }
.crit { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #241f48; }
.crit:last-child { border-bottom: 0; }
.crit .ck { flex: 0 0 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.crit .ck.yes { background: #34d399; color: #03140d; }
.crit .ck.no { background: #3b3470; color: #a7a1d4; }

/* ---------- Playground ---------- */
.pg-editor { min-height: 320px; border-radius: 0; }
.pg-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.pg-toolbar select { flex: 1; min-width: 180px; background: #0f0c22; border: 1px solid #3b3470; border-radius: 12px; padding: 8px 10px; min-height: 44px; }
.pg-out { display: block; min-height: 120px; max-height: 420px; }

/* ---------- Progress ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #17142e; border: 1px solid #2d2858; border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6em; }
.stat span { font-size: 0.82em; color: #a7a1d4; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .badges { grid-template-columns: repeat(5, 1fr); } }
.badge { background: #17142e; border: 1px solid #2d2858; border-radius: 16px; padding: 12px 6px; text-align: center; }
.badge .bi { font-size: 30px; display: block; }
.badge .bn { font-weight: 700; font-size: 0.85em; display: block; margin-top: 4px; }
.badge .bd { font-size: 0.72em; color: #9d97cf; display: block; }
.badge.locked { opacity: 0.38; }
.badge.locked .bi { filter: grayscale(1); }
.cert-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #241f48; }
.cert-row:last-child { border-bottom: 0; }

/* ---------- News / freshness ---------- */
.pill-new { background: #fbbf24; color: #1b1300; margin-left: 6px; }
.pill-upd { background: #0f2633; color: #22d3ee; border: 1px solid #155e75; margin-left: 6px; }
.li-title + .pill { font-size: 0.7em; vertical-align: middle; }
.news-card { border-color: #4c3d99; background: #1b1640; }
.news-mini { margin: 0 0 4px; padding-left: 20px; }
.news-mini li { margin-bottom: 4px; }
.spot-head { margin: 18px 0 10px; color: #fbbf24; }
.card.spot { margin-bottom: 8px; background: #17142e; }
.news-item { margin-bottom: 12px; }
.news-item h3 { margin-bottom: 8px; }
.news-item p { margin: 10px 0 0; }
.news-item .why { color: #d6d0ff; }
.news-item .src { display: inline-block; margin-top: 10px; font-weight: 700; word-break: break-word; }
.tag { display: inline-block; font-size: 0.75em; font-weight: 700; border: 1px solid #3b3470; border-radius: 999px; padding: 2px 9px; margin: 0 6px 4px 0; }
.sources { margin: -8px 0 16px; font-size: 0.88em; }

/* ---------- Glossary ---------- */
.gloss-item { padding: 12px 0; border-bottom: 1px solid #241f48; }
.gloss-item b { color: #22d3ee; }
.search { margin-bottom: 12px; }

/* ---------- About ---------- */
.guide-card { display: flex; gap: 14px; align-items: center; }
.guide-avatar { flex: 0 0 64px; height: 64px; border-radius: 18px; overflow: hidden; }
.guide-avatar img { display: block; width: 64px; height: 64px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(15, 12, 34, 0.96); border-top: 1px solid #2d2858;
  padding: 6px 4px; padding-bottom: calc(6px + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tabbar a { flex: 1; text-align: center; text-decoration: none; color: #9d97cf; padding: 4px 2px; border-radius: 12px; }
.tabbar a .ti { display: block; font-size: 22px; line-height: 1.1; }
.tabbar a .tl { display: block; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tabbar a.on { color: #ffffff; background: #231d4f; }

/* ---------- Toast & modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 60;
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: #fbbf24; color: #1b1300; font-weight: 700; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); max-width: 90%; text-align: center;
  -webkit-transition: all 0.25s ease; transition: all 0.25s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-wrap { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(5, 4, 16, 0.78); padding: 16px; overflow-y: auto; }
.modal-wrap.open { display: block; }
.modal { max-width: 560px; margin: 40px auto; background: #17142e; border: 1px solid #3b3470; border-radius: 20px; padding: 20px; }
.modal h2 { margin-bottom: 8px; }
.path-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: #1f1b3d; border: 2px solid #2d2858; border-radius: 14px; padding: 12px; margin-bottom: 10px;
}
.path-btn:hover, .path-btn:focus { border-color: #8b5cf6; }
.path-btn .pi { font-size: 28px; }
.cert-canvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid #3b3470; display: block; margin: 10px 0; }

.footer { text-align: center; color: #9d97cf; font-size: 0.85em; margin: 30px 0 10px; }
.footer a { color: #a7a1d4; }

@media (max-width: 380px) {
  .brand-text { font-size: 15px; }
  .hero h1 { font-size: 1.6em; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .tabbar a .tl { font-size: 10px; }
}
@media (max-width: 345px) {
  .brand { gap: 7px; }
  .brand img { width: 28px; height: 28px; }
  .brand-text { font-size: 13.5px; }
  .xp-chip { font-size: 12px; padding: 4px 9px; }
  .icon-btn { min-width: 36px; }
  .tabbar a .ti { font-size: 20px; }
  .tabbar a .tl { font-size: 9.5px; }
}
