:root {
    --ink: #161522;
    --ink-soft: #63617a;
    --paper: #FAFAF9;
    --panel: #ffffff;
    --line: #ECEAF3;

    --indigo: #9F208C;
    --indigo-deep: #7C1A6D;
    --sun: #FFC93C;
    --sun-deep: #F0AF0C;
    --coral: #F4867C;
    --coral-deep: #EE6E62;
    --lav: #B9AEFB;
    --lav-deep: #9C8CF7;
    --sky: #6FC1E8;
    --sky-deep: #4CA9D6;

    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow-card: 0 1px 2px rgba(22, 21, 34, .04), 0 10px 24px -14px rgba(22, 21, 34, .18);
    --shadow-card-hover: 0 1px 2px rgba(22, 21, 34, .05), 0 22px 40px -18px rgba(22, 21, 34, .28);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.display-font {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

:focus-visible {
    outline: 2.5px solid var(--indigo);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ===== App shell ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

/* ===== Sidebar ===== */
.sidebar {
    --w: 268px;
    width: var(--w);
    flex: 0 0 var(--w);
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 28px 20px 28px;
    transition: margin-left .32s cubic-bezier(.4, 0, .2, 1), opacity .22s ease;
}

.sidebar.is-collapsed {
    margin-left: calc(-1 * var(--w));
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .sidebar.is-collapsed {
        margin-left: 0;
        opacity: 1;
        pointer-events: auto;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    margin-bottom: 26px;
    padding: 0 4px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--indigo), var(--sky));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .85rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #A7A4BE;
    margin: 4px 4px 12px;
}

.course-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.course-item {
    margin-bottom: 2px;
}

.course-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 12px;
    border-radius: 11px;
    border: none;
    background: transparent;
    color: var(--ink);
    font-weight: 600;
    font-size: .92rem;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.course-btn:hover {
    background: #F4F3FB;
}

.course-btn .chev {
    color: #C9C6DC;
    font-size: .85rem;
    transition: transform .15s ease;
}

.course-btn.active {
    background: linear-gradient(135deg, var(--indigo), #B93AA3);
    color: #fff;
    box-shadow: 0 10px 20px -10px rgba(159, 32, 140, .6);
}

.course-btn.active .chev {
    color: rgba(255, 255, 255, .75);
}

.course-btn .count {
    font-size: .72rem;
    font-weight: 700;
    color: #B0AEC6;
    background: #F1F0F8;
    padding: 2px 7px;
    border-radius: 20px;
    margin-right: auto;
    margin-left: 10px;
}

.course-btn.active .count {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* ===== Main ===== */
.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 26px 32px 60px;
}

@media (max-width:575.98px) {
    .main {
        padding: 18px 16px 48px;
    }
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--ink);
    flex: 0 0 auto;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.icon-btn:hover {
    background: #F4F3FB;
    border-color: #DFDCF0;
}

.icon-btn:active {
    transform: scale(.95);
}

.page-title {
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -.02em;
    margin: 0;
}

.page-sub {
    color: var(--ink-soft);
    font-size: .98rem;
    margin: 4px 0 0;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1 1 320px;
    min-width: 220px;
}

.search-input-group {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    display: flex;
    align-items: center;
    padding: 2px 6px 2px 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.search-input-group:focus-within {
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px rgba(159, 32, 140, .12);
}

.search-input-group i {
    color: #B0AEC6;
    font-size: 1.05rem;
}

.search-input-group input {
    border: none;
    outline: none;
    padding: 10px 8px;
    flex: 1;
    font-size: .94rem;
    background: transparent;
    font-family: inherit;
}

.search-clear {
    border: none;
    background: none;
    color: #C9C6DC;
    font-size: 1rem;
    padding: 6px;
    display: none;
    cursor: pointer;
}

.search-clear.show {
    display: inline-flex;
}

.view-toggle {
    display: flex;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    padding: 3px;
    background: #fff;
}

.view-toggle button {
    border: none;
    background: transparent;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A7A4BE;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.view-toggle button.active {
    background: var(--ink);
    color: #fff;
}

.result-meta {
    font-size: .85rem;
    color: var(--ink-soft);
    margin-bottom: 16px;
}

.result-meta strong {
    color: var(--ink);
}

/* ===== Cards ===== */
#cardGrid.list-view .col-wrap {
    width: 100%;
}

#cardGrid.list-view .tut-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 168px;
}

#cardGrid.list-view .thumb {
    width: 260px;
    flex: 0 0 260px;
    height: auto;
    aspect-ratio: auto;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

#cardGrid.list-view .card-body-x {
    padding: 22px 28px;
    justify-content: center;
    gap: 12px;
}

#cardGrid.list-view .card-title-x {
    font-size: 1.15rem;
}

@media (max-width:575.98px) {
    #cardGrid.list-view .tut-card {
        flex-direction: column;
        min-height: 0;
    }

    #cardGrid.list-view .thumb {
        width: 100%;
        height: 180px;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}

.tut-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: transform .2s cubic-bezier(.4, 0, .2, 1), box-shadow .2s ease, border-color .2s ease;
}

.tut-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: #E3E0F5;
}

.tut-card:hover .play-chip {
    transform: scale(1);
    opacity: 1;
}

.thumb {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb .decor {
    position: absolute;
    inset: 0;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.play-chip {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    transform: scale(.85);
    opacity: 0;
    transition: all .18s ease;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .18);
}

.card-body-x {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.card-title-x {
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -.01em;
    line-height: 1.3;
    margin: 0;
}

.tag-pill {
    display: inline-flex;
    align-self: flex-start;
    padding: 5px 11px;
    border-radius: 20px;
    background: #F9E9F6;
    color: #9F208C;
    font-size: .75rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--ink-soft);
}

.empty-state i {
    font-size: 2.4rem;
    color: #D8D5EC;
    margin-bottom: 12px;
    display: block;
}

/* ===== Thumbnail art (pure CSS) ===== */
.bg-indigo-x {
    background: linear-gradient(155deg, var(--indigo), var(--indigo-deep));
}

.bg-sun-x {
    background: linear-gradient(155deg, var(--sun), var(--sun-deep));
}

.bg-coral-x {
    background: linear-gradient(155deg, var(--coral), var(--coral-deep));
}

.bg-lav-x {
    background: linear-gradient(155deg, var(--lav), var(--lav-deep));
}

.bg-sky-x {
    background: linear-gradient(155deg, var(--sky), var(--sky-deep));
}

.dot-row {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    gap: 6px;
}

.dot-row span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
}

/* style-guide art */
.art-styleguide .chip-row {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.art-styleguide .abcbox {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    padding: 6px 16px;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: .02em;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.art-styleguide .swatches {
    display: flex;
    gap: 5px;
}

.art-styleguide .swatches span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

/* wireframe art */
.art-wire {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-wire .frame {
    width: 64%;
    height: 62%;
    background: rgba(255, 255, 255, .9);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.art-wire .ln {
    height: 6px;
    border-radius: 3px;
    background: #E7E4F5;
}

.art-wire .ln.w1 {
    width: 70%;
}

.art-wire .ln.w2 {
    width: 100%;
}

.art-wire .ln.w3 {
    width: 85%;
}

.art-wire .ln.w4 {
    width: 55%;
}

.art-wire .cursor-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    top: 34%;
    right: 26%;
}

/* color system art */
.art-color {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.art-color .pie {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: conic-gradient(#fff 0 40%, rgba(255, 255, 255, .45) 40% 70%, rgba(255, 255, 255, .75) 70% 100%);
}

.art-color .hexes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.art-color .hexchip {
    font-size: .62rem;
    font-weight: 700;
    background: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    color: #333;
}

/* phone / UI art */
.art-phone {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-phone .device {
    width: 46%;
    height: 78%;
    background: #fff;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .15);
}

.art-phone .dev-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--sun);
    margin: 0 auto 4px;
}

.art-phone .ln {
    height: 5px;
    border-radius: 3px;
    background: #EDEBF7;
}

.art-phone .close-x {
    position: absolute;
    top: 14px;
    right: 16px;
    color: #fff;
    opacity: .85;
    font-size: 1.1rem;
}

/* big letters art */
.art-letters {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.art-letters .cardlet {
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1.6rem;
}

.art-letters .swatch-strip {
    position: absolute;
    right: 14px;
    top: 14px;
    bottom: 14px;
    width: 26px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.art-letters .swatch-strip span {
    flex: 1;
}

/* storyboard art */
.art-story {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.art-story .frame {
    width: 26%;
    height: 60%;
    background: rgba(255, 255, 255, .92);
    border-radius: 8px;
}

/* search / doc art */
.art-search {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-search .doc {
    width: 50%;
    height: 70%;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
}

.art-search .doc .ln {
    height: 5px;
    border-radius: 3px;
    background: #ECEAF7;
    margin-bottom: 6px;
}

.art-search .glass {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 4px solid #fff;
    border-radius: 50%;
    bottom: 22%;
    right: 24%;
}

.art-search .glass::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 14px;
    background: #fff;
    border-radius: 2px;
    right: -8px;
    bottom: -6px;
    transform: rotate(45deg);
}

/* overlapping shapes (gestalt) */
.art-shapes {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-shapes .sh {
    position: absolute;
    border-radius: 14px;
}

.art-shapes .sh1 {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, .55);
    transform: translate(-16px, -10px) rotate(6deg);
}

.art-shapes .sh2 {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, .9);
    border-radius: 50%;
    transform: translate(16px, 10px);
}

/* type scale art */
.art-type {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.art-type .tl {
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
}

.art-type .tl.t1 {
    font-size: 1.9rem;
}

.art-type .tl.t2 {
    font-size: 1.2rem;
    opacity: .85;
}

.art-type .tl.t3 {
    font-size: .8rem;
    opacity: .65;
}

/* component grid art */
.art-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 18px;
}

.art-grid span {
    background: rgba(255, 255, 255, .85);
    border-radius: 6px;
}

.art-grid span:nth-child(3n+2) {
    background: rgba(255, 255, 255, .55);
}

/* chat bubble art */
.art-chat {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-chat .bubble {
    background: #fff;
    border-radius: 14px 14px 14px 4px;
    padding: 10px 14px;
    max-width: 64%;
}

.art-chat .bubble .ln {
    height: 5px;
    border-radius: 3px;
    background: #ECEAF7;
    margin-bottom: 5px;
}

/* ===== Modal ===== */
.modal-content {
    border-radius: 18px;
    border: none;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
}

.modal-title {
    font-weight: 700;
    font-size: 1.02rem;
}

.modal-body {
    padding: 0;
    background: #0b0b12;
}

/* Sidebar mobile offcanvas polish */
@media (max-width:991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1045;
        top: 0;
        bottom: 0;
        left: 0;
        box-shadow: 0 0 0 100vmax rgba(15, 14, 26, 0);
    }

    .offcanvas-backdrop {
        opacity: .4;
    }
}
