﻿/* 登入 / 註冊 */
.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 26px 26px 22px;
    box-sizing: border-box;
    justify-self: center;
    align-self: center;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(14, 10, 32, 0.96), rgba(6, 8, 22, 0.98));
    border: 1px solid rgba(150, 110, 255, 0.28);
    border-radius: 20px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-align: left;
}

/* —— 登入頁全屏舞台 · 語言 · 左右卡牆 —— */
#screen-auth {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
}

html:has(#screen-auth:not(.hidden)),
body:has(#screen-auth:not(.hidden)) {
    overflow: hidden;
    height: 100%;
    max-height: 100dvh;
}

.auth-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-ambient-aurora {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(ellipse 42% 55% at 2% 42%, rgba(127, 0, 255, 0.42), transparent 58%),
        radial-gradient(ellipse 38% 50% at 98% 48%, rgba(255, 0, 128, 0.36), transparent 56%),
        radial-gradient(ellipse 35% 45% at 6% 78%, rgba(0, 255, 200, 0.2), transparent 52%),
        radial-gradient(ellipse 35% 45% at 94% 22%, rgba(255, 215, 0, 0.18), transparent 52%),
        radial-gradient(ellipse 40% 35% at 50% 100%, rgba(0, 255, 255, 0.12), transparent 50%);
    animation: authAuroraDrift 18s ease-in-out infinite alternate;
    filter: blur(40px);
}

.auth-ambient-sparkles {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(1px 1px at 28% 72%, rgba(255, 215, 0, 0.85), transparent),
        radial-gradient(1.5px 1.5px at 72% 22%, rgba(0, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 88% 78%, rgba(255, 110, 199, 0.85), transparent),
        radial-gradient(1px 1px at 48% 42%, rgba(192, 132, 252, 0.75), transparent);
    animation: authSparkleTwinkle 5s ease-in-out infinite;
}

@keyframes authAuroraDrift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(3%, -2%) scale(1.06); }
}

@keyframes authSparkleTwinkle {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.auth-top-bar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    padding: 14px 18px;
    pointer-events: none;
}

.auth-lang-wrap {
    pointer-events: auto;
    background: rgba(8, 6, 20, 0.82);
    border: 1px solid rgba(163, 112, 247, 0.55);
    border-radius: 999px;
    padding: 6px 12px 6px 10px;
    box-shadow: 0 0 20px rgba(127, 0, 255, 0.35);
    backdrop-filter: blur(10px);
}

.auth-layout {
    position: relative;
    z-index: 12;
    pointer-events: auto;
}

/* 登入頁標題區 · 提高對比與銳利度 */
.auth-hero {
    font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.auth-hero-copy {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: min(100%, 480px);
    margin: 0 auto 14px;
    padding: 14px 18px 16px;
    box-sizing: border-box;
    border-radius: 14px;
    background: rgba(6, 4, 20, 0.78);
    border: 1px solid rgba(163, 112, 247, 0.32);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
}

.auth-rainbow-text {
    background: linear-gradient(
        105deg,
        #ff3d9a 0%,
        #ffd700 12%,
        #7dff9a 24%,
        #00f0ff 36%,
        #c084fc 48%,
        #ff6b6b 60%,
        #ffd700 72%,
        #7df9ff 84%,
        #ff3d9a 100%
    );
    background-size: 320% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: authRainbowSweep 5s linear infinite;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 20px rgba(127, 0, 255, 0.45));
}

.auth-rainbow-text--title {
    margin: 0 0 12px;
    font-family: Orbitron, "Noto Sans TC", sans-serif;
    font-size: clamp(2.1rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: 0.16em;
    line-height: 1.15;
    text-transform: uppercase;
}

.auth-rainbow-text--tag {
    display: block;
    margin: 0 0 8px;
    font-family: Urbanist, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.35;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    animation: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.auth-rainbow-text--tag::-webkit-scrollbar {
    display: none;
}

@keyframes authRainbowSweep {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 320% 50%;
    }
}

.auth-hero-copy .auth-tag.auth-rainbow-text--tag {
    font-family: Urbanist, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-indent: 0;
    line-height: 1.35;
    text-transform: uppercase;
    text-shadow: none;
    color: transparent;
    background: linear-gradient(90deg, #f0e8ff 0%, #c9b0ff 38%, #88e4ff 72%, #e8d48a 100%);
    background-size: 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.auth-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.32em;
    color: #d4b8ff;
    margin: 0 0 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.auth-hero-copy .auth-tag {
    text-shadow: none;
}

.auth-title {
    margin: 0 0 12px;
    padding-inline: 6px;
    font-family: Urbanist, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
    font-size: clamp(26px, 5.5vw, 40px);
    font-weight: 800;
    letter-spacing: 0.14em;
    text-indent: 0.14em;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
    background: linear-gradient(90deg, #f5eeff 0%, #d4b8ff 38%, #9ae8ff 72%, #c4a0ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9));
}

.auth-sub {
    color: rgba(230, 238, 255, 0.95);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.75;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.auth-sub--single-line {
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.04em;
    font-size: clamp(11px, 2.2vw, 14px);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.auth-sub--single-line::-webkit-scrollbar {
    display: none;
}

.auth-sub strong,
.auth-tilt-hint strong {
    background: linear-gradient(
        90deg,
        #ffd700,
        #7dff9a,
        #00f0ff,
        #ff6ec7,
        #ffd700
    );
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: authRainbowSweep 4s linear infinite;
    font-weight: 900;
}

.auth-tilt-hint {
    position: relative;
    z-index: 2;
    font-size: 13px;
    font-weight: 700;
    margin: 10px auto 0;
    max-width: 360px;
    color: rgba(210, 228, 255, 0.92);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}


/* 中央主打稀有卡（兩側卡牆之間） */
.auth-preview-mount--featured {
    position: relative;
    z-index: 15;
    width: min(300px, 38vw);
    max-width: 100%;
    min-height: 400px;
    margin: 4px auto 0;
    overflow: visible;
}

.auth-preview-mount--featured::before {
    content: "";
    position: absolute;
    inset: -6%;
    z-index: -1;
    border-radius: 18px;
    background: conic-gradient(
        from 0deg,
        #ff3d9a,
        #ffd700,
        #7dff9a,
        #00f0ff,
        #c084fc,
        #ff3d9a
    );
    filter: blur(22px);
    opacity: 0.55;
    animation: authPreviewAuraSpin 8s linear infinite;
}

@keyframes authPreviewAuraSpin {
    to {
        transform: rotate(360deg);
    }
}

.auth-preview-mount--featured .card-temple-seal {
    display: none !important;
}

.auth-preview-mount {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: min(300px, 44vw);
    min-height: 360px;
    margin: 0 auto;
    cursor: pointer;
    filter: drop-shadow(0 20px 48px rgba(127, 0, 255, 0.45));
    transition: filter 0.2s ease, transform 0.2s ease;
}

.auth-preview-mount:hover {
    filter: drop-shadow(0 24px 56px rgba(0, 255, 255, 0.35));
    transform: translateY(-4px);
}

.auth-preview-mount .void-card-frame,
.auth-preview-mount .void-card-frame.auth-preview-card-art {
    width: min(280px, 100%);
    margin: 0 auto;
}

.auth-preview-mount .void-card-stage,
.auth-preview-mount .catalog-tile-3d {
    width: 100% !important;
    aspect-ratio: 2 / 3;
    min-height: 360px;
}

.auth-preview-mount--ready .void-card-img,
.auth-preview-mount--ready .catalog-tile-img {
    opacity: 1 !important;
    visibility: visible !important;
}

.auth-preview-mount .void-card-img,
.auth-preview-mount .catalog-tile-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
}

.auth-preview-mount .card-temple-seal {
    transform: scale(1.05);
    transform-origin: center bottom;
}

.auth-preview-mount--ready .void-card-stage.void-rainbow-shine-wrap {
    border-radius: 12px;
}

/* 登入主打卡 · 略強於圖鑑格 */
.void-card-stage.void-rainbow-holo-active--featured .void-card-holo.void-rainbow-holo::before,
.auth-preview-mount--ready .void-card-holo.void-rainbow-holo::before {
    mix-blend-mode: soft-light;
    opacity: 0.56;
}

.void-card-stage.void-rainbow-holo-active--featured .void-card-holo.void-rainbow-holo::after,
.auth-preview-mount--ready .void-card-holo.void-rainbow-holo::after {
    opacity: 0.36;
}

.void-card-stage.void-rainbow-holo-active--featured.void-rainbow-shine-wrap::after,
.auth-preview-mount--ready .void-rainbow-shine-wrap::after {
    animation-duration: 3.6s;
}

.auth-preview-mount--featured.auth-preview-mount--ready::before {
    opacity: 0.72;
    filter: blur(26px);
}

.auth-preview-loading,
.auth-preview-fallback {
    margin: 0;
    padding: 24px;
    font-size: 14px;
    font-weight: 700;
    color: rgba(220, 210, 255, 0.85);
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.auth-preview-mount:not(.auth-preview-mount--ready) .void-card-frame {
    opacity: 0;
}

.auth-box {
    position: relative;
    z-index: 25;
    pointer-events: auto;
}

.auth-wing {
    pointer-events: none;
    overflow: visible;
}

.auth-stage {
    position: relative;
    z-index: 2;
    pointer-events: auto;
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(260px, 340px)
        minmax(300px, 400px)
        minmax(180px, 1fr);
    gap: 8px 12px;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100%;
    height: 100%;
    padding: 56px 10px 28px;
    box-sizing: border-box;
    align-items: center;
}

.auth-center {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 14;
}

.auth-box {
    grid-column: 3;
    justify-self: center;
}

.auth-wing--left {
    grid-column: 1;
}

.auth-wing--right {
    grid-column: 4;
}

#screen-auth .auth-layout {
    max-width: none;
    width: auto;
    margin: 0;
    display: contents;
}

.auth-wing {
    --wing-card-w: 168px;
    --wing-card-h: 238px;
    position: relative;
    min-height: min(92vh, 820px);
    height: 100%;
    width: 100%;
    max-width: 460px;
    justify-self: center;
}

.auth-wing::before {
    content: "";
    position: absolute;
    inset: 4% 8%;
    z-index: 0;
    border-radius: 50%;
    background:
        radial-gradient(ellipse 70% 55% at 50% 45%, rgba(127, 0, 255, 0.22), transparent 68%),
        radial-gradient(ellipse 50% 40% at 20% 80%, rgba(0, 255, 255, 0.14), transparent 60%),
        radial-gradient(ellipse 45% 38% at 85% 20%, rgba(255, 0, 128, 0.16), transparent 58%);
    filter: blur(28px);
    animation: authWingGlowPulse 7s ease-in-out infinite alternate;
    pointer-events: none;
}

.auth-wing--left {
    justify-self: end;
}

.auth-wing--right {
    justify-self: start;
}

.auth-wing--left::before {
    background:
        radial-gradient(ellipse 70% 55% at 55% 45%, rgba(127, 0, 255, 0.26), transparent 68%),
        radial-gradient(ellipse 50% 40% at 15% 75%, rgba(0, 255, 200, 0.18), transparent 60%);
}

.auth-wing--right::before {
    background:
        radial-gradient(ellipse 70% 55% at 45% 45%, rgba(255, 0, 128, 0.24), transparent 68%),
        radial-gradient(ellipse 50% 40% at 85% 25%, rgba(255, 215, 0, 0.16), transparent 60%);
}

@keyframes authWingGlowPulse {
    0% { opacity: 0.65; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1.04); }
}

.auth-wing-slot {
    position: absolute;
    width: var(--wing-card-w);
    height: var(--wing-card-h);
    z-index: calc(1 + var(--wing-i, 0));
    filter: drop-shadow(0 16px 36px rgba(0, 0, 0, 0.72));
    animation: authWingFloat 5.5s ease-in-out infinite;
    animation-delay: calc(var(--wing-i, 0) * -0.55s);
    pointer-events: auto;
    cursor: default;
    will-change: margin-top;
    transition: filter 0.25s, z-index 0s;
    overflow: visible;
    border-radius: 10px;
}

.auth-wing-slot .void-card-frame,
.auth-wing-slot .void-card-frame.auth-wing-card-art {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    border-radius: inherit;
    perspective: 900px;
    transform-style: preserve-3d;
}

.auth-wing-slot .void-card-stage,
.auth-wing-slot .catalog-tile-3d {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 2 / 3;
    cursor: default;
}

.auth-wing-slot .void-card-stage.card-holo-tilt,
.auth-wing-slot .catalog-tile-3d.card-holo-tilt {
    transition: transform 0.1s ease-out;
}

.auth-wing-slot .void-card-stage.card-holo-tilt.is-tilt-rest,
.auth-wing-slot .catalog-tile-3d.card-holo-tilt.is-tilt-rest {
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.auth-wing-slot .void-card-img,
.auth-wing-slot .catalog-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.auth-wing-slot .card-temple-seal,
.auth-wing-slot .card-standard-footer,
.auth-wing-slot .card-gold-frame,
.auth-wing-slot .card-unified-header,
.auth-wing-slot .card-unified-body {
    display: none !important;
}

.auth-wing-slot:hover {
    z-index: 30;
    filter: drop-shadow(0 22px 48px rgba(127, 0, 255, 0.55));
}

.auth-wing-slot:hover .card-3d-wrap {
    transform: scale(1.04);
}

.auth-wing-slot .card-3d-wrap {
    width: var(--wing-card-w) !important;
    height: var(--wing-card-h) !important;
    margin: 0 auto;
    transition: transform 0.25s ease;
}

.auth-wing-slot .card-stars,
.auth-wing-slot .limited-tag {
    display: none !important;
}

.auth-wing-slot .rarity-emblem,
.auth-wing-slot .rarity-pill {
    transform: scale(0.92);
    transform-origin: top right;
}

.auth-wing-slot .card-standard-footer {
    font-size: 9px;
}

.auth-wing--left .auth-wing-slot--i0 { top: -1%; left: 0%; transform: rotate(-11deg); }
.auth-wing--left .auth-wing-slot--i1 { top: 10%; left: 44%; transform: rotate(6deg); }
.auth-wing--left .auth-wing-slot--i2 { top: 23%; left: 2%; transform: rotate(-7deg); }
.auth-wing--left .auth-wing-slot--i3 { top: 36%; left: 46%; transform: rotate(8deg); }
.auth-wing--left .auth-wing-slot--i4 { top: 49%; left: 0%; transform: rotate(-5deg); }
.auth-wing--left .auth-wing-slot--i5 { top: 62%; left: 42%; transform: rotate(7deg); }
.auth-wing--left .auth-wing-slot--i6 { top: 75%; left: 8%; transform: rotate(-6deg); }

.auth-wing--right .auth-wing-slot--i0 { top: 0%; right: 0%; left: auto; transform: rotate(10deg); }
.auth-wing--right .auth-wing-slot--i1 { top: 11%; right: 42%; left: auto; transform: rotate(-6deg); }
.auth-wing--right .auth-wing-slot--i2 { top: 24%; right: 2%; left: auto; transform: rotate(7deg); }
.auth-wing--right .auth-wing-slot--i3 { top: 37%; right: 44%; left: auto; transform: rotate(-8deg); }
.auth-wing--right .auth-wing-slot--i4 { top: 50%; right: 0%; left: auto; transform: rotate(6deg); }
.auth-wing--right .auth-wing-slot--i5 { top: 63%; right: 40%; left: auto; transform: rotate(-7deg); }
.auth-wing--right .auth-wing-slot--i6 { top: 76%; right: 6%; left: auto; transform: rotate(5deg); }

@keyframes authWingFloat {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -14px; }
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 12px;
    padding: 5px;
    width: 100%;
}

.auth-tabs--triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.auth-tabs--triple .auth-tab {
    font-size: 12px;
    padding: 10px 4px;
}

.cloud-sync-status {
    width: 100%;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.cloud-status--pending {
    background: rgba(136, 204, 255, 0.12);
    color: rgba(180, 220, 255, 0.85);
    border: 1px solid rgba(136, 204, 255, 0.25);
}

.cloud-status--ok {
    background: rgba(0, 204, 136, 0.12);
    color: #7dffb8;
    border: 1px solid rgba(0, 204, 136, 0.35);
}

.cloud-status--warn {
    background: rgba(255, 170, 0, 0.12);
    color: #ffcc66;
    border: 1px solid rgba(255, 170, 0, 0.35);
}

.auth-gate-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    margin-bottom: 14px;
    padding: 14px 14px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(120, 80, 255, 0.22), rgba(0, 180, 255, 0.12));
    border: 1px solid rgba(170, 140, 255, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-gate-banner__icon {
    font-size: 22px;
    line-height: 1;
    margin-top: 2px;
}

.auth-gate-banner strong {
    display: block;
    color: #fff;
    font-size: 15px;
    margin-bottom: 4px;
}

.auth-gate-banner p {
    margin: 0;
    color: rgba(220, 230, 255, 0.78);
    font-size: 12px;
    line-height: 1.45;
}

#screen-auth.auth-gate-locked {
    z-index: 12000;
}

body.auth-gate-active #screen-app,
body.auth-gate-active #hero-welcome {
    pointer-events: none;
}

.auth-tab {
    width: 100%;
    padding: 11px 8px;
    text-align: center;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.auth-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.75);
}

.auth-tab.active {
    background: rgba(100, 70, 180, 0.55);
    color: #fff;
    text-shadow: none;
    box-shadow: none;
}

.auth-panel { display: none; text-align: left; }
.auth-panel.active { display: block; }

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-field {
    margin-bottom: 16px;
    width: 100%;
}

.auth-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: 7px;
    letter-spacing: 0.08em;
    text-transform: none;
}

.auth-field label .req { color: #ff6b9d; font-weight: 800; }

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    margin: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input::placeholder {
    color: rgba(255, 255, 255, 0.32);
    font-size: 14px;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(163, 112, 247, 0.85);
    box-shadow: 0 0 0 3px rgba(163, 112, 247, 0.2);
}

.auth-field input.invalid {
    border-color: #ff4466;
}

.auth-field-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
    line-height: 1.4;
}

.auth-field-error {
    font-size: 11px;
    color: #ff6b9d;
    margin-top: 5px;
    min-height: 0;
}

.auth-field-error:empty {
    display: none;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
    cursor: pointer;
}

.auth-check input {
    margin-top: 2px;
    accent-color: #a370f7;
}

.auth-check-inline {
    margin: 0;
}

.btn-forgot-link {
    background: none;
    border: none;
    color: rgba(180, 200, 255, 0.85);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-forgot-link:hover {
    color: #fff;
}

.btn-auth-primary {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(200, 160, 255, 0.45);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, #7c4dff 0%, #5a32c4 100%);
    box-shadow: none;
    text-shadow: none;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn-auth-primary::after {
    display: none;
}

.btn-auth-primary:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #8a5fff 0%, #6540d4 100%);
    border-color: rgba(220, 190, 255, 0.55);
    box-shadow: none;
}

.auth-benefits {
    margin: 0 0 16px;
    padding: 12px 14px;
    list-style: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.2);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    text-align: center;
}

.auth-benefits li {
    margin: 4px 0;
    text-align: center;
}

.auth-benefits strong {
    color: #ffd700;
}

.auth-msg {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    display: none;
}

.auth-msg.show {
    display: block;
}

.auth-msg.error {
    background: rgba(255, 50, 80, 0.2);
    border: 1px solid rgba(255, 80, 120, 0.5);
    color: #ffb4c8;
}

.auth-msg.success {
    background: rgba(0, 180, 120, 0.15);
    border: 1px solid rgba(100, 255, 180, 0.4);
    color: #9dffc8;
}

.auth-msg-email {
    opacity: 0.9;
    word-break: break-all;
}

.auth-msg-action {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(200, 160, 255, 0.55);
    border-radius: 8px;
    background: rgba(90, 50, 140, 0.45);
    color: #f0e6ff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.auth-msg-action:hover {
    background: rgba(120, 70, 180, 0.55);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.social-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-social svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.auth-legal {
    margin-top: 14px;
    font-size: 11px;
    color: rgba(210, 220, 245, 0.82);
    line-height: 1.55;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.auth-legal-link {
    color: rgba(180, 200, 255, 0.95);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.auth-legal-link:hover {
    color: #fff;
}

.password-strength {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 6px;
    overflow: hidden;
}

.password-strength span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

.forgot-panel {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(163, 112, 247, 0.35);
}

.forgot-panel.hidden { display: none; }

.forgot-panel .forgot-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
}

.forgot-panel input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 14px;
}

.forgot-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.auth-oauth-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-oauth-modal.hidden { display: none; }

.oauth-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
}

.oauth-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: oauthSpin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes oauthSpin {
    to { transform: rotate(360deg); }
}

.file-protocol-wall {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 5, 12, 0.97);
    box-sizing: border-box;
}

.file-protocol-wall.hidden {
    display: none !important;
}

.file-protocol-box {
    max-width: 480px;
    padding: 28px 24px;
    border-radius: 16px;
    border: 2px solid #ff6b9d;
    background: linear-gradient(145deg, rgba(40, 10, 30, 0.95), rgba(15, 10, 40, 0.98));
    box-shadow: 0 0 40px rgba(255, 80, 140, 0.35);
    text-align: center;
}

.file-protocol-box h2 {
    margin: 0 0 12px;
    font-size: 20px;
    color: #ff8cb8;
}

.file-protocol-box p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.file-protocol-box ol {
    text-align: left;
    margin: 12px 0 16px;
    padding-left: 22px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.file-protocol-box code {
    background: rgba(0, 0, 0, 0.45);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
}

.file-protocol-box .fp-url {
    display: block;
    margin: 8px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    color: #7dffb8;
    font-size: 13px;
}

@media (min-width: 961px) {
    html:has(#screen-auth:not(.hidden)),
    body:has(#screen-auth:not(.hidden)) {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        max-height: none !important;
    }

    #screen-auth:not(.hidden) {
        overflow: visible !important;
        height: auto !important;
        min-height: 100dvh !important;
        max-height: none !important;
    }

    .auth-stage {
        min-height: 100dvh;
        height: auto;
        overflow: visible;
    }

    .auth-wing--left,
    .auth-wing--right {
        display: block !important;
        z-index: 11;
    }

    .auth-wing-slot {
        pointer-events: auto;
    }

    .auth-center .auth-hero-copy {
        margin-top: -14px;
        margin-bottom: 4px;
    }

    .auth-center .auth-hero-copy .auth-rainbow-text--tag,
    .auth-center .auth-hero-copy .auth-tag.auth-rainbow-text--tag {
        font-size: 15px;
        letter-spacing: 0.14em;
        margin-bottom: 8px;
    }

    .auth-center .auth-preview-mount--featured {
        margin-top: 22px;
    }

    .auth-center .auth-tilt-hint {
        margin-top: 14px;
    }
}

@media (max-width: 1320px) {
    .auth-wing {
        --wing-card-w: 148px;
        --wing-card-h: 210px;
        max-width: 380px;
        min-height: min(88vh, 720px);
    }
}

@media (max-width: 1180px) {
    .auth-stage {
        grid-template-columns: minmax(140px, 1fr) minmax(220px, 300px) minmax(280px, 360px) minmax(140px, 1fr);
    }
    .auth-wing {
        --wing-card-w: 132px;
        --wing-card-h: 188px;
        max-width: 300px;
    }
}

@media (max-width: 960px) {
    html:has(#screen-auth:not(.hidden)),
    body:has(#screen-auth:not(.hidden)) {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        max-height: none !important;
    }

    #screen-auth:not(.hidden) {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        height: auto !important;
        min-height: 100dvh !important;
        max-height: none !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        padding: max(52px, env(safe-area-inset-top, 0px)) 12px
            max(28px, env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
    }

    .auth-stage {
        grid-template-columns: 1fr;
        max-width: 100%;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        padding-top: 44px !important;
        padding-bottom: 24px !important;
        gap: 16px !important;
        align-items: stretch !important;
        overflow: visible !important;
    }

    .auth-center,
    .auth-box,
    .auth-wing--left,
    .auth-wing--right {
        grid-column: 1;
    }

    .auth-box {
        order: 1;
        position: relative;
        z-index: 20;
    }

    .auth-center {
        order: 2;
        z-index: 12;
    }

    .auth-wing {
        display: none;
    }

    .auth-preview-mount--featured {
        min-height: 0 !important;
        max-height: none !important;
        width: min(180px, 62vw) !important;
        margin: 0 auto !important;
        overflow: hidden;
    }

    .auth-preview-mount .void-card-stage,
    .auth-preview-mount .catalog-tile-3d {
        min-height: 0 !important;
        max-height: min(240px, 38vh) !important;
        aspect-ratio: 2 / 3;
    }

    .auth-preview-mount .void-card-frame,
    .auth-preview-mount .void-card-frame.auth-preview-card-art {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }

    .auth-tilt-hint {
        font-size: 11px;
        margin-top: 6px;
    }
}

@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
        gap: 32px;
        max-width: 440px;
    }
    .auth-hero {
        order: 1;
        max-width: 100%;
        justify-self: center;
        padding: 8px 12px;
    }
    .auth-box {
        order: 2;
        justify-self: stretch;
    }
    .auth-preview-mount {
        min-height: 260px;
        max-width: 200px;
    }
}

/* 📱 登入畫面 / Google 登入區塊 — 手機版滾動與按鈕可點（auth.css 最底部） */
@media (max-width: 768px) {
  html:has(#screen-auth:not(.hidden)),
  body:has(#screen-auth:not(.hidden)) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    max-height: none !important;
  }

  #screen-auth:not(.hidden) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: max(52px, env(safe-area-inset-top, 0px)) 12px
      max(28px, env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }

  #screen-auth .auth-stage {
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    padding-top: 44px !important;
    padding-bottom: 24px !important;
    gap: 14px !important;
    overflow: visible !important;
  }

  #screen-auth .auth-center {
    width: 100% !important;
    max-width: 100% !important;
  }

  #screen-auth .auth-hero-copy {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 10px !important;
    padding: 0 0 6px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #screen-auth .auth-preview-mount,
  #screen-auth .auth-preview-mount--featured {
    min-height: 220px !important;
    max-height: none !important;
    width: min(200px, 58vw) !important;
    margin-bottom: 6px !important;
    overflow: visible !important;
  }

  #screen-auth .auth-preview-mount .void-card-stage,
  #screen-auth .auth-preview-mount .catalog-tile-3d {
    min-height: 200px !important;
    max-height: min(280px, 42vh) !important;
    aspect-ratio: 2 / 3 !important;
  }

  #screen-auth .auth-tilt-hint {
    display: none;
  }

  /* 登入外殼：.auth-box（表單 + Google 按鈕） */
  #screen-auth .auth-box {
    width: 90% !important;
    max-width: 400px !important;
    height: auto !important;
    max-height: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 22px 18px 20px !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  #screen-auth .auth-footer-block,
  #screen-auth .social-btns {
    width: 100% !important;
    flex-shrink: 0 !important;
  }

  #screen-auth .btn-social,
  #screen-auth #btn-google {
    width: 100% !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 2 !important;
    touch-action: manipulation !important;
  }

  /* OAuth 連線中彈窗：.auth-oauth-modal + .oauth-box */
  .auth-oauth-modal:not(.hidden) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .auth-oauth-modal .oauth-box {
    width: 90% !important;
    height: auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 25px 20px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin: auto !important;
  }

  /* Google GSI（僅限登入區，避免影響全站 iframe） */
  #screen-auth #g_id_onload,
  #screen-auth .g_id_signin,
  #screen-auth .social-btns iframe {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 40px !important;
    box-sizing: border-box !important;
  }

  #screen-auth .social-btns iframe {
    display: block !important;
    margin: 0 auto !important;
    border: 0 !important;
  }

  #card-modal:not(.hidden) {
    z-index: 100000 !important;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px)) !important;
    align-items: center !important;
    overflow-y: auto !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch !important;
  }

  #card-modal:not(.hidden)::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  #card-modal .modal-inner.modal-inner--premium {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: min(100%, 400px) !important;
    max-width: 98vw !important;
    max-height: none !important;
    overflow: visible !important;
    gap: 10px !important;
  }

  #card-modal .modal-inner.modal-inner--premium #modal-card-mount {
    flex: 0 0 auto !important;
    order: 1 !important;
    overflow: auto !important;
    max-height: min(72vh, 640px) !important;
  }

  #card-modal .modal-inner.modal-inner--premium .modal-actions {
    flex: 0 0 auto !important;
    order: 2 !important;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)) !important;
  }

  #card-modal .modal-inner.modal-inner--zoom {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: min(100%, 400px) !important;
    max-width: 98vw !important;
    max-height: none !important;
    margin: auto !important;
    overflow: visible !important;
    gap: 10px !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    grid-template-areas: unset !important;
  }

  #card-modal .modal-inner.modal-inner--zoom #modal-card-mount {
    flex: 0 0 auto !important;
    order: 1 !important;
    overflow: hidden !important;
    max-height: min(40vh, 300px) !important;
  }

  #card-modal .modal-inner.modal-inner--zoom #modal-meta {
    flex: 1 1 auto !important;
    order: 2 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: min(38vh, 320px) !important;
    min-height: 0 !important;
    padding: 0 6px 6px !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    text-align: center !important;
    -webkit-overflow-scrolling: touch;
  }

  #card-modal .modal-inner.modal-inner--zoom.modal-inner--art-meta #modal-meta {
    max-height: min(42vh, 360px) !important;
  }

  #card-modal .modal-inner.modal-inner--zoom .modal-actions {
    flex: 0 0 auto !important;
    order: 3 !important;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)) !important;
    position: relative !important;
    z-index: 20 !important;
    pointer-events: auto !important;
  }
}

/* 登入頁 · 卡牌詳情彈窗（桌面／手機共用，對齊圖鑑一覽） */
#card-modal:not(.hidden) {
    z-index: 100000 !important;
    pointer-events: auto !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body.void-card-modal-open .auth-wing-slot {
    pointer-events: none !important;
}

body.void-card-modal-open #card-modal,
body.void-card-modal-open #card-modal .modal-inner,
body.void-card-modal-open #card-modal .modal-actions,
body.void-card-modal-open #card-modal #btn-close-modal {
    pointer-events: auto !important;
}

#card-modal:not(.hidden)::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

@media (min-width: 769px) {
    #card-modal .modal-inner.modal-inner--zoom {
        display: grid !important;
        grid-template-columns: minmax(0, 360px) minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) auto !important;
        grid-template-areas: 'card meta' 'actions actions' !important;
        max-width: min(920px, 98vw) !important;
        max-height: min(96vh, 880px) !important;
    }

    #card-modal .modal-inner.modal-inner--zoom #modal-card-mount {
        grid-area: card !important;
        order: unset !important;
        flex: unset !important;
        max-height: none !important;
    }

    #card-modal .modal-inner.modal-inner--zoom #modal-meta {
        grid-area: meta !important;
        order: unset !important;
        flex: unset !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        max-height: min(72vh, 640px) !important;
    }

    #card-modal .modal-inner.modal-inner--zoom .modal-actions {
        grid-area: actions !important;
        order: unset !important;
        flex: unset !important;
        position: relative !important;
        z-index: 20 !important;
        pointer-events: auto !important;
        isolation: isolate;
    }

    #card-modal .modal-inner.modal-inner--zoom #btn-close-modal {
        position: relative;
        z-index: 21;
        cursor: pointer;
    }

    #card-modal .modal-rarity-banner {
        display: block !important;
    }
}
