[data-theme="light"] {
    --ad-bg: #fff9f0;
    --ad-border: rgba(249, 115, 22, 0.20);
}

[data-theme="dark"] {
    --ad-bg: rgba(249, 115, 22, 0.04);
    --ad-border: rgba(249, 115, 22, 0.18);
}

/* ══ 3-COLUMN LAYOUT ═══════════════════════════════════════ */
.tp-layout {
    display: grid;
    grid-template-columns: 272px 1fr 256px;
    min-height: 100vh;
    padding-top: 70px;
    align-items: start;
}

/* ══ LEFT SIDEBAR ══════════════════════════════════════════ */
.tp-sidebar {
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 0 0 40px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    transition: background 0.4s ease;
}

.tp-sidebar::-webkit-scrollbar {
    width: 3px;
}

.tp-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.tp-sb-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}

.tp-sb-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .08em;
    transition: color 0.2s;
    margin-bottom: 14px;
}

.tp-sb-back:hover {
    color: var(--accent);
}

.tp-sb-tut-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.tp-sb-tut-name {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.tp-sb-tut-meta {
    font-size: 11px;
    color: var(--text3);
    font-weight: 500;
}

.tp-sb-progress {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.tp-sb-prog-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 8px;
}

.tp-sb-prog-track {
    height: 5px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.tp-sb-prog-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #ec4899);
    border-radius: 999px;
    transition: width 0.5s var(--ease-out);
    width: 14%;
}

.tp-sb-prog-done {
    font-size: 10px;
    color: var(--text3);
    font-weight: 500;
}

.tp-chapters {
    padding: 10px 0;
}

.tp-ch-group {
    padding: 10px 0 4px;
}

.tp-ch-group-label {
    padding: 4px 18px 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text3);
}

.tp-ch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-left: 2px solid transparent;
    position: relative;
}

.tp-ch-item:hover {
    background: rgba(249, 115, 22, 0.06);
}

.tp-ch-item.active {
    background: rgba(249, 115, 22, 0.1);
    border-left-color: var(--accent);
}

.tp-ch-num {
    min-width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg3);
    color: var(--text3);
    border: 1px solid var(--border);
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.tp-ch-num.done {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

.tp-ch-item.active .tp-ch-num {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent);
    border-color: rgba(249, 115, 22, 0.4);
}

.tp-ch-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text2);
    flex: 1;
    line-height: 1.4;
}

.tp-ch-item.active .tp-ch-name {
    color: var(--accent);
    font-weight: 600;
}

.tp-ch-item.done .tp-ch-name {
    color: var(--text2);
}

.tp-ch-done-icon {
    color: #22c55e;
    flex-shrink: 0;
    margin-left: auto;
}

/* ══ TOPBAR ════════════════════════════════════════════════ */
.tp-topbar {
    position: sticky;
    top: 70px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 32px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.tp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text3);
    font-weight: 500;
}

.tp-breadcrumb a {
    color: var(--text2);
    transition: color 0.2s;
}

.tp-breadcrumb a:hover {
    color: var(--accent);
}

.tp-breadcrumb span {
    color: var(--text);
    font-weight: 600;
}

.tp-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-chapter-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text3);
    font-weight: 600;
    background: var(--bg3);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.tp-mark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    transition: var(--transition);
}

.tp-mark-btn:hover {
    border-color: var(--green);
    color: var(--green);
    background: rgba(34, 197, 94, 0.06);
}

.tp-mark-btn.marked {
    border-color: rgba(34, 197, 94, 0.4);
    color: var(--green);
    background: rgba(34, 197, 94, 0.08);
}

.tp-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    transition: var(--transition);
}

.tp-nav-btn:hover {
    border-color: var(--border-h);
    color: var(--text);
    transform: translateY(-1px);
}

.tp-nav-btn-primary {
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.tp-nav-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
    border-color: transparent;
    color: #fff;
}

/* ══ MAIN CONTENT ══════════════════════════════════════════ */
.tp-main {
    min-width: 0;
}

.tp-content {
    padding: 40px 40px 80px;
    /* max-width: 820px; */
}

/* ── Badges ─────────────────────────────────────────────── */
.tp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.tp-badge-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.tp-badge-green {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.tp-badge-blue {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.tp-badge-sm {
    font-size: 10px;
    padding: 2px 8px;
}

/* ── Chapter Hero ───────────────────────────────────────── */
.tp-ch-hero {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.tp-ch-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tp-ch-title {
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
}

.tp-ch-subtitle {
    font-size: 15px;
    color: var(--text2);
    line-height: 1.75;
    margin-bottom: 16px;
    max-width: 680px;
}

.tp-ch-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text3);
    font-weight: 500;
}

.tp-ch-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── What you'll learn ──────────────────────────────────── */
.tp-learn-box {
    background: linear-gradient(135deg, rgba(212, 109, 6, 0.06), rgba(249, 115, 22, 0.04));
    border: 1px solid var(--border-h);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 32px;
}

.tp-learn-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--accent);
    margin-bottom: 14px;
}

.tp-learn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tp-learn-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text2);
    font-weight: 500;
    line-height: 1.5;
}

.tp-icon-green {
    color: var(--green);
}

.tp-icon-accent {
    color: var(--accent);
}

/* ── Section ────────────────────────────────────────────── */
.tp-section {
    margin-bottom: 40px;
}

.tp-section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(249, 115, 22, 0.18);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: linear-gradient(135deg, #f97316, #ec4899);
    border-radius: 4px;
    flex-shrink: 0;
}

.tp-body-text {
    font-size: 15px;
    color: var(--text2);
    line-height: 1.8;
    margin-bottom: 18px;
    font-weight: 500;
}

.tp-body-text strong {
    color: var(--text);
    font-weight: 700;
}

/* ── Info boxes ─────────────────────────────────────────── */
.tp-info-box {
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin: 20px 0;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text2);
    font-weight: 500;
}

.tp-info-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 8px;
}

.tp-info-warning {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.tp-info-label-warning {
    color: #fbbf24;
}

.tp-info-tip {
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.tp-info-label-tip {
    color: var(--green);
}

.tp-info-note {
    border: 1px solid var(--border-h);
    background: linear-gradient(135deg, rgba(212, 109, 6, 0.06), rgba(249, 115, 22, 0.04));
}

.tp-info-label-note {
    color: var(--accent);
}

/* ── Code blocks ────────────────────────────────────────── */
.tp-code-wrap {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 16px 0;
    box-shadow: var(--shadow-sm);
}

.tp-code-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tp-code-dots {
    display: flex;
    gap: 5px;
}

.tp-code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.tp-code-dots span:nth-child(1) {
    background: #ff5f56;
}

.tp-code-dots span:nth-child(2) {
    background: #ffbd2e;
}

.tp-code-dots span:nth-child(3) {
    background: #27c93f;
}

.tp-code-lang {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: .06em;
    text-transform: uppercase;
    flex: 1;
}

.tp-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.tp-copy-btn:hover {
    border-color: rgba(249, 115, 22, .5);
    color: #f97316;
    background: rgba(249, 115, 22, .06);
}

.tp-copy-btn.copied {
    color: #22c55e;
    border-color: rgba(34, 197, 94, .4);
}

.tp-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 11px;
    font-weight: 700;
    color: #22c55e;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tp-run-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.25);
}

.tp-code {
    padding: 20px 22px 22px;
    overflow-x: auto;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .08) transparent;
}

.tp-code code {
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.85;
    color: var(--text);
    white-space: pre;
    display: block;
}

.c-dt {
    color: #89dceb;
}

.c-tag {
    /* color: #89b4fa; */
    color: var(--accent-2);
}

.c-attr {
    color: #6f896c;
}

.c-str {
    color: #ffbc29;
}

.c-cm {
    color: #6c7086;
    font-style: italic;
}

.c-kw {
    color: #cba6f7;
}

.c-fn {
    color: #89dceb;
}

.c-val {
    color: #fab387;
}

.c-sel {
    color: #89b4fa;
}

.c-prop {
    color: #6f896c;
}

.c-num {
    color: #fab387;
}

/* ── Live Editor ────────────────────────────────────────── */
.tp-live-editor {
    margin: 24px 0;
    border: 1px solid var(--border-h);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.08), var(--shadow-md);
}

.tp-live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(236, 72, 153, 0.08));
    border-bottom: 1px solid var(--border);
}

.tp-live-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.tp-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: .5;
        transform: scale(.8)
    }
}

.tp-live-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-live-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: .04em;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.tp-live-run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

.tp-live-newtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: var(--transition);
}

.tp-live-newtab-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tp-live-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.tp-live-code-panel {
    background: #0d0d14;
    padding: 0;
    border-right: 1px solid var(--border);
    position: relative;
}

.tp-live-panel-label {
    padding: 7px 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tp-live-textarea {
    width: 100%;
    padding: 18px 18px;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: #cdd6f4;
    line-height: 1.85;
    resize: none;
    min-height: 200px;
    overflow-y: scroll;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tp-live-preview-panel {
    background: #fff;
}

.tp-live-preview-panel .tp-live-panel-label {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.4);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.tp-live-preview-iframe {
    width: 100%;
    min-height: 200px;
    border: none;
    background: #fff;
    height: 100%;
}

/* ── Inline Code ────────────────────────────────────────── */
.tp-inline-code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 1px 7px;
    border-radius: 5px;
}

/* ── Anatomy / Explain ──────────────────────────────────── */
.tp-anatomy-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px 24px 20px;
    margin: 20px 0;
    overflow-x: auto;
}

.tp-anatomy-row {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 15px;
    margin-bottom: 10px;
}

.tp-anatomy-tag-open,
.tp-anatomy-tag-close {
    color: var(--accent-2);
}

.tp-anatomy-attr-val {
    color: #6f896c;
}

.tp-anatomy-str {
    color: #ffbc29;
}

.tp-anatomy-content {
    color: var(--accent-3);
    background: rgba(249, 115, 22, .08);
    border-bottom: 2px solid var(--accent);
    padding: 0 4px;
}

.tp-anatomy-labels {
    display: flex;
    font-size: 11px;
    color: var(--text3);
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.tp-anatomy-labels span {
    flex: 1;
    text-align: center;
    padding: 4px 2px;
}

.tp-explain-list {
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tp-explain-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border);
}

.tp-explain-item:last-child {
    border-bottom: none;
}

.tp-explain-code {
    padding: 12px 16px;
    background: var(--bg2);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-2);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.tp-explain-desc {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text2);
    line-height: 1.6;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* ══ ADS ═════════════════════════════════════════════════ */
.tp-ad-slot {
    margin: 40px 0;
    background: var(--ad-bg);
    border: 1px dashed var(--border-h);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.tp-ad-slot::before {
    content: 'Advertisement';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text3);
}

.tp-ad-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f97316, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.tp-ad-content {
    flex: 1;
}

.tp-ad-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 3px;
}

.tp-ad-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.tp-ad-sub {
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
}

.tp-ad-btn {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-display);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--transition);
}

.tp-ad-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.35);
}

/* Google Ads placeholder */
.tp-google-ad {
    margin: 36px 0;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.tp-google-ad-label {
    position: absolute;
    top: 7px;
    right: 10px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text3);
}

.tp-google-ad-inner {
    font-size: 12px;
    color: var(--text3);
    font-style: italic;
    font-family: var(--font-mono);
}

/* ══ QUIZ ════════════════════════════════════════════════ */
.tp-quiz-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin: 40px 0;
    transition: background 0.4s ease;
    position: relative;
    overflow: hidden;
}

.tp-quiz-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #f97316, #a855f7);
}

.tp-quiz-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}

.tp-quiz-q {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    line-height: 1.55;
}

.tp-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tp-quiz-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    font-size: 14px;
    color: var(--text2);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    font-weight: 500;
}

.tp-quiz-opt::before {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    transition: all 0.2s;
}

.tp-quiz-opt:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(249, 115, 22, .04);
}

.tp-quiz-opt:hover::before {
    border-color: var(--accent);
}

.tp-quiz-opt.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, .08);
    color: var(--green);
    pointer-events: none;
}

.tp-quiz-opt.correct::before {
    background: #22c55e;
    border-color: #22c55e;
}

.tp-quiz-opt.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, .06);
    color: #ef4444;
    pointer-events: none;
}

.tp-quiz-opt.wrong::before {
    background: #ef4444;
    border-color: #ef4444;
}

.tp-quiz-opt.disabled {
    pointer-events: none;
    opacity: .5;
}

.tp-quiz-result {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 700;
    min-height: 20px;
}

.tp-quiz-result.correct {
    color: #22c55e;
}

.tp-quiz-result.wrong {
    color: #ef4444;
}

.tp-quiz-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 11px;
    color: var(--text3);
    font-weight: 600;
}

/* ══ SUMMARY ═════════════════════════════════════════════ */
.tp-summary-box {
    background: linear-gradient(135deg, rgba(249, 115, 22, .05), rgba(168, 85, 247, .04));
    border: 1px solid rgba(249, 115, 22, .15);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin: 40px 0;
}

.tp-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 16px;
}

.tp-summary-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tp-summary-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text2);
    line-height: 1.65;
    font-weight: 500;
}

.tp-summary-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 9px;
    flex-shrink: 0;
}

/* ══ CHAPTER NAV (bottom) ════════════════════════════════ */
.tp-ch-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.tp-ch-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-body);
    text-align: left;
}

.tp-ch-nav-btn:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.tp-ch-nav-prev {
    flex-direction: row;
}

.tp-ch-nav-next {
    flex-direction: row-reverse;
    text-align: right;
}

.tp-ch-nav-btn span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-ch-nav-btn small {
    font-size: 10px;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.tp-ch-nav-btn strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.tp-ch-nav-btn:hover strong {
    color: var(--accent);
}

/* ══ RIGHT SIDEBAR ════════════════════════════════════════ */
.tp-right-sidebar {
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    padding: 20px 14px 40px;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    transition: background 0.4s ease;
}

.tp-right-sidebar::-webkit-scrollbar {
    width: 3px;
}

.tp-right-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.tp-rs-section {
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.tp-rs-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tp-rs-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 10px;
}

/* TOC */
.tp-toc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-toc-item {
    display: block;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text2);
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
    font-weight: 500;
}

.tp-toc-item:hover {
    color: var(--text);
    background: rgba(249, 115, 22, .05);
    border-left-color: rgba(249, 115, 22, .3);
}

.tp-toc-item.active {
    color: var(--accent);
    background: rgba(249, 115, 22, .08);
    border-left-color: var(--accent);
    font-weight: 700;
}

/* Chapter info */
.tp-rs-info-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tp-rs-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text2);
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.tp-rs-info-row:last-child {
    border-bottom: none;
}

.tp-rs-info-val {
    font-weight: 700;
    color: var(--text);
}

/* Share section */
.tp-share-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 14px;
}

.tp-share-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}

.tp-share-btns {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tp-share-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    width: 100%;
    text-align: left;
}

.tp-share-btn:hover {
    transform: translateX(3px);
}

.tp-share-twitter:hover {
    border-color: rgba(29, 161, 242, 0.4);
    color: #1da1f2;
    background: rgba(29, 161, 242, 0.06);
}

.tp-share-linkedin:hover {
    border-color: rgba(0, 119, 181, 0.4);
    color: #0077b5;
    background: rgba(0, 119, 181, 0.06);
}

.tp-share-whatsapp:hover {
    border-color: rgba(37, 211, 102, 0.4);
    color: #25d366;
    background: rgba(37, 211, 102, 0.06);
}

.tp-share-link:hover {
    border-color: var(--border-h);
    color: var(--accent);
    background: rgba(249, 115, 22, 0.06);
}

.tp-share-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.tp-share-twitter .tp-share-icon {
    background: rgba(29, 161, 242, 0.15);
}

.tp-share-linkedin .tp-share-icon {
    background: rgba(0, 119, 181, 0.15);
}

.tp-share-whatsapp .tp-share-icon {
    background: rgba(37, 211, 102, 0.15);
}

.tp-share-link .tp-share-icon {
    background: rgba(249, 115, 22, 0.15);
}

/* Related cards */
.tp-rs-related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-rs-related-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.tp-rs-related-card:hover {
    border-color: var(--border-h);
    transform: translateX(3px);
    box-shadow: var(--shadow-sm);
}

.tp-rs-rel-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.tp-rel-css {
    background: linear-gradient(135deg, #264de4, #06b6d4);
}

.tp-rel-js {
    background: linear-gradient(135deg, #f0db4f, #f97316);
}

.tp-rel-tw {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.tp-rs-rel-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    transition: color 0.2s;
}

.tp-rs-related-card:hover .tp-rs-rel-name {
    color: var(--accent);
}

.tp-rs-rel-meta {
    font-size: 11px;
    color: var(--text3);
}

/* CTA */
.tp-rs-cta {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 14px;
    text-align: center;
}

.tp-rs-cta-emoji {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tp-rs-cta-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.tp-rs-cta-sub {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
    margin-bottom: 14px;
    font-weight: 500;
}

.tp-rs-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: #fff;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(249, 115, 22, .25);
}

.tp-rs-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, .35);
}

/* ══ FADE ANIMATIONS ═════════════════════════════════════ */
.fade-in {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    transition-delay: .1s
}

.delay-2 {
    transition-delay: .2s
}

/* ══ MOBILE SIDEBAR TOGGLE ═══════════════════════════════ */
.tp-mob-sidebar-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    width: 100%;
    font-family: var(--font-body);
    transition: color .2s;
}

.tp-mob-sidebar-toggle:hover {
    color: var(--accent);
}

.tp-mob-chevron {
    transition: transform 0.3s;
}


/* ══ RESPONSIVE ══════════════════════════════════════════ */
@media (max-width: 1280px) {
    .tp-layout {
        grid-template-columns: 240px 1fr 240px;
    }
}

@media (max-width: 1060px) {
    .tp-layout {
        grid-template-columns: 240px 1fr;
    }

    .tp-right-sidebar {
        display: none;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .tp-layout {
        grid-template-columns: 1fr;
        padding-top: 60px;
    }

    .tp-sidebar {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        width: 280px;
        height: calc(100vh - 60px);
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }

    .tp-sidebar.open {
        display: block;
    }

    .tp-mob-sidebar-toggle {
        display: flex;
    }

    .tp-topbar {
        padding: 10px 16px;
        gap: 8px;
    }

    .tp-chapter-count {
        display: none;
    }

    .tp-content {
        padding: 24px 18px 60px;
    }

    .tp-learn-grid {
        grid-template-columns: 1fr;
    }

    .tp-ch-nav {
        grid-template-columns: 1fr;
    }

    .tp-ch-nav-next {
        flex-direction: row;
        text-align: left;
    }

    .tp-live-body {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tp-ch-title {
        font-size: 1.6rem;
    }

    .tp-topbar-right {
        gap: 5px;
    }

    .tp-mark-btn,
    .tp-nav-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .tp-code code {
        font-size: 12px;
    }
}