/* ==========================================================
   SUNARB PUBLIC UI V2.1
   ========================================================== */

:root {
    --sun-bg: #f5f6f8;
    --sun-surface: #ffffff;
    --sun-text: #202124;
    --sun-muted: #696d75;
    --sun-border: #e1e4e8;
    --sun-soft: #f0f2f4;
    --sun-shadow: 0 1px 2px rgba(0,0,0,.04);
    --sun-radius: 15px;
}


html {
    background: var(--sun-bg);
}


body {
    margin: 0;
    background: var(--sun-bg);
    color: var(--sun-text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
    -webkit-font-smoothing: antialiased;
}


.shell {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}


/* ----------------------------------------------------------
   HEADER
   ---------------------------------------------------------- */

.site-header {
    background: var(--sun-surface);
    border-bottom: 1px solid var(--sun-border);
}


.header-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}


.header-brand-area {
    display: flex;
    align-items: baseline;
    gap: 11px;
}


.logo {
    color: #191a1d;
    text-decoration: none;
    font-size: 30px;
    font-weight: 850;
    letter-spacing: -1.3px;
    line-height: 1;
}


.logo:hover {
    text-decoration: none;
}


.brand-subtitle {
    color: var(--sun-muted);
    font-size: 13px;
}


.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


.lab-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eceeef;
    color: #656970;
    font-size: 11px;
    white-space: nowrap;
}


.language-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--sun-border);
    border-radius: 9px;
    background: var(--sun-surface);
    color: var(--sun-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}


.language-switch:hover {
    background: var(--sun-soft);
    text-decoration: none;
}


/* ----------------------------------------------------------
   CATEGORY SCROLLER
   ---------------------------------------------------------- */

.category-bar {
    background: var(--sun-surface);
    border-bottom: 1px solid var(--sun-border);
}


.category-scroll {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    padding-block: 10px;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}


.category-scroll::-webkit-scrollbar {
    height: 6px;
}


.category-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--sun-soft);
    color: #45484e;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}


.category-chip:hover {
    border-color: #d8dce1;
    background: #e8eaed;
    text-decoration: none;
}


.category-chip small {
    color: #81858c;
    font-size: 11px;
}


/* ----------------------------------------------------------
   CONTENT
   ---------------------------------------------------------- */

.content {
    min-height: 65vh;
    padding-top: 38px;
    padding-bottom: 48px;
}


.content > h1 {
    margin: 0 0 10px;
    font-size: clamp(27px, 3vw, 38px);
    letter-spacing: -.6px;
}


.content > .subtle {
    margin-top: 0;
    margin-bottom: 26px;
    color: var(--sun-muted);
    line-height: 1.8;
}


.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}


.page-heading h1 {
    margin: 0;
    font-size: clamp(27px, 3vw, 37px);
    line-height: 1.2;
}


.page-heading p {
    margin: 8px 0 0;
    color: var(--sun-muted);
}


.page-counter {
    flex: 0 0 auto;
    color: var(--sun-muted);
    font-size: 14px;
}


.page-counter strong {
    color: var(--sun-text);
}


/* ----------------------------------------------------------
   GAME GRID
   ---------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}


.card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sun-border);
    border-radius: var(--sun-radius);
    background: var(--sun-surface);
    box-shadow: var(--sun-shadow);
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease;
}


.card:hover {
    transform: translateY(-2px);
    border-color: #d4d8dd;
    box-shadow: 0 5px 15px rgba(0,0,0,.06);
}


.thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #e9ebee;
}


.thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.card-body {
    padding: 12px 13px 13px;
}


.card-body h2 {
    min-height: 2.8em;
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}


.card-body h2 a {
    display: -webkit-box;
    overflow: hidden;
    color: var(--sun-text);
    text-decoration: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


.card-body h2 a:hover {
    text-decoration: underline;
}


.card-body small {
    color: var(--sun-muted);
    font-size: 12px;
}


/* ----------------------------------------------------------
   PAGINATION
   ---------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 34px;
}


.pagination-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}


.pagination-number,
.pagination-edge {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 10px;
    border: 1px solid var(--sun-border);
    border-radius: 9px;
    background: var(--sun-surface);
    color: var(--sun-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}


.pagination-number:hover,
.pagination-edge:hover {
    background: var(--sun-soft);
    text-decoration: none;
}


.pagination-number.current {
    border-color: #202124;
    background: #202124;
    color: #fff;
}


.pagination-edge.disabled {
    opacity: .4;
    cursor: default;
}


.pagination-dots {
    color: var(--sun-muted);
}


/* ----------------------------------------------------------
   GAME PAGE
   ---------------------------------------------------------- */

.game-page-card {
    padding: 22px;
    border: 1px solid var(--sun-border);
    border-radius: 18px;
    background: var(--sun-surface);
    box-shadow: var(--sun-shadow);
}


.game-heading {
    margin-bottom: 18px;
}


.game-heading h1 {
    margin: 0;
    font-size: clamp(27px, 3vw, 38px);
    line-height: 1.25;
}


.game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
    color: var(--sun-muted);
    font-size: 14px;
}


.game-meta a {
    color: #555a61;
    text-decoration: none;
}


.game-meta a:hover {
    text-decoration: underline;
}


.player-stage {
    overflow: hidden;
    width: 100%;
    border: 10px solid #17181a;
    border-radius: 18px;
    background: #17181a;
    box-sizing: border-box;
}


.ruffle-host {
    width: 100%;
    max-height: 78vh;
    margin-inline: auto;
    background: #111;
}


.ruffle-host > * {
    display: block;
    width: 100% !important;
    height: 100% !important;
}


.player-stage:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: #000;
}


.player-stage:fullscreen .ruffle-host {
    width: 100vw;
    height: 100vh;
    max-height: none;
}


.player-toolbar {
    display: flex;
    justify-content: end;
    gap: 8px;
    margin-top: 10px;
}


.player-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--sun-border);
    border-radius: 9px;
    background: var(--sun-surface);
    color: var(--sun-text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}


.player-button:hover {
    background: var(--sun-soft);
}


.player-button span {
    font-size: 17px;
}


.game-description {
    margin-top: 18px;
    color: #4d5157;
    font-size: 15px;
    line-height: 1.9;
}


.game-description p {
    margin-bottom: 0;
}


.recovered-note {
    color: var(--sun-muted);
    font-size: 13px;
}


.related-section {
    margin-top: 30px;
}


.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}


.section-heading h2 {
    margin: 0;
    font-size: 24px;
}


/* ----------------------------------------------------------
   FOOTER
   ---------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--sun-border);
    background: var(--sun-surface);
}


.footer-inner {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--sun-muted);
    font-size: 13px;
}


.footer-inner > div:first-child {
    display: flex;
    gap: 7px;
}


.footer-inner strong {
    color: var(--sun-text);
}


.footer-note {
    font-size: 12px;
}


/* ----------------------------------------------------------
   LTR
   ---------------------------------------------------------- */

html[dir="ltr"] .content,
html[dir="ltr"] .site-footer {
    text-align: left;
}


/* ----------------------------------------------------------
   TABLET
   ---------------------------------------------------------- */

@media (max-width: 900px) {

    .grid {
        grid-template-columns:
            repeat(3, minmax(0,1fr));
        gap: 14px;
    }


    .shell {
        width: min(
            100% - 24px,
            1180px
        );
    }


    .content {
        padding-top: 28px;
    }

}


/* ----------------------------------------------------------
   MOBILE
   ---------------------------------------------------------- */

@media (max-width: 640px) {

    .shell {
        width: calc(100% - 20px);
    }


    .header-inner {
        min-height: 61px;
        gap: 8px;
    }


    .header-brand-area {
        gap: 0;
    }


    .logo {
        font-size: 28px;
    }


    .brand-subtitle {
        display: none;
    }


    .header-actions {
        gap: 5px;
    }


    .lab-badge {
        min-height: 25px;
        padding-inline: 8px;
        font-size: 9px;
    }


    .language-switch {
        min-height: 31px;
        padding-inline: 9px;
        font-size: 12px;
    }


    .category-scroll {
        width: auto;
        margin-inline: -10px;
        padding-inline: 10px;
        scrollbar-width: none;
    }


    .category-scroll::-webkit-scrollbar {
        display: none;
    }


    .category-chip {
        min-height: 32px;
        padding-inline: 10px;
        font-size: 12px;
    }


    .content {
        padding-top: 25px;
        padding-bottom: 34px;
    }


    .content > h1 {
        font-size: 29px;
    }


    .content > .subtle {
        font-size: 14px;
        line-height: 1.7;
        margin-bottom: 22px;
    }


    .page-heading {
        align-items: start;
        margin-bottom: 18px;
    }


    .page-heading h1 {
        font-size: 28px;
    }


    .page-heading p {
        font-size: 13px;
    }


    .page-counter {
        padding-top: 4px;
        font-size: 12px;
    }


    .grid {
        grid-template-columns:
            repeat(2, minmax(0,1fr));
        gap: 11px;
    }


    .card {
        border-radius: 12px;
    }


    .card:hover {
        transform: none;
    }


    .card-body {
        padding: 9px 9px 10px;
    }


    .card-body h2 {
        min-height: 2.7em;
        margin-bottom: 4px;
        font-size: 13px;
        line-height: 1.35;
    }


    .card-body small {
        font-size: 11px;
    }


    .pagination {
        gap: 7px;
        margin-top: 26px;
    }


    .pagination-pages {
        gap: 4px;
    }


    .pagination-number {
        min-width: 34px;
        min-height: 35px;
        padding-inline: 5px;
        font-size: 12px;
    }


    .pagination-edge {
        min-height: 35px;
        min-width: auto;
        padding-inline: 9px;
        font-size: 11px;
    }


    .pagination-dots {
        font-size: 12px;
    }


    .game-page-card {
        margin-inline: 0;
        padding: 16px 10px;
        border-radius: 15px;
    }


    .game-heading {
        margin-bottom: 14px;
        padding-inline: 4px;
    }


    .game-heading h1 {
        font-size: 28px;
    }


    .game-meta {
        font-size: 13px;
        line-height: 1.7;
    }


    .player-stage {
        border-width: 8px;
        border-radius: 16px;
    }


    .ruffle-host {
        max-height: 70vh;
    }


    .player-toolbar {
        justify-content: stretch;
    }


    .player-button {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: 7px;
        font-size: 12px;
    }


    .game-description {
        padding-inline: 4px;
        font-size: 14px;
    }


    .related-section {
        margin-top: 25px;
    }


    .section-heading h2 {
        font-size: 23px;
    }


    .footer-inner {
        min-height: 76px;
        align-items: center;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        text-align: center;
    }


    .footer-inner > div:first-child {
        justify-content: center;
    }

}


/* ----------------------------------------------------------
   VERY SMALL PHONES
   Keep 2-column layout but tighten it.
   ---------------------------------------------------------- */

@media (max-width: 360px) {

    .grid {
        gap: 8px;
    }


    .card-body {
        padding-inline: 7px;
    }


    .card-body h2 {
        font-size: 12px;
    }


    .pagination-edge {
        padding-inline: 7px;
    }

}
