:root {
    --wedding-gold: #d4af37;
    --wedding-rose: #e8a598;
    --wedding-ink: #07050b;
    --wedding-panel: rgba(22, 17, 36, 0.72);
    --header-height-mobile: 7.6rem;
}

html {
    background: var(--wedding-ink);
}

body {
    background:
        radial-gradient(circle at 12% 10%, rgba(139, 27, 35, 0.16), transparent 30rem),
        radial-gradient(circle at 88% 40%, rgba(212, 175, 55, 0.09), transparent 32rem),
        var(--wedding-ink);
    color: #f3f4f6;
    overflow-x: hidden;
}

button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

.story-speed-control option {
    background: #161124;
    color: #f3f4f6;
}

button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--wedding-gold);
    outline-offset: 3px;
}

.site-header {
    padding-top: max(0.75rem, env(safe-area-inset-top));
}

.glass-panel {
    background: var(--wedding-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(212, 175, 55, 0.15);
}

.glass-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gold-gradient-text {
    color: #e8c75f;
    background: linear-gradient(135deg, #fff6d5 0%, #d4af37 50%, #aa7c11 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.perspective-1000 {
    perspective: 1200px;
}

.transform-style-3d {
    transform-style: preserve-3d;
}

.theme-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.theme-card {
    position: relative;
    min-height: 10.5rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
    text-align: left;
    opacity: 1;
    transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
}

.theme-card::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
    background: linear-gradient(to top, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.28) 66%, rgba(0, 0, 0, 0.12));
}

.theme-card:hover {
    border-color: rgba(212, 175, 55, 0.42);
}

.theme-card.is-active {
    border-color: rgba(212, 175, 55, 0.74);
    box-shadow: 0 18px 42px rgba(212, 175, 55, 0.12);
    transform: translateY(-2px);
}

.theme-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.58;
    filter: brightness(0.72) saturate(0.76);
    transition: filter 300ms ease, opacity 300ms ease, transform 700ms ease;
}

.theme-card:hover .theme-card__image,
.theme-card.is-active .theme-card__image {
    opacity: 0.82;
    filter: brightness(0.92) saturate(1);
    transform: scale(1.045);
}

.theme-card__content {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 10.5rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.theme-card__eyebrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #e5e7eb;
    font-family: Cinzel, serif;
    font-size: 0.625rem;
    letter-spacing: 0.12em;
}

.theme-card__number {
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(212, 175, 55, 0.38);
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.15);
    color: #f3d779;
}

.theme-card__title {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.theme-card__subtitle {
    margin-top: 0.25rem;
    color: #f3f4f6;
    font-size: 0.75rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.story-stage {
    min-height: clamp(32rem, 72svh, 38.75rem);
}

.story-copy-shadow {
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.86);
}

.story-thumbnails {
    scrollbar-width: none;
}

.story-thumbnails::-webkit-scrollbar {
    display: none;
}

.story-controls {
    row-gap: 0.65rem;
}

.story-speed-control select {
    min-width: 2.5rem;
}

.story-thumbnail {
    width: 3.25rem;
    height: 3.25rem;
    flex: 0 0 auto;
    border: 2px solid transparent;
    border-radius: 0.7rem;
    object-fit: cover;
    opacity: 0.52;
    transition: border-color 240ms ease, opacity 240ms ease, transform 240ms ease;
}

.story-thumbnail:hover {
    opacity: 1;
}

.story-thumbnail.is-active {
    border-color: var(--wedding-gold);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.24);
    opacity: 1;
    transform: scale(1.04);
}

.story-image {
    will-change: opacity, transform;
}

.danmaku-item {
    position: absolute;
    left: 100%;
    opacity: 0;
    white-space: nowrap;
    will-change: opacity, transform;
    animation: danmaku-move linear forwards;
}

@keyframes danmaku-move {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0);
    }
    5%, 94% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translate3d(calc(-100vw - 100%), 0, 0);
    }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0b0813;
}

::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #2d2242;
}

@media (max-width: 767px) {
    .mobile-main {
        padding-top: calc(var(--header-height-mobile) + env(safe-area-inset-top));
        padding-right: 0.875rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        padding-left: 0.875rem;
    }

    .theme-list {
        display: flex;
        width: calc(100vw - 0.875rem);
        margin-right: -0.875rem;
        gap: 0.75rem;
        overflow-x: auto;
        padding: 0.125rem 0.875rem 0.75rem 0.125rem;
        scroll-padding-left: 0.125rem;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .theme-list::-webkit-scrollbar {
        display: none;
    }

    .theme-card {
        width: min(79vw, 20rem);
        min-width: min(79vw, 20rem);
        min-height: 8.75rem;
        scroll-snap-align: start;
    }

    .theme-card__content {
        min-height: 8.75rem;
        padding: 0.875rem;
    }

    .story-stage {
        min-height: min(34rem, calc(100svh - 8.5rem));
        border-radius: 1.25rem;
    }

    .story-stage__copy {
        padding: 1.15rem;
    }

    .story-stage__footer {
        padding: 1.15rem;
    }

    .story-thumbnail {
        width: 2.8rem;
        height: 2.8rem;
    }

    .mobile-icon-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .danmaku-item {
        max-width: 78vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
