/* iwantcoding.com — w3schools-inspired Laravel demo styles */

:root {
    --green: #4F46E5;
    --green-dark: #059862;
    --yellow: #ffd333;
    --grey-100: #f1f1f1;
    --grey-200: #e7e7e7;
    --grey-300: #ddd;
    --text: #000;
    --text-dim: #555;
    --code-bg: #e7e9eb;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    color: var(--text);
    background: #fff;
    line-height: 1.5;
    font-size: 15px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Top nav ===== */
.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #282a35;
    color: #fff;
    padding: 0 20px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand {
    color: #fff;
    font-weight: bold;
    font-size: 22px;
    letter-spacing: -0.5px;
    margin-right: 12px;
}
.brand span { color: var(--green); }
.brand:hover { text-decoration: none; opacity: 0.9; }

.topnav-links {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
}
.topnav-links a {
    color: #fff;
    padding: 18px 14px;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.topnav-links a:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}
.topnav-links a.active {
    border-bottom-color: var(--green);
    color: #fff;
}

/* ===== Categorised mega-menu ===== */
.topnav .mega {
    position: relative;
    display: inline-flex;
    align-self: stretch;
}
.topnav .mega-toggle {
    background: transparent; border: 0; color: #fff;
    padding: 0 14px; height: 56px;
    font: inherit; font-size: 14px; line-height: 56px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    box-sizing: border-box;
}
.topnav .mega-toggle:hover,
.topnav .mega-toggle:focus { background: rgba(255,255,255,0.08); outline: 0; }
.topnav .mega-toggle[aria-expanded="true"] {
    background: rgba(255,255,255,0.08);
    border-bottom-color: var(--green);
}
.topnav .mega-caret { display: inline-block; transition: transform 0.15s; }
.topnav .mega-toggle[aria-expanded="true"] .mega-caret { transform: rotate(180deg); }

.topnav .mega-panel {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background: #fff;
    color: #222;
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
    border-top: 3px solid var(--green);
    padding: 22px 26px;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 22px 32px;
    width: max(720px, 70vw);
    max-width: 1100px;
    /* topnav has z-index 50 — keep panel above it and above any page content */
    z-index: 1000;
}
.topnav .mega.is-open > .mega-panel { display: grid; }
.topnav .mega:hover > .mega-panel,
.topnav .mega:focus-within > .mega-panel { display: grid; }

.topnav .mega-col h4.mega-cat {
    margin: 0 0 8px;
    font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px;
    color: #4F46E5;
    border-bottom: 1px solid #eee; padding-bottom: 6px;
}
.topnav .mega-col ul { list-style: none; margin: 0; padding: 0; }
.topnav .mega-col li { margin: 0; }
.topnav .mega-panel .mega-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px; margin: 1px -8px;
    font-size: 14px; line-height: 1.3;
    color: #333;
    border-radius: 3px;
    border-bottom: 0;
    white-space: normal;
    text-decoration: none;
}
.topnav .mega-panel .mega-link:hover { background: #f5f5f5; color: #000; text-decoration: none; }
.topnav .mega-panel .mega-link.mega-live { font-weight: 600; color: #222; }
.topnav .mega-panel .mega-link.mega-soon { color: #777; }
.topnav .mega-panel .mega-link.mega-soon:hover { color: #333; }
.topnav .mega-link-label { flex: 1; }
.topnav .mega-soon-badge {
    font-size: 10px; font-weight: bold; text-transform: uppercase;
    background: #ffd333; color: #4a3500;
    padding: 1px 6px; border-radius: 2px; letter-spacing: 0.4px;
    margin-left: 8px;
}

/* Pinned shortcuts to live tracks (next to the mega-menu) */
.topnav-links .topnav-pin {
    color: #fff;
    padding: 18px 10px;
    font-size: 13px; font-weight: 500;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}
.topnav-links .topnav-pin:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.topnav-links .topnav-pin.active { border-bottom-color: var(--green); color: #fff; }

@media (max-width: 1100px) {
    .topnav-links .topnav-pin { display: none; }   /* keep only the mega button on narrow screens */
}
@media (max-width: 800px) {
    .topnav .mega-panel { grid-template-columns: 1fr 1fr; width: min(95vw, 600px); }
}
@media (max-width: 520px) {
    .topnav .mega-panel { grid-template-columns: 1fr; width: 95vw; left: -10px; }
}

/* ===== Coming-soon page ===== */
.coming-soon { padding: 40px 20px; max-width: 900px; margin: 0 auto; }
.coming-soon-card {
    background: #fff; border: 1px solid #eee; border-radius: 6px;
    padding: 36px 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.coming-soon-badge {
    display: inline-block;
    background: #ffd333; color: #4a3500;
    padding: 4px 10px; border-radius: 2px;
    font-size: 11px; font-weight: bold; letter-spacing: 0.8px; text-transform: uppercase;
    margin-bottom: 14px;
}
.coming-soon-card h1 { margin: 0 0 8px; font-size: 38px; }
.coming-soon-tagline { font-size: 16px; color: #555; margin: 0 0 28px; }
.coming-soon-card h2 { font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px; color: #4F46E5; margin: 26px 0 10px; }
.coming-soon-actions { padding-left: 22px; line-height: 1.7; color: #333; }
.coming-soon-live { padding-left: 0; list-style: none; }
.coming-soon-live li { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.coming-soon-live li:last-child { border-bottom: 0; }
.coming-soon-live a { color: #4F46E5; }
.coming-soon-live .muted { color: #888; font-weight: normal; }
.coming-soon-foot { margin-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }

.topnav-search input {
    padding: 8px 12px;
    border: 0;
    border-radius: 2px;
    background: #fff;
    color: #000;
    width: 180px;
}

.topnav-cta { display: flex; gap: 6px; }
.btn-light, .btn-yellow, .btn-green {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border: 0;
}
.btn-light    { background: #fff; color: #000; }
.btn-yellow   { background: var(--yellow); color: #000; }
.btn-green    { background: var(--green); color: #fff; }
.btn-light:hover, .btn-yellow:hover, .btn-green:hover { text-decoration: none; filter: brightness(0.95); }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(180deg, #d9eee1 0%, #f1faf5 100%);
    text-align: center;
    padding: 80px 20px 70px;
}
.hero h1 { font-size: 60px; margin: 0 0 10px; }
.hero p  { font-size: 22px; color: #333; margin: 0 0 28px; }
.hero-search {
    display: flex;
    justify-content: center;
    gap: 0;
    max-width: 720px;
    margin: 0 auto 28px;
}
.hero-search input {
    flex: 1;
    padding: 14px 18px;
    border: 0;
    background: #fff;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.hero-search button {
    background: var(--green);
    color: #fff;
    border: 0;
    padding: 0 26px;
    font-weight: bold;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}
.hero-not-sure {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 4px;
    padding: 10px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.hero-not-sure span { font-weight: bold; }

/* ===== Container & track grid ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.track-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    padding-top: 50px;
    padding-bottom: 50px;
}
.track-card {
    display: block;
    background: var(--grey-100);
    color: #000;
    padding: 22px;
    border-radius: 6px;
    border-left: 6px solid var(--accent, var(--green));
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.track-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.track-card-tag {
    display: inline-block;
    background: var(--accent, var(--green));
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 2px;
    margin-bottom: 10px;
}
.track-card h2 { margin: 0 0 6px; font-size: 20px; }
.track-card p  { margin: 0 0 14px; color: var(--text-dim); }
.track-card-cta { color: var(--accent, var(--green)); font-weight: bold; }

/* ===== Home — categorised track grid ===== */
.home-categories {
    padding-top: 36px;
    padding-bottom: 36px;
}
.home-cat-title {
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 22px;
    scroll-margin-top: 72px;
}
.home-cat-title:first-of-type { margin-top: 8px; }
.home-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.home-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 124px;
    padding: 14px 16px;
    border-radius: 6px;
    background: var(--grey-100);
    color: #000;
    border-left: 5px solid var(--accent, var(--green));
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.home-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.home-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.home-card-tag {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent, var(--green));
}
.home-card-tagline {
    margin: 0 0 12px;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.home-card-cta {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent, var(--green));
}
.home-card-badge {
    background: #ffb703;
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 2px;
}
.home-card--soon {
    background: #fafafa;
    opacity: 0.85;
}

/* ===== Search page ===== */
.search-page { padding: 40px 0 80px; }
.search-title { margin: 0 0 24px; font-size: 32px; }
.search-form {
    display: flex; gap: 10px; margin-bottom: 14px;
}
.search-input {
    flex: 1; min-width: 0;
    padding: 12px 14px;
    border: 1px solid #ccc; border-radius: 4px;
    font-size: 16px;
}
.search-meta { color: var(--text-dim); margin: 0 0 18px; }
.search-results { list-style: none; padding: 0; margin: 0; }
.search-hit a {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    align-items: baseline;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 4px;
    color: #000;
    transition: background 0.1s;
}
.search-hit a:hover { background: var(--grey-100); text-decoration: none; }
.search-hit-track {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-hit-title { font-size: 15px; font-weight: 600; }
.search-hit-title mark {
    background: #ffeaa7; padding: 0 2px; border-radius: 2px;
}
.search-hit-section {
    font-size: 12px; color: var(--text-dim);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-more {
    list-style: none; padding: 12px 14px;
    color: var(--text-dim); font-size: 13px;
}

/* ===== Banner ===== */
.banner {
    background: var(--green);
    color: #fff;
    text-align: center;
    padding: 50px 20px;
    margin-top: 0;
}
.banner h2 { margin: 0 0 8px; font-size: 32px; }
.banner p  { margin: 0 0 22px; font-size: 16px; }
.banner .btn-green {
    background: #fff;
    color: var(--green);
}

/* ===== Tutorial layout: sidebar + lesson ===== */
.tutorial {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 56px - 120px);
}
.sidebar {
    background: var(--grey-100);
    border-right: 1px solid var(--grey-300);
    padding-bottom: 30px;
    overflow-y: auto;
    max-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    align-self: start;
}
.sidebar h3 {
    margin: 0;
    padding: 14px 18px;
    color: #fff;
    font-size: 16px;
}
.sidebar h4.sidebar-section {
    margin: 14px 0 0;
    padding: 8px 18px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    background: var(--grey-200);
    border-top: 1px solid var(--grey-300);
    border-bottom: 1px solid var(--grey-300);
}
.sidebar ul { list-style: none; margin: 0; padding: 6px 0; }
.sidebar li a {
    display: block;
    padding: 7px 18px;
    color: #000;
    border-left: 4px solid transparent;
    font-size: 13.5px;
}
.sidebar li a:hover {
    background: var(--grey-200);
    text-decoration: none;
}
.sidebar li a.active {
    background: var(--green);
    color: #fff;
    border-left-color: var(--green-dark);
    font-weight: bold;
}

.lesson {
    padding: 24px 38px 60px;
    max-width: 900px;
}
.lesson h1 { font-size: 36px; margin: 18px 0 12px; }
.lesson h2 { font-size: 22px; margin: 28px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--grey-200); }
.lesson p  { margin: 8px 0; }
.lesson code {
    background: var(--grey-100);
    padding: 2px 6px;
    border-radius: 2px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
}
.checklist { list-style: square; padding-left: 22px; }
.checklist li { margin: 4px 0; }

.lesson-intro { font-size: 16px; color: #333; }

.lesson ol { padding-left: 22px; }
.lesson ol li { margin: 4px 0; }

.lesson table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0 22px;
    font-size: 14px;
}
.lesson th, .lesson td {
    border: 1px solid var(--grey-300);
    padding: 9px 11px;
    text-align: left;
    vertical-align: top;
}
.lesson th {
    background: var(--grey-100);
    font-weight: bold;
}
.lesson tbody tr:nth-child(even) td { background: #fafafa; }
.lesson tbody tr:hover td { background: #f1faf5; }

.lesson figure {
    margin: 18px 0;
    padding: 18px;
    background: #fafafa;
    border: 1px solid var(--grey-200);
    border-radius: 4px;
    text-align: center;
}
.lesson figure svg { max-width: 100%; height: auto; display: inline-block; }
.lesson figcaption {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
}

.lesson .note {
    background: #fffbe6;
    border-left: 4px solid var(--yellow);
    padding: 10px 14px;
    margin: 14px 0;
    font-size: 14px;
    border-radius: 0 4px 4px 0;
}
.lesson .tip {
    background: #e8f5ed;
    border-left: 4px solid var(--green);
    padding: 10px 14px;
    margin: 14px 0;
    font-size: 14px;
    border-radius: 0 4px 4px 0;
}

/* ===== Code box (Try it Yourself) ===== */
.codebox {
    background: var(--code-bg);
    border-radius: 4px;
    padding: 16px;
    margin: 14px 0 20px;
}
.codebox-head {
    font-weight: bold;
    margin-bottom: 8px;
}
.codebox pre {
    background: #fff;
    padding: 14px;
    border-radius: 3px;
    margin: 0 0 14px;
    overflow-x: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre;
}

/* ===== Lesson nav buttons ===== */
.lesson-nav {
    display: flex;
    justify-content: space-between;
    margin: 12px 0 22px;
}
.lesson-nav.bottom { margin-top: 32px; }
.lesson-nav a, .lesson-nav span {
    background: var(--green);
    color: #fff;
    padding: 8px 16px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 13px;
}
.lesson-nav a:hover { text-decoration: none; background: var(--green-dark); }
.lesson-nav span.disabled { background: var(--grey-300); color: #888; }

/* ===== Footer ===== */
.site-footer {
    background: #282a35;
    color: #fff;
    padding: 26px 20px;
    text-align: center;
    font-size: 13px;
}
.site-footer p { margin: 4px 0; opacity: 0.85; }

/* ===== Sidebar progress + checkmarks ===== */
.sidebar-progress {
    padding: 10px 18px;
    font-size: 12px;
    color: var(--text-dim);
    background: #fafafa;
    border-bottom: 1px solid var(--grey-300);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.sidebar-progress .progress-count { color: var(--green); font-weight: bold; font-size: 13px; }
.sidebar-progress .reset-progress { font-size: 11px; color: var(--text-dim); text-decoration: underline; }
.sidebar-progress .reset-progress:hover { color: #c00; }

.sidebar li.completed > a::before {
    content: "✓ ";
    color: var(--green);
    font-weight: bold;
}

/* ===== Mark complete button ===== */
.btn-mark-complete {
    background: #fff;
    color: var(--green);
    border: 2px solid var(--green);
    padding: 6px 14px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.btn-mark-complete:hover { background: #f1faf5; }
.btn-mark-complete.is-complete {
    background: var(--green);
    color: #fff;
}

/* ===== Quiz ===== */
.quiz {
    background: #fafafa;
    border: 1px solid var(--grey-200);
    border-radius: 6px;
    padding: 18px 22px;
    margin: 16px 0 24px;
}
.quiz-question {
    border: 0;
    margin: 0 0 18px;
    padding: 0;
}
.quiz-question legend {
    padding: 0 0 8px;
    font-size: 15px;
    color: #222;
}
.quiz-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}
.quiz-option:hover { background: #f1f1f1; }
.quiz-option input { margin: 0; }
.quiz-option.mark-correct   { background: #d9f3e3; color: #064; }
.quiz-option.mark-incorrect { background: #fbdcdc; color: #800; text-decoration: line-through; }
.quiz-actions { display: flex; gap: 10px; margin-top: 10px; }
.quiz-result {
    margin: 12px 0 0;
    font-weight: bold;
    font-size: 15px;
}
.quiz-result.good { color: var(--green); }
.quiz-result.bad  { color: #c00; }

/* ===== Exercise ===== */
.exercise {
    background: #fffef5;
    border: 1px solid #f0e6b8;
    border-radius: 6px;
    padding: 18px 22px;
    margin: 16px 0 24px;
}
.exercise-instruction { margin: 0 0 12px; font-size: 15px; color: #333; }
.exercise-code {
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: 4px;
    padding: 14px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.exercise-text { white-space: pre-wrap; }
.exercise-blank {
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    padding: 2px 8px;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #fff;
    min-width: 70px;
    margin: 0 2px;
}
.exercise-blank:focus { outline: 2px solid var(--green); border-color: var(--green); }
.exercise-blank.correct   { background: #d9f3e3; border-color: var(--green); }
.exercise-blank.incorrect { background: #fbdcdc; border-color: #c00; }
.exercise-actions { display: flex; gap: 10px; margin-top: 14px; }
.exercise-hint {
    background: #fff;
    border-left: 4px solid var(--yellow);
    padding: 8px 12px;
    margin: 12px 0 0;
    font-size: 13px;
    color: #555;
}
.exercise-result {
    margin: 12px 0 0;
    font-weight: bold;
    font-size: 15px;
}
.exercise-result.good { color: var(--green); }
.exercise-result.bad  { color: #c00; }

/* ===== CodeMirror tweaks ===== */
.tryit-editor .CodeMirror {
    flex: 1 1 auto;
    height: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
}
.tryit-editor .CodeMirror-scroll { min-height: 100%; }

/* ===== Tryit editor ===== */
.tryit-body { margin: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.tryit-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #282a35;
    color: #fff;
    padding: 8px 14px;
    height: 50px;
    flex: 0 0 auto;
}
.tryit-back {
    color: #fff;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 2px;
}
.tryit-back:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.tryit-title { flex: 1; font-weight: bold; font-size: 15px; }
.tryit-title .muted { color: #aaa; font-weight: normal; margin-left: 6px; }
.tryit-actions { display: flex; gap: 8px; }
.tryit-actions button { font-family: inherit; }

.tryit-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1 1 auto;
    min-height: 0;
    background: #d9d9d9;
    gap: 1px;
}
.tryit-pane {
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.tryit-pane-head {
    background: #e7e9eb;
    color: #555;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-bottom: 1px solid #ccc;
    flex: 0 0 auto;
}
.tryit-editor textarea {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    outline: 0;
    resize: none;
    padding: 14px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
    color: #000;
    white-space: pre;
    tab-size: 4;
}
.tryit-preview iframe {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    background: #fff;
}

@media (max-width: 800px) {
    .tryit-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
    .topnav { flex-wrap: wrap; height: auto; padding: 8px 12px; }
    .topnav-search { order: 5; width: 100%; }
    .topnav-search input { width: 100%; }
    .tutorial { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--grey-300); }
    .lesson { padding: 18px; }
    .hero h1 { font-size: 38px; }
    .hero p  { font-size: 18px; }
}

/* ===== Learner actions (lesson header row) ===== */
.learner-actions { display: flex; gap: 8px; align-items: center; margin: 4px 0 16px; flex-wrap: wrap; }
.learner-actions [data-bookmark-btn].active { background: var(--yellow); color: #000; }
.learner-actions .level-badge {
    margin-left: auto;
    background: var(--grey-100); color: #333;
    padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: bold;
}

/* ===== AI panel ===== */
.ai-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.35);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
    z-index: 90;
}
.ai-backdrop.open { opacity: 1; pointer-events: auto; }
.ai-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
    background: #fff; box-shadow: -6px 0 24px rgba(0,0,0,0.12);
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.25s ease;
    z-index: 100;
    font-size: 14px;
}
.ai-panel.open { transform: translateX(0); }
.ai-panel-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; background: #282a35; color: #fff;
    border-bottom: 1px solid #1f2129;
}
.ai-tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.ai-tab {
    background: transparent; color: #ccc; border: 0; cursor: pointer;
    padding: 6px 10px; border-radius: 4px; font-size: 12px; font-weight: bold;
}
.ai-tab.active { background: var(--green); color: #fff; }
.ai-tab:hover  { color: #fff; }
.ai-close {
    background: transparent; color: #fff; border: 0; cursor: pointer;
    font-size: 24px; line-height: 1; padding: 0 4px;
}
.ai-pane { display: none; flex-direction: column; flex: 1; min-height: 0; padding: 12px; gap: 10px; overflow-y: auto; }
.ai-pane.active { display: flex; }
.ai-help  { color: #555; margin: 0; font-size: 13px; }
.ai-row   { display: flex; gap: 8px; align-items: center; }
.ai-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; flex: 1; }
.ai-row select, .ai-row input[type="number"] {
    flex: 1; padding: 6px 8px; font: inherit; border: 1px solid var(--grey-300); border-radius: 4px;
}
.ai-pane textarea {
    width: 100%; padding: 10px; font-family: Consolas, "Courier New", monospace;
    font-size: 13px; border: 1px solid var(--grey-300); border-radius: 4px; resize: vertical;
}
.ai-output { display: flex; flex-direction: column; gap: 8px; }
.ai-result {
    background: #f9fafb; border-left: 3px solid var(--green);
    padding: 10px 12px; border-radius: 0 4px 4px 0;
}
.ai-result.ai-error { border-left-color: #dc2626; background: #fef2f2; }
.ai-result.ai-info  { border-left-color: #2965F1; background: #f0f7ff; }
.ai-result pre {
    background: #282a35; color: #fafafa; padding: 10px; border-radius: 4px;
    overflow-x: auto; font-size: 12px; margin: 6px 0;
}
.ai-result h3, .ai-result h4 { margin: 8px 0 4px; }
.ai-result ul { padding-left: 22px; }
.ai-quiz-form fieldset { border: 1px solid var(--grey-300); border-radius: 4px; padding: 8px 12px; margin: 6px 0; }
.ai-quiz-form label    { display: block; padding: 4px 0; }
.ai-quiz-result { font-weight: bold; }

/* ===== Chat ===== */
.ai-chat-log { flex: 1; min-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.ai-turn { display: flex; }
.ai-turn.ai-user      { justify-content: flex-end; }
.ai-turn.ai-assistant { justify-content: flex-start; }
.ai-turn.ai-error     { justify-content: flex-start; }
.ai-bubble { max-width: 88%; padding: 8px 12px; border-radius: 10px; background: var(--grey-100); }
.ai-turn.ai-user      .ai-bubble { background: var(--green); color: #fff; }
.ai-turn.ai-error     .ai-bubble { background: #fef2f2; border-left: 3px solid #dc2626; }
.ai-thinking { font-size: 18px; opacity: 0.7; letter-spacing: 3px; }
.ai-chat-form { display: flex; gap: 6px; align-items: stretch; }
.ai-chat-form textarea { flex: 1; padding: 8px; font: inherit; }
.ai-chat-form button { align-self: stretch; }

/* ===== AI hint button inside quiz ===== */
.ai-hint-btn { margin-top: 6px; font-size: 12px; }
.ai-hint-text { margin: 6px 0 0; font-size: 13px; color: #555; font-style: italic; }

/* ===== Notes panel ===== */
.notes-panel {
    position: fixed; bottom: 16px; right: 16px;
    width: min(360px, 90%); max-height: 60vh;
    background: #fffce0; border: 1px solid #e5d97a; border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.15);
    display: none; flex-direction: column;
    z-index: 80;
}
.notes-panel.open { display: flex; }
.notes-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #ffe97a; }
.notes-head .ai-close { color: #000; }
.notes-panel textarea {
    flex: 1; min-height: 200px;
    border: 0; background: transparent; padding: 12px; font: inherit; resize: none;
}
.notes-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; font-size: 12px; color: #6b5d00; }

/* ===== Achievement toast ===== */
.achievement-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(40px);
    background: #282a35; color: #fff; padding: 12px 18px; border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.25);
    display: flex; gap: 12px; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
    z-index: 110;
}
.achievement-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.achievement-icon { font-size: 28px; }
.achievement-body { display: flex; flex-direction: column; line-height: 1.3; }
.achievement-body strong { font-size: 14px; }
.achievement-body span   { font-size: 12px; opacity: 0.85; }

/* ===== Tryit additions: theme picker, console, action buttons ===== */
.tryit-theme { display: flex; gap: 6px; align-items: center; color: #ccc; font-size: 12px; }
.tryit-theme select { padding: 4px 6px; border-radius: 3px; border: 0; font: inherit; }

.tryit-preview { display: flex; flex-direction: column; }
.tryit-console {
    display: flex; flex-direction: column;
    border-top: 1px solid #444;
    max-height: 40%;
    background: #1e1f29;
    color: #e0e0e0;
}
.tryit-console[hidden] { display: none !important; }
.tryit-console-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 8px; background: #282a35; font-size: 12px;
}
.tryit-console-head button { padding: 2px 8px; font-size: 11px; }
.tryit-console pre {
    margin: 0; padding: 8px; flex: 1; overflow: auto;
    font-family: Consolas, "Courier New", monospace; font-size: 12px;
    white-space: pre-wrap; word-break: break-word;
}

/* ===== Multi-file Playground tabs ===== */
.tryit-filetabs { display: flex; gap: 2px; flex: 1; }
.tryit-filetab {
    background: transparent; border: 0; color: #555; cursor: pointer;
    padding: 5px 14px; font-size: 12px; font-weight: bold; letter-spacing: 0.5px;
    border-bottom: 2px solid transparent;
}
.tryit-filetab:hover { color: #000; }
.tryit-filetab.active {
    color: var(--green);
    border-bottom-color: var(--green);
}

/* ===== Boss Quiz ===== */
.boss { padding: 40px 20px; max-width: 880px; }
.boss-head h1 { margin: 0; }
.boss-tag {
    display: inline-block; vertical-align: middle;
    background: linear-gradient(45deg, #E44D26, #ffd333); color: #fff;
    font-size: 13px; padding: 4px 10px; border-radius: 4px; margin-left: 10px;
    letter-spacing: 1px;
}
.boss-bar { display: flex; gap: 16px; align-items: center; margin: 14px 0 20px; }
.boss-timer {
    font-family: Consolas, monospace; font-size: 32px; font-weight: bold;
    background: #282a35; color: #ffd333; padding: 6px 16px; border-radius: 6px;
    min-width: 110px; text-align: center;
}
.boss-from { font-size: 11px; color: #999; margin-left: 8px; }
.boss-form { margin-top: 20px; }
.boss-q { margin: 12px 0; }
.boss-result { font-size: 16px; margin-top: 20px; padding: 14px; background: var(--grey-100); border-radius: 6px; }

/* ===== Flashcards ===== */
.flashcards { padding: 40px 20px; max-width: 720px; }
.flash-head h1 { margin: 0 0 6px; }
.flash-progress { display: flex; align-items: center; gap: 8px; margin: 10px 0 20px; font-weight: bold; }
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.flash-card {
    width: 100%; max-width: 480px; height: 260px; perspective: 1000px; cursor: pointer;
}
.flash-card-inner {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}
.flash-card.flipped .flash-card-inner { transform: rotateY(180deg); }
.flash-face {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; text-align: center;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    font-size: 22px; font-weight: bold;
}
.flash-front { background: #fff; border: 1px solid var(--grey-200); }
.flash-back  { background: var(--green); color: #fff; transform: rotateY(180deg); font-size: 17px; font-weight: normal; line-height: 1.4; }
.flash-actions { display: flex; gap: 10px; }

/* ===== Daily Challenge ===== */
.challenge { padding: 40px 20px; max-width: 880px; }
.challenge-tag {
    display: inline-block; background: #E44D26; color: #fff;
    font-size: 12px; letter-spacing: 1px; padding: 4px 10px; border-radius: 3px;
}
.challenge-prompt { font-size: 18px; color: #333; margin: 10px 0 16px; }
.challenge-actions { display: flex; gap: 10px; margin: 20px 0; }
.challenge-starter { background: var(--grey-100); padding: 18px; border-radius: 6px; }
.challenge-starter pre { background: #fff; padding: 12px; border-radius: 4px; overflow-x: auto; font-size: 13px; }

/* ===== Cheat sheet ===== */
.cheat-body { background: #f5f5f5; }
.cheat-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 20px; background: #282a35; color: #fff;
}
.cheat-sheet {
    background: #fff; max-width: 900px; margin: 24px auto; padding: 40px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.cheat-sheet h1 { margin: 0 0 4px; }
.cheat-tagline { color: var(--text-dim); margin: 0 0 20px; }
.cheat-section-title {
    margin-top: 22px; padding-bottom: 4px;
    border-bottom: 2px solid var(--green);
    font-size: 16px; text-transform: uppercase; letter-spacing: 1px;
}
.cheat-grid {
    list-style: none; padding: 0; margin: 8px 0 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px 16px; font-size: 13px;
}
.cheat-grid li a { color: #000; text-decoration: none; }
.cheat-grid li a:hover { color: var(--green); }
.cheat-foot { margin-top: 30px; border-top: 1px solid #eee; padding-top: 10px; font-size: 11px; color: var(--text-dim); }
.cheat-foot kbd {
    background: #f1f1f1; border: 1px solid #ccc; border-radius: 3px; padding: 1px 6px;
    font-family: Consolas, monospace; font-size: 11px;
}
@media print {
    .cheat-bar { display: none; }
    .cheat-body { background: #fff; }
    .cheat-sheet { box-shadow: none; max-width: none; margin: 0; padding: 16px 20px; }
    .cheat-grid { grid-template-columns: repeat(3, 1fr); gap: 2px 12px; }
    a { color: #000; text-decoration: none; }
}

/* ===== Sidebar extras ===== */
.sidebar-extras {
    padding: 4px 18px 12px;
    display: flex; flex-direction: column; gap: 4px;
    border-bottom: 1px solid var(--grey-300);
    background: #fafafa;
}
.extras-link {
    display: block;
    font-size: 13px; color: #333; padding: 4px 6px; border-radius: 3px;
    text-decoration: none;
}
.extras-link:hover { background: var(--grey-200); text-decoration: none; }

/* ===== Profile ===== */
.profile { padding: 40px 20px; max-width: 880px; }
.profile-head {
    display: flex; gap: 20px; align-items: center;
    background: linear-gradient(135deg, #f1faf5, #fff);
    border-radius: 8px; padding: 20px; box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: grid; place-items: center;
    font-size: 36px; font-weight: bold;
    box-shadow: 0 4px 12px rgba(4,170,109,0.3);
}
.profile-meta h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.profile-meta h1 button { font-size: 12px; padding: 4px 8px; }
.profile-stats { margin: 8px 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.profile-pill {
    background: #fff; border: 1px solid var(--grey-300);
    padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: bold;
}
.profile-cta { display: flex; gap: 8px; align-items: center; }
.profile-publish-status { margin: 8px 0 0; font-size: 13px; color: #555; }

.profile-section { margin: 24px 0; }
.profile-section h2 { margin: 0 0 8px; font-size: 18px; }
.profile-list, .profile-badges {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
}
.profile-list li, .profile-badge {
    background: var(--grey-100); padding: 10px 12px; border-radius: 4px; font-size: 14px;
}
.profile-list li small { color: #666; font-style: italic; display: block; margin-top: 4px; }
.profile-empty { grid-column: 1 / -1; color: var(--text-dim); font-style: italic; }
.profile-note { color: var(--text-dim); font-size: 13px; margin-top: 24px; }

/* ===== Leaderboard ===== */
.leaderboard { padding: 40px 20px; max-width: 880px; }
.lb-head h1 { margin: 0 0 6px; }
.lb-tabs { display: flex; gap: 4px; margin: 18px 0 12px; border-bottom: 1px solid var(--grey-300); }
.lb-tab {
    background: transparent; border: 0; cursor: pointer;
    padding: 8px 16px; font-weight: bold; font-size: 14px;
    border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.lb-tab.active { border-bottom-color: var(--green); color: var(--green); }
.lb-pane { display: none; }
.lb-pane.active { display: block; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lb-table th, .lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--grey-200); text-align: left; }
.lb-table thead th { background: var(--grey-100); }
.lb-table .lb-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
.lb-empty { color: var(--text-dim); padding: 20px; font-style: italic; }

/* ===== Comments ===== */
.comments-section { margin-top: 36px; border-top: 2px solid var(--grey-200); padding-top: 20px; }
.comments-section h2 { margin: 0 0 12px; }
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.comments-empty, .comments-loading { color: var(--text-dim); font-style: italic; }

.comment {
    display: grid; grid-template-columns: 36px 1fr; gap: 8px;
    padding: 12px; background: var(--grey-100); border-radius: 6px;
}
.comment-reply { margin-left: 24px; background: #fafafa; }
.comment-vote { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.comment-vote-btn { background: transparent; border: 0; cursor: pointer; padding: 2px 4px; font-size: 12px; color: #666; }
.comment-vote-btn:hover { color: var(--green); }
.comment-vote-count { font-size: 13px; font-weight: bold; }
.comment-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.comment-head small { color: var(--text-dim); }
.comment-body { margin: 0 0 6px; white-space: pre-wrap; word-wrap: break-word; }
.comment-reply-btn {
    background: transparent; border: 0; cursor: pointer; color: var(--green);
    font-size: 12px; font-weight: bold; padding: 0;
}
.comment-replies { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

.comments-form { display: flex; flex-direction: column; gap: 8px; }
.comments-form input[type="text"],
.comments-form textarea {
    padding: 10px; border: 1px solid var(--grey-300); border-radius: 4px;
    font: inherit;
}
.comments-form textarea { resize: vertical; }
.comments-form-actions { display: flex; gap: 8px; align-items: center; }
.comments-form-status { color: #555; font-size: 13px; }

/* ===== Auth pages ===== */
.auth-page { max-width: 420px; padding: 40px 20px; }
.auth-page h1 { margin: 0 0 16px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-weight: bold; font-size: 14px; }
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    padding: 10px 12px; font: inherit;
    border: 1px solid var(--grey-300); border-radius: 4px;
}
.auth-form input:focus-visible {
    outline: none; border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(4,170,109,0.15);
}
.auth-form small { font-weight: normal; color: var(--text-dim); }
.auth-form .btn-green { padding: 10px 16px; font-size: 15px; }
.auth-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: normal !important; }
.auth-alt   { text-align: center; margin-top: 14px; color: var(--text-dim); }
.auth-note  { font-size: 12px; color: var(--text-dim); margin-top: 18px; }
.auth-error {
    background: #fef2f2; border-left: 4px solid #dc2626;
    padding: 10px 14px; margin-bottom: 14px; border-radius: 0 4px 4px 0;
    color: #7f1d1d;
}
.auth-error ul { margin: 0; padding-left: 20px; }

/* ===== Auth pages ===== */
.auth-page { max-width: 420px; margin: 60px auto; padding: 30px; background: #fff; border-radius: 8px; box-shadow: 0 1px 8px rgba(0,0,0,0.05); }
.auth-page h1 { margin-top: 0; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: bold; }
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="password"] {
    padding: 10px 12px; border: 1px solid var(--grey-300); border-radius: 4px; font: inherit;
}
.auth-form .auth-check { flex-direction: row; align-items: center; gap: 8px; font-weight: normal; }
.auth-form button[type="submit"] { margin-top: 6px; }
.auth-alt { margin-top: 16px; font-size: 14px; color: var(--text-dim); }
.auth-error {
    background: #fef2f2; border-left: 4px solid #dc2626;
    padding: 10px 14px; margin: 0 0 16px; border-radius: 0 4px 4px 0; font-size: 14px;
}
.auth-error ul { margin: 4px 0 0 0; padding-left: 18px; }

/* ===== Admin ===== */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
.admin-sidebar {
    background: #1f2129; color: #fff; padding: 18px 0;
    display: flex; flex-direction: column;
}
.admin-brand {
    margin: 0 18px 14px; font-size: 13px; letter-spacing: 2px;
    text-transform: uppercase; color: var(--green);
}
.admin-sidebar nav { display: flex; flex-direction: column; }
.admin-sidebar nav a {
    color: #ccc; padding: 10px 18px; text-decoration: none; font-size: 14px;
    border-left: 3px solid transparent;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.admin-sidebar nav a.active { background: rgba(4,170,109,0.15); border-left-color: var(--green); color: #fff; }
.admin-sidebar hr { border: 0; border-top: 1px solid #333; margin: 14px 0; }
.admin-user { padding: 0 18px; font-size: 13px; }
.admin-user strong { display: block; }
.admin-user small { color: #777; font-size: 11px; }
.admin-user form { margin-top: 8px; }

.admin-main { padding: 24px 28px; background: #f5f5f5; min-width: 0; }
.admin-main h1 { margin: 0 0 16px; }
.admin-flash {
    background: #dcfce7; border-left: 4px solid var(--green);
    padding: 8px 14px; margin-bottom: 14px; border-radius: 0 4px 4px 0;
}
.admin-flash-err { background: #fef2f2; border-left-color: #dc2626; }
.admin-stats {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: #fff; padding: 16px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    display: flex; flex-direction: column;
}
.stat-num { font-size: 26px; font-weight: bold; color: var(--green); }
.stat-label { font-size: 12px; color: #555; }

.admin-block { background: #fff; padding: 18px 20px; border-radius: 6px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.admin-block h2 { margin: 0 0 10px; font-size: 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--grey-200); text-align: left; vertical-align: top; }
.admin-table thead th { background: var(--grey-100); }
.admin-body { max-width: 360px; overflow-wrap: break-word; }
.admin-empty { color: var(--text-dim); padding: 14px; font-style: italic; }
.admin-filter {
    display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
    background: #fff; padding: 12px; border-radius: 6px;
}
.admin-filter input[type="search"], .admin-filter select {
    padding: 7px 10px; border: 1px solid var(--grey-300); border-radius: 4px; font: inherit;
}
.admin-del { color: #dc2626; }
.admin-tag {
    display: inline-block; background: var(--grey-200); color: #555;
    font-size: 10px; padding: 1px 6px; border-radius: 2px; vertical-align: middle;
}

@media (max-width: 800px) {
    .admin { grid-template-columns: 1fr; }
    .admin-sidebar { padding: 10px 0; }
    .admin-sidebar nav { flex-direction: row; overflow-x: auto; }
    .admin-sidebar nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 14px; white-space: nowrap; }
    .admin-sidebar nav a.active { border-left: 0; border-bottom-color: var(--green); }
}

/* ===== PWA: install button + offline indicator + offline page ===== */
.pwa-offline {
    display: inline-flex; align-items: center; gap: 4px;
    background: #fef2f2; color: #dc2626;
    padding: 4px 8px; border-radius: 3px; font-size: 12px; font-weight: bold;
}
.pwa-offline::before { content: '●'; }
.pwa-install { font-size: 12px; }

.offline-page {
    max-width: 600px; margin: 80px auto; padding: 0 20px; text-align: center;
}
.offline-page h1 { font-size: 36px; }

/* ===== Code Diff Viewer ===== */
.code-diff-wrap {
    margin: 18px 0; border: 1px solid var(--grey-300); border-radius: 6px;
    overflow: hidden; background: #fff;
}
.code-diff-title {
    padding: 8px 14px; background: var(--grey-100);
    font-weight: bold; font-size: 13px; border-bottom: 1px solid var(--grey-300);
}
.cd-tabs {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; background: #fafafa; border-bottom: 1px solid var(--grey-200);
}
.cd-tab {
    background: transparent; border: 0; cursor: pointer;
    padding: 4px 10px; border-radius: 3px;
    font-size: 12px; font-weight: bold; color: #555;
}
.cd-tab.active { background: var(--green); color: #fff; }
.cd-lang {
    margin-left: 6px; padding: 2px 8px; background: var(--grey-200); color: #555;
    font-size: 11px; border-radius: 3px; text-transform: uppercase; letter-spacing: 1px;
}
.cd-summary { margin-left: auto; display: flex; gap: 6px; font-size: 12px; }
.cd-stat { font-family: Consolas, "Courier New", monospace; font-weight: bold; }
.cd-stat.cd-add { color: #16a34a; }
.cd-stat.cd-del { color: #dc2626; }

.cd-body { overflow-x: auto; max-height: 480px; }
.cd-table {
    width: 100%; border-collapse: collapse;
    font-family: Consolas, "Courier New", monospace; font-size: 13px;
    table-layout: fixed;
}
.cd-table thead th {
    background: #f1f1f1; padding: 4px 8px; text-align: left; font-size: 11px;
    text-transform: uppercase; letter-spacing: 1px; color: #555;
    border-bottom: 1px solid var(--grey-300);
}
.cd-num {
    width: 38px; padding: 2px 6px; text-align: right;
    color: #999; background: #fafafa; border-right: 1px solid var(--grey-200);
    user-select: none;
}
.cd-marker {
    width: 24px; padding: 2px 6px; text-align: center;
    color: #999; font-weight: bold; user-select: none;
    border-right: 1px solid var(--grey-200);
}
.cd-marker.cd-add { color: #16a34a; }
.cd-marker.cd-del { color: #dc2626; }
.cd-cell {
    padding: 2px 8px; white-space: pre-wrap; word-break: break-word;
    border-right: 1px solid var(--grey-200);
}
.cd-cell.cd-eq    { background: #fff; }
.cd-cell.cd-add   { background: #dcfce7; }
.cd-cell.cd-del   { background: #fee2e2; }
.cd-cell.cd-empty { background: #fafafa; }
.cd-side .cd-cell { width: 50%; }

.code-diff-usage {
    background: #282a35; color: #f8f8f2; padding: 14px; border-radius: 4px;
    overflow-x: auto; font-size: 13px;
}

/* ===== Study Rooms ===== */
.study-index { padding: 40px 20px; max-width: 880px; }
.study-head h1 { margin: 0 0 6px; }
.study-create {
    background: #fff; padding: 20px; border-radius: 6px;
    margin: 20px 0; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.study-create-form {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.study-create-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: bold; flex: 1; min-width: 180px; }
.study-create-form input, .study-create-form select {
    padding: 8px 10px; border: 1px solid var(--grey-300); border-radius: 4px; font: inherit;
}

.study-rooms { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.study-room-card { background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.study-room-link { display: block; padding: 14px 16px; text-decoration: none; color: #000; }
.study-room-link:hover { background: #f1faf5; text-decoration: none; }
.study-room-link strong { font-size: 16px; }
.study-room-link .study-tag {
    display: inline-block; vertical-align: middle; margin-left: 8px;
    background: var(--green); color: #fff; padding: 2px 8px;
    font-size: 11px; border-radius: 3px; letter-spacing: 0.5px;
}
.study-meta { display: block; margin-top: 4px; color: var(--text-dim); font-size: 12px; }
.study-meta code { background: var(--grey-100); padding: 1px 6px; border-radius: 2px; font-family: Consolas, monospace; }
.study-presence { color: #16a34a; font-weight: bold; }
.study-empty { color: var(--text-dim); font-style: italic; }

/* ===== Inside a room ===== */
.study-room { padding: 30px 20px; max-width: 1100px; }
.study-room-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.study-room-head h1 { margin: 0; }
.study-room-meta { color: var(--text-dim); font-size: 14px; margin: 4px 0 0; }
.study-room-meta code { background: var(--grey-100); padding: 1px 6px; border-radius: 2px; font-family: Consolas, monospace; }
.study-room-actions { display: flex; gap: 8px; }

.study-room-grid {
    display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin-top: 20px;
}
.study-side {
    background: #fff; padding: 14px; border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    height: fit-content;
}
.study-side h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: #555; }
.study-side .study-count { background: var(--green); color: #fff; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: bold; }
.study-people { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.study-info { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-dim); margin: 8px 0 0; }
.study-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ccc; }
.study-dot-ok   { background: #16a34a; }
.study-dot-warn { background: #ffd333; }

.study-chat { background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); display: flex; flex-direction: column; min-height: 520px; }
.study-log {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    max-height: 60vh;
}
.study-msg { padding: 8px 12px; background: var(--grey-100); border-radius: 6px; }
.study-msg header { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-bottom: 2px; color: #555; }
.study-msg p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.study-msg pre { margin: 0; background: #282a35; color: #f8f8f2; padding: 8px 10px; border-radius: 4px; font-family: Consolas, monospace; font-size: 13px; overflow-x: auto; }
.study-msg-system { background: #fffbe6; border-left: 3px solid var(--yellow); }

.study-form { border-top: 1px solid var(--grey-200); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.study-form input[type="text"], .study-form textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--grey-300); border-radius: 4px; font: inherit;
}
.study-form textarea { resize: vertical; }
.study-form-row { display: flex; gap: 10px; align-items: center; }
.study-form-row .study-form-status { flex: 1; font-size: 12px; color: #555; }
.study-kind-toggle { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; color: #555; }

@media (max-width: 800px) {
    .study-room-grid { grid-template-columns: 1fr; }
}

/* ===== Certificate flow ===== */
.cert-page { padding: 30px 20px; max-width: 760px; }
.cert-head h1 { margin: 0; }
.cert-progress { margin: 24px 0; }
.cert-progress-bar { background: var(--grey-200); border-radius: 999px; height: 14px; overflow: hidden; }
.cert-progress-fill { height: 100%; transition: width 0.4s ease; }
.cert-issued, .cert-claim, .cert-not-yet, .cert-login-gate {
    background: #fff; padding: 22px; border-radius: 8px; margin: 16px 0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.cert-issued h2, .cert-claim h2, .cert-not-yet h2, .cert-login-gate h2 { margin-top: 0; }
.cert-cta { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn-lg { font-size: 16px; padding: 12px 22px; }
.cert-faq { margin-top: 30px; }
.cert-faq summary { cursor: pointer; font-weight: bold; padding: 8px 0; }
.cert-faq ul { padding-left: 22px; }

.cert-callout {
    background: #f1faf5; border-left: 4px solid var(--green);
    padding: 14px 18px; margin: 16px 0; border-radius: 0 4px 4px 0;
}
.cert-callout small { color: var(--text-dim); }

/* ===== Printable certificate ===== */
.cert-print-body { margin: 0; background: #e8e8e8; font-family: Verdana, sans-serif; }
.cert-toolbar {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: #282a35; color: #fff;
}
.cert-doc { padding: 30px 20px; display: flex; justify-content: center; }
.cert-border {
    width: 100%; max-width: 900px;
    background: #fff; padding: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.15);
    border: 8px solid var(--green);
    background-clip: padding-box;
}
.cert-inner {
    border: 2px solid var(--green);
    padding: 50px 50px;
    text-align: center;
    background: #fff;
}
.cert-eyebrow {
    text-transform: uppercase; letter-spacing: 6px;
    color: var(--text-dim); font-size: 13px; margin: 0 0 18px;
}
.cert-title {
    font-size: 44px; margin: 0 0 16px;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--green);
}
.cert-presented { color: var(--text-dim); margin: 8px 0; font-style: italic; }
.cert-name {
    font-size: 40px; font-family: Georgia, "Times New Roman", serif;
    margin: 8px 0 18px; font-weight: normal;
    border-bottom: 1px solid var(--grey-300);
    padding-bottom: 14px; display: inline-block;
    min-width: 60%;
}
.cert-statement { font-size: 16px; color: #333; max-width: 600px; margin: 0 auto 30px; line-height: 1.6; }
.cert-meta {
    display: flex; justify-content: space-around; align-items: center;
    gap: 20px; margin: 30px 0 18px;
}
.cert-meta-col { display: flex; flex-direction: column; align-items: flex-start; }
.cert-meta-right { align-items: flex-end; }
.cert-meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); }
.cert-meta-value { font-size: 15px; font-weight: bold; margin-top: 4px; }
.cert-seal {
    width: 90px; height: 90px; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-weight: bold; font-family: Georgia, serif;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.cert-verify { font-size: 11px; color: var(--text-dim); margin: 24px 0 0; word-break: break-all; }

@media print {
    .cert-toolbar { display: none; }
    .cert-print-body { background: #fff; }
    .cert-doc { padding: 0; }
    .cert-border { box-shadow: none; }
    @page { size: A4 landscape; margin: 12mm; }
}

/* ===== Public verification ===== */
.cert-verify-page { padding: 60px 20px; max-width: 580px; }
.cert-verify-card {
    background: #fff; padding: 32px; border-radius: 8px; text-align: center;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.cert-verify-ok  { border-top: 6px solid var(--green); }
.cert-verify-bad { border-top: 6px solid #dc2626; }
.cert-verify-icon { font-size: 56px; }
.cert-verify-card h1 { margin: 8px 0 16px; }
.cert-verify-table { width: 100%; margin: 16px auto; max-width: 380px; }
.cert-verify-table th, .cert-verify-table td {
    padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--grey-200);
    font-size: 14px;
}
.cert-verify-table th { color: var(--text-dim); font-weight: normal; width: 40%; }
