/* --- Reset & Temel Ayarlar --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #090d16;
    --card-bg: rgba(22, 30, 49, 0.82);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --error: #f43f5e;
    --error-glow: rgba(244, 63, 94, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
    padding: 24px 16px;
}

/* --- Arka Plan Glow Efektleri --- */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
    top: -120px;
    left: -120px;
}

.bg-glow-2 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.25) 0%, transparent 70%);
    bottom: -120px;
    right: -120px;
}

/* --- Ana Konteyner --- */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    margin: 20px auto;
}

/* --- Üst Başlık & Ses Kontrolü --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.3px;
}

.badge-icon {
    font-size: 1rem;
}

.sound-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.sound-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.08);
}

.sound-btn.muted {
    opacity: 0.5;
}

.main-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.quiz-description {
    font-size: 0.96rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Oyuncu Giriş Formu --- */
.player-form-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    margin-bottom: 24px;
    animation: fadeInSlideUp 0.35s ease;
}

.form-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #f1f5f9;
}

.input-wrap {
    margin-bottom: 20px;
}

#playerName {
    width: 100%;
    max-width: 320px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all 0.25s ease;
}

#playerName::placeholder {
    color: #64748b;
    font-weight: 400;
}

#playerName:focus {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.shake-input {
    animation: shake 0.4s ease;
    border-color: var(--error) !important;
}

/* --- İlerleme ve İstatistik Çubuğu --- */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 16px;
    margin-bottom: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 65px;
}

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
}

.score-stat {
    color: #fbbf24;
}

.progress-wrap {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Oyun Kartı & Görsel --- */
.game-card {
    position: relative;
    animation: fadeInSlideUp 0.35s ease;
}

.image-wrapper {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 18px;
    min-height: 160px;
}

.note-img {
    height: 130px;
    max-width: 100%;
    object-fit: contain;
    display: block;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.note-img.loaded {
    opacity: 1;
    transform: scale(1);
}

.question-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 14px;
}

/* Metronom Göstergesi */
.metronome-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 18px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.25s ease;
}

.metronome-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.metronome-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
    transition: all 0.15s ease;
}

.metronome-indicator.pulse .metronome-dot {
    background: #fbbf24;
    transform: scale(1.5);
    box-shadow: 0 0 12px #fbbf24;
}

/* --- Seçenekler Grid --- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.option-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    padding: 13px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.option-badge {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-light);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-text {
    flex: 1;
    text-align: left;
    font-size: 0.98rem;
}

.option-button:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.16);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.option-button:hover:not(:disabled) .option-badge {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.option-button.evaluating {
    border-color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.15) !important;
    animation: pulseGlow 0.8s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 10px rgba(251, 191, 36, 0.2); }
    to { box-shadow: 0 0 20px rgba(251, 191, 36, 0.5); }
}

/* Doğru Cevap */
.option-button.correct {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px var(--success-glow) !important;
    transform: scale(1.02);
}

.option-button.correct .option-badge {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

/* Yanlış Cevap */
.option-button.wrong {
    background: linear-gradient(135deg, #dc2626 0%, #f43f5e 100%) !important;
    border-color: #fb7185 !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px var(--error-glow) !important;
    animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.option-button.wrong .option-badge {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.option-button:disabled {
    cursor: default;
    opacity: 0.9;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Geri Bildirim Alanı --- */
.feedback-wrapper {
    min-height: 44px;
    margin-top: 10px;
}

.feedback-text {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    display: inline-block;
    animation: fadeInSlideUp 0.3s ease;
}

.feedback-correct {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.feedback-wrong {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fb7185;
}

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

/* --- Skor & Bitiş Kartı --- */
.score-card {
    padding: 16px 0;
    animation: fadeInSlideUp 0.4s ease;
}

.result-badge {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: bounce 1.2s infinite alternate ease-in-out;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

#resultTitle {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #ffffff;
}

.result-message {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 26px;
    line-height: 1.5;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.summary-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.summary-num {
    font-size: 1.65rem;
    font-weight: 800;
}

.score-box .summary-num { color: #fbbf24; }
.correct-box .summary-num { color: var(--success); }
.percentage-box .summary-num { color: var(--primary-light); }

.summary-text {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buton Stilleri */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
    transition: all 0.25s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -5px rgba(99, 102, 241, 0.65);
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* --- Puan Tablosu (Scoreboard) --- */
.scoreboard-section {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.scoreboard-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.scoreboard-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.table-wrap {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#scoreboard {
    width: 100%;
    border-collapse: collapse;
}

#scoreboard th {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 16px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#scoreboard td {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

#scoreboard tr:last-child td {
    border-bottom: none;
}

.rank-badge {
    font-weight: 700;
}

.player-name-cell {
    font-weight: 600;
}

.current-player-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--primary-light);
    margin-left: 6px;
}

.score-pill {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fbbf24;
}

.empty-scoreboard {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Footer Bilgisi --- */
.footer-info {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.88rem;
}

.footer-info a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-info a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.sub-credit {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Konfeti Canvas --- */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

/* --- Responsive Tasarım --- */
@media (max-width: 640px) {
    .container {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .main-title {
        font-size: 1.7rem;
    }

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

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .option-button {
        padding: 11px 10px;
        font-size: 0.92rem;
        gap: 8px;
    }

    .option-badge {
        width: 28px;
        height: 28px;
        font-size: 0.72rem;
    }

    .result-summary {
        gap: 8px;
    }

    .summary-num {
        font-size: 1.35rem;
    }
}
