.revamppage-smartteen {
    color: #ffffff;
}

.smartteen-cn {
    display: inline;
}

.smartteen-eng {
    display: none;
}

.smartteen-overlay__close-cn {
    display: block;
}

.smartteen-overlay__close-eng {
    display: none;
}

.revamppage-smartteen .section-title {
    margin-bottom: 1.5rem;
    position: relative;
    margin: 1rem 0 0px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: left;
    text-align: center;
    background-image: url("../images/about_title_bg.png");
    background-repeat: no-repeat;
    background-size: auto;
    height: 6rem;
    width: 22rem;
    z-index: 5;
}

.revamppage-smartteen .section-title .smartteen-cn,
.revamppage-smartteen .section-title .smartteen-eng {
    max-width: 17rem;
    max-height: 5rem;
    padding-left: 4rem;
    line-height: 1.5;
    font-weight: 700;
    color: #fff;
    font-size: clamp(0.9rem, 1.1rem + 0.8vw, 1.6rem);
    overflow: hidden;
    display: inline-block;
    box-sizing: border-box;
}

.smartteen-carousel-section {
    position: relative;
    background-image: url(../images/bgBlurredBlack.png);
    background-repeat: no-repeat;
    background-size: cover;
    padding: 0rem 0rem;
    margin-bottom: 5rem;
}

.smartteen-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.smartteen-carousel-viewport {
    width: 100%;
    overflow-x: auto;
    /* allow vertical overflow so titles/meta that extend above the card are visible
       instead of being clipped by the viewport. Horizontal scrolling remains enabled. */
    overflow-y: hidden;
    position: relative;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
    /* center carousel contents vertically when viewport height increases */
    display: flex;
    align-items: center;
    /* allow the viewport to size naturally rather than forcing 100% height
       so absolute-positioned parts of cards can be visible within the surrounding layout */
    height: auto;
    /* reduce large bottom padding that previously pushed cards upward on small screens */
    padding: 4rem 0 6rem;
}

.smartteen-carousel-viewport::-webkit-scrollbar,
.smartteen-carousel-viewport::-webkit-scrollbar-track,
.smartteen-carousel-viewport::-webkit-scrollbar-thumb {
    display: none;
}

.smartteen-carousel {
    display: flex;
    box-sizing: border-box;
    align-items: center;
    width: max-content;
    will-change: transform;
    /* ensure consistent spacing between card boxes */
    gap: 1.25rem;
}

.smartteen-carousel-footer {
    margin-top: 1.25rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.smartteen-active-info {
    max-width: 760px;
    margin: 0 auto;
}

.smartteen-active-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.smartteen-active-intro {
    font-size: 0.98rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    max-height: 6.6rem;
    /* limit height and allow scrolling if longer */
    overflow-y: auto;
}

.smartteen-card {
    /* cover and box sizing */
    --cover-size: clamp(260px, 30vw, 460px);
    --card-base-width: clamp(180px, 22vw, 300px);
    /* visual scales */
    --active-scale: 1.05;
    --nonactive-scale: 0.85;
    /* reserve the box width to the active visual width so spacing between boxes is identical */
    --card-box-width: calc(var(--card-base-width) * var(--active-scale));
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    /* All cards use the same box width so layout spacing between boxes is consistent */
    width: var(--card-box-width);
    min-width: 0;
    height: auto;
    cursor: pointer;
    position: relative;
    overflow: visible;
    /* keep container stable; visual scaling occurs inside the cover element */
    transition: box-shadow 0.28s ease, opacity 0.22s ease, transform 0.22s ease;
    /* Keep enough room to show title above and intro below the centered cover */
    min-height: calc(var(--cover-size) + 8rem);
    scroll-snap-align: center;
    transform: scale(0.6);
    pointer-events: none;
}

/* Active (center) card is 30% larger than non-active (0.6 * 1.3 = 0.78) */
.smartteen-card.active,
.smartteen-card:focus {
    /* visually emphasize active card without changing box width */
    transform: translateY(-6px);
    opacity: 1;
    z-index: 5;
    pointer-events: auto;
}

/* dim non-active cards */
.smartteen-card:not(.active) {
    opacity: 0.9;
}

.smartteen-card__title {
    /* positioned above the centered cover; when height grows it expands upward */
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: calc(50% + (var(--cover-size) / 2) + 1rem);
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
    z-index: 3;
}

.smartteen-card.active .smartteen-card__title,
.smartteen-card:focus .smartteen-card__title {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.smartteen-card__cover {
    width: calc(100%);
    overflow: visible;
    /* allow scaled cover to overflow without clipping */
    /* absolutely center the cover inside the card so image doesn't move when text changes */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block;
    height: var(--cover-size);
    max-width: 100%;
    box-sizing: border-box;
    z-index: 2;
    /* prepare for inner scaling */
    transform-origin: center;
}

/* Images use contain so the full artwork/pattern is visible and remains centered */
.smartteen-card__cover img,
.smartteen-card__cover canvas {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
    transform-origin: center;
    transition: transform 0.28s cubic-bezier(.2, .9, .2, 1);
    /* scale to produce non-active visual size inside the reserved box */
    --_cover-default-scale: calc(var(--nonactive-scale) / var(--active-scale));
    transform: scale(var(--_cover-default-scale));
}

/* Active card's cover scales up to fill the reserved box (visual emphasis) */
.smartteen-card.active .smartteen-card__cover img,
.smartteen-card.active .smartteen-card__cover canvas,
.smartteen-card:focus .smartteen-card__cover img,
.smartteen-card:focus .smartteen-card__cover canvas {
    transform: scale(1);
}

/* Active card scales via transform; cover is absolute so will scale with the card */
.smartteen-card.active .smartteen-card__cover,
.smartteen-card:focus .smartteen-card__cover {
    height: var(--cover-size);
}


.smartteen-card__meta {
    /* positioned below the centered cover; grows downward when intro is long */
    position: absolute;
    top: calc(50% + (var(--cover-size) / 2) + 0.25rem);
    text-align: left;
    box-sizing: border-box;
    width: 100%;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
    z-index: 3;
    display: flex;
    flex-direction: column;
}

.smartteen-card.active .smartteen-card__meta,
.smartteen-card:focus .smartteen-card__meta {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}


.smartteen-card__intro {
    font-size: 0.9rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    max-height: 10rem;
    overflow: hidden;
    padding: 0rem 0rem 1rem 0rem;
}

.smartteen-card__read-btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}


.smartteen-carousel__nav {
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.32);
    color: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.smartteen-carousel__nav:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.smartteen-overlay {
    position: relative;
    inset: auto;
    background-image: url(../images/bgBlurredBlack.png);
    background-repeat: no-repeat;
    background-size: cover;
    display: none;
    width: 100%;
}

.smartteen-overlay.open {
    display: block;
}

body.smartteen-overlay-open .smartteen-carousel-section {
    display: none;
}

.smartteen-overlay__inner {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
    margin-bottom: 5rem;
}

.smartteen-overlay__close-wrap {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 10;
}

.smartteen-overlay__close-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    color: #ffffff;
    font-size: 0.85rem;
    white-space: nowrap;
}

.smartteen-overlay__close-cn,
.smartteen-overlay__close-eng {
    display: block;
}

.smartteen-overlay__close {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.smartteen-overlay__content {
    position: relative;
    padding: 2.5rem 3rem 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.smartteen-overlay__book-meta {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.75rem;
    align-items: start;
}

.smartteen-overlay__book-cover {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.smartteen-overlay__book-cover img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.smartteen-overlay__pdf-link a {
    display: inline-block;
    color: #fff;
    text-decoration: underline;
}

.smartteen-overlay__book-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.smartteen-overlay__book-title {
    margin: 0;
    font-size: clamp(1.6rem, 2vw, 2.5rem);
    font-weight: 800;
}

.smartteen-overlay__book-intro {
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    max-height: 20rem;
    overflow-y: auto;
}

.smartteen-overlay__page-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    width: 13rem;
    margin: 1rem auto;
}

.smartteen-overlay__page-nav {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 1.4rem;
    cursor: pointer;
}

.smartteen-overlay__page-indicator {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

.smartteen-overlay__page-viewer {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
}

.smartteen-overlay__book-page {
    background: rgb(195 193 193 / 95%);
    padding: 0.5rem 0.5rem 0.5rem 0.5rem;
    overflow-y: hidden;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    pointer-events: auto;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
}

/* spread columns */
.smartteen-overlay__book-page .pdf-page {
    width: 50%;
    box-sizing: border-box;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.smartteen-overlay__book-page .pdf-page--left,
.smartteen-overlay__book-page .pdf-page--right {
    background: transparent;
}

.smartteen-overlay__book-page img {
    max-width: 100%;
    display: block;
    margin: 1rem auto;
    border-radius: 18px;
}

.smartteen-pdf-canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    margin: 0 auto;
    pointer-events: auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);

}

/* ensure PDF viewer container allows touch pan/scroll */
.smartteen-overlay__book-page .pdfjsViewer {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.smartteen-overlay__book-page h4 {
    margin-top: 0;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 980px) {
    .smartteen-overlay__content {
        grid-template-columns: 1fr;
        padding: 3rem 1.5rem 1.5rem;
    }

    .smartteen-overlay__book-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {

    /* On narrow screens show single page stacked rather than two-column spread */
    .smartteen-overlay__book-page {
        flex-direction: row;
        margin: 0 auto;
    }

    .smartteen-overlay__book-page .pdf-page {
        width: 100%;
    }
}


@media (max-width: 720px) {
    .revamppage-smartteen {
        padding: 2rem 0 2.5rem;
    }

    .smartteen-carousel-section {
        padding: 1rem 1rem;
        height: 28rem;
        margin-bottom: 1rem;
    }

    /* Make the carousel horizontal with nav buttons on mobile and ensure the active card is prominent */
    .smartteen-carousel-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    .smartteen-carousel-viewport {
        margin: auto;
        height: 100%;
        padding: 0;
    }

    .smartteen-card__title {
        /* show title on mobile and make it readable */
        position: relative;
        opacity: 0;
        pointer-events: auto;
        top: 0;
        left: 0;
        font-size: 1rem;
        text-align: center;
        margin: 0.5rem 0 0.25rem;
    }

    .smartteen-card {
        /* Make the card big on mobile so the cover, title and intro are readable */
        --card-base-width: 86vw;
        --cover-size: 60vw;
        min-width: auto;
        min-height: auto;
        align-items: stretch;
        /* remove global shrink so text remains legible */
        transform: none;
        /* ensure a predictable mobile width (don't rely on --active-scale being set) */
        width: var(--card-base-width);
    }

    /* Keep non-active cards visible and interactive on small screens so users can tap Read */
    .smartteen-card:not(.active) {
        opacity: 0.9;
        pointer-events: auto;
        transform: none;
    }

    /* Ensure active card shows title and meta and sits above neighbors (still keep emphasis) */
    .smartteen-card.active,
    .smartteen-card:focus {
        transform: translateY(-6px) scale(1);
        z-index: 6;
        opacity: 1;
    }

    /* Make meta flow under the cover rather than being absolutely positioned so content isn't clipped */
    .smartteen-card__meta {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        opacity: 0;
        transform: none;
        pointer-events: auto;
        z-index: 3;
        display: flex;
        flex-direction: column;
        padding: 0.5rem 1rem 1rem;
    }

    .smartteen-card__intro {
        max-height: none;
        overflow: visible;
        font-size: 0.95rem;
    }

    .smartteen-card__read-btn {
        display: inline-block;
        /* slightly larger touch target on mobile */
        padding: 0.6rem 1rem;
    }

    .smartteen-card__meta {
        top: calc(50% + (var(--cover-size) / 2) + 0.5rem);
    }

    .smartteen-card__intro {
        font-size: 0.95rem;
        max-height: 10rem;
        overflow-y: hidden;
    }

    .smartteen-card__cover img {
        object-fit: contain;
        height: 100%;
    }

    .smartteen-overlay__inner {
        width: 100%;
        max-width: 100%;
    }

    .smartteen-overlay__content {
        position: relative;
        padding: 6rem 2rem 2rem 2rem;
        width: 85%;
        margin: 0 auto;
    }

    /* PDF overlay sizing: make iframe fill most of viewport and fit responsively */
    .smartteen-overlay__pdf-wrap {
        width: 100%;
        box-sizing: border-box;
    }

    /* default canvas style (overridden inside spread columns) */
    .smartteen-pdf-canvas {
        display: block;
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        margin: 0 auto;
        pointer-events: auto;
        /* allow touch interactions */
    }

    /* ensure canvas inside two-column spread fits its column */
    .smartteen-overlay__book-page .pdf-page .smartteen-pdf-canvas {
        width: 100% !important;
        height: auto !important;
    }


    .smartteen-overlay__pdf-wrap iframe {
        width: 100%;
        height: calc(100vh - 180px);
        max-height: 88vh;
        border: none;
        border-radius: 8px;
        background: #fff;
    }

    .smartteen-overlay__pdf-link a {
        display: inline-block;
        color: #fff;
        text-decoration: underline;
    }

    .smartteen-overlay__pdf-fallback {
        font-size: 0.95rem;
        color: rgba(255, 255, 255, 0.85);
    }
}