/* frontend/style.css – Herzlich Braut Weltmeister Challenge 2026 Elfmeter-Spiel Styling */

/* WM-Farben als CSS-Variablen (RGB für rgba() Kompatibilität) */
:root {
    --wm-blue: #0055A4;
    --wm-blue-rgb: 0, 85, 164;
    --wm-gold: #FFCC00;
    --wm-gold-rgb: 255, 204, 0;
    --wm-dark: #1A1A2E;
    --wm-dark-rgb: 26, 26, 46;
    --wm-light: #FFFFFF;
    --wm-green: #00A86B;
    --wm-red: #FF3333;
}

/* Grundlayout */
body {
    margin: 0;
    padding: 0;
    background: radial-gradient(ellipse at center, #1B5E20 0%, #0A2E10 100%);
    font-family: Arial, sans-serif;
    overflow: hidden;
}

/* Stadion-Licht-Effekt */
.game-field::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 120vw;
    height: 60vh;
    background: radial-gradient(ellipse, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Spielfeld – Vollflächiges Layout */
.game-field {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.04) 0px,
            rgba(255,255,255,0.04) 2px,
            transparent 2px,
            transparent 8px
          ),
        radial-gradient(ellipse at center, #1B5E20 0%, #0A2E10 100%);
}

/* Tor — immer 80% der Bildbreite */
.goal {
    position: relative;
    width: 80vw;
    height: 28vh;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 18px,
            rgba(255,255,255,0.15) 18px,
            rgba(255,255,255,0.15) 20px
          ),
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 18px,
            rgba(255,255,255,0.15) 18px,
            rgba(255,255,255,0.15) 20px
          ),
        rgba(0,0,0,0.4);  /* Dunkler Hintergrund hinter dem Netz */
    border: none;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
    z-index: 1;
}
/* Netz-Welle auf Tor */
.goal.net-wave {
    animation: netWave 0.8s ease-out forwards;
}

/* Torpfosten */
.goal-post {
    position: absolute;
    width: 2vw;
    height: 28vh;
    background: linear-gradient(90deg, #FFFFFF 0%, #CCCCCC 100%);
    box-shadow: 2px 0 6px rgba(0,0,0,0.5);
    z-index: 3;
}
.goal-post.left {
    left: -1vw;
}
.goal-post.right {
    right: -1vw;
}
/* Querbalken */
.goal-post.top {
    position: absolute;
    top: -2vw;
    left: 0;
    right: 0;
    height: 2vw;
    background: linear-gradient(180deg, #FFFFFF 0%, #CCCCCC 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    z-index: 3;
}

/* Zielzonen (3 Felder: links, mitte, rechts) */
.zone {
    position: relative;
    background: rgba(var(--wm-gold-rgb), 0.4);
    border: 2px solid var(--wm-gold);
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
    z-index: 2;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.zone:hover {
    background: rgba(var(--wm-gold-rgb), 0.9);
    border-color: #fff;
    box-shadow: 0 0 24px rgba(var(--wm-gold-rgb), 0.8), inset 0 0 20px rgba(255,255,255,0.3);
    transform: scale(1.06);
    cursor: pointer;
}
.zone.selected {
    animation: zonePulse 0.8s ease-out;
}
/* Deaktivierte Zonen (nach Spielende / vor Banner-Dismiss) */
.zone.disabled {
    pointer-events: none;
    opacity: 0.4;
    cursor: default;
}

/* Torwart */
.goalkeeper {
    position: absolute;
    width: 12vw;
    height: 18vh;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6em;
    top: 6vh;
    left: 50%;
    transform: translateX(-6vw);
    z-index: 4;
}
.goalkeeper::before {
    content: '🤸';  /* Torwart Emoji */
}
.goalkeeper.catching::before {
    content: '🧤';  /* Fang Emoji bei saved */
}

/* Spieler-Avatar */
.player-avatar {
    position: absolute;
    width: 12vw;
    height: 17vh;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6em;
    bottom: 10vh;
    left: 0;
    z-index: 5;
}
.player-avatar::before {
    content: '👰';  /* Braut als Torschützin */
}

/* Ball */
.ball {
    position: absolute;
    width: 8vw;
    height: 8vh;
    background: radial-gradient(circle at 35% 35%, #FFFFFF 0%, #E0E0E0 100%);
    border: 2px solid #333;
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.4);
    border-radius: 50%;
    bottom: 10vh;
    left: 5vw;
    z-index: 6;
    opacity: 0;  /* Erst nach Einlauf sichtbar */
    transition: opacity 0.3s ease;
}
.ball.visible {
    opacity: 1;
}
/* Schwarzes Fünfeck */
.ball::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    background: #222;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

/* Schuss-Historie-Leiste — tiefer gesetzt, unter dem Header */
.history-list {
    position: absolute;
    top: 10vh;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 5vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    z-index: 10;
}
.history-slot {
    width: 10vw;
    height: 4vh;
    margin: 0.5vw;
    background: rgba(var(--wm-dark-rgb), 0.8);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
}

/* Punktezähler */
.point-counter {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 25vw;
    height: 7vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    z-index: 10;
}
.point-counter span {
    font-size: 2.5em;
    color: var(--wm-gold);
    margin: 1vw;
}

/* Stimmungs-Reaktion */
.reaction-text {
    position: absolute;
    top: 38vh;
    left: 50%;
    transform: translateX(-50%);
    width: 50vw;
    height: 6vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--wm-gold);
    z-index: 10;
}

/* Schuss-Prompt-Banner — vor jedem Torschuss */
.shot-prompt {
    position: absolute;
    top: 42vh;
    left: 50%;
    transform: translateX(-50%);
    width: 75vw;
    padding: 16px 20px;
    background: rgba(var(--wm-blue-rgb), 0.92);
    border: 2px solid var(--wm-gold);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--wm-light);
    text-align: center;
    cursor: pointer;
    z-index: 50;
    touch-action: manipulation;
    animation: modalPopIn 0.4s ease-out;
    box-shadow: 0 4px 24px rgba(var(--wm-blue-rgb), 0.6);
}

/* Rabatt-Modal — deutlich größer (~50% der Bildschirmfläche) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    width: 85vw;
    max-width: 500px;
    min-height: 45vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.modal-content h2 {
    font-size: 2em;
    margin: 0 0 8px 0;
    color: var(--wm-dark);
}
.modal-content p {
    font-size: 1.4em;
    margin: 4px 0;
    color: #333;
}
.discount-highlight {
    font-size: 2.8em !important;
    color: var(--wm-blue) !important;
    margin: 12px 0 !important;
}
.discount-note {
    font-size: 1.1em !important;
    color: #666 !important;
}
#restart-btn {
    margin-top: 16px;
    padding: 14px 32px;
    font-size: 1.3em;
    font-weight: bold;
    background: var(--wm-gold);
    color: var(--wm-dark);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
}

/* Error-Notification */
.error-notification {
    position: absolute;
    top: 40vh;
    left: 50%;
    transform: translateX(-50%);
    width: 50vw;
    height: 6vh;
    background: var(--wm-red);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: var(--wm-light);
    z-index: 100;
}

/* WM-Header-Banner */
.wm-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 1.5vh 0;
    background: linear-gradient(180deg, rgba(0,85,164,0.9) 0%, transparent 100%);
    z-index: 20;
}
.wm-header h1 {
    margin: 0;
    font-size: 2.2em;
    color: var(--wm-gold);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    letter-spacing: 0.1em;
}
.wm-subtitle {
    margin: 0;
    font-size: 1.2em;
    color: var(--wm-light);
    opacity: 0.8;
}

/* Konfetti-Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    opacity: 0;
}

/* Responsive Breakpoints — Smartphone-optimiert */
@media (max-width: 480px) {
    .goal {
        width: 80vw;
        height: 30vh;
    }
    .goalkeeper {
        width: 14vw;
        height: 20vh;
        font-size: 7em;
    }
    .player-avatar {
        width: 14vw;
        height: 20vh;
        font-size: 7em;
    }
    .ball {
        width: 10vw;
        height: 10vh;
    }
    .history-list {
        top: 11vh;
    }
    .history-slot {
        width: 12vw;
        font-size: 1.8em;
    }
    .point-counter {
        width: 30vw;
    }
    .point-counter span {
        font-size: 3em;
    }
    .reaction-text {
        font-size: 2.2em;
    }
    .wm-header h1 {
        font-size: 2.4em;
    }
    .wm-subtitle {
        font-size: 1.3em;
    }
    .shot-prompt {
        width: 85vw;
        font-size: 1.7em;
        padding: 18px 22px;
    }
    .modal-content {
        width: 90vw;
        min-height: 50vh;
        padding: 24px;
    }
    .modal-content h2 {
        font-size: 2.2em;
    }
    .modal-content p {
        font-size: 1.5em;
    }
    .discount-highlight {
        font-size: 3.2em !important;
    }
    .discount-note {
        font-size: 1.2em !important;
    }
    #restart-btn {
        font-size: 1.5em;
        padding: 16px 36px;
    }
}

@media (max-width: 360px) {
    .goal {
        width: 80vw;
        height: 32vh;
    }
    .goalkeeper {
        width: 16vw;
        height: 22vh;
        font-size: 8em;
    }
    .player-avatar {
        width: 16vw;
        height: 22vh;
        font-size: 8em;
    }
    .ball {
        width: 12vw;
        height: 12vh;
    }
    .history-list {
        top: 12vh;
    }
    .history-slot {
        width: 14vw;
        font-size: 2em;
    }
    .point-counter {
        width: 35vw;
    }
    .point-counter span {
        font-size: 3.2em;
    }
    .reaction-text {
        font-size: 2.4em;
    }
    .wm-header h1 {
        font-size: 2.6em;
    }
    .wm-subtitle {
        font-size: 1.4em;
    }
    .shot-prompt {
        width: 88vw;
        font-size: 1.9em;
        padding: 20px 24px;
    }
    .modal-content {
        width: 92vw;
        min-height: 52vh;
        padding: 20px;
    }
    .modal-content h2 {
        font-size: 2.4em;
    }
    .modal-content p {
        font-size: 1.6em;
    }
    .discount-highlight {
        font-size: 3.5em !important;
    }
    .discount-note {
        font-size: 1.3em !important;
    }
    #restart-btn {
        font-size: 1.6em;
        padding: 18px 40px;
    }
}

/* ============================================
   Spielregeln-Banner (erscheint beim Laden)
   ============================================ */
.rules-banner {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
    touch-action: manipulation;
    animation: modalPopIn 0.5s ease-out;
}
.rules-content {
    background: white;
    border-radius: 20px;
    padding: 32px 28px;
    width: 88vw;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 85, 164, 0.4);
}
.rules-content h2 {
    font-size: 2em;
    margin: 0 0 16px 0;
    color: var(--wm-dark);
}
.rules-content ul {
    text-align: left;
    padding-left: 24px;
    margin: 0 0 16px 0;
    font-size: 1.2em;
    color: #333;
    line-height: 1.6;
}
.rules-prizes {
    background: rgba(var(--wm-blue-rgb), 0.06);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0 0 16px 0;
    text-align: left;
}
.prize-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 1.15em;
    color: #333;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.prize-row:last-child {
    border-bottom: none;
}
.prize-row span:first-child {
    color: #666;
}
.prize-row strong {
    color: var(--wm-blue);
}
.rules-validity {
    font-size: 1.3em;
    color: var(--wm-dark);
    margin: 12px 0 8px 0;
    padding: 8px 12px;
    background: rgba(var(--wm-gold-rgb), 0.2);
    border-radius: 8px;
}
.rules-cta {
    font-size: 1.1em;
    color: var(--wm-blue);
    font-weight: bold;
    margin: 12px 0 0 0;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Regeln-Banner Footer */
.rules-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.rules-footer a {
    font-size: 1em;
    color: var(--wm-blue);
    text-decoration: none;
}
.rules-footer a:hover {
    text-decoration: underline;
}
.footer-separator {
    color: #ccc;
    font-size: 0.9em;
}

/* Opt-In Checkbox */
.opt-in-label {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    font-size: 1.1em !important;
    font-weight: normal !important;
    color: #555 !important;
    text-align: left;
    cursor: pointer;
    line-height: 1.4;
}
.opt-in-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.opt-in-label a {
    color: var(--wm-blue);
    text-decoration: underline;
}
#save-name-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Ergebnis-Modal (nach Spielende)
   ============================================ */
.result-modal {
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px;
}

/* Name-Eingabe */
#name-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
}
#name-section label {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--wm-dark);
}
#bride-name {
    width: 80%;
    padding: 14px 18px;
    font-size: 1.3em;
    border: 2px solid var(--wm-blue);
    border-radius: 10px;
    text-align: center;
    outline: none;
}
#bride-name:focus {
    border-color: var(--wm-gold);
    box-shadow: 0 0 12px rgba(var(--wm-gold-rgb), 0.4);
}
#save-name-btn {
    padding: 14px 32px;
    font-size: 1.3em;
    font-weight: bold;
    background: var(--wm-blue);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
}
#save-name-btn:active {
    background: var(--wm-gold);
    color: var(--wm-dark);
}

/* Gewinncode-Sektion */
#prize-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
}
.prize-label {
    font-size: 1.6em;
    font-weight: bold;
    color: var(--wm-dark);
    margin: 0;
}
.slug-display {
    font-size: 2em;
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 0.15em;
    color: var(--wm-blue);
    background: rgba(var(--wm-blue-rgb), 0.08);
    padding: 14px 24px;
    border-radius: 12px;
    border: 2px dashed var(--wm-blue);
    cursor: pointer;
    user-select: all;
    -webkit-user-select: all;
    word-break: break-all;
}
.slug-hint {
    font-size: 1em;
    color: #888;
    margin: 0;
}
#qr-container {
    margin: 8px 0;
    padding: 12px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--wm-gold);
}
#qr-image {
    width: 180px;
    height: 180px;
    display: block;
}
.prize-instruction {
    font-size: 1.15em;
    color: #555;
    line-height: 1.5;
    margin: 8px 0;
}
.booking-btn {
    display: inline-block;
    padding: 16px 32px;
    font-size: 1.3em;
    font-weight: bold;
    background: var(--wm-gold);
    color: var(--wm-dark);
    text-decoration: none;
    border-radius: 12px;
    margin: 8px 0;
    touch-action: manipulation;
}
.booking-btn:active {
    background: var(--wm-blue);
    color: white;
}
.prize-validity {
    font-size: 1.2em;
    color: var(--wm-dark);
    margin: 8px 0 0 0;
    padding: 8px 12px;
    background: rgba(var(--wm-gold-rgb), 0.2);
    border-radius: 8px;
}

/* Responsive Anpassungen für neue Elemente */
@media (max-width: 480px) {
    .rules-content {
        padding: 24px 20px;
        width: 92vw;
    }
    .rules-content h2 {
        font-size: 2em;
    }
    .rules-content ul {
        font-size: 1.2em;
    }
    .prize-row {
        font-size: 1.2em;
    }
    .rules-validity {
        font-size: 1.3em;
    }
    .slug-display {
        font-size: 2em;
    }
    #qr-image {
        width: 160px;
        height: 160px;
    }
}

@media (max-width: 360px) {
    .rules-content {
        padding: 20px 16px;
        width: 94vw;
    }
    .rules-content h2 {
        font-size: 2em;
    }
    .rules-content ul {
        font-size: 1.15em;
    }
    .prize-row {
        font-size: 1.15em;
    }
    .slug-display {
        font-size: 1.8em;
        padding: 12px 18px;
    }
    #qr-image {
        width: 140px;
        height: 140px;
    }
}
