/* ═══════════════════════════════════════════════════════════
   FRACTION FRENZY TUTORIAL (ff-tutorial.js)
   ═══════════════════════════════════════════════════════════ */

/* --- Overlay --- */
.fft-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fft-overlay.fft-visible {
    opacity: 1;
}

.fft-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.fft-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- Modal mode --- */
.fft-overlay.fft-modal-mode {
    background: none;
}

.fft-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.fft-modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1;
    aspect-ratio: 16 / 10;
}

.fft-modal-container .fft-close-btn {
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
}

.fft-modal-container .fft-stage {
    padding: 1.5rem;
}

.fft-modal-container .fft-subtitle-bar {
    padding: 0 1.5rem 1rem;
    min-height: 60px;
}

.fft-modal-container .fft-subtitle-text {
    font-size: 1rem;
}

.fft-modal-container .fft-play-btn {
    padding: 1.5rem 2.5rem;
    font-size: 1rem;
    border-radius: 18px;
}

.fft-modal-container .fft-play-btn svg {
    width: 36px;
    height: 36px;
}

.fft-modal-container .fft-heading {
    font-size: 1.6rem;
}

.fft-modal-container .fft-title-text {
    font-size: 3.5rem;
}

.fft-modal-container .fft-player-icon {
    font-size: 1.8rem;
}

.fft-modal-container .fft-team-group {
    width: 110px;
    padding: 0.75rem 0.75rem 2rem;
}

.fft-modal-container .fft-card {
    padding: 1rem 1.5rem;
}

.fft-modal-container .fft-card .ff-frac-num,
.fft-modal-container .fft-card .ff-frac-den {
    font-size: 2.5rem;
}

.fft-modal-container .fft-op-icon {
    font-size: 2.2rem;
}

.fft-modal-container .fft-shh-emoji {
    font-size: 4rem;
}

.fft-modal-container .fft-podium-block {
    width: 80px;
}

.fft-modal-container .fft-podium-1 .fft-podium-block { height: 110px; }
.fft-modal-container .fft-podium-2 .fft-podium-block { height: 80px; }
.fft-modal-container .fft-podium-3 .fft-podium-block { height: 55px; }

/* --- Stage --- */
.fft-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fft-stage.fft-fade-out {
    opacity: 0;
    transform: scale(0.96);
}

.fft-stage.fft-fade-in {
    animation: fftFadeIn 0.4s ease both;
}

@keyframes fftFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Subtitle bar --- */
.fft-subtitle-bar {
    width: 100%;
    max-width: 800px;
    min-height: 80px;
    padding: 0 2rem 1.5rem;
    text-align: center;
}

.fft-subtitle-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.15rem;
    line-height: 1.5;
    transition: opacity 0.25s ease;
    margin: 0;
}

/* --- Progress bar --- */
.fft-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.fft-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #ec4899);
    width: 0%;
    transition: width 0.3s linear;
}

/* --- Play overlay --- */
.fft-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background: rgba(0, 0, 0, 0.3);
}

.fft-play-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #f97316, #ec4899);
    border: none;
    border-radius: 24px;
    padding: 2rem 3rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 8px 40px rgba(249, 115, 22, 0.3);
}

.fft-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 50px rgba(249, 115, 22, 0.4);
}

/* --- Scene: shared --- */
.fft-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2rem;
    width: 100%;
}

.fft-heading {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

/* --- Scene: Title --- */
.fft-title-text {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    letter-spacing: -2px;
    animation: fftTitleSlam 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.fft-title-text-2 {
    animation-delay: 0.15s;
}

.fft-title-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.3rem;
    font-weight: 500;
    animation: fftFadeUp 0.5s ease 0.4s both;
}

@keyframes fftTitleSlam {
    from { opacity: 0; transform: scale(1.5); }
    to { opacity: 1; transform: scale(1); }
}

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

/* --- Scene: Teams --- */
.fft-team-icons {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.fft-team-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    justify-items: center;
    width: 130px;
    position: relative;
    padding-bottom: 2rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem 1rem 2.2rem;
}

.fft-team-small {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
}

.fft-player-icon {
    font-size: 2.2rem;
    animation: fftPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay) both;
}

.fft-team-label {
    position: absolute;
    bottom: 0.5rem;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-weight: 600;
    animation: fftFadeUp 0.3s ease var(--delay) both;
}

.fft-team-note {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.95rem;
    margin-top: 0.5rem;
    animation: fftFadeUp 0.4s ease 1s both;
}

@keyframes fftPopIn {
    from { opacity: 0; transform: scale(0) rotate(-15deg); }
    to { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* --- Scene: Fractions --- */
.fft-cards-row {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.fft-card {
    padding: 1.5rem 2.5rem;
}

.fft-card .ff-frac-num,
.fft-card .ff-frac-den {
    font-size: 4rem;
}

.fft-card .ff-frac-bar {
    height: 4px;
    margin: 0.3rem 0;
}

.fft-card-pop-left {
    animation: fftCardLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.fft-card-pop-right {
    animation: fftCardRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.fft-and {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    animation: fftFadeUp 0.3s ease 0.3s both;
}

@keyframes fftCardLeft {
    from { opacity: 0; transform: rotate(-3deg) translateX(-60px) scale(0.8); }
    to { opacity: 1; transform: rotate(-3deg) translateX(0) scale(1); }
}

@keyframes fftCardRight {
    from { opacity: 0; transform: rotate(3deg) translateX(60px) scale(0.8); }
    to { opacity: 1; transform: rotate(3deg) translateX(0) scale(1); }
}

/* --- Scene: Operations --- */
.fft-ops-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 600px;
}

.fft-op-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--colour);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    animation: fftPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay) both;
}

.fft-op-icon {
    font-size: 3rem;
    font-weight: 700;
    color: var(--colour);
}

.fft-op-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

/* --- Scene: Sum --- */
.fft-sum-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.fft-sum-item {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    animation: fftFadeUp 0.3s ease var(--delay) both;
}

.fft-sum-plus {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.3);
    animation: fftFadeUp 0.3s ease var(--delay) both;
}

.fft-sum-line {
    width: 120px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0.3rem 0;
    animation: fftFadeUp 0.3s ease var(--delay) both;
}

.fft-sum-total {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fftPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay) both;
}

/* --- Scene: Quiet --- */
.fft-shh-emoji {
    font-size: 6rem;
    animation: fftPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.fft-quiet-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    animation: fftFadeUp 0.3s ease 0.3s both;
}

/* --- Scene: Mixed number --- */
.fft-mixed-demo {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.fft-mixed-wrong,
.fft-mixed-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    animation: fftPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay) both;
}

.fft-mixed-wrong {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.4);
}

.fft-mixed-right {
    background: rgba(52, 211, 153, 0.15);
    border: 2px solid rgba(52, 211, 153, 0.4);
}

.fft-mixed-frac {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.fft-mixed-x {
    font-size: 2rem;
    color: #ef4444;
    font-weight: 700;
}

.fft-mixed-tick {
    font-size: 2rem;
    color: #34d399;
    font-weight: 700;
}

.fft-mixed-arrow {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
    animation: fftFadeUp 0.3s ease var(--delay) both;
}

/* --- Scene: Scoring / Podium --- */
.fft-podium {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.fft-podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: fftPodiumRise 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay) both;
}

.fft-podium-pts {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.fft-podium-block {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    border-radius: 12px 12px 0 0;
    font-weight: 800;
    font-size: 1.3rem;
    color: white;
}

.fft-podium-1 .fft-podium-block {
    height: 140px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

.fft-podium-2 .fft-podium-block {
    height: 100px;
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

.fft-podium-3 .fft-podium-block {
    height: 70px;
    background: linear-gradient(180deg, #d97706, #b45309);
}

.fft-scoring-note {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    margin-top: 0.5rem;
    animation: fftFadeUp 0.4s ease 0.8s both;
}

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

/* --- Scene: Outro --- */
.fft-outro-scene .fft-title-text {
    font-size: 4rem;
}

.fft-outro-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.3rem;
    font-style: italic;
    animation: fftFadeUp 0.5s ease 0.3s both;
}

/* --- How to Play button (lobby) --- */
.fft-how-to-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(249, 115, 22, 0.1);
    border: 2px solid rgba(249, 115, 22, 0.3);
    color: #f97316;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

.fft-how-to-play-btn:hover {
    background: rgba(249, 115, 22, 0.18);
    border-color: rgba(249, 115, 22, 0.5);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .fft-title-text {
        font-size: 3rem;
    }
    .fft-heading {
        font-size: 1.5rem;
    }
    .fft-ops-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .fft-card .ff-frac-num,
    .fft-card .ff-frac-den {
        font-size: 2.5rem;
    }
    .fft-podium-block {
        width: 70px;
    }
    .fft-mixed-demo {
        flex-direction: column;
        gap: 1rem;
    }
}

