:root {
    --moon-bg: #040508;
    --moon-surface: #0d0d10;
    --moon-raised: #151419;
    --moon-white: #f3eee5;
    --moon-muted: #a79f92;
    --moon-blue: #39445a;
    --moon-bronze: #d7ae62;
    --moon-gold-soft: #f5e4bc;
    --moon-gold-deep: #8f642d;
}

* { box-sizing: border-box; }
html { background: var(--moon-bg); color-scheme: dark; }
body.theme-moon {
    min-height: 100vh;
    margin: 0;
    background: var(--moon-bg);
    color: var(--moon-white);
    font-family: "Manrope", sans-serif;
    font-size: 16px;
}
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.moon-header {
    min-height: 204px;
    padding: 0;
    border-bottom: 1px solid rgba(215, 174, 98, .28);
    background: #020306;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}
.moon-header::after {
    content: "";
    position: absolute;
    left: 12%; right: 12%; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--moon-gold-deep), var(--moon-gold-soft), var(--moon-gold-deep), transparent);
    opacity: .78;
}
.moon-brand { display: block; width: min(100%, 1320px); height: 203px; overflow: hidden; }
.moon-brand img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.moon-shell { width: min(100%, 1180px); margin: 0 auto; padding: 14px 12px 28px; }
.moon-top-banner, .moon-inline-banner { display: block; width: 100%; overflow: hidden; border: 1px solid rgba(215,174,98,.24); }
.moon-top-banner { margin-bottom: 10px; max-height: 190px; }
.moon-top-banner img, .moon-inline-banner img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: cover; }

.moon-primary-cta, .moon-inline-cta {
    min-height: 48px;
    border: 1px solid rgba(215,174,98,.52);
    background: #0c0b0a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 800;
    color: var(--moon-gold-soft);
    position: relative;
    overflow: hidden;
}
.moon-primary-cta { margin-bottom: 10px; }
.moon-primary-cta::after, .moon-inline-cta::after {
    content: ""; position: absolute; inset: 0 auto 0 -35%; width: 20%;
    background: rgba(245,228,188,.18); transform: skewX(-18deg); animation: moonCtaSweep 5.4s ease-in-out infinite;
}
.moon-primary-cta i, .moon-inline-cta i { color: var(--moon-gold-soft); }

.moon-warning {
    min-height: 50px; margin-bottom: 14px; padding: 10px 18px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    position: relative; isolation: isolate; overflow: hidden;
    border: 1px solid rgba(215,174,98,.48); background: #0d0b0a;
    color: #eee4d2; font-size: 13px; font-weight: 800; text-align: center;
    box-shadow: inset 0 1px 0 rgba(245,228,188,.08), inset 0 -1px 0 rgba(143,100,45,.12);
}
.moon-warning::before, .moon-warning::after {
    content: ""; position: absolute; z-index: -1; top: -40%; bottom: -40%; width: 28%;
    pointer-events: none; opacity: 0; transform: skewX(-18deg) translate3d(-260%,0,0);
}
.moon-warning::before {
    left: 0; background: linear-gradient(90deg, transparent, rgba(215,174,98,.08), rgba(245,228,188,.34), rgba(215,174,98,.08), transparent);
    animation: moonWarningSweep 5.2s ease-in-out infinite;
}
.moon-warning::after {
    right: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), rgba(255,244,218,.22), rgba(255,255,255,.05), transparent);
    transform: skewX(18deg) translate3d(260%,0,0); animation: moonWarningSweepReverse 5.2s ease-in-out 1.05s infinite;
}
.moon-warning i, .moon-warning span { position: relative; z-index: 1; }
.moon-warning i { color: var(--moon-gold-soft); text-shadow: 0 0 12px rgba(215,174,98,.55); }

.moon-section { margin-top: 14px; }
.moon-section-head { height: 38px; display: grid; grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr); align-items: center; gap: 13px; }
.moon-section-head > span { width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--tier-accent)); opacity: .7; }
.moon-section-head > span:last-child { background: linear-gradient(90deg, var(--tier-accent), transparent); }
.moon-section-head h2 { margin: 0; text-align: center; font: 800 15px/1 "League Spartan", sans-serif; color: var(--tier-accent); }
.moon-section-mega { --tier-accent: #f5e4bc; }
.moon-section-diamond { --tier-accent: #e7e0d5; }
.moon-section-gold { --tier-accent: #c89547; }
.moon-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; min-width: 0; }
.moon-section-diamond .moon-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
.moon-section-gold .moon-list { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }

.moon-card {
    height: 166px; min-width: 0; overflow: hidden; position: relative;
    border: 1px solid rgba(215,174,98,.18); background: var(--moon-surface);
    box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.moon-section-diamond .moon-card { height: 148px; }
.moon-section-gold .moon-card { height: auto; aspect-ratio: 4 / 5; }
.moon-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--card-accent); z-index: 5; }
.moon-card::after {
    content: ""; position: absolute; z-index: 3; inset: 42% 0 0; pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(4,6,10,.18) 34%, rgba(4,6,10,.68));
}
.moon-card-mega { --card-accent: #f5e4bc; }
.moon-card-diamond { --card-accent: #d8d4cf; }
.moon-card-gold { --card-accent: #c89547; }
.moon-gallery { display: block; position: absolute; z-index: 1; inset: 0; min-width: 0; overflow: hidden; background: #0b0e14; }
.moon-track { height: 100%; }
.moon-gallery:not(.is-ready) .moon-track { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); }
.moon-gallery:not(.is-ready) .moon-frame:nth-child(n+5) { display: none; }
.moon-card-diamond .moon-gallery:not(.is-ready) .moon-track { grid-template-columns: repeat(2, minmax(0,1fr)); }
.moon-card-diamond .moon-gallery:not(.is-ready) .moon-frame:nth-child(n+3) { display: none; }
.moon-card-gold .moon-gallery:not(.is-ready) .moon-track { grid-template-columns: minmax(0,1fr); }
.moon-card-gold .moon-gallery:not(.is-ready) .moon-frame:nth-child(n+2) { display: none; }
.moon-gallery.is-ready .moon-track { display: flex; width: max-content; will-change: transform; }
.moon-frame { display: block; min-width: 0; height: 100%; overflow: hidden; border-right: 1px solid rgba(255,255,255,.08); }
.moon-frame img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 18%; }
.moon-frame img.is-landscape { object-position: center; }
.moon-eclipse-sweep {
    position: absolute; inset: 0 auto 0 -8%; width: 5%; pointer-events: none;
    background: rgba(245,228,188,.32); opacity: 0; transform: skewX(-7deg);
}
.moon-gallery.is-shifting .moon-eclipse-sweep { animation: moonEclipse .68s ease-in-out; }
.moon-location {
    position: absolute; top: 8px; z-index: 4; min-height: 25px; padding: 5px 8px;
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(5,5,7,.88); border: 1px solid rgba(215,174,98,.28);
    color: #f3eee5; font-size: 11px; font-weight: 800; backdrop-filter: blur(5px);
}
.moon-location { right: 8px; max-width: 48%; }
.moon-location { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moon-location i { color: var(--moon-bronze); }

.moon-identity {
    position: absolute; z-index: 6; left: 8px; bottom: 8px; min-height: 38px;
    max-width: calc(100% - 16px); padding: 6px 10px;
    display: flex; align-items: center; gap: 7px;
    border: 1px solid rgba(215,174,98,.24); border-left-color: var(--card-accent);
    background: rgba(5,5,7,.93); box-shadow: 0 8px 22px rgba(0,0,0,.4);
}
.moon-name { min-width: 0; color: #f7f8fa; font: 800 17px/1.04 "League Spartan", sans-serif; overflow-wrap: anywhere; text-shadow: 0 1px 3px #000; }
.moon-age { flex: 0 0 auto; padding-left: 7px; border-left: 1px solid rgba(215,174,98,.28); color: #e4c98f; font-size: 13px; font-weight: 800; }
.moon-card-gold .moon-identity { left: 5px; right: 5px; bottom: 5px; min-height: 30px; max-width: none; padding: 5px 6px; gap: 5px; }
.moon-card-gold .moon-name { font-size: 12px; line-height: 1.05; }
.moon-card-gold .moon-age { padding-left: 5px; font-size: 10px; }
.moon-card-gold .moon-location { top: 5px; right: 5px; max-width: calc(100% - 10px); min-height: 22px; padding: 4px 5px; font-size: 9px; }
.moon-placeholder-card .moon-frame { background: #02050a; }
.moon-placeholder-card .moon-frame img { object-fit: contain; object-position: center; }
.moon-placeholder-card::after { display: none; }
.moon-inline { width: 100%; min-width: 0; max-width: 100%; margin: 2px 0; }
.moon-inline-banner { max-height: 190px; }
.moon-empty { padding: 36px 12px; text-align: center; color: var(--moon-muted); }
.moon-footer { padding: 26px 8px 4px; text-align: center; color: #81796d; font-size: 12px; }

@keyframes moonCtaSweep { 0%,62% { left: -35%; opacity: 0; } 70% { opacity: 1; } 88%,100% { left: 120%; opacity: 0; } }
@keyframes moonEclipse { 0% { left: -8%; opacity: 0; } 25% { opacity: .75; } 100% { left: 103%; opacity: 0; } }
@keyframes moonWarningSweep {
    0%, 12% { opacity: 0; transform: skewX(-18deg) translate3d(-260%,0,0); }
    24% { opacity: .9; }
    46%, 100% { opacity: 0; transform: skewX(-18deg) translate3d(560%,0,0); }
}
@keyframes moonWarningSweepReverse {
    0%, 12% { opacity: 0; transform: skewX(18deg) translate3d(260%,0,0); }
    24% { opacity: .72; }
    46%, 100% { opacity: 0; transform: skewX(18deg) translate3d(-560%,0,0); }
}

@media (max-width: 560px) {
    .moon-header { min-height: 88px; padding: 0; }
    .moon-brand { width: 100%; height: 87px; }
    .moon-brand img { object-position: center; }
    .moon-shell { padding: 9px 8px 22px; }
    .moon-card { height: 132px; }
    .moon-section-diamond .moon-card { height: 126px; }
    .moon-section-gold .moon-list { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; }
    .moon-section-gold .moon-card { height: auto; }
    .moon-identity { left: 6px; bottom: 6px; min-height: 34px; max-width: calc(100% - 12px); padding: 5px 7px; gap: 5px; }
    .moon-name { font-size: 14px; }
    .moon-age { font-size: 12px; }
    .moon-location { top: 6px; right: 6px; max-width: 54%; }
    .moon-card-diamond .moon-location { max-width: 72%; }
    .moon-card-diamond .moon-name { font-size: 13px; }
    .moon-card-diamond .moon-age { font-size: 11px; }
    .moon-card-gold .moon-name { font-size: 11px; }
    .moon-card-gold .moon-age { font-size: 9px; }
    .moon-warning { min-height: 46px; padding: 9px 12px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .theme-moon:not(.moon-preview-motion) .moon-primary-cta::after,
    .theme-moon:not(.moon-preview-motion) .moon-inline-cta::after,
    .theme-moon:not(.moon-preview-motion) .moon-warning::before,
    .theme-moon:not(.moon-preview-motion) .moon-warning::after,
    .theme-moon:not(.moon-preview-motion) .moon-gallery.is-shifting .moon-eclipse-sweep { animation: none; }
    .theme-moon:not(.moon-preview-motion) .moon-track { transition: none !important; }
}
