/* =============================================
   FOOTBALL.CSS — Football Maths game styles
   Sofia's Game Arcade
   ============================================= */

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Back nav handled by base.css */

/* ---- Game container ---- */
.game-container {
    text-align: center;
    padding: var(--space-xl);
    max-width: 500px;
    width: 100%;
}

/* ---- Screen transitions ---- */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(14px);
}

.screen.active {
    display: block;
    animation: screenIn 0.4s ease forwards;
}

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

/* ---- Title screen ---- */
.title {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--accent-green), #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.credit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* ---- Setup labels ---- */
.setup-label {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
}

/* ---- Timer picker ---- */
.timer-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.time-btn {
    width: 52px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color var(--transition-fast),
                background var(--transition-fast),
                transform var(--transition-fast);
}

.time-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(96, 165, 250, 0.1);
    transform: scale(1.08);
}

.time-btn:active {
    transform: scale(0.95);
}

.time-btn.active {
    border-color: var(--accent-blue);
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
}

/* ---- Ready screen ---- */
.ready-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--space-2xl) 0 var(--space-xl);
}

/* ---- Countdown screen ---- */
.countdown-number {
    font-size: 6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: var(--space-xl);
}

.countdown-number.pop {
    animation: countPop 0.4s ease;
}

@keyframes countPop {
    0%   { opacity: 0; transform: scale(2); }
    60%  { opacity: 1; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.tables-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.table-btn {
    width: 60px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color var(--transition-fast),
                background var(--transition-fast),
                transform var(--transition-fast);
}

.table-btn:hover {
    border-color: var(--accent-green);
    background: rgba(74, 222, 128, 0.1);
    transform: scale(1.08);
}

.table-btn:active {
    transform: scale(0.95);
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.9rem 2.4rem;
    border-radius: var(--radius-full);
    border: none;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast),
                box-shadow var(--transition-fast);
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
}

.btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: scale(0.97);
}

.btn-start {
    background: var(--accent-green);
    color: #0b0e1a;
    padding: 1rem 3rem;
    font-size: 1.3rem;
    animation: pulseGlow 2.5s ease-in-out infinite;
}

.btn-start:hover {
    background: #22c55e;
    animation: none;
    box-shadow: 0 0 24px rgba(74, 222, 128, 0.4);
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(74, 222, 128, 0.2); }
    50%      { box-shadow: 0 0 24px rgba(74, 222, 128, 0.45); }
}

/* ---- Scoreboard bar ---- */
.scoreboard-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.team {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.team-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.team-score {
    font-size: 2rem;
    font-weight: 800;
}

.team-you .team-score { color: var(--accent-green); }
.team-cpu .team-score { color: var(--accent-red); }

.round-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---- Pitch ---- */
.pitch {
    position: relative;
    width: 300px;
    height: 180px;
    margin: 0 auto var(--space-lg);
    background: linear-gradient(180deg, #1a5c2a 0%, #1e6b31 100%);
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

/* Goal */
.goal {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 70px;
}

.net {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.08) 10px,
        rgba(255, 255, 255, 0.08) 11px
    ),
    repeating-linear-gradient(
        0deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.08) 10px,
        rgba(255, 255, 255, 0.08) 11px
    );
    border-radius: 4px 4px 0 0;
}

.post-left,
.post-right {
    position: absolute;
    top: 0;
    width: 4px;
    height: 100%;
    background: #fff;
    border-radius: 2px;
}

.post-left  { left: 0; }
.post-right { right: 0; }

.crossbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #fff;
    border-radius: 2px;
}

/* Ball */
.ball {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    transition: all 0.5s ease;
}

.ball-goal {
    bottom: 50px;
    font-size: 2.4rem;
    animation: ballToGoal 0.5s ease forwards;
}

.ball-miss {
    animation: ballMiss 0.5s ease forwards;
}

.ball-saved {
    animation: ballSaved 0.5s ease forwards;
}

@keyframes ballToGoal {
    0%   { bottom: 20px; transform: translateX(-50%) scale(1); }
    100% { bottom: 65px; transform: translateX(-50%) scale(0.8); }
}

@keyframes ballMiss {
    0%   { bottom: 20px; transform: translateX(-50%) scale(1); opacity: 1; }
    100% { bottom: 80px; transform: translateX(80px) scale(0.6) rotate(30deg); opacity: 0.4; }
}

@keyframes ballSaved {
    0%   { bottom: 20px; transform: translateX(-50%) scale(1); }
    50%  { bottom: 55px; transform: translateX(-50%) scale(0.9); }
    100% { bottom: 30px; transform: translateX(60px) scale(1) rotate(-15deg); }
}

/* Result flash text */
.result-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
}

.flash-goal {
    color: var(--accent-green);
    animation: flashIn 0.4s ease forwards;
}

.flash-miss {
    color: var(--accent-red);
    animation: flashIn 0.4s ease forwards;
}

@keyframes flashIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---- Question area ---- */
.question-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.action-label {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-label.attacking { color: var(--accent-green); }
.action-label.defending { color: var(--accent-blue); }

/* Timer bar */
.question-timer {
    width: 100%;
    max-width: 320px;
}

.timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    width: 100%;
    background: var(--accent-green);
    border-radius: 3px;
    transition: width 12s linear;
}

.timer-fill.timer-danger {
    background: var(--accent-red);
}

/* Question */
.question-text {
    font-size: 1.8rem;
    font-weight: 800;
    margin: var(--space-xs) 0;
}

/* Answer row */
.answer-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.answer-input {
    width: 100px;
    padding: 0.7rem;
    background: transparent;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color var(--transition-med);
    -moz-appearance: textfield;
}

.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-input:focus {
    border-color: var(--accent-green);
}

.answer-input:disabled {
    opacity: 0.4;
}

.btn-shoot {
    background: var(--accent-green);
    color: #0b0e1a;
    padding: 0.7rem 1.8rem;
    font-size: 1.1rem;
    animation: none;
}

.btn-shoot:hover {
    background: #22c55e;
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.3);
}

.btn-shoot:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Final screen ---- */
.final-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: var(--space-md);
    animation: resultPop 0.5s ease;
}

.win-color  { color: var(--accent-green); }
.lose-color { color: var(--accent-red); }
.draw-color { color: var(--accent-yellow); }

@keyframes resultPop {
    0%   { opacity: 0; transform: scale(0.7); }
    70%  { transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

.final-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    font-size: 1.2rem;
    margin-bottom: var(--space-md);
}

.final-scores strong {
    color: var(--text-primary);
}

.final-vs {
    color: var(--text-muted);
}

.final-msg {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: var(--space-xl);
}

/* ---- Responsive ---- */
@media (max-width: 420px) {
    .game-container {
        padding: 1.2rem;
    }

    .title {
        font-size: 1.8rem;
    }

    .pitch {
        width: 260px;
        height: 160px;
    }

    .goal {
        width: 130px;
        height: 58px;
    }

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

    .scoreboard-bar {
        gap: var(--space-md);
    }

    .team-score {
        font-size: 1.6rem;
    }
}
