:root {
    --realm-cyan: #4ff6ff;
    --realm-violet: #8d5bff;
    --realm-gold: #f2c66d;
    --realm-red: #ff3366;
    --realm-dark: #0a0e17;
}

/* ===== Fullscreen video background (replaces canvas portal) ===== */
.realm-bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    z-index: -2;
    pointer-events: none;
    filter: saturate(1.05) contrast(1.04) brightness(0.55);
}

.realm-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, rgba(15, 10, 30, 0.6) 0%, rgba(6, 10, 18, 0.85) 60%, rgba(4, 4, 12, 0.95) 100%);
}

.realm-container {
    align-items: stretch;
}

.realm-background {
    position: relative;
    background: transparent !important;
}

.realm-layout {
    width: min(1440px, 96vw);
    margin: 1.5rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.realm-signup-header {
    width: min(960px, 100%);
    margin-inline: auto;
    padding: 1rem 1.4rem 1.05rem;
    text-align: center;
}

.realm-signup-header h1 {
    margin-bottom: 0.35rem;
}

.realm-signup-hero-subtitle {
    margin: 0 auto;
    max-width: 780px;
    color: #dbe5ff;
    font-size: 1rem;
    line-height: 1.45;
}

/* ===== Copy section: simple static intro ===== */
.realm-copy {
    background: rgba(6, 10, 18, 0.62);
    border: 1px solid rgba(79, 246, 255, 0.25);
    border-radius: 12px;
    padding: 1rem 1.15rem 1.05rem;
    box-shadow: 0 0 24px rgba(79, 246, 255, 0.06), 0 0 44px rgba(141, 91, 255, 0.06), inset 0 1px 0 rgba(255,255,255,0.04);
    position: relative;
    overflow: hidden;
}

.realm-copy h1 {
    margin-bottom: 0.4rem;
    color: var(--realm-cyan);
    letter-spacing: 0.02em;
    text-align: center;
}

.realm-copy h2 {
    color: #d2d9ff;
    font-size: 1rem;
    margin-bottom: 0.6rem;
    text-align: center;
}

.realm-copy > p,
.realm-copy-lead {
    color: #e4e8f8;
    margin-bottom: 0.4rem;
    text-align: center;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.88rem;
    line-height: 1.45;
}

.realm-copy-more {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.realm-copy-more a {
    color: var(--realm-gold);
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 198, 109, 0.55);
    padding-bottom: 1px;
}

.realm-copy-more a:hover {
    color: #ffe1a8;
    border-bottom-color: #ffe1a8;
}

/* ===== Doors: Cards as closed doors, login hidden behind ===== */
.realm-doors-container {
    --realm-door-gap: clamp(12px, 1.8vw, 24px);
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: var(--realm-door-gap);
    min-height: clamp(460px, 72vh, 760px);
    overflow: hidden;
    border-radius: 22px;
}

.realm-door-column {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - (var(--realm-door-gap) / 2));
    min-height: clamp(460px, 72vh, 760px);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    position: relative;
    z-index: 2;
    transition: transform 1.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.realm-door-title-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    min-width: min(72%, 320px);
    padding: 0.65rem 1.15rem;
    border-radius: 999px;
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: linear-gradient(180deg, rgba(2, 6, 16, 0.52), rgba(2, 6, 16, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    transition: transform 180ms ease, filter 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.realm-door-title-link span {
    pointer-events: none;
    display: inline-block;
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    animation: realm-door-title-breathe 4.2s ease-in-out infinite;
}

.realm-door-title-link-left {
    color: var(--realm-cyan);
    border-color: rgba(79, 246, 255, 0.45);
    text-shadow: 0 0 12px rgba(79, 246, 255, 0.22);
}

.realm-door-title-link-right {
    color: var(--realm-violet);
    border-color: rgba(141, 91, 255, 0.45);
    text-shadow: 0 0 12px rgba(141, 91, 255, 0.25);
}

.realm-door-title-link-right span {
    animation-delay: -2.1s;
}

@keyframes realm-door-title-breathe {
    0%, 100% {
        transform: translate3d(0, 0, 0);
        opacity: 0.92;
    }
    50% {
        transform: translate3d(0, -1px, 0);
        opacity: 1;
    }
}

.realm-door-title-link:hover,
.realm-door-title-link:focus-visible {
    filter: brightness(1.08);
    transform: translate3d(0, -2px, 0);
    outline: none;
}

.realm-hero-card.realm-door {
    display: block;
    flex: 1;
    min-width: 100%;
    max-width: 100%;
    min-height: 0;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    transition: transform 1.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s ease, filter 0.5s ease;
    animation: none;
    position: relative;
    z-index: 1;
}

.realm-hero-card.realm-door:hover {
    box-shadow: 0 0 50px rgba(141, 91, 255, 0.3), 0 0 80px rgba(79, 246, 255, 0.15);
    filter: saturate(1.08) brightness(1.05);
}

.realm-doors-open .realm-door-column {
    pointer-events: none;
}

/* Barn doors: each card slides to its edge (left slides left, right slides right) */
.realm-doors-open .realm-door-column-left {
    transform: translateX(-110%);
}

.realm-doors-open .realm-door-column-right {
    transform: translateX(110%);
}

.realm-door-cta {
    display: none;
}

.realm-hero-card {
    flex: 0 0 auto;
    width: 300px;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid rgba(141, 91, 255, 0.35);
    box-shadow: 0 0 30px rgba(141, 91, 255, 0.12), 0 0 60px rgba(79, 246, 255, 0.06);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.realm-hero-card-right {
    animation-delay: -3s;
}

.realm-hero-card:not(.realm-door):hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 0 40px rgba(141, 91, 255, 0.25), 0 0 80px rgba(79, 246, 255, 0.12);
}

.realm-hero-card img {
    width: 100%;
    height: 100%;
    min-height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.realm-hero-card-video {
    position: relative;
}

.realm-hero-card-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-out;
}

.realm-hero-card-video:hover video {
    opacity: 1;
}

/* Signup panel: centered when doors open, zooms in as doors reveal.
   Override auth.css fadeInUp so our door-reveal animation controls visibility. */
.realm-login-panel.auth-content {
    animation: none;
}

.realm-login-panel {
    display: none;
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%) scale(0.24);
    transform-origin: 50% 50%;
    max-width: 1080px;
    width: min(1080px, calc(100% - 3rem));
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.realm-doors-open .realm-login-panel {
    display: block;
    position: fixed;
    left: 50%;
    top: 52%;
    width: min(1080px, calc(100vw - 3rem));
    pointer-events: auto;
    z-index: 1100;
    animation: realm-portal-reveal 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes realm-portal-reveal {
    0% {
        transform: translate(-50%, -50%) scale(0.24);
        opacity: 0;
    }
    35% {
        transform: translate(-50%, -50%) scale(0.46);
        opacity: 0.22;
    }
    70% {
        transform: translate(-50%, -50%) scale(0.82);
        opacity: 0.82;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.realm-auth-content {
    position: relative;
    background: rgba(12, 16, 28, 0.95);
    border: 1px solid rgba(141, 91, 255, 0.4);
    box-shadow: 0 0 32px rgba(79, 246, 255, 0.08), 0 0 64px rgba(141, 91, 255, 0.06), inset 0 1px 0 rgba(255,255,255,0.05);
}

.realm-reveal-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 420px);
    gap: 1rem;
    min-height: min(620px, calc(100vh - 5rem));
    isolation: isolate;
}

.realm-reveal-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../wwwroot/realm_treasure.png") center center / cover no-repeat;
    opacity: 0.38;
    z-index: -2;
}

.realm-reveal-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(5, 8, 18, 0.3) 0%, rgba(5, 8, 18, 0.72) 54%, rgba(4, 6, 14, 0.92) 100%),
        radial-gradient(circle at 40% 30%, rgba(79, 246, 255, 0.16), transparent 36%),
        radial-gradient(circle at 62% 46%, rgba(141, 91, 255, 0.18), transparent 34%);
    z-index: -1;
}

.realm-reveal-copy,
.realm-reveal-auth {
    position: relative;
    z-index: 1;
}

.realm-reveal-copy {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-self: stretch;
    padding: 1.4rem;
    border-radius: 18px;
    border: 1px solid rgba(79, 246, 255, 0.16);
    background: linear-gradient(180deg, rgba(7, 10, 18, 0.08), rgba(7, 10, 18, 0.44) 50%, rgba(7, 10, 18, 0.72) 100%);
}

.realm-reveal-kicker {
    margin: 0 0 0.5rem;
    color: var(--realm-gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.realm-reveal-copy h3 {
    margin: 0 0 0.75rem;
    color: #f5f8ff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.6rem, 2.5vw, 2.3rem);
    line-height: 1.1;
    text-shadow: 0 0 24px rgba(79, 246, 255, 0.15);
}

.realm-reveal-intro {
    margin: 0 0 1rem;
    max-width: 48rem;
    color: #e8eefb;
    font-size: 1rem;
    line-height: 1.55;
}

.realm-reveal-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.realm-reveal-benefit {
    padding: 0.85rem 0.9rem 0.95rem;
    border-radius: 14px;
    background: rgba(6, 10, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(3px);
}

.realm-reveal-benefit h4 {
    margin: 0 0 0.35rem;
    color: #f5d898;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
}

.realm-reveal-benefit p {
    margin: 0;
    color: #d8e1f6;
    font-size: 0.92rem;
    line-height: 1.45;
}

.realm-reveal-auth {
    display: flex;
    align-items: stretch;
}

.realm-reveal-auth #step-account {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    padding: 1.3rem;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(8, 10, 18, 0.74), rgba(8, 10, 18, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.realm-avatar-layout {
    width: min(1120px, 96vw);
}

.realm-avatar-page-content {
    width: min(1040px, 96vw);
    max-width: min(1040px, 96vw);
    margin: 0 auto;
    padding: 1.2rem;
    animation: none;
}

.realm-username-page-content {
    width: min(620px, 94vw);
    max-width: min(620px, 94vw);
    margin: 0 auto;
    padding: 1.4rem;
    animation: none;
}

.realm-error-layout {
    width: min(980px, 94vw);
}

.realm-error-page-content {
    width: min(900px, 94vw);
    max-width: min(900px, 94vw);
    margin: 0 auto;
    padding: 1.1rem;
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    gap: 1rem;
    align-items: stretch;
    animation: none;
}

.realm-error-card-art {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(141, 91, 255, 0.45);
    box-shadow: 0 0 24px rgba(141, 91, 255, 0.22);
}

.realm-error-card-art img {
    width: 100%;
    height: 100%;
    min-height: 100%;
    object-fit: cover;
    display: block;
}

.realm-error-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(18, 10, 32, 0.96), rgba(8, 4, 16, 0.98));
    border: 1px solid rgba(141, 91, 255, 0.45);
}

.realm-error-kicker {
    margin: 0 0 0.45rem;
    color: var(--realm-red);
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
}

.realm-error-panel h1 {
    margin: 0 0 0.7rem;
    color: #f2efff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
}

.realm-error-message {
    margin: 0 0 0.65rem;
    color: #d7d0ef;
    font-size: 1rem;
    line-height: 1.45;
}

.realm-error-code {
    margin: 0 0 1rem;
    color: #bca9ea;
    font-size: 0.9rem;
}

.realm-avatar-row-single .realm-avatar-dossier {
    width: 100%;
}

.realm-username-panel {
    margin-bottom: 1rem;
}

.realm-username-row {
    align-items: stretch;
}

.realm-username-row .form-input {
    font-size: 1.08rem;
}

.realm-username-message {
    margin: 0.6rem 0 0;
    color: #d9e1f5;
    font-size: 0.96rem;
}

.realm-username-message.is-available {
    color: #bbffe5;
}

.realm-username-message.is-unavailable {
    color: #ffd4dc;
}

/* Portal effects when doors reveal the signup (both animations - glow must not override reveal) */
.realm-doors-open .realm-login-panel.realm-auth-content {
    overflow: visible;
    box-shadow: 0 0 40px rgba(79, 246, 255, 0.2), 0 0 80px rgba(141, 91, 255, 0.15), 0 0 120px rgba(141, 91, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.08);
    animation: realm-portal-reveal 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards,
               realm-portal-glow 3s ease-in-out 1.1s infinite;
}

.realm-doors-open .realm-login-panel.realm-auth-content::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    padding: 3px;
    background: linear-gradient(120deg, transparent 30%, rgba(79, 246, 255, 0.5) 50%, transparent 70%);
    background-size: 200% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: realm-portal-shimmer 2.5s ease-in-out infinite;
    opacity: 0.9;
}

body[data-faction="creation"] .realm-doors-open .realm-login-panel.realm-auth-content::after {
    background: linear-gradient(120deg, transparent 25%, rgba(242, 198, 109, 0.45) 45%, rgba(79, 246, 255, 0.5) 55%, transparent 75%);
}

body[data-faction="transformation"] .realm-doors-open .realm-login-panel.realm-auth-content::after {
    background: linear-gradient(120deg, transparent 25%, rgba(141, 91, 255, 0.55) 45%, rgba(255, 51, 102, 0.35) 55%, transparent 75%);
}

@keyframes realm-portal-glow {
    0%, 100% { box-shadow: 0 0 40px rgba(79, 246, 255, 0.2), 0 0 80px rgba(141, 91, 255, 0.15), 0 0 120px rgba(141, 91, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.08); }
    50% { box-shadow: 0 0 55px rgba(79, 246, 255, 0.35), 0 0 110px rgba(141, 91, 255, 0.25), 0 0 160px rgba(141, 91, 255, 0.12), inset 0 1px 0 rgba(255,255,255,0.1); }
}

@keyframes realm-portal-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.realm-close-doors-btn {
    position: static;
    align-self: flex-start;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    padding: 0.45rem 0.7rem;
}

#step-account {
    position: relative;
    z-index: 1;
}

#step-account .auth-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding-top: 0;
}

.realm-auth-header-simple {
    text-align: left;
}

.realm-panel-title {
    display: block;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.realm-panel-subtitle {
    margin-bottom: 0;
    padding-inline: 0;
    max-width: 28rem;
}

/* ===== Login panel: kingdom gate — larger type, grandeur ===== */
.realm-auth-content {
    border-radius: 16px;
    padding: 1.75rem 1.5rem 1.5rem;
}

#step-account .auth-title {
    font-size: 1.65rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

#step-account .auth-subtitle {
    font-size: 1.05rem;
    line-height: 1.4;
    color: #e0e6f5;
    font-weight: 500;
}

#step-account .realm-google-caption,
#step-account .auth-divider span {
    font-size: 1.05rem;
    font-weight: 600;
    color: #d4daf2;
}

#step-account .auth-divider {
    margin: 1.25rem 0;
}

#step-account .form-label {
    font-size: 1rem;
    color: #c2cce8;
}

#step-account .auth-footer .text-muted,
#step-account .auth-footer .btn-link {
    font-size: 1.05rem;
}

#step-account .auth-footer .btn-link {
    font-weight: 600;
}

#step-account .form-input {
    font-size: 1rem;
    padding: 0.65rem 0.85rem;
}

#step-account .realm-email-toggle span {
    font-size: 1rem;
}

/* Form inputs - gamer style */
.realm-auth-content .form-input {
    background: rgba(6, 10, 18, 0.9);
    border: 1px solid rgba(79, 246, 255, 0.25);
    color: #e8ecff;
    border-radius: 8px;
}

.realm-auth-content .form-input:focus {
    border-color: var(--realm-cyan);
    box-shadow: 0 0 12px rgba(79, 246, 255, 0.25);
}

.realm-auth-content .form-label {
    color: #b8c4e8;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Reserve button - gamer primary */
.realm-auth-content .register-button:not(:disabled) {
    background: linear-gradient(135deg, var(--realm-violet) 0%, #6d3fd4 100%);
    border: 1px solid rgba(79, 246, 255, 0.3);
    box-shadow: 0 0 20px rgba(141, 91, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

.realm-auth-content .register-button:not(:disabled):hover {
    box-shadow: 0 0 28px rgba(141, 91, 255, 0.5), 0 0 40px rgba(79, 246, 255, 0.2);
    transform: translateY(-2px);
}

.realm-auth-content .register-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(80, 80, 100, 0.5);
    border-color: rgba(100, 100, 120, 0.3);
}

.realm-auth-content .login-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(80, 80, 100, 0.5);
    border-color: rgba(100, 100, 120, 0.3);
}

.realm-auth-content .auth-title {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.realm-auth-content .auth-title i {
    color: var(--realm-gold);
}

.realm-auth-content .auth-subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 500;
}

/* ===== Faction background video tinting ===== */
body[data-faction="creation"] .realm-bg-video {
    filter: saturate(1.1) contrast(1.02) brightness(0.52) hue-rotate(-5deg);
}

body[data-faction="transformation"] .realm-bg-video {
    filter: saturate(1.15) contrast(1.08) brightness(0.45) hue-rotate(5deg);
}

body[data-faction="creation"] .realm-bg-overlay {
    background: radial-gradient(ellipse at 50% 40%, rgba(20, 28, 48, 0.5) 0%, rgba(8, 14, 24, 0.78) 60%, rgba(4, 6, 14, 0.92) 100%);
}

body[data-faction="transformation"] .realm-bg-overlay {
    background: radial-gradient(ellipse at 50% 40%, rgba(12, 6, 24, 0.55) 0%, rgba(6, 4, 14, 0.82) 60%, rgba(3, 2, 8, 0.95) 100%);
}

/* ===== Faction themes: Creation (Synthia) vs Transformation (Syntheos) ===== */
body[data-faction="creation"] .realm-auth-content,
body[data-faction="creation"] .realm-avatar-dossier,
body[data-faction="creation"] .realm-adjust-section,
body[data-faction="creation"] .realm-portrait-list {
    --realm-faction-accent: var(--realm-cyan);
    --realm-faction-accent-2: var(--realm-gold);
    --realm-faction-bg: rgba(14, 20, 36, 0.95);
    --realm-faction-border: rgba(79, 246, 255, 0.35);
    --realm-faction-glow: rgba(79, 246, 255, 0.15);
}

/* Creation: warm, luminous, hopeful */
body[data-faction="creation"] .realm-auth-content {
    background: linear-gradient(180deg, rgba(28, 32, 48, 0.97) 0%, rgba(18, 24, 38, 0.98) 50%, rgba(14, 20, 36, 0.98) 100%);
    border: 1px solid rgba(79, 246, 255, 0.5);
    box-shadow:
        0 0 40px rgba(79, 246, 255, 0.18),
        0 0 80px rgba(242, 198, 109, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(79, 246, 255, 0.08);
}

body[data-faction="creation"] #step-account .auth-title {
    color: #f4f6ff;
    text-shadow: 0 0 20px rgba(79, 246, 255, 0.25);
}

body[data-faction="creation"] #step-account .auth-title i {
    color: var(--realm-gold);
    text-shadow: 0 0 12px rgba(242, 198, 109, 0.5);
}

body[data-faction="creation"] #step-account .auth-subtitle {
    color: #e8ecf8;
}

body[data-faction="creation"] #step-account .realm-google-caption,
body[data-faction="creation"] #step-account .auth-divider span {
    color: #d8e0f5;
}

body[data-faction="creation"] .realm-auth-content::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(242, 198, 109, 0.12) 0%, transparent 50%),
                url("../wwwroot/joinsynthia.png") center/cover no-repeat;
    opacity: 0.06;
    pointer-events: none;
    border-radius: inherit;
}

body[data-faction="transformation"] .realm-auth-content,
body[data-faction="transformation"] .realm-avatar-dossier,
body[data-faction="transformation"] .realm-adjust-section,
body[data-faction="transformation"] .realm-portrait-list {
    --realm-faction-accent: var(--realm-violet);
    --realm-faction-accent-2: var(--realm-red);
    --realm-faction-bg: rgba(8, 6, 18, 0.96);
    --realm-faction-border: rgba(141, 91, 255, 0.45);
    --realm-faction-glow: rgba(141, 91, 255, 0.2);
}

/* Transformation: deep, shadowy, imposing */
body[data-faction="transformation"] .realm-auth-content {
    background: linear-gradient(180deg, rgba(10, 6, 22, 0.98) 0%, rgba(6, 4, 14, 0.99) 50%, rgba(4, 2, 10, 0.99) 100%);
    border: 1px solid rgba(141, 91, 255, 0.55);
    box-shadow:
        0 0 45px rgba(141, 91, 255, 0.22),
        0 0 90px rgba(255, 51, 102, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(141, 91, 255, 0.15);
}

body[data-faction="transformation"] #step-account .auth-title {
    color: #f0eef8;
    text-shadow: 0 0 24px rgba(141, 91, 255, 0.35);
}

body[data-faction="transformation"] #step-account .auth-title i {
    color: var(--realm-violet);
    text-shadow: 0 0 14px rgba(141, 91, 255, 0.6);
}

body[data-faction="transformation"] #step-account .auth-subtitle {
    color: #c8c4e0;
}

body[data-faction="transformation"] #step-account .realm-google-caption,
body[data-faction="transformation"] #step-account .auth-divider span {
    color: #b8b0d8;
}

body[data-faction="transformation"] .realm-auth-content::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 100% 70% at 50% -10%, rgba(141, 91, 255, 0.15) 0%, transparent 45%),
                url("../wwwroot/joinsyntheos.png") center/cover no-repeat;
    opacity: 0.06;
    pointer-events: none;
    border-radius: inherit;
}

body[data-faction="creation"] .realm-login-panel.realm-auth-content::before,
body[data-faction="transformation"] .realm-login-panel.realm-auth-content::before {
    display: none;
}

body[data-faction="creation"] .realm-panel-title {
    text-shadow: 0 0 18px rgba(79, 246, 255, 0.22);
}

body[data-faction="transformation"] .realm-panel-title {
    text-shadow: 0 0 20px rgba(141, 91, 255, 0.3);
}

body[data-faction="creation"] .realm-reveal-copy,
body[data-faction="creation"] .realm-reveal-benefit {
    border-color: rgba(79, 246, 255, 0.2);
}

body[data-faction="transformation"] .realm-reveal-copy,
body[data-faction="transformation"] .realm-reveal-benefit {
    border-color: rgba(141, 91, 255, 0.24);
}

body[data-faction="creation"] #step-account .form-label {
    color: #b8c4e8;
}

body[data-faction="transformation"] #step-account .form-label {
    color: #b0a8d0;
}

body[data-faction="transformation"] #step-account .auth-footer .text-muted {
    color: #a8a0c8;
}

body[data-faction="transformation"] #step-account .auth-footer .btn-link {
    color: #c4b8f0;
}

body[data-faction="creation"] .realm-auth-content .form-input:focus {
    border-color: var(--realm-cyan);
    box-shadow: 0 0 12px rgba(79, 246, 255, 0.3);
}

body[data-faction="transformation"] .realm-auth-content .form-input:focus {
    border-color: var(--realm-violet);
    box-shadow: 0 0 12px rgba(141, 91, 255, 0.35);
}

body[data-faction="creation"] .realm-auth-content .register-button:not(:disabled),
body[data-faction="creation"] .realm-auth-content .login-button:not(:disabled) {
    background: linear-gradient(135deg, var(--realm-cyan) 0%, #3ab8c4 100%);
    border-color: rgba(242, 198, 109, 0.4);
}

body[data-faction="transformation"] .realm-auth-content .register-button:not(:disabled),
body[data-faction="transformation"] .realm-auth-content .login-button:not(:disabled) {
    background: linear-gradient(135deg, var(--realm-violet) 0%, #6d2fd4 100%);
    border-color: rgba(255, 51, 102, 0.3);
}

body[data-faction="creation"] .realm-portrait-frame {
    border-color: var(--realm-cyan);
}

body[data-faction="transformation"] .realm-portrait-frame {
    border-color: var(--realm-violet);
}

body[data-faction="creation"] .realm-dossier-label {
    color: var(--realm-cyan);
}

body[data-faction="transformation"] .realm-dossier-label {
    color: var(--realm-violet);
}

body[data-faction="creation"] .realm-adjust-section {
    border-color: rgba(79, 246, 255, 0.25);
}

body[data-faction="transformation"] .realm-adjust-section {
    border-color: rgba(141, 91, 255, 0.3);
}

body[data-faction="creation"] .realm-celebrate-portrait {
    border-color: var(--realm-gold);
}

body[data-faction="transformation"] .realm-celebrate-portrait {
    border-color: var(--realm-violet);
}

.realm-dot {
    color: var(--text-muted);
    margin: 0 0.4rem;
}

#googleSigninPlaceholder {
    margin: 0.75rem 0 0.2rem;
    padding: 0.6rem;
    text-align: center;
    border: 1px solid rgba(79, 246, 255, 0.3);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.realm-social-section {
    margin-bottom: 0.8rem;
}

.realm-social-section .form-group {
    margin-bottom: 0.5rem;
}

.realm-email-section .form-group {
    margin-bottom: 0.75rem;
}

.form-label-hint {
    font-weight: 400;
    color: var(--realm-gold);
    font-size: 0.9em;
}

.realm-last-google-line {
    color: var(--realm-gold);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.realm-google-caption {
    color: #d7ddf7;
    margin: 0.4rem 0 0.5rem;
    font-weight: 600;
}

/* ===== Collapsible email/password section ===== */
.realm-email-toggle {
    cursor: pointer;
    user-select: none;
}

.realm-email-toggle:hover span {
    color: var(--realm-cyan);
}

.realm-toggle-icon {
    font-size: 0.7em;
    margin-left: 0.3rem;
    transition: transform 0.3s ease;
}

.realm-email-toggle.open .realm-toggle-icon {
    transform: rotate(180deg);
}

.realm-email-collapse {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.realm-email-collapse.open {
    max-height: 400px;
    opacity: 1;
}

.realm-thankyou-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 15%, rgba(79, 246, 255, 0.18), transparent 42%),
        radial-gradient(circle at 82% 82%, rgba(141, 91, 255, 0.2), transparent 44%),
        #060811;
}

.realm-thankyou-card {
    width: min(720px, 92vw);
    background: rgba(12, 16, 30, 0.94);
    border: 1px solid rgba(79, 246, 255, 0.35);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 0 30px rgba(79, 246, 255, 0.12);
}

.realm-thankyou-icon {
    font-size: 2rem;
    color: var(--realm-gold);
    margin-bottom: 0.8rem;
}

.realm-thankyou-card h1 {
    margin-bottom: 0.8rem;
    color: #ffffff;
}

.realm-thankyou-card p {
    color: #d5dbf8;
}

.realm-thankyou-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* ===== Unfold animation ===== */
.realm-unfold {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin 0.4s ease;
    margin-top: 0;
}

.realm-unfold.realm-unfold-open {
    max-height: 600px;
    opacity: 1;
    margin-top: 1rem;
}

.realm-section-title {
    color: var(--realm-gold);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

/* ===== Preset chips ===== */
.realm-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.realm-chip {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    border: 1px solid rgba(79, 246, 255, 0.35);
    background: rgba(79, 246, 255, 0.08);
    color: #c8dfff;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.realm-chip:hover {
    background: rgba(79, 246, 255, 0.2);
    border-color: var(--realm-cyan);
    color: #fff;
}

.realm-chip.active {
    background: var(--realm-violet);
    border-color: var(--realm-violet);
    color: #fff;
}

/* ===== Avatar creation: portrait list + dossier ===== */
.realm-avatar-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    min-height: 0;
    align-items: flex-start;
}

.realm-portrait-list {
    flex-shrink: 0;
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: rgba(9, 11, 18, 0.6);
    border: 1px solid rgba(141, 91, 255, 0.25);
    border-radius: 10px;
    overflow: hidden;
}

.realm-portrait-list-label {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--realm-gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(141, 91, 255, 0.2);
    flex-shrink: 0;
}

.realm-portrait-list-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    min-height: 120px;
    max-height: 340px;
    align-items: center;
    justify-content: flex-start;
}

/* Avatar step: header with title + logout side by side */
#step-avatar .auth-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    text-align: left;
}

#step-avatar .auth-header .auth-title {
    flex: 1;
    justify-content: flex-start;
    margin-bottom: 0;
}

#step-avatar .auth-header .realm-logout-btn {
    margin-top: 0;
    flex-shrink: 0;
}

.realm-portrait-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.realm-portrait-list-scroll::-webkit-scrollbar-track {
    background: rgba(4, 6, 14, 0.6);
    border-radius: 3px;
}

.realm-portrait-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(141, 91, 255, 0.4);
    border-radius: 3px;
}

.realm-avatar-dossier {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    align-items: flex-start;
    background: rgba(9, 11, 18, 0.7);
    border: 1px solid rgba(79, 246, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(79, 246, 255, 0.06), inset 0 1px 0 rgba(255,255,255,0.03);
}

.realm-portrait-column {
    width: 210px;
    min-width: 210px;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.realm-dossier-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-self: stretch;
}

.realm-dossier-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.realm-dossier-row.realm-dossier-full {
    flex-direction: column;
    gap: 0.2rem;
}

.realm-dossier-label {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--realm-cyan);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 70px;
}

.realm-dossier-value {
    font-size: 0.88rem;
    color: #c8cfea;
    line-height: 1.45;
}

.realm-dossier-value.realm-dossier-motto {
    font-style: italic;
    color: var(--realm-gold);
}

.realm-dossier-row.realm-dossier-full .realm-dossier-value {
    max-height: 80px;
    overflow-y: auto;
}

.realm-portrait-frame {
    position: relative;
    width: 180px;
    min-width: 180px;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--realm-violet);
    background: #0a0c14;
    flex-shrink: 0;
    align-self: flex-start;
}

.realm-portrait-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.realm-portrait-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    z-index: 1;
    background: #060914;
}

.realm-portrait-video.hidden {
    display: none;
}

.realm-portrait-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: rgba(6, 8, 17, 0.85);
    color: var(--realm-cyan);
    font-size: 0.9rem;
    z-index: 3;
    text-align: center;
    padding: 0.5rem;
}

.realm-portrait-spinner.hidden { display: none; }

.realm-casino-wheel {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.2s ease;
    background:
        conic-gradient(
            from 0deg,
            rgba(79, 246, 255, 0.9) 0deg 24deg,
            rgba(242, 198, 109, 0.95) 24deg 48deg,
            rgba(141, 91, 255, 0.95) 48deg 72deg,
            rgba(79, 246, 255, 0.9) 72deg 96deg,
            rgba(242, 198, 109, 0.95) 96deg 120deg,
            rgba(141, 91, 255, 0.95) 120deg 144deg,
            rgba(79, 246, 255, 0.9) 144deg 168deg,
            rgba(242, 198, 109, 0.95) 168deg 192deg,
            rgba(141, 91, 255, 0.95) 192deg 216deg,
            rgba(79, 246, 255, 0.9) 216deg 240deg,
            rgba(242, 198, 109, 0.95) 240deg 264deg,
            rgba(141, 91, 255, 0.95) 264deg 288deg,
            rgba(79, 246, 255, 0.9) 288deg 312deg,
            rgba(242, 198, 109, 0.95) 312deg 336deg,
            rgba(141, 91, 255, 0.95) 336deg 360deg
        );
    mix-blend-mode: screen;
    box-shadow: 0 0 26px rgba(79, 246, 255, 0.35);
    -webkit-mask: radial-gradient(circle, transparent 56%, #000 63%, #000 74%, transparent 81%);
    mask: radial-gradient(circle, transparent 56%, #000 63%, #000 74%, transparent 81%);
}

.realm-casino-wheel.hidden { display: none; }

.realm-portrait-frame.video-rolling .realm-casino-wheel {
    opacity: 0.95;
    animation: realm-casino-spin 0.7s linear infinite;
}

.realm-portrait-frame.video-rolling img {
    animation: realm-video-roll-pulse 1.2s ease-in-out infinite;
    filter: saturate(1.15) contrast(1.06);
}

@keyframes realm-casino-spin {
    from { transform: rotate(0deg) scale(0.98); }
    to { transform: rotate(360deg) scale(1.02); }
}

@keyframes realm-video-roll-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.realm-video-roll-status {
    margin: 0 0 0.55rem;
    font-size: 0.85rem;
    color: #cfe6ff;
}

.realm-dice-status {
    margin: 0 0 0.55rem;
    font-size: 0.85rem;
    color: #cfe6ff;
}

.realm-video-roll-status.realm-video-roll-error {
    color: #ff9da8;
}

.realm-positivity-section {
    background: linear-gradient(135deg, rgba(242, 198, 109, 0.09), rgba(79, 246, 255, 0.05));
    border-color: rgba(242, 198, 109, 0.35);
    cursor: pointer;
}

.realm-positivity-balance {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.05em;
}

.success-notification.realm-coder-toast {
    max-width: 700px;
    background:
        linear-gradient(135deg, rgba(6, 10, 18, 0.32), rgba(6, 10, 18, 0.74)),
        url("../wwwroot/realm_coder_toast_bg.png") center center / cover no-repeat;
    border: 1px solid rgba(242, 198, 109, 0.55);
    box-shadow: 0 0 28px rgba(79, 246, 255, 0.18), 0 0 40px rgba(141, 91, 255, 0.16);
}

.success-notification.realm-coder-toast .success-content {
    align-items: flex-start;
    min-height: 156px;
    padding: 1rem 1rem 1.05rem;
    background: linear-gradient(180deg, rgba(3, 8, 18, 0.22), rgba(3, 8, 18, 0.46));
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.success-notification.realm-coder-toast .success-message {
    line-height: 1.45;
    font-weight: 600;
    white-space: normal;
}

.realm-dice-row {
    align-items: center;
    flex-wrap: wrap;
}

.realm-dice-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    justify-content: flex-start;
}

.realm-die {
    width: 72px;
    min-width: 72px;
    height: 72px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    color: #f7fbff;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.realm-die:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.03);
}

.realm-die:disabled {
    cursor: not-allowed;
}

.realm-die.is-spent {
    opacity: 0.34;
    filter: grayscale(0.5);
    box-shadow: none;
}

.realm-die-image {
    border-color: rgba(79, 246, 255, 0.45);
    background: linear-gradient(180deg, rgba(79, 246, 255, 0.22), rgba(10, 22, 38, 0.95));
}

.realm-die-image:hover:not(:disabled) {
    border-color: var(--realm-cyan);
    box-shadow: 0 0 18px rgba(79, 246, 255, 0.28);
}

.realm-die-video {
    border-color: rgba(141, 91, 255, 0.5);
    background: linear-gradient(180deg, rgba(141, 91, 255, 0.26), rgba(24, 10, 38, 0.96));
}

.realm-die-video:hover:not(:disabled) {
    border-color: var(--realm-violet);
    box-shadow: 0 0 18px rgba(141, 91, 255, 0.28);
}

.realm-die-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.realm-die-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.realm-die-cost {
    font-size: 0.65rem;
    color: var(--realm-gold);
}

.realm-video-roll-row {
    align-items: center;
    flex-wrap: wrap;
}

.realm-video-roll-row .btn-link {
    color: var(--realm-cyan);
    font-size: 0.85rem;
    white-space: nowrap;
}

.realm-portrait-video-roll {
    margin-bottom: 0;
    padding: 0.55rem;
}

.realm-avatar-bio {
    flex: 1;
    min-width: 0;
}

.realm-avatar-bio h3 {
    color: var(--realm-cyan);
    margin-bottom: 0.4rem;
}

.realm-avatar-bio p {
    color: #c8cfea;
    font-size: 0.88rem;
    line-height: 1.5;
    max-height: 140px;
    overflow-y: auto;
}

/* ===== Adjust sections ===== */
.realm-adjust-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(9, 11, 18, 0.5);
    border: 1px solid rgba(141, 91, 255, 0.2);
    border-radius: 8px;
}

.realm-adjust-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #b0b8d8;
}

.realm-remaining {
    color: var(--realm-gold);
    font-weight: 600;
}

.realm-adjust-row {
    display: flex;
    gap: 0.5rem;
}

.realm-adjust-row .form-input {
    flex: 1;
}

.realm-adjust-row .btn {
    flex-shrink: 0;
}

.realm-verification-panel {
    margin-top: 1rem;
    padding: 0.85rem;
    background: rgba(79, 246, 255, 0.08);
    border: 1px solid rgba(79, 246, 255, 0.3);
    border-radius: 10px;
}

.realm-verification-panel h3 {
    color: var(--realm-cyan);
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.realm-verification-panel p {
    color: #d7ddf7;
    margin-bottom: 0.7rem;
}

.realm-out-of-tokens {
    margin-top: 1rem;
    padding: 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(242, 198, 109, 0.4);
    background: rgba(242, 198, 109, 0.08);
}

.realm-out-of-tokens h4 {
    color: var(--realm-gold);
    margin-bottom: 0.35rem;
}

.realm-out-of-tokens p {
    color: #f1e8d2;
    margin-bottom: 0.8rem;
}

.realm-logout-btn {
    margin-top: 0.75rem;
}

/* ===== Portrait gallery (vertical list) ===== */
.realm-portrait-list-scroll .realm-gallery-thumb {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    max-width: 72px;
    max-height: 72px;
    flex: 0 0 72px;
    flex-shrink: 0;
    align-self: center;
    box-sizing: border-box;
}

.realm-gallery-thumb {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(141, 91, 255, 0.3);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    box-sizing: border-box;
    background: #0a0c14;
    position: relative;
}

.realm-gallery-thumb:hover {
    border-color: var(--realm-cyan);
    transform: scale(1.05);
    transform-origin: center center;
}

.realm-gallery-thumb.selected {
    border-color: var(--realm-gold);
    box-shadow: 0 0 10px rgba(242, 198, 109, 0.5);
}

.realm-gallery-thumb img {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
    vertical-align: top;
}

.realm-gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    background: #050813;
}

.realm-gallery-thumb-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfd8ff;
    background: linear-gradient(135deg, rgba(79, 246, 255, 0.15), rgba(141, 91, 255, 0.18));
    font-size: 1.25rem;
}

.realm-gallery-thumb-badge {
    position: absolute;
    right: 4px;
    top: 4px;
    font-size: 0.62rem;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(3, 8, 18, 0.85);
    border: 1px solid rgba(109, 228, 255, 0.35);
    color: #bdf4ff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Celebration ===== */
.realm-celebrate {
    text-align: center;
    padding: 1.5rem 1rem;
}

.realm-celebrate-icon {
    font-size: 3rem;
    color: var(--realm-gold);
    margin-bottom: 0.8rem;
    animation: realm-glow 2s ease-in-out infinite alternate;
}

@keyframes realm-glow {
    from { text-shadow: 0 0 10px rgba(242, 198, 109, 0.4); }
    to { text-shadow: 0 0 30px rgba(242, 198, 109, 0.8), 0 0 60px rgba(79, 246, 255, 0.3); }
}

.realm-celebrate h1 {
    color: var(--realm-cyan);
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.realm-celebrate-subtitle {
    color: var(--realm-gold);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.realm-celebrate p {
    color: #c8cfea;
}

.realm-celebrate-portrait {
    margin: 1.25rem auto;
    width: 200px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--realm-gold);
    box-shadow: 0 0 20px rgba(242, 198, 109, 0.3);
}

.realm-celebrate-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Loading overlay with funny sayings ===== */
.realm-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(4, 6, 14, 0.72);
    backdrop-filter: blur(6px);
}

.realm-loading-overlay.hidden {
    display: none;
}

.realm-loading-card {
    width: min(560px, 100%);
    text-align: center;
    max-width: 560px;
    padding: 1.75rem 1.5rem;
    background: linear-gradient(180deg, rgba(14, 18, 32, 0.96) 0%, rgba(8, 10, 20, 0.98) 100%);
    border: 1px solid rgba(79, 246, 255, 0.28);
    border-radius: 18px;
    box-shadow: 0 0 36px rgba(79, 246, 255, 0.12), 0 0 70px rgba(141, 91, 255, 0.1);
}

.realm-loading-spinner {
    font-size: 2.5rem;
    color: var(--realm-cyan);
    margin-bottom: 1rem;
    animation: realm-glow 2s ease-in-out infinite alternate;
}

.realm-loading-message {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.9rem;
}

.realm-loading-saying {
    color: var(--realm-gold);
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.35;
    min-height: 2.7em;
    text-shadow: 0 0 18px rgba(242, 198, 109, 0.5), 0 0 40px rgba(79, 246, 255, 0.15);
    animation: realm-saying-pulse 2.5s ease-in-out infinite alternate;
}

@keyframes realm-saying-pulse {
    from { opacity: 0.85; transform: scale(1); }
    to { opacity: 1; transform: scale(1.03); }
}

/* ===== Copy collapse (avatar flow) ===== */
.realm-copy-collapsed {
    display: none;
}

.realm-hero-row-collapsed {
    overflow: visible;
    min-height: auto;
}

.realm-hero-row-collapsed .realm-hero-card {
    display: none;
}

.realm-hero-row-collapsed .realm-login-panel {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: none !important;
    z-index: auto;
    visibility: visible !important;
    max-width: 100%;
}

.realm-hero-row-collapsed .realm-auth-content {
    width: min(920px, 94vw) !important;
    max-width: 100% !important;
    flex: 1;
    margin: 0 auto;
    animation: none !important;
    overflow: visible;
}

.realm-hero-row-collapsed .realm-auth-content::after {
    display: none !important;
}

.realm-hero-row-collapsed .realm-auth-content .realm-avatar-dossier .realm-portrait-frame {
    width: 180px;
    min-width: 180px;
    height: 180px;
}

/* ===== Large screens: show all 3 columns ===== */
@media (max-width: 1280px) {
    .realm-hero-card {
        width: 240px;
    }

    .realm-reveal-benefits {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .realm-doors-container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        min-height: auto;
        overflow: visible;
    }

    .realm-hero-card.realm-door {
        max-width: 100%;
        width: 100%;
        min-height: 0;
        flex: 0 0 auto;
    }

    .realm-door-column {
        max-width: 100%;
        width: min(640px, 100%);
        min-height: auto;
    }

    .realm-doors-open .realm-door-column-left,
    .realm-doors-open .realm-door-column-right {
        transform: none;
    }

    .realm-login-panel {
        display: none;
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        opacity: 0;
        pointer-events: auto;
        width: min(940px, 100%);
        max-width: 100%;
    }

    .realm-doors-open .realm-login-panel {
        display: block;
        opacity: 1;
        animation: none;
    }

    .realm-hero-row {
        justify-content: center;
    }

    .realm-layout {
        width: min(760px, 92vw);
        margin: 1rem auto;
        gap: 1rem;
    }

    body[data-avatar-page="true"] .realm-layout {
        width: min(1040px, 96vw);
    }

    body[data-avatar-page="true"] .realm-avatar-page-content {
        width: 100%;
        max-width: 100%;
    }

    .realm-error-page-content {
        grid-template-columns: 1fr;
    }

    .realm-auth-content {
        max-width: 100%;
    }

    .realm-reveal-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .realm-reveal-copy {
        order: 2;
        padding: 1rem;
    }

    .realm-reveal-auth {
        order: 1;
    }

    .realm-reveal-auth #step-account {
        max-width: 100%;
        margin-left: 0;
    }

    .realm-avatar-row {
        flex-direction: column;
    }

    .realm-portrait-list {
        width: 100%;
        max-height: 180px;
    }

    .realm-portrait-list-scroll {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        min-height: 0;
    }

    .realm-avatar-dossier {
        flex-direction: column;
        align-items: center;
    }

    .realm-portrait-column {
        width: 100%;
        min-width: 0;
    }

    .realm-avatar-dossier .realm-portrait-frame {
        width: 160px;
        min-width: 160px;
        height: 160px;
    }
}

/* Mobile-first signup */
@media (max-width: 640px) {
    .realm-doors-container {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.35rem;
        min-height: auto;
    }

    .realm-door-column {
        width: 50%;
        max-width: 50%;
        min-height: auto;
        gap: 0.35rem;
        transform-origin: top center;
        animation: realm-mobile-door-settle 220ms ease-out both;
    }

    @keyframes realm-mobile-door-settle {
        from { transform: scale(0.98); }
        to { transform: scale(0.9); }
    }

    .realm-hero-card.realm-door {
        aspect-ratio: 0.64;
    }

    .realm-layout {
        width: 100%;
        padding: 0 0.75rem;
        margin: 0.75rem 0;
    }

    body[data-avatar-page="true"] .realm-layout {
        width: 100%;
        margin: 0.75rem 0;
    }

    .realm-error-page-content,
    .realm-username-page-content {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
    }

    .realm-signup-header {
        padding-inline: 1rem;
    }

    .realm-signup-hero-subtitle {
        font-size: 0.95rem;
    }

    .realm-door-title-link {
        min-width: 100%;
        font-size: 0.72rem;
        letter-spacing: 0.08em;
        padding: 0.48rem 0.45rem;
    }

    .realm-panel-subtitle {
        padding-inline: 0;
    }

    .realm-auth-content {
        padding: 1rem;
    }

    .realm-reveal-copy {
        padding: 0.9rem;
    }

    .realm-reveal-copy h3 {
        font-size: 1.45rem;
    }

    .realm-reveal-benefit p {
        font-size: 0.9rem;
    }

    .realm-loading-overlay {
        padding: 1rem;
    }

    .realm-loading-card {
        padding: 1.35rem 1.1rem;
        border-radius: 16px;
    }

    .realm-loading-spinner {
        font-size: 2.1rem;
        margin-bottom: 0.85rem;
    }

    .realm-loading-message {
        font-size: 1rem;
    }

    .realm-loading-saying {
        min-height: 2.4em;
    }

    .realm-google-primary .google-signin-button {
        max-width: 100%;
    }

    .realm-google-primary .google-signin-button > div {
        width: 100% !important;
    }
}

@media (hover: none) {
    .realm-copy {
        box-shadow: 0 0 24px rgba(79, 246, 255, 0.06), 0 0 44px rgba(141, 91, 255, 0.06), inset 0 1px 0 rgba(255,255,255,0.04);
    }
}

@media (max-width: 480px) {
    .realm-layout {
        padding: 0 0.5rem;
    }

    .realm-door-column {
        gap: 0.4rem;
    }

    .realm-hero-card.realm-door {
        aspect-ratio: 0.6;
    }

    .realm-door-cta {
        min-width: calc(100% - 2rem);
        bottom: 1rem;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }

    .realm-auth-content {
        padding: 0.875rem;
    }

    .auth-title {
        font-size: 1.15rem;
    }

    #step-account .auth-title {
        font-size: 1.4rem;
    }

    #step-account .auth-subtitle {
        font-size: 1rem;
    }

    .realm-die {
        width: 64px;
        min-width: 64px;
        height: 64px;
    }
}
