/* ============================================
   RESET E VARIÁVEIS
   ============================================ */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --card-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-primary: #f8f9ff;
    --bg-secondary: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-radius: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   DECORAÇÃO DE FUNDO
   ============================================ */
.background-decoration {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
}

.background-decoration::before,
.background-decoration::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.background-decoration::before {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -200px;
    right: -200px;
}

.background-decoration::after {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -150px;
    left: -150px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, 50px) scale(1.1); }
    50% { transform: translate(0, 100px) scale(0.9); }
    75% { transform: translate(-50px, 50px) scale(1.05); }
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ============================================
   CABEÇALHO
   ============================================ */
.app-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.main-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.title-jp {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 3em;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-text {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin-top: 10px;
    font-weight: 300;
}

/* ============================================
   SEÇÃO DE PRONÚNCIA ALEATÓRIA
   ============================================ */
.random-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 1.6em;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon {
    color: #667eea;
}

/* Contador de Sequência */
.streak-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #fff5e6 0%, #ffe4cc 100%);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}

.streak-icon {
    font-size: 1.4em;
    animation: pulse 2s ease-in-out infinite;
}

.streak-text {
    font-size: 1em;
    color: var(--text-primary);
    font-weight: 500;
}

.streak-text strong {
    font-size: 1.3em;
    color: #f45c43;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Display de Pronúncia */
.pronunciation-display {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.circle-wrapper {
    position: relative;
    display: inline-block;
}

.circle-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    background: var(--primary-gradient);
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.3;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.1); }
}

.circle {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    font-size: 2.2em;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Grupo de Input */
.input-group {
    display: flex;
    gap: 15px;
    max-width: 500px;
    margin: 30px auto;
    flex-wrap: wrap;
}

input {
    flex: 1;
    min-width: 200px;
    padding: 16px 24px;
    font-size: 1.1em;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    background: #f7fafc;
}

input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

input::placeholder {
    color: #a0aec0;
}

.btn-primary {
    padding: 16px 32px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    font-family: 'Poppins', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.3em;
    transition: var(--transition);
}

.btn-primary:hover .btn-icon {
    transform: translateX(5px);
}

/* Feedback Container */
.feedback-container {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.feedback {
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.feedback.show {
    opacity: 1;
    transform: scale(1);
}

.feedback.correct {
    color: #38ef7d;
    text-shadow: 0 2px 10px rgba(56, 239, 125, 0.3);
}

.feedback.error {
    color: #f45c43;
    text-shadow: 0 2px 10px rgba(244, 92, 67, 0.3);
}

.scoreAnimation {
    font-size: 2.5em;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.scoreAnimation.show {
    opacity: 1;
    transform: scale(1);
    animation: popUp 0.6s ease-out;
}

@keyframes popUp {
    0% { transform: scale(0.5) translateY(20px); }
    50% { transform: scale(1.2) translateY(-10px); }
    100% { transform: scale(1) translateY(0); }
}

/* ============================================
   SEÇÃO DE FIXAÇÃO
   ============================================ */
.fixation-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.6s ease-out 0.4s both;
    transition: var(--transition);
}

.toggle-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50px;
    color: #667eea;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
}

.toggle-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.eye-icon {
    transition: var(--transition);
}

/* Grid de Números */
.numbers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 30px;
    transition: var(--transition);
}

.number-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out both;
}

.number-card:nth-child(1) { animation-delay: 0.1s; }
.number-card:nth-child(2) { animation-delay: 0.15s; }
.number-card:nth-child(3) { animation-delay: 0.2s; }
.number-card:nth-child(4) { animation-delay: 0.25s; }
.number-card:nth-child(5) { animation-delay: 0.3s; }
.number-card:nth-child(6) { animation-delay: 0.35s; }
.number-card:nth-child(7) { animation-delay: 0.4s; }
.number-card:nth-child(8) { animation-delay: 0.45s; }
.number-card:nth-child(9) { animation-delay: 0.5s; }
.number-card:nth-child(10) { animation-delay: 0.55s; }

.number-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.card-inner {
    padding: 24px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.number-badge {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--card-gradient);
    color: white;
    font-size: 1.6em;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.romaji {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hiragana {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    color: #764ba2;
}

/* Estado Oculto */
.fixation-section.hidden {
    filter: blur(12px);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

.fixation-section.hidden .numbers-grid {
    transform: scale(0.95);
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 1.1em;
    animation: fadeIn 0.6s ease-out 0.6s both;
}

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .title-jp {
        font-size: 2.2em;
    }

    .title-text {
        font-size: 1.4em;
    }

    .subtitle {
        font-size: 1em;
    }

    .random-section,
    .fixation-section {
        padding: 25px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 1.3em;
    }

    .circle {
        width: 150px;
        height: 150px;
        font-size: 1.8em;
    }

    .circle-glow {
        width: 180px;
        height: 180px;
    }

    .input-group {
        flex-direction: column;
        width: 100%;
    }

    input,
    .btn-primary {
        width: 100%;
        min-width: auto;
    }

    .numbers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .feedback {
        font-size: 1.1em;
    }

    .scoreAnimation {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .title-jp {
        font-size: 1.8em;
    }

    .title-text {
        font-size: 1.2em;
    }

    .random-section,
    .fixation-section {
        padding: 20px;
    }

    .circle {
        width: 130px;
        height: 130px;
        font-size: 1.5em;
    }

    .numbers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   ESTADOS INTERATIVOS E ACESSIBILIDADE
   ============================================ */
*:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

::selection {
    background: #667eea;
    color: white;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Remover animações para quem prefere movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
