/**
 * ═══════════════════════════════════════════════════════════════════════════
 * GAME GHOST - GLOBAL STYLES (UPDATED)
 * ═══════════════════════════════════════════════════════════════════════════
 */

:root {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --bg-dark: #0a0a0f;
    --bg-medium: #1a1a2e;
    --text: #ffffff;
    --text-dim: #94a3b8;
    --glow: rgba(139, 92, 246, 0.6);
    --spotify-green: #1DB954;
    --font-size-base: 16px;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-h3: 1.5rem;
    --font-size-h2: 2rem;
    --font-size-h1: 2.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASIS & GLOBALE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-size: var(--font-size-base);
    line-height: 1.6;
    touch-action: manipulation;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    animation: backgroundShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCREENS & CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    z-index: 10;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#start-screen, #end-screen {
    justify-content: flex-start;
    overflow-y: auto;
}

.container {
    width: 100%;
    max-width: 900px;
    text-align: center;
    padding: 1.5rem;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAFIE
   ═══════════════════════════════════════════════════════════════════════════ */
h1 {
    font-size: var(--font-size-h1);
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

h2 {
    font-size: var(--font-size-h2);
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--primary-light);
}

h3 {
    font-size: var(--font-size-h3);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-dim);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎵 ARTIST BANNER (NEU) - MIT BILD + TEXT
   ═══════════════════════════════════════════════════════════════════════════ */
.artist-banner {
    display: block;
    width: 100%;
    max-width: 700px;
    margin: 1.5rem auto;
    padding: 0;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.15), rgba(139, 92, 246, 0.15));
    border: 2px solid var(--spotify-green);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(29, 185, 84, 0.2);
}

.artist-banner:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(29, 185, 84, 0.4);
    border-color: var(--primary-light);
}

.artist-banner:active {
    transform: translateY(-2px);
}

.artist-banner-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 18px 18px 0 0;
}

.artist-banner-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
}

.artist-image {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--spotify-green), var(--primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 4px 15px rgba(29, 185, 84, 0.4);
}

.music-note {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.artist-info {
    text-align: left;
}

.artist-label {
    font-size: 0.85rem;
    color: var(--spotify-green);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.artist-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.artist-subtitle {
    font-size: 0.95rem;
    color: var(--text-dim);
    font-weight: 500;
}

.spotify-logo {
    width: 50px;
    height: 50px;
    color: var(--spotify-green);
    transition: transform 0.3s ease;
}

.artist-banner:hover .spotify-logo {
    transform: scale(1.15) rotate(5deg);
}

/* Mobile Optimierung Banner */
@media (max-width: 600px) {
    .artist-banner-content {
        grid-template-columns: auto 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .artist-image {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .artist-name {
        font-size: 1.1rem;
    }
    
    .spotify-logo {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS (TOUCH-OPTIMIERT)
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    min-height: 48px;
    font-size: var(--font-size-lg);
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LADEBILDSCHIRM
   ═══════════════════════════════════════════════════════════════════════════ */
#loading-screen {
    background: var(--bg-dark);
    gap: 2rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top: 4px solid var(--primary);
    border-right: 4px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-screen p {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STARTSEITE
   ═══════════════════════════════════════════════════════════════════════════ */
.game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.game-card {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
    text-align: left;
    touch-action: manipulation;
}

.practice-game-card {
    cursor: pointer;
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.game-tag {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-light);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPIEL-INTRO
   ═══════════════════════════════════════════════════════════════════════════ */
.game-number {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 50px;
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.game-preview {
    background: rgba(139, 92, 246, 0.1);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    margin: 1rem 0;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.game-instructions {
    font-size: var(--font-size-lg);
    line-height: 1.7;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.ready-prompt {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--success);
    margin: 1.5rem 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPIELBILDSCHIRM
   ═══════════════════════════════════════════════════════════════════════════ */
#game-screen {
    justify-content: flex-start;
    gap: 1rem;
    padding: 0;
}

.game-header {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top)); 
    padding-left: calc(1rem + env(safe-area-inset-left)); 
    padding-right: calc(1rem + env(safe-area-inset-right)); 
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    width: 100%;
    max-width: 900px;
    margin-top: 1rem;
}

#current-score {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-light);
    font-variant-numeric: tabular-nums;
}

.instructions {
    font-size: var(--font-size-base);
    color: var(--text-dim);
}

.game-container {
    flex: 1;
    width: 100%;
    max-width: 900px;
    background: rgba(26, 26, 46, 0.9);
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: calc(1rem + env(safe-area-inset-left)); 
    margin-right: calc(1rem + env(safe-area-inset-right)); 
    margin-bottom: calc(1rem + env(safe-area-inset-bottom)); 
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENDBILDSCHIRM
   ═══════════════════════════════════════════════════════════════════════════ */
.final-score-display {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
    padding: 2rem;
    border-radius: 20px;
    margin: 1.5rem 0;
    border: 1px solid var(--primary);
}

.final-score-display .label {
    display: block;
    font-size: var(--font-size-lg);
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.final-score {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
}

.score-form {
    margin: 2rem 0;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.name-input {
    width: 100%;
    padding: 0.8rem 1rem;
    min-height: 48px;
    font-size: var(--font-size-lg);
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 14px;
    color: var(--text);
    margin-bottom: 1rem;
    text-align: center;
    touch-action: manipulation;
}

.name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.player-rank {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--success);
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 16px;
    border: 2px solid var(--success);
}

.highscore-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: left;
}

.highscore-entry {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: background 0.3s ease;
}

.highscore-entry .rank {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-light);
}

.highscore-entry .name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.highscore-entry .score {
    text-align: right;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
    font-variant-numeric: tabular-nums;
}

.highscore-entry.player-entry {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid var(--primary);
    transform: scale(1.02);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.button-group .btn {
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.legal-footer {
    width: 100%;
    padding: 1rem;
    margin-top: 3rem;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex;
}

.legal-footer .links {
    display: flex;
    gap: 1.5rem;
}

.legal-footer a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ZERTIFIKAT-VORSCHAU
   ═══════════════════════════════════════════════════════════════════════════ */
#certificate-preview-container {
    margin-top: 2rem;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#certificate-preview-container.hidden {
    display: none;
}

.preview-title {
    font-size: 1.25rem;
    color: #f59e0b;
    margin: 0;
}

#certificate-image {
    width: 100%;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#certificate-actions {
    width: 100%;
}

#share-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    font-size: 1.1rem;
    padding: 0.9rem 1rem;
}

#share-download-icon {
    font-size: 1.5rem;
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
    :root {
        --font-size-base: 18px;
        --font-size-h2: 2.5rem;
        --font-size-h1: 3.5rem;
    }
    .container {
        padding: 3rem;
    }
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn {
        padding: 1rem 2.5rem;
    }
    .button-group {
        flex-direction: row;
    }
    #game-screen {
        padding: 1.5rem;
        padding-top: calc(1.5rem + env(safe-area-inset-top));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
        padding-left: calc(1.5rem + env(safe-area-inset-left));
        padding-right: calc(1.5rem + env(safe-area-inset-right));
    }
    .game-header {
        padding: 1.5rem 2rem;
        padding-top: 1.5rem;
    }
    .final-score {
        font-size: 5rem;
    }
    .highscore-entry {
        grid-template-columns: 60px 1fr 100px;
    }
}

@media (min-width: 1024px) {
    :root {
        --font-size-h1: 4.5rem;
    }
    .game-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .highscore-list {
        max-height: 500px;
    }
    .legal-footer {
        flex-direction: row;
        gap: 2rem;
    }
}

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 25px rgba(139, 92, 246, 0.6);
    }
    .game-card:hover {
        transform: translateY(-5px);
        border-color: var(--primary);
        box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
    }
    .legal-footer a:hover {
        color: var(--secondary);
    }
    .highscore-entry:hover {
        background: rgba(139, 92, 246, 0.1);
    }
}