:root {
    /* Champagne Gold Accent (Hintergrund-Ornamente) */
    --accent-color:  #c9a961;
    --accent-dark:   #a8893f;
    --accent-light:  #d9bf7c;
    --accent-bright: #e6cf8e;

    /* Discord Blurple */
    --discord-color:  #5865F2;
    --discord-hover:  #4752c4;
    --discord-bright: #7983f5;

    /* Text */
    --text-primary:   #f5f4f1;
    --text-secondary: #d4d3cf;
    --text-muted:     #9b9a96;

    /* Radius */
    --radius-md: 12px;
    --radius-lg: 18px;

    /* Transitions */
    --t-fast:   200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-normal: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow:   600ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:   'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-primary);
    background: #08080a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow: hidden;
}

/* ========== HINTERGRUND-LAYERS ========== */
.bg-layers {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-wallpaper {
    position: absolute;
    inset: 0;
    background: url(/images/wallpaper.png) center/cover no-repeat;
    filter: blur(2px) brightness(0.4) saturate(0.85);
    transform: scale(1.05);
}

.bg-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, transparent 0%, rgba(8, 8, 10, 0.5) 60%, rgba(8, 8, 10, 0.95) 100%),
        linear-gradient(180deg, rgba(8, 8, 10, 0.4) 0%, transparent 30%, transparent 70%, rgba(8, 8, 10, 0.6) 100%);
}

.bg-mesh {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(201, 169, 97, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 169, 97, 0.04) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    opacity: 0.6;
}

.bg-grain {
    position: absolute;
    inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.79 0 0 0 0 0.66 0 0 0 0 0.38 0 0 0 0.13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.3;
    mix-blend-mode: overlay;
    animation: grainShift 8s steps(8) infinite;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-3%, 2%); }
    50% { transform: translate(2%, -3%); }
    75% { transform: translate(-2%, -2%); }
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    will-change: transform;
}

.bg-orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.45), transparent 70%);
    top: -10%; left: -10%;
    animation: orbDrift1 22s ease-in-out infinite alternate;
}

.bg-orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(168, 137, 63, 0.30), transparent 70%);
    bottom: -15%; right: -10%;
    animation: orbDrift2 28s ease-in-out infinite alternate;
}

.bg-orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(217, 191, 124, 0.22), transparent 70%);
    top: 50%; left: 60%;
    animation: orbDrift3 18s ease-in-out infinite alternate;
}

@keyframes orbDrift1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 100px) scale(1.15); }
}
@keyframes orbDrift2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-100px, -80px) scale(0.9); }
}
@keyframes orbDrift3 {
    0%   { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-30%, -70%) scale(1.2); }
}

/* ========== ECK-ORNAMENTE ========== */
.deco {
    position: fixed;
    width: 140px;
    height: 140px;
    color: var(--accent-color);
    z-index: 1;
    pointer-events: none;
    opacity: 0.55;
}
.deco-tl { top: 24px; left: 24px; animation: decoFloat 6s ease-in-out infinite; }
.deco-br { bottom: 24px; right: 24px; animation: decoFloat 6s ease-in-out infinite reverse; }

@keyframes decoFloat {
    0%, 100% { transform: translate(0, 0); opacity: 0.55; }
    50%      { transform: translate(6px, -6px); opacity: 0.8; }
}

/* ========== BÜHNE ========== */
.login-stage {
    position: relative;
    z-index: 2;
    height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    gap: 0;
    animation: stageFade 0.5s ease-out;
}

@keyframes stageFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== LOGO ========== */
.logo-frame {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}

.logo-halo {
    position: absolute;
    inset: -40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.35) 0%, rgba(201, 169, 97, 0.08) 40%, transparent 70%);
    filter: blur(20px);
    animation: haloPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes haloPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.08); }
}

.logo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
}

.logo-ring-outer {
    border: 1.5px dashed rgba(201, 169, 97, 0.55);
    animation: ringSpin 22s linear infinite;
}

.logo-ring-inner {
    inset: 14px;
    border: 1px solid rgba(217, 191, 124, 0.35);
    border-top-color: var(--accent-bright);
    animation: ringSpin 14s linear infinite reverse;
}

@keyframes ringSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.logo {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: logoBreathe 4.5s ease-in-out infinite;
}

@keyframes logoBreathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.55))
            drop-shadow(0 0 25px rgba(201, 169, 97, 0.35));
}

/* ========== TYPOGRAFIE ========== */
.login-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #f8f5ee 0%, var(--accent-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 36px;
    text-shadow: 0 4px 30px rgba(201, 169, 97, 0.3);
}

/* ========== DISCORD BUTTON ========== */
.discord-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 280px;
    min-height: 56px;
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--discord-color) 0%, var(--discord-hover) 100%);
    color: #ffffff;
    font-size: 1.0125rem;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid rgba(121, 131, 245, 0.45);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-normal), background var(--t-normal);
    box-shadow:
        0 12px 30px rgba(88, 101, 242, 0.45),
        0 0 50px rgba(88, 101, 242, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -2px 0 rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    letter-spacing: 0.3px;
}

.discord-btn-glow {
    position: absolute;
    inset: -100% -50% -100% -50%;
    background: linear-gradient(115deg,
        transparent 35%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 65%);
    transition: transform var(--t-slow);
    transform: translateX(-100%);
    pointer-events: none;
}

.discord-btn:hover .discord-btn-glow { transform: translateX(100%); }

.discord-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--discord-bright) 0%, var(--discord-color) 100%);
    box-shadow:
        0 16px 45px rgba(88, 101, 242, 0.65),
        0 0 70px rgba(88, 101, 242, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.discord-btn:active { transform: translateY(0) scale(0.985); }

.discord-icon {
    width: 22px; height: 22px;
    fill: currentColor;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform var(--t-normal);
}

.discord-btn:hover .discord-icon { transform: rotate(-10deg) scale(1.1); }

/* ========== ERROR + FOOTER ========== */
#error-container {
    min-height: 0;
    width: 100%;
    max-width: 360px;
    margin-top: 20px;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(224, 123, 123, 0.2), rgba(224, 123, 123, 0.1));
    border: 1px solid rgba(224, 123, 123, 0.4);
    border-radius: var(--radius-md);
    color: #f5b9b9;
    font-size: 0.85rem;
    line-height: 1.5;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(224, 123, 123, 0.15);
    animation: errorSlide 0.4s ease-out;
}

@keyframes errorSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.error-icon {
    width: 20px; height: 20px;
    fill: none;
    flex-shrink: 0;
    color: #f0a0a0;
}

.login-credit {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: var(--text-muted);
    z-index: 2;
    text-align: center;
}

.footer-heart {
    color: #e07b7b;
    margin: 0 2px;
    animation: heartBeat 1.6s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25%      { transform: scale(1.15); }
    50%      { transform: scale(0.95); }
}

.footer-link {
    color: var(--accent-bright);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color var(--t-fast);
}

.footer-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -2px;
    width: 0; height: 1.5px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-bright));
    transition: width var(--t-normal);
}

.footer-link:hover { color: var(--accent-color); }
.footer-link:hover::after { width: 100%; }

/* ========== RESPONSIVE ========== */
@media (max-width: 540px) {
    .logo-frame { width: 168px; height: 168px; margin-bottom: 22px; }
    .logo { width: 124px; height: 124px; }

    .login-title { font-size: 2.1rem; margin-bottom: 30px; }

    .discord-btn { min-width: 260px; font-size: 0.95rem; }

    .deco-tl { top: 16px; left: 16px; width: 100px; height: 100px; }
    .deco-br { bottom: 16px; right: 16px; width: 100px; height: 100px; }

    .login-credit { bottom: 16px; font-size: 0.72rem; }
}

@media (max-width: 380px) {
    .deco { display: none; }

    .logo-frame { width: 148px; height: 148px; }
    .logo { width: 108px; height: 108px; }

    .login-title { font-size: 1.85rem; }
    .discord-btn { min-width: 240px; padding: 13px 24px; }
}

@media (max-height: 620px) {
    .logo-frame { width: 140px; height: 140px; margin-bottom: 16px; }
    .logo { width: 100px; height: 100px; }
    .login-title { font-size: 1.85rem; margin-bottom: 22px; }
}

/* OS-Flag "Bewegung reduzieren": alle Dauer-Animationen/Übergänge + backdrop-filter
   aus (universell statt Selektor-Liste — fängt auch bg-mesh, discord-btn-glow etc.).
   Die statischen Blurs der Orbs bleiben günstig, da sie ohne Animation nur einmal
   berechnet werden. Konsistent zum reduced-motion-Block in global.css. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* ===== PERFORMANCE-MODUS (manueller Toggle, siehe global.css) =====
   Klasse wird via /js/perf-mode-init.js aus der localStorage-Präferenz
   'ap-perf-lite' noch vor dem ersten Paint auf <html> gesetzt. Greift damit
   auch hier, sobald der Nutzer den Modus in der App einmal aktiviert hat —
   schaltet die teuren animierten Orbs/Logo-Ringe/Glass-Effekte ab. */
html.perf-lite *,
html.perf-lite *::before,
html.perf-lite *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
