/* ===========================
   RESET & BASIS
=========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow-x: hidden;
}

html {
    font-size: 16px;
    background: #1a1033;
    min-height: 100%;
}

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #1a1033 0%, #2d1b5a 50%, #1a1033 100%);
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
    /* dvh respektiert die mobile Browser-UI dynamisch */
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ===========================
   LOADER
=========================== */
#loader {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #2d1b5a 0%, #0a0418 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    padding: 0;
}

#loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#logoCanvas {
    width: min(260px, 72vw);
    height: min(260px, 72vw);
    filter: drop-shadow(0 0 40px rgba(255, 100, 50, 0.4));
    display: block;
}

/* Scrolling während Loader unterbinden */
body.loading {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

.loader-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #ff9a3c;
    text-transform: uppercase;
    animation: pulse 1.2s ease-in-out infinite;
}

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

/* ===========================
   HAUPTSEITE
=========================== */
#mainContent {
    opacity: 0;
    transition: opacity 1s ease;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

#mainContent.visible {
    opacity: 1;
}

/* ===========================
   EMOJI HINTERGRUND
=========================== */
#emojiBackground {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.falling-emoji {
    position: absolute;
    top: -60px;
    font-size: 1.8rem;
    animation: fall linear infinite;
    opacity: 0.35;
    user-select: none;
    will-change: transform;
}

@keyframes fall {
    0%   { transform: translateY(-60px) rotate(0deg); }
    100% { transform: translateY(110vh) rotate(720deg); }
}

/* ===========================
   HERO
=========================== */
.hero {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 32px 18px 24px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px 6px 6px;
    border-radius: 100px;
    margin-bottom: 18px;
    animation: slideDown 0.8s ease 0.2s backwards;
}

.mini-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hero-badge span {
    font-weight: 600;
    color: #fff;
    font-size: 0.82rem;
    white-space: nowrap;
}

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

.title {
    font-family: 'Bangers', cursive;
    font-size: clamp(2.2rem, 11vw, 4.5rem);
    line-height: 1.05;
    margin-bottom: 16px;
    letter-spacing: 1.5px;
}

.title-line-1 {
    display: block;
    color: #fff;
    animation: slideInLeft 0.9s ease 0.4s backwards;
}

.title-line-2 {
    display: block;
    background: linear-gradient(135deg, #ff6b35 0%, #ff9a3c 50%, #ffd23f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 80px rgba(255, 154, 60, 0.4);
    animation: slideInRight 0.9s ease 0.6s backwards;
}

@keyframes slideInLeft {
    from { transform: translateX(-50px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(50px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.subtitle {
    font-size: clamp(0.95rem, 4vw, 1.2rem);
    color: rgba(255, 255, 255, 0.85);
    max-width: 540px;
    margin: 0 auto;
    line-height: 1.5;
    animation: fadeIn 1s ease 0.9s backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===========================
   FORM SECTION
=========================== */
.form-section {
    position: relative;
    z-index: 2;
    padding: 16px 16px 32px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.form-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 1s ease 1.2s backwards;
}

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

.card-glow {
    position: absolute;
    top: -100px;
    right: -100px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.3) 0%, transparent 70%);
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-30px, 30px); }
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-of-type {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
    font-size: 0.98rem;
}

.required {
    color: #ff6b35;
}

.optional {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    font-size: 0.85rem;
}

/* HINT */
.hint {
    display: block;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
}

.hint strong {
    color: #ff9a3c;
    font-weight: 700;
}

/* INPUTS */
input[type="text"],
textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    /* font-size: 16px verhindert iOS-Zoom beim Focus */
    font-size: 16px;
    transition: all 0.25s ease;
    resize: vertical;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #ff9a3c;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 154, 60, 0.15);
}

textarea {
    min-height: 80px;
    line-height: 1.4;
}

/* SUBMIT BUTTON */
.submit-btn {
    width: 100%;
    /* Min Touch-Target Höhe 48px */
    min-height: 52px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff9a3c 50%, #ffd23f 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 14px;
    color: #1a1033;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.submit-btn:active {
    transform: scale(0.98);
}

@media (hover: hover) {
    .submit-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 32px rgba(255, 107, 53, 0.5);
    }
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-emoji {
    font-size: 1.2rem;
}

.submit-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: none;
    animation: none;
}

/* SUCCESS MESSAGE */
.success-message {
    display: none;
    text-align: center;
    padding: 12px 0;
    animation: scaleIn 0.5s ease;
}

.success-message.visible {
    display: block;
}

.success-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: bounce-in 0.8s ease;
}

@keyframes bounce-in {
    0%   { transform: scale(0) rotate(-180deg); }
    60%  { transform: scale(1.2) rotate(20deg); }
    100% { transform: scale(1) rotate(0); }
}

.success-message h2 {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    margin-bottom: 8px;
    color: #ffd23f;
    letter-spacing: 1.5px;
}

.success-message p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 18px;
    font-size: 1rem;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ===========================
   FOOTER
=========================== */
.footer {
    text-align: center;
    padding: 20px 16px 24px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
}

.footer a {
    color: #ff9a3c;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer a:hover,
.footer a:focus {
    color: #ffd23f;
    text-decoration: underline;
}

/* ===========================
   FORM HIDDEN
=========================== */
.form-card form.hidden {
    display: none;
}

/* ===========================
   ERROR STYLE
=========================== */
.error-shake {
    animation: shake 0.5s ease;
    border-color: #ff4757 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-8px); }
    75%      { transform: translateX(8px); }
}

/* ===========================
   TABLET / DESKTOP (ab 600px)
=========================== */
@media (min-width: 600px) {
    .hero {
        padding: 56px 24px 32px;
    }

    .hero-badge {
        gap: 12px;
        padding: 10px 20px 10px 10px;
        margin-bottom: 28px;
    }

    .mini-logo {
        width: 36px;
        height: 36px;
    }

    .hero-badge span {
        font-size: 0.95rem;
    }

    .title {
        margin-bottom: 22px;
        letter-spacing: 2px;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .form-section {
        padding: 32px 24px 60px;
        max-width: 680px;
    }

    .form-card {
        padding: 38px 36px;
        border-radius: 30px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    .form-label {
        margin-bottom: 12px;
        font-size: 1.05rem;
    }

    input[type="text"],
    textarea {
        padding: 16px 20px;
        border-radius: 16px;
    }

    .submit-btn {
        padding: 18px 30px;
        font-size: 1.15rem;
        border-radius: 16px;
    }

    .submit-btn .btn-emoji {
        font-size: 1.3rem;
        transition: transform 0.3s ease;
    }

    .submit-btn:hover .btn-emoji {
        transform: translateX(4px) rotate(-15deg);
    }

    .success-emoji {
        font-size: 5rem;
        margin-bottom: 16px;
    }

    .success-message h2 {
        font-size: 2.5rem;
    }

    .falling-emoji {
        font-size: 2.5rem;
    }

    .loader-text {
        font-size: 1.2rem;
    }

    .loader-inner {
        gap: 24px;
    }

    #logoCanvas {
        width: 300px;
        height: 300px;
    }
}

/* ===========================
   DESKTOP (ab 900px)
=========================== */
@media (min-width: 900px) {
    .hero {
        padding: 70px 24px 40px;
    }
}

/* ===========================
   SEHR KLEINE GERÄTE (unter 360px)
=========================== */
@media (max-width: 360px) {
    .hero {
        padding: 24px 14px 18px;
    }

    .hero-badge {
        padding: 5px 12px 5px 5px;
    }

    .hero-badge span {
        font-size: 0.75rem;
    }

    .mini-logo {
        width: 24px;
        height: 24px;
    }

    .form-section {
        padding: 12px 12px 24px;
    }

    .form-card {
        padding: 20px 16px;
        border-radius: 20px;
    }

    .falling-emoji {
        font-size: 1.5rem;
    }
}

/* ===========================
   REDUCED MOTION
=========================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .falling-emoji {
        display: none;
    }
}
