/* ============================================
   FRACTION FRENZY STYLES
   ============================================ */

/* --- State Sections --- */
.fractions-state {
    padding: 2rem 0;
}

/* --- Student Header --- */
.fractions-student-header {
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    padding: 1rem 0;
    color: white;
}

.fractions-student-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fractions-student-header .student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fractions-student-header .session-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.fractions-student-header .team-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

/* --- Teacher Header --- */
.fractions-teacher-header {
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    padding: 2rem 0;
    color: white;
}

.fractions-teacher-header h1 {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.fractions-teacher-header .back-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

.fractions-teacher-header .back-link:hover {
    color: white;
}

/* --- Teacher Lobby --- */
.fractions-teacher-lobby {
    max-width: 700px;
    margin: 0 auto;
}

/* --- Student Lobby --- */
.fractions-lobby {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

/* --- Game Header --- */
.fractions-game-header {
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    padding: 0.75rem 0;
    color: white;
}

.fractions-game-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fractions-game-header .game-header-left,
.fractions-game-header .game-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fractions-game-header .game-header-center {
    font-weight: 600;
    font-size: 1.1rem;
}

/* --- Team Builder (Drag & Drop) --- */
.fractions-team-builder {
    max-width: 1100px;
    margin: 0 auto;
}

.team-builder-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.team-builder-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
    min-height: 300px;
}

.unassigned-panel {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.unassigned-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #64748b;
}

.player-drag-list {
    min-height: 60px;
    padding: 0.5rem;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.player-drag-list.drag-over {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.05);
}

.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-content: start;
}

.fractions-team-column {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-top: 4px solid #6366f1;
    overflow: hidden;
}

.team-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: white;
}

.team-name-input {
    background: transparent;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    outline: none;
}

.team-name-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.team-remove-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.team-remove-btn:hover {
    color: white;
}

.team-drop-zone {
    min-height: 80px;
    padding: 0.5rem;
    border: 2px dashed transparent;
    margin: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.team-drop-zone.drag-over {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.05);
}

.drop-hint {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 1rem 0;
}

.team-member-count {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.fractions-player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    cursor: grab;
    transition: all 0.15s ease;
    user-select: none;
}

.fractions-player-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.fractions-player-card.dragging {
    opacity: 0.4;
}

.fractions-player-card .player-card-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.fractions-player-card .player-card-drag-handle {
    color: #94a3b8;
    font-size: 1rem;
}

.touch-drag-clone {
    border: 2px solid #f97316;
    background: white !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.team-builder-actions {
    margin-top: 2rem;
    text-align: center;
}

/* --- Fractions Display (Large / Teacher) --- */
.fractions-display-large {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.fractions-display-label {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.fractions-display-pair {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.fraction-large {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.fraction-large .frac-num {
    color: #1e293b;
}

.fraction-large .frac-bar {
    display: block;
    width: 100%;
    height: 4px;
    background: #1e293b;
    margin: 0.2rem 0;
    border-radius: 2px;
}

.fraction-large .frac-den {
    color: #1e293b;
}

.fractions-and {
    font-size: 1.5rem;
    color: #64748b;
    font-weight: 500;
}

.fractions-difficulty-badge {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-easy {
    background: #dcfce7;
    color: #16a34a;
}

.difficulty-medium {
    background: #fef3c7;
    color: #d97706;
}

.difficulty-hard {
    background: #fecaca;
    color: #dc2626;
}

/* ================================================
   FRACTION FRENZY — Student Game Screen (.ff-)
   ================================================ */

/* --- Game Screen Container --- */
.ff-game-screen {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: calc(100vh - 200px);
}

.ff-game-screen .fractions-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Round Badge --- */
.ff-round-badge {
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 500;
    padding: 0.3rem 1rem;
    background: #f1f5f9;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1.5rem;
}

/* --- Fraction Cards --- */
.ff-fractions-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.ff-op-symbol {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    z-index: 1;
}

.ff-fraction-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 3px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    line-height: 1;
}

.ff-card-left {
    transform: rotate(-3deg);
    border-color: #818cf8;
}

.ff-card-right {
    transform: rotate(3deg);
    border-color: #f472b6;
}

.ff-card-left:hover {
    transform: rotate(-3deg) scale(1.05);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.2);
}

.ff-card-right:hover {
    transform: rotate(3deg) scale(1.05);
    box-shadow: 0 8px 30px rgba(244, 114, 182, 0.2);
}

.ff-frac-num, .ff-frac-den {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1e293b;
}

.ff-frac-bar {
    display: block;
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    margin: 0.2rem 0;
}

/* Fraction card entrance animation */
.ff-fraction-card.ff-animate-in.ff-card-left {
    animation: ffSlideInLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ff-fraction-card.ff-animate-in.ff-card-right {
    animation: ffSlideInRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes ffSlideInLeft {
    0% { opacity: 0; transform: rotate(-3deg) translateX(-80px) scale(0.8); }
    100% { opacity: 1; transform: rotate(-3deg) translateX(0) scale(1); }
}

@keyframes ffSlideInRight {
    0% { opacity: 0; transform: rotate(3deg) translateX(80px) scale(0.8); }
    100% { opacity: 1; transform: rotate(3deg) translateX(0) scale(1); }
}

/* --- Operation Word --- */
.ff-operation-word {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    text-align: center;
}

.ff-operation-word.ff-fade-in {
    animation: ffFadeInScale 0.4s ease both;
}

.ff-operation-word.ff-fade-out {
    animation: ffFadeOut 0.3s ease both;
}

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

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

/* --- MathLive Input Area --- */
.ff-input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 320px;
    margin-bottom: 1.5rem;
}

.ff-math-input {
    width: 100%;
    font-size: 1.8rem;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.5rem;
    min-height: 70px;
    text-align: center;
    transition: border-color 0.2s ease;
    --caret-color: #f97316;
}

.ff-math-input:focus-within {
    border-color: #f97316;
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.ff-math-input:disabled {
    background: #f1f5f9;
    opacity: 0.7;
}

.ff-submit-btn {
    width: 100%;
    max-width: 320px;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ff-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.ff-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ff-submit-btn:disabled {
    background: #10b981;
    cursor: default;
    opacity: 1;
}

/* --- Feedback --- */
.ff-feedback {
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 1.3rem;
    text-align: center;
}

.ff-feedback-success {
    color: #16a34a;
}

.ff-feedback-error {
    color: #dc2626;
}

/* --- Correct Flash Animation --- */
.ff-correct-flash {
    animation: ffCorrectFlash 0.6s ease;
}

@keyframes ffCorrectFlash {
    0% { border-color: #e2e8f0; }
    30% { border-color: #22c55e; background-color: #dcfce7; }
    100% { border-color: #22c55e; }
}

/* --- Shake Animation --- */
.ff-shake {
    animation: ffShake 0.5s ease;
}

@keyframes ffShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

/* --- Progressive Sum Equation --- */
.ff-sum-equation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 1rem;
    color: #64748b;
    width: 100%;
    max-width: 520px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ff-sum-value {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-weight: 600;
    padding: 0.2rem 0.35rem;
}

.ff-sum-filled {
    color: #16a34a;
    background: #dcfce7;
    border-radius: 6px;
    animation: ffFadeInScale 0.4s ease both;
}

.ff-sum-slot {
    color: #cbd5e1;
    font-size: 1.5rem;
    line-height: 1;
}

.ff-sum-plus, .ff-sum-equals {
    color: #94a3b8;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Rendered fraction in sum equation */
.ff-sum-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
}

.ff-sf-num, .ff-sf-den {
    font-size: 0.85rem;
    font-weight: 700;
    color: inherit;
}

.ff-sf-bar {
    display: block;
    width: 100%;
    min-width: 12px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    margin: 1px 0;
}

.ff-sum-whole {
    font-size: 1rem;
    font-weight: 700;
    color: inherit;
}

.ff-sum-neg {
    font-weight: 700;
    color: inherit;
    margin-right: 1px;
}

/* Inline answer input in sum equation */
.ff-sum-answer-slot {
    display: inline-flex;
    align-items: center;
}

.ff-sum-inline-input {
    width: 120px;
    min-height: 55px;
    font-size: 1.4rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.2s ease;
    --caret-color: #f97316;
}

.ff-sum-inline-input:focus-within {
    border-color: #f97316;
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.ff-sum-inline-input::part(menu-toggle),
.ff-math-input::part(menu-toggle) {
    display: none !important;
}

/* Answer area below sum equation (submit btn + feedback) */
.ff-sum-answer-area {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
    margin-top: 1rem;
}

/* --- Sum Focused State (transition from individual to team sum) --- */
.ff-game-screen.ff-sum-focused .ff-fractions-row {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.4s ease;
}

.ff-game-screen.ff-sum-focused .ff-operation-word {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.ff-game-screen.ff-sum-focused .ff-input-area {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: opacity 0.2s ease, max-height 0.3s ease;
}

.ff-game-screen.ff-sum-focused .ff-sum-equation {
    font-size: 1.6rem;
    padding: 2rem 2.5rem;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-top: 2rem;
    gap: 0.8rem;
    border-radius: 16px;
}

.ff-game-screen.ff-sum-focused .ff-sum-inline-input {
    width: 140px;
    min-height: 70px;
    font-size: 1.8rem;
}

.ff-game-screen.ff-sum-focused .ff-sf-num,
.ff-game-screen.ff-sum-focused .ff-sf-den {
    font-size: 1.3rem;
}

.ff-game-screen.ff-sum-focused .ff-sum-whole {
    font-size: 1.6rem;
}



.ff-game-screen.ff-sum-focused .ff-sum-plus,
.ff-game-screen.ff-sum-focused .ff-sum-equals {
    font-size: 1.6rem;
}

/* --- Teammate Toast Notifications --- */
.ff-toast-container {
    position: fixed;
    right: 1rem;
    top: 5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.ff-toast {
    background: white;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #6366f1;
    font-size: 0.85rem;
    color: #334155;
    animation: ffToastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    pointer-events: auto;
}

.ff-toast strong {
    color: #1e293b;
}

.ff-toast-exit {
    animation: ffToastOut 0.4s ease both;
}

@keyframes ffToastIn {
    0% { opacity: 0; transform: translateX(100px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes ffToastOut {
    0% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(100px); }
}

/* ================================================
   OLD Student Fractions Display (kept for teacher)
   ================================================ */

.fractions-round-info {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

/* --- Game Layout (Teacher) --- */
.fractions-teacher-game {
    max-width: 1000px;
    margin: 0 auto;
}

.fractions-game-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.fractions-team-progress-section h3,
.fractions-leaderboard-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #334155;
}

.fractions-team-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* --- Team Progress Card (Teacher) --- */
.fractions-team-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #6366f1;
    overflow: hidden;
    transition: all 0.3s ease;
}

.fractions-team-card.finished {
    opacity: 0.85;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    color: white;
    font-size: 0.9rem;
}

.team-card-name {
    font-weight: 600;
}

.team-card-score {
    font-weight: 700;
}

.team-card-members {
    padding: 0.5rem 0.75rem;
}

.team-member-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.member-name {
    flex: 1;
    color: #334155;
}

.member-operation {
    color: #64748b;
    font-weight: 600;
    font-family: monospace;
    font-size: 0.95rem;
}

.member-status {
    font-size: 0.85rem;
    color: #94a3b8;
    min-width: 1.5rem;
    text-align: center;
}

.member-status.done {
    color: #16a34a;
    font-weight: 700;
}

.team-card-final {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #64748b;
}

.team-card-final.active {
    color: #f97316;
    font-weight: 500;
}

.team-card-final.scored {
    color: #16a34a;
    font-weight: 600;
}

/* --- Leaderboard --- */
.fractions-leaderboard {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.fractions-leaderboard .leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.75rem;
}

.fractions-leaderboard .leaderboard-item:last-child {
    border-bottom: none;
}

.fractions-leaderboard .leaderboard-position {
    font-weight: 700;
    font-size: 1.1rem;
    color: #64748b;
    min-width: 1.5rem;
}

.fractions-leaderboard .leaderboard-name {
    flex: 1;
    font-weight: 500;
    padding-left: 0.75rem;
}

.fractions-leaderboard .leaderboard-score {
    font-weight: 700;
    color: #f97316;
}

.fractions-leaderboard .leaderboard-item.is-my-team {
    background: #fff7ed;
}

.fractions-leaderboard-final {
    max-width: 500px;
    margin: 0 auto 2rem;
}

/* --- Round Controls --- */
.fractions-round-controls {
    text-align: center;
    padding: 1.5rem 0;
}

.round-status {
    color: #64748b;
    font-size: 0.95rem;
}

/* (Old student operation cards, feedback, team sum, progress bar removed — replaced by .ff- styles above) */

/* --- Student: Round Complete --- */
.round-complete-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

.score-result {
    padding: 1.5rem;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.score-result.score-top {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.score-position {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.score-points {
    display: block;
    font-size: 1.2rem;
    color: #f97316;
    font-weight: 600;
    margin-top: 0.25rem;
}

.waiting-next-round {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    margin-top: 1rem;
}

/* --- Mini Leaderboard (Student) --- */
.fractions-mini-leaderboard {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.mini-leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.mini-leaderboard-item:last-child {
    border-bottom: none;
}

.mini-leaderboard-item.is-my-team {
    background: #fff7ed;
    font-weight: 600;
}

.mini-pos {
    font-weight: 700;
    color: #64748b;
    min-width: 1.5rem;
}

.mini-name {
    flex: 1;
    padding-left: 0.5rem;
}

.mini-score {
    font-weight: 600;
    color: #f97316;
}

/* --- Student: Team Reveal --- */
.fractions-team-reveal {
    text-align: center;
    padding: 3rem 0;
}

.fractions-team-reveal h2 {
    font-size: 1.3rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.team-reveal-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.team-reveal-members {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.team-reveal-hint {
    color: #94a3b8;
    font-style: italic;
}

/* --- Finished State --- */
.fractions-finished,
.fractions-finished-student {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.fractions-finished h1,
.fractions-finished-student h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.fractions-finished h3,
.fractions-finished-student h3 {
    margin-bottom: 1.5rem;
    color: #64748b;
}

.final-team-result {
    padding: 2rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 16px;
    margin-bottom: 2rem;
}

.final-position {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.final-score {
    font-size: 1.5rem;
    color: #f97316;
    font-weight: 600;
}

.final-team-name {
    margin-top: 0.5rem;
    color: #64748b;
}

/* --- Error State --- */
.fractions-error {
    text-align: center;
    padding: 3rem 0;
}

.fractions-error svg {
    color: #ef4444;
    margin-bottom: 1rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .team-builder-layout {
        grid-template-columns: 1fr;
    }

    .teams-container {
        grid-template-columns: 1fr 1fr;
    }

    .fractions-game-layout {
        grid-template-columns: 1fr;
    }

    .fraction-large {
        font-size: 2.5rem;
    }

    .fractions-display-pair {
        gap: 1rem;
    }

    /* Student game responsive */
    .ff-fractions-row {
        gap: 0.5rem;
    }

    .ff-op-symbol {
        font-size: 1.8rem;
    }

    .ff-fraction-card {
        padding: 1rem 1.5rem;
    }

    .ff-frac-num, .ff-frac-den {
        font-size: 2.5rem;
    }

    .ff-operation-word {
        font-size: 1.5rem;
    }

    .ff-math-input {
        font-size: 1.5rem;
        min-height: 60px;
    }
}

@media (max-width: 480px) {
    .teams-container {
        grid-template-columns: 1fr;
    }

    .fraction-large {
        font-size: 2rem;
    }

    .ff-fraction-card {
        padding: 0.75rem 1rem;
    }

    .ff-frac-num, .ff-frac-den {
        font-size: 2rem;
    }

    .ff-op-symbol {
        font-size: 1.5rem;
    }

    .ff-operation-word {
        font-size: 1.3rem;
    }

    .ff-sum-equation {
        font-size: 0.85rem;
        gap: 0.3rem;
        padding: 0.5rem 0.75rem;
    }

    .ff-sum-inline-input {
        width: 60px;
        min-height: 40px;
        font-size: 1rem;
    }

    .ff-toast-container {
        right: 0.5rem;
        top: 4rem;
    }

    .ff-toast {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
}

/* ============================================
   Fraction Frenzy — Teacher Presentation Dashboard
   ============================================ */

/* Hidden by default, shown only in fullscreen */
.ft-presentation {
    display: none;
}

/* When game-state is the fullscreen target, hide admin view */
#game-state.fullscreen-active {
    display: flex;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

#game-state.fullscreen-active .fractions-game-header,
#game-state.fullscreen-active > .container {
    display: none;
}

#game-state.fullscreen-active .ft-presentation {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Presentation container */
.ft-presentation {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 3rem;
    gap: 2rem;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Subtle animated background glow */
.ft-presentation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 50%, rgba(244, 114, 182, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

/* --- Header --- */
.ft-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 900px;
    z-index: 1;
}

.ft-round-badge {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ft-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.ft-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.ft-rules-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.ft-rules-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}

/* --- Fraction Cards (larger for projection) --- */
.ft-fractions-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    z-index: 1;
}

.ft-card {
    padding: 2rem 3rem;
    border-width: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.ft-card .ff-frac-num,
.ft-card .ff-frac-den {
    font-size: 5rem;
}

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

.ft-op-symbol {
    font-size: 3rem;
    letter-spacing: 0.15em;
}

/* --- Leaderboard --- */
.ft-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    max-width: 700px;
    z-index: 1;
}

.ft-lb-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.3s ease, background 0.3s ease;
}

.ft-lb-row:first-child {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
}

.ft-lb-pos {
    font-size: 1.5rem;
    min-width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.ft-lb-pos-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 700;
}

.ft-lb-name {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 120px;
    flex-shrink: 0;
}

.ft-lb-bar-bg {
    flex: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    overflow: hidden;
}

.ft-lb-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 4px;
}

.ft-lb-score {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 70px;
    text-align: right;
    flex-shrink: 0;
}

/* --- Controls --- */
.ft-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 1;
}

.ft-next-btn {
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
}

.ft-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.4);
}

.ft-force-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ft-force-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
}

.ft-status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    margin: 0;
}

/* --- Rules Modal --- */
.ft-rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.ft-rules-card {
    background: white;
    border-radius: 20px;
    max-width: 520px;
    width: 90%;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ft-rules-card h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: #1e293b;
}

.ft-rules-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.ft-rules-close:hover {
    color: #1e293b;
}

.ft-rules-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ft-rule {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.ft-rule-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.ft-rule p {
    margin: 0;
    padding-top: 0.3rem;
    color: #475569;
    line-height: 1.5;
}

.ft-scoring {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.ft-scoring h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #1e293b;
}

.ft-scoring p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* --- Fraction Frenzy lobby display (orange/pink gradient) --- */
.ff-lobby-display.bingo-fullscreen-display {
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
}

/* --- Display Mode button in game header --- */
.ft-display-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.ft-display-mode-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.ft-display-mode-btn svg {
    flex-shrink: 0;
}

.ft-display-mode-inline {
    margin-top: 0.75rem;
}

/* --- Fullscreen button styling inside presentation header --- */
.ft-header-actions .fullscreen-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ft-header-actions .fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}

