:root {
    --alp-bg: #f7f9fc;
    --alp-surface: #ffffff;
    --alp-soft: #f3f6fb;
    --alp-border: #e7ebf1;
    --alp-border-strong: #cbd5e1;
    --alp-text: #101827;
    --alp-muted: #667085;
    --alp-primary: #2563eb;
    --alp-primary-dark: #1d4ed8;
    --alp-danger: #dc2626;
    --alp-radius: 18px;
    --alp-radius-sm: 12px;
    --alp-shadow: 0 10px 32px rgba(15, 23, 42, .06);
}

.alp-wrap,
.alp-directory,
.alp-carousel {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    padding: 0;
    color: var(--alp-text);
    font-family: inherit;
}

.alp-wrap *,
.alp-wrap *::before,
.alp-wrap *::after,
.alp-directory *,
.alp-directory *::before,
.alp-directory *::after,
.alp-carousel *,
.alp-carousel *::before,
.alp-carousel *::after { box-sizing: border-box; }

.alp-hero,
.alp-card,
.alp-directory-head,
.alp-carousel-head,
.alp-topic-card,
.alp-carousel-card {
    border: 1px solid var(--alp-border);
    background: var(--alp-surface);
    border-radius: var(--alp-radius);
    box-shadow: var(--alp-shadow);
}

.alp-hero {
    display: grid;
    gap: 10px;
    padding: clamp(18px, 2.6vw, 30px);
    margin-bottom: 14px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.alp-hero-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}
.alp-hero-copy { min-width: 0; }
.alp-tutor-photo,
.alp-tutor-avatar {
    width: clamp(68px, 9vw, 104px);
    height: clamp(68px, 9vw, 104px);
    border-radius: 22px;
    object-fit: cover;
    border: 1px solid var(--alp-border);
    background: var(--alp-soft);
    box-shadow: 0 10px 22px rgba(15,23,42,.06);
}
.alp-tutor-avatar,
.alp-topic-thumb-empty,
.alp-rec-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--alp-primary-dark);
    font-weight: 800;
    font-size: 28px;
}

.alp-kicker {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--alp-primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.alp-hero h2,
.alp-directory h2 {
    margin: 0;
    color: var(--alp-text);
    font-size: clamp(24px, 3.2vw, 42px);
    line-height: 1.1;
    letter-spacing: -.035em;
}

.alp-hero p,
.alp-directory-head p {
    margin: 0;
    max-width: 920px;
    color: var(--alp-muted);
    font-size: 15px;
    line-height: 1.6;
}

.alp-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.alp-benefits span,
.alp-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 10px;
    border: 1px solid var(--alp-border);
    border-radius: 999px;
    background: #fff;
    color: var(--alp-text);
    font-size: 13px;
    line-height: 1.25;
}

.alp-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.28fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.alp-sidebar,
.alp-main { display: grid; gap: 12px; min-width: 0; }
.alp-sidebar { position: sticky; top: 18px; }

.alp-card { overflow: hidden; }
.alp-rules,
.alp-history-card,
.alp-samples,
.alp-program-recs,
.alp-reference-recs,
.alp-tutor-recs,
.alp-reviews { padding: 14px; }

.alp-card h3,
.alp-topic-card h3 {
    margin: 0 0 8px;
    color: var(--alp-text);
    font-size: 16px;
    line-height: 1.3;
}

.alp-rules p,
.alp-history-note,
.alp-history-status,
.alp-program-empty,
.alp-reference-empty,
.alp-tutor-empty,
.alp-reviews p,
.alp-muted {
    margin: 0;
    color: var(--alp-muted);
    font-size: 13px;
    line-height: 1.55;
}

.alp-history-status,
.alp-blocked-note,
.alp-login-cta {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--alp-radius-sm);
    background: var(--alp-soft);
    color: var(--alp-muted);
    font-size: 13px;
}

.alp-blocked-note {
    margin: 12px 14px 0;
    border: 1px solid rgba(220, 38, 38, .22);
    background: #fff1f2;
    color: #991b1b;
}

.alp-login-cta {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin: 12px 14px 0;
    border: 1px solid #dbeafe;
    background: #eff6ff;
}
.alp-login-cta strong { display: block; color: var(--alp-text); font-size: 14px; }
.alp-login-cta p { margin: 3px 0 0; color: var(--alp-muted); font-size: 12px; line-height: 1.45; }
.alp-login-cta[hidden] { display: none !important; }

.alp-samples { display: flex; flex-direction: column; gap: 8px; }
.alp-chip { width: 100%; justify-content: flex-start; cursor: pointer; text-align: left; font-family: inherit; }
.alp-chip:hover { border-color: #bfdbfe; background: #eff6ff; }

.alp-chat-card { background: #fff; }
.alp-chat-head {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    border-bottom: 1px solid var(--alp-border);
    background: rgba(248, 250, 252, .92);
}
.alp-chat-titleline { display: flex; align-items: center; gap: 10px; min-width: 0; }
.alp-chat-photo { width: 42px; height: 42px; border-radius: 14px; object-fit: cover; border: 1px solid var(--alp-border); background: var(--alp-soft); }
.alp-chat-head h3 { margin: 0 0 3px; }
.alp-chat-head p { margin: 0; color: var(--alp-muted); font-size: 13px; }
.alp-chat-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.alp-btn,
.alp-topic-link {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--alp-border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--alp-text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.alp-btn:hover,
.alp-topic-link:hover { border-color: #93c5fd; background: #eff6ff; color: var(--alp-primary-dark); transform: translateY(-1px); }
.alp-btn-primary { border-color: var(--alp-primary); background: var(--alp-primary); color: #fff; }
.alp-btn-primary:hover { border-color: var(--alp-primary-dark); background: var(--alp-primary-dark); color: #fff; }
.alp-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.alp-chat-window {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: clamp(360px, 48vh, 620px);
    max-height: min(70vh, 760px);
    overflow: auto;
    padding: 14px;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    scroll-behavior: smooth;
}

.alp-message {
    position: relative;
    max-width: min(82%, 860px);
    padding: 11px 12px;
    border: 1px solid var(--alp-border);
    border-radius: 16px;
    background: #fff;
    color: var(--alp-text);
    box-shadow: 0 8px 22px rgba(15,23,42,.045);
}
.alp-message strong { display: block; margin-bottom: 4px; font-size: 12px; color: var(--alp-muted); }
.alp-message-body { font-size: 14px; line-height: 1.62; }
.alp-user { align-self: flex-end; border-color: #bfdbfe; background: #eff6ff; }
.alp-assistant { align-self: flex-start; }
.alp-message-error { border-color: rgba(220,38,38,.28); background: #fff1f2; color: #991b1b; }
.alp-message p { margin: 0 0 9px; }
.alp-message p:last-child { margin-bottom: 0; }
.alp-message ul,
.alp-message ol { margin: 6px 0 10px 20px; padding: 0; }
.alp-message li { margin: 3px 0; }
.alp-message h2,
.alp-message h3,
.alp-message h4 { margin: 10px 0 6px; color: var(--alp-text); line-height: 1.3; }
.alp-message code { padding: 2px 5px; border-radius: 6px; background: #f1f5f9; }
.alp-message pre { overflow: auto; padding: 10px; border-radius: 12px; background: #0f172a; color: #f8fafc; }
.alp-message a { color: var(--alp-primary-dark); font-weight: 700; }
.alp-copy { margin-top: 8px; border: 0; background: transparent; color: var(--alp-primary-dark); padding: 0; font-size: 12px; font-weight: 700; cursor: pointer; }
.alp-retry { margin-top: 8px; }

.alp-typing {
    padding: 0 14px 10px;
    color: var(--alp-muted);
    font-size: 13px;
}
.alp-typing::after { content: '…'; animation: alpPulse 1s infinite; }
@keyframes alpPulse { 0%,100%{opacity:.2} 50%{opacity:1} }
.is-typing::after { content: '▍'; display: inline-block; margin-left: 1px; color: var(--alp-primary); animation: alpPulse .8s infinite; }

.alp-chat-form {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--alp-border);
    background: #fff;
}
.alp-input-label { display: block; margin-bottom: 6px; color: var(--alp-muted); font-size: 12px; font-weight: 700; }
.alp-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.alp-input {
    width: 100%;
    min-height: 48px;
    max-height: 170px;
    padding: 12px 14px;
    border: 1px solid var(--alp-border-strong);
    border-radius: 16px;
    background: #fff;
    color: var(--alp-text);
    resize: none;
    font: inherit;
    font-size: 16px;
    line-height: 1.45;
    outline: none;
}
.alp-input:focus { border-color: var(--alp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.alp-input-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--alp-muted); font-size: 12px; }

.alp-session-list { display: grid; gap: 8px; margin-top: 10px; }
.alp-session-item {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--alp-border);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.alp-session-item strong { display: block; color: var(--alp-text); font-size: 13px; }
.alp-session-item small { color: var(--alp-muted); }

.alp-program-grid,
.alp-reference-grid,
.alp-tutor-grid,
.alp-directory-grid {
    display: grid;
    gap: 10px;
}
.alp-program-grid,
.alp-reference-grid,
.alp-tutor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.alp-rec-card,
.alp-tutor-card,
.alp-topic-card,
.alp-carousel-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--alp-border);
    border-radius: 15px;
    background: #fff;
}
.alp-rec-card,
.alp-tutor-card { grid-template-columns: 60px minmax(0, 1fr); align-items: start; }
.alp-rec-card img,
.alp-rec-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 12px; background: var(--alp-soft); }
.alp-rec-card h4,
.alp-tutor-card strong,
.alp-carousel-card h3 { margin: 0 0 4px; color: var(--alp-text); font-size: 14px; line-height: 1.35; }
.alp-rec-card h4 a { color: inherit; text-decoration: none; }
.alp-rec-card small,
.alp-tutor-card small,
.alp-topic-tutor { display: block; margin-bottom: 4px; color: var(--alp-primary-dark); font-size: 12px; font-weight: 700; }
.alp-rec-card p,
.alp-tutor-card p,
.alp-topic-card p { margin: 0; color: var(--alp-muted); font-size: 13px; line-height: 1.5; }
.alp-see-all-tutors { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--alp-primary-dark); }

.alp-reviews form { display: grid; gap: 8px; margin-top: 10px; }
.alp-reviews input,
.alp-reviews select,
.alp-reviews textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--alp-border-strong);
    border-radius: 12px;
    font: inherit;
}
.alp-review-list { display: grid; gap: 10px; margin-top: 12px; }
.alp-review-item { padding: 12px; border: 1px solid var(--alp-border); border-radius: 14px; background: #fff; }
.alp-review-item div { display: flex; justify-content: space-between; gap: 8px; }
.alp-review-item span { color: #f59e0b; white-space: nowrap; }
.alp-review-item p { margin: 6px 0; color: var(--alp-text); }
.alp-review-item small { color: var(--alp-muted); }


.alp-topic-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
    background: var(--alp-soft);
    border: 1px solid var(--alp-border);
}
.alp-topic-card .alp-topic-link,
.alp-carousel-card .alp-topic-link { width: max-content; margin-top: auto; }
.alp-topic-body { display: grid; gap: 8px; align-content: start; }
.alp-topic-tutor {
    color: var(--alp-primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
}
.alp-carousel { color: var(--alp-text); font-family: inherit; }
.alp-carousel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px;
    margin-bottom: 12px;
}
.alp-carousel-head h2 {
    margin: 0;
    font-size: clamp(22px, 2.5vw, 34px);
    line-height: 1.15;
    letter-spacing: -.025em;
}
.alp-carousel-head p { margin: 6px 0 0; color: var(--alp-muted); font-size: 14px; line-height: 1.55; }
.alp-carousel-nav { display: flex; gap: 8px; flex: 0 0 auto; }
.alp-carousel-prev,
.alp-carousel-next {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--alp-border-strong);
    background: #fff;
    color: var(--alp-text);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}
.alp-carousel-prev:hover,
.alp-carousel-next:hover { border-color: #93c5fd; background: #eff6ff; color: var(--alp-primary-dark); }
.alp-carousel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 280px);
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scroll-padding-inline: 2px;
    padding: 2px 2px 12px;
    scrollbar-width: thin;
}
.alp-carousel-card {
    scroll-snap-align: start;
    min-height: 100%;
    box-shadow: none;
}
.alp-carousel-card p { margin: 0; color: var(--alp-muted); font-size: 13px; line-height: 1.5; }
.alp-directory-head { padding: 22px; margin-bottom: 14px; }
.alp-topic-search {
    width: 100%;
    max-width: 520px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--alp-border-strong);
    border-radius: 999px;
    font: inherit;
    font-size: 15px;
}
.alp-directory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.alp-topic-card { align-content: start; box-shadow: none; }
.alp-topic-card code { display: block; overflow: auto; margin-top: 4px; padding: 8px; border-radius: 8px; background: var(--alp-soft); font-size: 12px; }

.alp-table-wrap { overflow-x: auto; margin: 10px 0; }
.alp-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.alp-table-wrap th,
.alp-table-wrap td { border: 1px solid var(--alp-border); padding: 8px; text-align: left; }
.alp-table-wrap th { background: var(--alp-soft); }

.alp-admin-wrap .form-table input[type="number"] { max-width: 90px; }
.alp-admin-wrap textarea.large-text { max-width: 880px; }

@media (min-width: 1280px) {
    .alp-sidebar { max-width: 340px; }
    .alp-chat-window { min-height: 560px; }
}

@media (max-width: 1080px) {
    .alp-layout { grid-template-columns: minmax(0, 250px) minmax(0, 1fr); }
    .alp-program-grid,
    .alp-reference-grid,
    .alp-tutor-grid,
    .alp-directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .alp-wrap,
    .alp-directory,
    .alp-carousel { margin: 12px 0; padding: 0; }
    .alp-layout { grid-template-columns: 1fr; }
    .alp-sidebar { position: static; order: 2; }
    .alp-main { order: 1; }
    .alp-hero { padding: 18px; border-radius: 18px; }
    .alp-chat-head { align-items: flex-start; flex-direction: column; }
    .alp-hero-head { grid-template-columns: 1fr; text-align: left; }
    .alp-tutor-photo, .alp-tutor-avatar { width: 76px; height: 76px; border-radius: 20px; }
    .alp-chat-actions { width: 100%; justify-content: flex-start; }
    .alp-chat-window { min-height: 420px; max-height: 66vh; padding: 12px; }
    .alp-message { max-width: 94%; }
    .alp-input-row { grid-template-columns: 1fr; }
    .alp-input-row .alp-btn-primary { width: 100%; min-height: 44px; }
    .alp-enter-hint { display: none; }
    .alp-login-cta { align-items: stretch; flex-direction: column; }
    .alp-login-cta .alp-btn { width: 100%; }
}

@media (max-width: 620px) {
    .alp-program-grid,
    .alp-reference-grid,
    .alp-tutor-grid,
    .alp-directory-grid { grid-template-columns: 1fr; }
    .alp-carousel-head { align-items: flex-start; flex-direction: column; }
    .alp-carousel-nav { width: 100%; justify-content: flex-end; }
    .alp-carousel-track { grid-auto-columns: minmax(235px, 82vw); }
    .alp-benefits { display: grid; }
    .alp-benefits span { justify-content: center; text-align: center; }
    .alp-rec-card,
    .alp-tutor-card { grid-template-columns: 1fr; }
    .alp-rec-card img,
    .alp-rec-thumb { width: 100%; height: 130px; }
    .alp-btn { width: auto; }
    .alp-chat-form { position: sticky; bottom: 0; z-index: 3; }
    .alp-chat-window { min-height: 380px; }
}

.alp-photo-admin .alp-photo-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid #dcdcde;
    display: block;
    margin-bottom: 8px;
}

/* v1.1.8: stabilisasi foto tutor, layout chat, dan kompatibilitas berbagai tema */
.alp-wrap img,
.alp-directory img,
.alp-carousel img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

.alp-tutor-photo,
.alp-chat-photo,
.alp-rec-thumb,
.alp-rec-card img,
.alp-topic-thumb {
    display: block;
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
    object-position: center;
}

.alp-tutor-photo,
.alp-tutor-avatar {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.alp-hero-head {
    grid-template-columns: clamp(72px, 8vw, 104px) minmax(0, 1fr);
}

.alp-chat-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.alp-chat-titleline { max-width: 100%; }
.alp-chat-titleline > div { min-width: 0; }
.alp-chat-titleline h3,
.alp-chat-titleline p {
    overflow: hidden;
    text-overflow: ellipsis;
}
.alp-chat-titleline p { white-space: nowrap; }
.alp-chat-photo {
    width: 44px;
    height: 44px;
    aspect-ratio: 1 / 1;
}

.alp-tutor-card {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
}
.alp-tutor-card .alp-rec-thumb {
    width: 64px;
    height: 64px;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    object-fit: cover;
    background: var(--alp-soft);
}
.alp-tutor-card > div { min-width: 0; }
.alp-tutor-card .alp-btn,
.alp-rec-card .alp-btn { margin-top: 8px; }

.alp-topic-thumb,
.alp-carousel-card .alp-topic-thumb {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 10;
}
.alp-topic-thumb-empty {
    min-height: 150px;
}

@media (max-width: 860px) {
    .alp-hero-head {
        grid-template-columns: 72px minmax(0, 1fr);
        align-items: start;
        text-align: left;
    }
    .alp-tutor-photo,
    .alp-tutor-avatar {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }
    .alp-chat-head {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .alp-chat-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .alp-hero {
        padding: 14px;
    }
    .alp-hero-head {
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 12px;
    }
    .alp-tutor-photo,
    .alp-tutor-avatar {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }
    .alp-hero h2 {
        font-size: clamp(21px, 6vw, 28px);
    }
    .alp-chat-titleline {
        gap: 8px;
    }
    .alp-chat-photo {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
    .alp-tutor-card,
    .alp-rec-card {
        grid-template-columns: 56px minmax(0, 1fr);
    }
    .alp-tutor-card .alp-rec-thumb,
    .alp-rec-card img,
    .alp-rec-thumb {
        width: 56px;
        height: 56px;
        border-radius: 12px;
    }
}

.alp-hero-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.alp-free-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

@media (max-width: 620px) {
    .alp-hero-badges { gap: 6px; }
    .alp-free-badge,
    .alp-kicker { font-size: 11px; min-height: 24px; padding: 5px 9px; }
}

.alp-review-status {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, .25);
    background: rgba(16, 185, 129, .08);
    color: #047857;
    font-size: 13px;
    font-weight: 700;
}

/* v1.2.8: directory/carousel polish, public cards only, safe image fallback */
.alp-directory-grid {
    grid-template-columns: repeat(var(--alp-dir-columns, 4), minmax(0, 1fr));
    gap: clamp(14px, 2vw, 22px);
}
.alp-topic-card,
.alp-carousel-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}
.alp-topic-card {
    min-height: 100%;
    grid-template-rows: auto 1fr;
}
.alp-topic-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--alp-border);
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
}
.alp-topic-media .alp-topic-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    border: 0;
    border-radius: 0;
    object-fit: cover;
    background: transparent;
}
.alp-topic-media .alp-topic-thumb-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    min-height: 0;
    color: var(--alp-primary-dark);
    font-size: clamp(38px, 7vw, 62px);
    font-weight: 900;
    line-height: 1;
    background: transparent;
}
.alp-topic-media .alp-topic-thumb + .alp-topic-thumb-empty { display: none; }
.alp-topic-media.alp-image-missing .alp-topic-thumb-empty { display: grid; }
.alp-topic-body,
.alp-carousel-card { min-width: 0; }
.alp-topic-card h3,
.alp-carousel-card h3 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
    color: var(--alp-text);
    font-size: clamp(17px, 1.55vw, 21px);
    line-height: 1.25;
    min-height: 2.5em;
}
.alp-topic-card p,
.alp-carousel-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    min-height: 4.5em;
}
.alp-topic-tutor {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alp-admin-shortcode,
.alp-topic-card code { display: none !important; }
.alp-carousel-track {
    grid-auto-columns: calc((100% - (var(--alp-carousel-visible, 4) - 1) * 16px) / var(--alp-carousel-visible, 4));
    gap: 16px;
    scroll-padding-inline: 4px;
    padding: 4px 4px 16px;
}
.alp-carousel-card {
    grid-template-rows: auto auto auto 1fr auto;
    min-height: 100%;
}
.alp-carousel-card .alp-topic-link,
.alp-topic-card .alp-topic-link { align-self: end; }
@media (max-width: 1180px) {
    .alp-directory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .alp-carousel-track { grid-auto-columns: calc((100% - 2 * 16px) / 3); }
}
@media (max-width: 860px) {
    .alp-directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .alp-carousel-track { grid-auto-columns: minmax(245px, 72vw); }
}
@media (max-width: 560px) {
    .alp-directory-grid { grid-template-columns: 1fr; }
    .alp-topic-card h3,
    .alp-carousel-card h3 { min-height: 0; }
    .alp-topic-card p,
    .alp-carousel-card p { min-height: 0; }
}

/* v1.2.9: distinct shortcode list layouts with admin-selectable themes */
.alp-directory {
    --alp-list-accent: #0f766e;
    --alp-list-soft: #ecfdf5;
    --alp-list-border: #99f6e4;
    --alp-list-ink: #0f172a;
    overflow: hidden;
}
.alp-directory.alp-theme-ocean {
    --alp-list-accent: #1d4ed8;
    --alp-list-soft: #eff6ff;
    --alp-list-border: #bfdbfe;
}
.alp-directory.alp-theme-sunrise {
    --alp-list-accent: #b45309;
    --alp-list-soft: #fff7ed;
    --alp-list-border: #fed7aa;
}
.alp-directory.alp-theme-neutral {
    --alp-list-accent: #334155;
    --alp-list-soft: #f8fafc;
    --alp-list-border: #cbd5e1;
}
.alp-directory-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
.alp-directory-head--compact {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    margin-bottom: 12px;
}
.alp-directory-copy { min-width: 0; }
.alp-directory .alp-directory-head h2 {
    font-size: 30px;
    line-height: 1.16;
    letter-spacing: 0;
}
.alp-directory-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.alp-directory-tools .alp-topic-search {
    flex: 1 1 260px;
    min-width: min(100%, 220px);
    margin-top: 0;
}
.alp-directory-nav {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
}
.alp-directory-prev,
.alp-directory-next {
    width: 40px;
    height: 40px;
    border: 1px solid var(--alp-list-border);
    border-radius: 999px;
    background: #fff;
    color: var(--alp-list-accent);
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}
.alp-directory-prev:hover,
.alp-directory-next:hover {
    border-color: var(--alp-list-accent);
    background: var(--alp-list-soft);
}
.alp-directory .alp-topic-tutor { color: var(--alp-list-accent); }
.alp-directory .alp-topic-link {
    border-color: var(--alp-list-border);
    color: var(--alp-list-accent);
}
.alp-directory .alp-topic-link:hover {
    border-color: var(--alp-list-accent);
    background: var(--alp-list-soft);
    color: var(--alp-list-accent);
}
.alp-directory .alp-topic-media {
    background: linear-gradient(135deg, #fff, var(--alp-list-soft));
}
.alp-directory .alp-directory-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.alp-empty-state {
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--alp-border-strong);
    border-radius: 14px;
    background: var(--alp-soft);
    color: var(--alp-muted);
}
.alp-directory--rows-slider .alp-directory-grid {
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(360px, 520px);
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scroll-padding-inline: 4px;
    padding: 4px 4px 16px;
    scrollbar-width: thin;
}
.alp-directory--rows-slider .alp-topic-card {
    grid-template-columns: 118px minmax(0, 1fr);
    grid-template-rows: none;
    align-items: stretch;
    min-height: 168px;
    scroll-snap-align: start;
}
.alp-directory--rows-slider .alp-topic-media {
    height: 100%;
    min-height: 132px;
    aspect-ratio: 1;
}
.alp-directory--rows-slider .alp-topic-body {
    align-content: center;
}
.alp-directory--rows-slider .alp-topic-card h3,
.alp-directory--rows-slider .alp-topic-card p {
    min-height: 0;
}
.alp-directory--mobile-carousel .alp-topic-card {
    border-color: var(--alp-list-border);
}
.alp-directory--mobile-carousel .alp-directory-nav {
    display: none;
}
.alp-directory--homepage .alp-directory-grid {
    grid-template-columns: repeat(var(--alp-dir-columns, 4), minmax(0, 1fr));
    gap: clamp(14px, 2vw, 20px);
}
.alp-directory--homepage .alp-topic-card {
    grid-template-rows: auto 1fr;
    border-color: rgba(15, 118, 110, .2);
}

@media (max-width: 760px) {
    .alp-directory .alp-directory-head h2 {
        font-size: 24px;
    }
    .alp-directory--mobile-carousel .alp-directory-grid {
        grid-template-columns: none !important;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, min(86vw, 360px));
        gap: 14px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline mandatory;
        scroll-padding-inline: 4px;
        padding: 4px 4px 16px;
        scrollbar-width: thin;
    }
    .alp-directory--mobile-carousel .alp-topic-card {
        scroll-snap-align: start;
    }
    .alp-directory--mobile-carousel .alp-directory-nav {
        display: flex;
    }
    .alp-directory--rows-slider .alp-topic-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: 0;
        padding: 12px;
    }
    .alp-directory--rows-slider .alp-topic-media {
        min-height: 0;
        aspect-ratio: 16 / 10;
    }
    .alp-directory--rows-slider .alp-topic-card h3,
    .alp-directory--mobile-carousel .alp-topic-card h3 {
        font-size: 17px;
    }
    .alp-directory--rows-slider .alp-directory-grid,
    .alp-directory--homepage .alp-directory-grid {
        grid-template-columns: 1fr !important;
        grid-auto-flow: row;
        gap: 14px;
        overflow: visible;
        padding: 0;
        scroll-snap-type: none;
    }
    .alp-directory--rows-slider .alp-directory-nav {
        display: none;
    }
    .alp-directory--rows-slider .alp-directory-head--compact {
        display: none;
    }
    .alp-directory--homepage .alp-topic-card,
    .alp-directory--rows-slider .alp-topic-card,
    .alp-directory--mobile-carousel .alp-topic-card {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .alp-directory-tools {
        align-items: stretch;
        flex-direction: column;
    }
    .alp-directory-tools .alp-topic-search,
    .alp-directory-nav {
        width: 100%;
    }
    .alp-directory-nav {
        justify-content: flex-end;
    }
    .alp-directory--mobile-carousel .alp-directory-grid {
        grid-auto-columns: minmax(0, min(88vw, 340px));
    }
    .alp-directory .alp-topic-card,
    .alp-carousel-card {
        border-radius: 14px;
        padding: 12px;
    }
    .alp-directory .alp-topic-media {
        border-radius: 12px;
    }
    .alp-directory .alp-topic-link {
        width: 100%;
        min-height: 42px;
    }
    .alp-directory .alp-topic-card h3,
    .alp-carousel-card h3 {
        font-size: 16px;
        line-height: 1.3;
        min-height: 0;
    }
    .alp-directory .alp-topic-card p,
    .alp-carousel-card p {
        -webkit-line-clamp: 2;
        min-height: 0;
        font-size: 13px;
    }
}
