:root {
    --roman-crimson: #8f1838;
    --roman-plum: #241a32;
    --roman-blue: #315c7d;
    --roman-laurel: #61745a;
    --roman-ivory: #f4efe5;
    --roman-gold: #c3a35d;
    --roman-ink: #17131d;
    --roman-line: rgba(36, 26, 50, 0.16);
}

html {
    scroll-behavior: smooth;
}

body.roman-theme {
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
    background: var(--roman-ivory);
    color: var(--roman-ink);
    font-family: "Manrope", sans-serif;
}

.roman-theme h1,
.roman-theme h2,
.roman-theme h3 {
    font-family: "Cinzel", serif;
    letter-spacing: 0;
}

.roman-theme main {
    width: 100%;
    max-width: 100vw;
    overflow: visible;
}

.roman-container {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
}

/* One navbar for every viewport. */
#navbar.roman-nav,
#navbar.roman-nav.scrolled {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1200;
    width: 100%;
    padding: 0;
    border: 0;
    border-bottom: 1px solid rgba(244, 239, 229, 0.14);
    border-radius: 0;
    background: rgba(36, 26, 50, 0.08);
    box-shadow: none;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: background 0.25s ease, border-color 0.25s ease;
}

#navbar.roman-nav.scrolled {
    background: rgba(36, 26, 50, 0.82);
    border-bottom-color: rgba(244, 239, 229, 0.2);
}

.roman-nav__inner {
    width: min(1240px, calc(100% - 48px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.roman-nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: "Cinzel", serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.roman-nav__brand img {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(244, 239, 229, 0.42);
    border-radius: 50%;
    object-fit: cover;
}

#navbar .roman-nav__links {
    display: flex;
    align-items: center;
    gap: 30px;
}

#navbar .roman-nav__links a,
#navbar .roman-nav__links button {
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.88);
    font: 600 0.77rem/1 "Manrope", sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.2s ease, border-color 0.2s ease;
}

#navbar .roman-nav__links a:hover,
#navbar .roman-nav__links button:hover {
    color: #fff;
    border-bottom-color: var(--roman-gold);
    transform: none;
}

.nav-mobile-actions {
    display: none;
    align-items: center;
    gap: 8px;
}

.roman-nav__icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(244, 239, 229, 0.26);
    border-radius: 50%;
    background: rgba(36, 26, 50, 0.18);
    color: #fff;
}

/* Scroll hero */
.roman-scroll {
    position: relative;
    width: 100%;
    max-width: 100vw;
    height: 220svh;
    padding: 0 !important;
    background: var(--roman-plum);
}

.roman-scene {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100vw;
    height: 100svh;
    overflow: hidden;
    isolation: isolate;
    clip-path: inset(0);
    contain: paint;
}

.roman-scene__picture {
    position: absolute;
    inset: 0;
    z-index: -4;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.roman-scene__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    will-change: transform;
}

.roman-scene__wash {
    position: absolute;
    inset: 0;
    z-index: -3;
    background:
        linear-gradient(90deg, rgba(24, 18, 31, 0.2) 0%, rgba(24, 18, 31, 0.02) 42%, rgba(24, 18, 31, 0.38) 100%),
        linear-gradient(0deg, rgba(24, 18, 31, 0.78) 0%, transparent 38%, rgba(36, 26, 50, 0.12) 100%);
    will-change: opacity;
}

.roman-hero {
    position: absolute;
    top: 50%;
    right: max(5vw, calc((100vw - 1180px) / 2));
    width: min(620px, 48vw);
    color: var(--roman-plum);
    text-align: right;
    transform: translateY(-46%);
    will-change: transform, opacity;
}

.roman-hero__school,
.roman-kicker {
    margin: 0 0 18px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.roman-hero h1 {
    margin: 0;
    max-width: 100%;
    color: var(--roman-plum);
    font-size: clamp(3.4rem, 6.5vw, 7rem);
    font-weight: 600;
    line-height: 0.86;
    white-space: nowrap;
    text-shadow: 0 8px 30px rgba(255, 255, 255, 0.24);
}

.roman-hero__latin {
    margin: 20px 0 0;
    color: var(--roman-crimson);
    font-family: "Cinzel", serif;
    font-size: clamp(0.9rem, 1.2vw, 1.15rem);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.roman-hero__intro {
    max-width: 480px;
    margin: 22px 0 0 auto;
    font-size: clamp(0.95rem, 1.2vw, 1.12rem);
    line-height: 1.7;
}

.roman-hero__actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.roman-button {
    min-height: 48px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 4px;
    font: 700 0.72rem/1 "Manrope", sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.roman-button--primary {
    background: var(--roman-plum);
    color: #fff;
}

.roman-button--primary:hover {
    background: var(--roman-crimson);
}

.roman-button--ghost {
    border-color: rgba(36, 26, 50, 0.24);
    background: rgba(244, 239, 229, 0.94);
    color: var(--roman-plum);
    box-shadow: 0 10px 28px rgba(36, 26, 50, 0.16);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.roman-button--ghost:hover {
    border-color: var(--roman-crimson);
    background: #fff;
    color: var(--roman-crimson);
}

.roman-button--crimson {
    background: var(--roman-crimson);
    color: #fff;
}

.roman-scroll-cue {
    position: absolute;
    right: 32px;
    bottom: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Editorial class chapter */
.roman-about {
    position: relative;
    z-index: 2;
    padding: 140px 0 160px;
    background: var(--roman-ivory);
}

.roman-editorial-heading {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 0.5fr);
    align-items: end;
    gap: 40px;
    padding-bottom: 70px;
    border-bottom: 1px solid var(--roman-line);
}

.roman-editorial-heading .roman-kicker {
    grid-column: 1 / -1;
    margin-bottom: 0;
    color: var(--roman-crimson);
}

.roman-editorial-heading h2 {
    margin: 0;
    color: var(--roman-plum);
    font-size: clamp(3rem, 6.5vw, 7.2rem);
    font-weight: 500;
    line-height: 0.92;
}

.roman-lead {
    margin: 0 0 8px;
    color: var(--roman-blue);
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.45rem, 2.2vw, 2.1rem);
    font-style: italic;
    line-height: 1.25;
}

.roman-class-layout {
    margin-top: 88px;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 56px;
    align-items: center;
}

.roman-class-photo {
    margin: 0;
}

.roman-class-photo img {
    width: 100%;
    max-height: 680px;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(36, 26, 50, 0.2);
}

.roman-class-photo figcaption {
    margin-top: 12px;
    color: rgba(36, 26, 50, 0.6);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.roman-quote {
    margin: 0;
    color: var(--roman-plum);
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.8rem, 3vw, 3.1rem);
    font-style: italic;
    line-height: 1.15;
}

.roman-archive {
    margin: 54px 0 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--roman-line);
    border-bottom: 1px solid var(--roman-line);
}

.roman-archive div {
    padding: 24px 12px 24px 0;
}

.roman-archive div + div {
    padding-left: 18px;
    border-left: 1px solid var(--roman-line);
}

.roman-archive span,
.roman-archive small {
    display: block;
}

.roman-archive span {
    color: var(--roman-crimson);
    font-family: "Cinzel", serif;
    font-size: clamp(1.7rem, 2.8vw, 2.8rem);
}

.roman-archive small {
    margin-top: 6px;
    color: rgba(36, 26, 50, 0.62);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.roman-homeroom {
    margin: 0;
    color: rgba(36, 26, 50, 0.66);
    font-size: 0.83rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.roman-homeroom strong {
    color: var(--roman-plum);
}

/* Gallery chapter */
.roman-gallery {
    padding: 140px 0;
    background: var(--roman-plum);
    color: var(--roman-ivory);
}

.roman-section-heading {
    max-width: 760px;
    margin-bottom: 64px;
}

.roman-section-heading .roman-kicker {
    color: var(--roman-gold);
}

.roman-section-heading h2 {
    margin: 0;
    font-size: clamp(3.2rem, 7vw, 7.4rem);
    font-weight: 500;
    line-height: 0.92;
}

.roman-section-heading > p:last-child {
    margin: 24px 0 0;
    max-width: 540px;
    color: rgba(244, 239, 229, 0.7);
    line-height: 1.7;
}

.roman-upload {
    max-width: none;
    margin: 0 0 28px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.roman-upload .gallery-upload-form {
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(300px, 1.3fr);
    gap: 24px;
    border: 1px solid rgba(244, 239, 229, 0.16);
    border-radius: 4px;
    background: rgba(244, 239, 229, 0.06);
}

.roman-gallery-frame {
    margin: 0;
    padding: 18px;
    border: 1px solid rgba(244, 239, 229, 0.14);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.12);
    box-shadow: none;
    overflow: hidden;
}

.roman-gallery .gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-count: auto;
    gap: 16px;
    padding: 0;
    overflow: hidden;
    align-items: start;
}

.roman-gallery .gallery-item,
.roman-gallery .gallery-item:hover {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    transform: none;
    border-radius: 8px;
}

.roman-gallery .gallery-item img,
.roman-gallery .gallery-item:hover img {
    width: 100%;
    max-width: 100%;
    height: auto;
    transform: none;
}

/* Anonymous messages */
.roman-voices {
    padding: 140px 0;
    background: var(--roman-blue);
    color: #fff;
}

.roman-section-heading--dark {
    max-width: 820px;
}

.roman-chat {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

.roman-chat .chat-feed,
.roman-chat .chat-composer {
    min-height: 460px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    background: rgba(23, 19, 29, 0.26);
    box-shadow: none;
}

.roman-chat .chat-composer {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.roman-chat .chat-field span,
.roman-upload .chat-field span {
    color: rgba(255, 255, 255, 0.74);
}

.roman-chat input,
.roman-chat textarea,
.roman-upload input {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.roman-mobile-chat-trigger {
    display: none;
}

/* Finale */
.roman-finale {
    position: relative;
    min-height: 90svh;
    padding: 0 !important;
    display: grid;
    place-items: center;
    overflow: hidden;
    isolation: isolate;
    background: var(--roman-plum);
}

.roman-finale__backdrop {
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(rgba(36, 26, 50, 0.64), rgba(36, 26, 50, 0.88)),
        url("../gallery/roman-hero.png") center 72% / cover;
}

.roman-finale__copy {
    width: min(900px, calc(100% - 48px));
    color: #fff;
    text-align: center;
}

.roman-finale__copy > p {
    margin: 0 0 18px;
    color: var(--roman-gold);
    font: 700 0.74rem/1 "Manrope", sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.roman-finale h2 {
    margin: 0;
    font-size: clamp(3.5rem, 8vw, 8rem);
    font-weight: 500;
    line-height: 0.9;
}

.roman-finale a {
    margin-top: 36px;
    display: inline-block;
    color: #fff;
    border-bottom: 1px solid var(--roman-gold);
}

.roman-footer {
    padding: 34px 24px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    border: 0;
    background: #17131d;
    color: rgba(244, 239, 229, 0.66);
}

.roman-footer img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.roman-footer p {
    margin: 0;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Keep the dark mini-game menu readable under the Roman theme. */
.roman-theme #games-modal .games-menu {
    background: var(--roman-plum);
    color: var(--roman-ivory);
    border-color: rgba(244, 239, 229, 0.16);
}

.roman-theme #games-modal .games-menu h2,
.roman-theme #games-modal .game-card-3d h3 {
    color: #fff;
}

.roman-theme #games-modal .game-card-3d p {
    color: rgba(244, 239, 229, 0.72);
}

.roman-theme #games-modal .game-icon {
    color: var(--roman-gold);
}

.roman-theme #games-modal .close-modal {
    color: rgba(244, 239, 229, 0.82);
}

.roman-theme #games-modal .close-modal:hover {
    color: #fff;
}

/* Tebak Guru lives on a dark game overlay, independent of page-theme text colors. */
.roman-theme #game-container-tebak-guru,
.roman-theme #game-container-tebak-guru .game-header h2,
.roman-theme #game-container-tebak-guru .score-display,
.roman-theme #game-container-tebak-guru .game-stage-title,
.roman-theme #game-container-tebak-guru .tg-final-score {
    color: #fff;
}

.roman-theme #game-container-tebak-guru .score-display span {
    color: var(--roman-gold);
}

.roman-theme #game-container-tebak-guru .tg-final-score {
    margin: 15px 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.roman-theme #game-container-tebak-guru .tg-final-percent {
    margin-bottom: 20px;
    color: rgba(244, 239, 229, 0.72);
}

@media (max-width: 900px) {
    .roman-container,
    .roman-nav__inner {
        width: min(100% - 32px, 1180px);
    }

    #navbar .roman-nav__links {
        display: none;
    }

    .nav-mobile-actions {
        display: flex;
    }

    .roman-scroll {
        height: 165svh;
    }

    .roman-scene__image {
        inset: 0;
        width: 100%;
        height: 100%;
        object-position: center center;
    }

    .roman-scene__wash {
        background:
            linear-gradient(0deg, rgba(36, 26, 50, 0.9) 0%, rgba(36, 26, 50, 0.08) 65%),
            linear-gradient(90deg, transparent, rgba(36, 26, 50, 0.14));
    }

    .roman-hero {
        top: auto;
        right: 24px;
        bottom: 100px;
        left: 24px;
        width: auto;
        max-width: calc(100vw - 48px);
        color: #fff;
        text-align: left;
        transform: none;
    }

    .roman-hero h1 {
        color: #fff;
        max-width: 100%;
        font-size: clamp(2.45rem, 11vw, 4.6rem);
        white-space: nowrap;
        text-shadow: 0 8px 32px rgba(0, 0, 0, 0.34);
    }

    .roman-gallery .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .roman-hero__school,
    .roman-hero__intro {
        color: rgba(255, 255, 255, 0.82);
    }

    .roman-hero__latin {
        color: #e4c775;
    }

    .roman-hero__intro {
        margin-left: 0;
    }

    .roman-hero__actions {
        justify-content: flex-start;
    }

    .roman-button--primary {
        background: var(--roman-crimson);
    }

    .roman-button--ghost {
        border-color: rgba(36, 26, 50, 0.24);
        background: rgba(244, 239, 229, 0.94);
        color: var(--roman-plum);
    }

    .roman-scroll-cue {
        display: none;
    }

    .roman-editorial-heading,
    .roman-class-layout,
    .roman-chat {
        grid-template-columns: 1fr;
    }

    .roman-class-copy {
        max-width: 680px;
    }

    .roman-upload .gallery-upload-form {
        grid-template-columns: 1fr;
    }

    .roman-footer {
        grid-template-columns: auto 1fr;
    }

    .roman-footer p:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .roman-nav__inner {
        min-height: 68px;
    }

    .roman-nav__brand span {
        display: none;
    }

    .roman-nav__brand img,
    .roman-nav__icon {
        width: 42px;
        height: 42px;
    }

    .roman-about,
    .roman-gallery,
    .roman-voices {
        padding: 96px 0;
    }

    .roman-editorial-heading {
        padding-bottom: 44px;
    }

    .roman-class-layout {
        margin-top: 52px;
        gap: 38px;
    }

    .roman-archive {
        margin-top: 38px;
    }

    .roman-archive div {
        padding: 18px 7px 18px 0;
    }

    .roman-archive div + div {
        padding-left: 10px;
    }

    .roman-hero__actions {
        flex-wrap: wrap;
    }

    .roman-mobile-chat-trigger {
        display: inline-flex;
    }

    .roman-gallery .gallery-grid {
        grid-template-columns: 1fr;
    }

    .roman-chat {
        display: none;
    }

    .roman-finale {
        min-height: 72svh;
    }

    .roman-footer {
        display: flex;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .roman-scroll {
        height: 100svh;
    }

    .roman-scene__image,
    .roman-hero {
        transform: none !important;
        opacity: 1 !important;
    }
}
