/* Fraction Circles Tool - CSS */
/* Uses design system variables from tools_design_system.css */

/* Override the min-height from base template */
.tool-page-wrapper:has(.fc-container) {
    min-height: 0 !important;
}

.tool-content-area:has(.fc-container) {
    min-height: 0 !important;
}

:fullscreen .tool-content-area:has(.fc-container),
:-webkit-full-screen .tool-content-area:has(.fc-container),
:-moz-full-screen .tool-content-area:has(.fc-container) {
    overflow: visible;
}

.fc-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--t-space-4) var(--t-space-3);
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    -webkit-user-select: none;
    user-select: none;
    overflow: hidden;
    position: relative;
    flex: 1;
}

/* Fullscreen mode - match wrapper bg to fc-container to eliminate any gap */
:fullscreen:has(.fc-container),
:-webkit-full-screen:has(.fc-container),
:-moz-full-screen:has(.fc-container) {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%) !important;
}

:fullscreen .fc-container,
:-webkit-full-screen .fc-container,
:-moz-full-screen .fc-container {
    min-height: 0;
    height: 100%;
    flex: 1;
    padding-top: 2vh;
    overflow-y: auto;
}

/* Fullscreen - Interactive mode bigger elements */
:fullscreen .fc-interactive-mode,
:-webkit-full-screen .fc-interactive-mode,
:-moz-full-screen .fc-interactive-mode {
    max-width: 100%;
    flex: 1;
}

:fullscreen .fc-interactive-workspace,
:-webkit-full-screen .fc-interactive-workspace,
:-moz-full-screen .fc-interactive-workspace {
    flex: 1;
}

:fullscreen .fc-pieces-palette,
:-webkit-full-screen .fc-pieces-palette,
:-moz-full-screen .fc-pieces-palette {
    padding: var(--t-space-4) var(--t-space-6);
}

:fullscreen .fc-palette-header,
:-webkit-full-screen .fc-palette-header,
:-moz-full-screen .fc-palette-header {
    font-size: 0.9rem;
    margin-bottom: var(--t-space-3);
}

:fullscreen .fc-palette-grid,
:-webkit-full-screen .fc-palette-grid,
:-moz-full-screen .fc-palette-grid {
    gap: var(--t-space-5);
}

:fullscreen .fc-draggable-piece,
:-webkit-full-screen .fc-draggable-piece,
:-moz-full-screen .fc-draggable-piece {
    width: 70px;
    height: 70px;
}

:fullscreen .fc-palette-label,
:-webkit-full-screen .fc-palette-label,
:-moz-full-screen .fc-palette-label {
    font-size: 0.9rem;
}

:fullscreen .fc-circles-area,
:-webkit-full-screen .fc-circles-area,
:-moz-full-screen .fc-circles-area {
    gap: var(--t-space-8, 3rem);
    align-items: center;
    flex: 1;
}

:fullscreen .fc-drop-circle,
:-webkit-full-screen .fc-drop-circle,
:-moz-full-screen .fc-drop-circle {
    width: 280px;
    height: 280px;
}

:fullscreen .fc-trash-zone,
:-webkit-full-screen .fc-trash-zone,
:-moz-full-screen .fc-trash-zone {
    font-size: 1rem;
    padding: var(--t-space-4) var(--t-space-6);
}

:fullscreen .fc-interactive-controls .fc-btn,
:-webkit-full-screen .fc-interactive-controls .fc-btn,
:-moz-full-screen .fc-interactive-controls .fc-btn {
    font-size: 1.1rem;
    padding: var(--t-space-3) var(--t-space-6);
}

/* Fullscreen - Explore mode bigger elements */
:fullscreen .fc-explore-mode,
:-webkit-full-screen .fc-explore-mode,
:-moz-full-screen .fc-explore-mode {
    max-width: 100%;
    flex: 1;
}

:fullscreen .fc-explore-display,
:-webkit-full-screen .fc-explore-display,
:-moz-full-screen .fc-explore-display {
    flex: 1;
}

:fullscreen .fc-explore-circle-section .fc-circle-container,
:-webkit-full-screen .fc-explore-circle-section .fc-circle-container,
:-moz-full-screen .fc-explore-circle-section .fc-circle-container {
    width: 280px;
    height: 280px;
}

:fullscreen .fc-number-input,
:-webkit-full-screen .fc-number-input,
:-moz-full-screen .fc-number-input {
    width: 90px;
    height: 56px;
    font-size: 1.75rem;
}

:fullscreen .fc-input-label,
:-webkit-full-screen .fc-input-label,
:-moz-full-screen .fc-input-label {
    font-size: 0.85rem;
}

:fullscreen .fc-explore-fraction,
:-webkit-full-screen .fc-explore-fraction,
:-moz-full-screen .fc-explore-fraction {
    font-size: 4rem;
}

:fullscreen .fc-explore-bar-section,
:-webkit-full-screen .fc-explore-bar-section,
:-moz-full-screen .fc-explore-bar-section {
    max-width: 800px;
}

:fullscreen .fc-bar,
:-webkit-full-screen .fc-bar,
:-moz-full-screen .fc-bar {
    height: 80px;
}

:fullscreen .fc-bar-input-label,
:-webkit-full-screen .fc-bar-input-label,
:-moz-full-screen .fc-bar-input-label {
    font-size: 0.9rem;
}

/* Fullscreen - Compare mode bigger elements */
:fullscreen .fc-fraction-panel .fc-circle-container,
:-webkit-full-screen .fc-fraction-panel .fc-circle-container,
:-moz-full-screen .fc-fraction-panel .fc-circle-container {
    width: 280px;
    height: 280px;
}

:fullscreen .fc-fraction-display,
:-webkit-full-screen .fc-fraction-display,
:-moz-full-screen .fc-fraction-display {
    font-size: 3.5rem;
}

:fullscreen .fc-comparison-symbol,
:-webkit-full-screen .fc-comparison-symbol,
:-moz-full-screen .fc-comparison-symbol {
    font-size: 4rem;
}

/* Fullscreen - Bottom controls bigger */
:fullscreen .fc-bottom-controls .fc-btn,
:-webkit-full-screen .fc-bottom-controls .fc-btn,
:-moz-full-screen .fc-bottom-controls .fc-btn {
    font-size: 1.1rem;
    padding: var(--t-space-3) var(--t-space-6);
}

/* Fullscreen - Mode toggle bigger */
:fullscreen .fc-mode-toggle,
:-webkit-full-screen .fc-mode-toggle,
:-moz-full-screen .fc-mode-toggle {
    margin-bottom: var(--t-space-4);
}

:fullscreen .fc-mode-btn,
:-webkit-full-screen .fc-mode-btn,
:-moz-full-screen .fc-mode-btn {
    font-size: 1.05rem;
    padding: var(--t-space-3) var(--t-space-5);
}

/* ============================================
   Mode Toggle
   ============================================ */
.fc-mode-toggle {
    display: flex;
    gap: var(--t-space-2);
    margin-bottom: var(--t-space-5);
    background: white;
    padding: var(--t-space-1);
    border-radius: var(--t-radius-2xl);
    box-shadow: var(--t-shadow-md);
}

.fc-mode-btn {
    padding: var(--t-space-2) var(--t-space-4);
    border: none;
    border-radius: var(--t-radius-xl);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-transition-fast);
    background: transparent;
    color: #64748b;
}

.fc-mode-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

.fc-mode-btn.fc-mode-active {
    background: linear-gradient(135deg, var(--t-primary) 0%, var(--t-primary-light) 100%);
    color: white;
    box-shadow: var(--t-shadow-primary);
}

/* ============================================
   COMPARE MODE - Main display area
   ============================================ */
.fc-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-4);
    flex-wrap: wrap;
    width: 100%;
    max-width: 1000px;
}

/* Fraction panel (contains circle, fraction display, and controls) */
.fc-fraction-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: var(--t-radius-2xl);
    padding: var(--t-space-5);
    box-shadow: var(--t-shadow-lg);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 3px solid transparent;
}

.fc-fraction-panel.fc-equivalent {
    border-color: var(--t-success);
    box-shadow: 0 0 0 4px rgba(0, 184, 148, 0.2), var(--t-shadow-lg);
}

/* Circle container */
.fc-circle-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: var(--t-space-4);
}

/* SVG Circle */
.fc-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    transition: transform 0.3s ease;
}

.fc-circle-bg {
    fill: #f1f5f9;
    stroke: #cbd5e1;
    stroke-width: 2;
}

/* Slice styles */
.fc-slice {
    transition: all 0.3s ease;
}

.fc-slice-filled {
    fill: #3b82f6;
    stroke: #1d4ed8;
    stroke-width: 1;
}

.fc-slice-empty {
    fill: #f1f5f9;
    stroke: #cbd5e1;
    stroke-width: 1;
}

/* Green when equivalent */
.fc-equivalent .fc-slice-filled {
    fill: #22c55e;
    stroke: #15803d;
}

/* Divider lines */
.fc-divider {
    stroke: #64748b;
    stroke-width: 1.5;
}

/* Fraction display */
.fc-fraction-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: var(--t-space-4);
    line-height: 1;
}

.fc-numerator,
.fc-denominator {
    min-width: 60px;
    text-align: center;
    padding: 0.25rem;
    transition: color 0.3s ease;
}

.fc-equivalent .fc-numerator,
.fc-equivalent .fc-denominator {
    color: #15803d;
}

.fc-fraction-bar {
    width: 80px;
    height: 4px;
    background: #1e293b;
    border-radius: 2px;
    margin: 0.25rem 0;
    transition: background-color 0.3s ease;
}

.fc-equivalent .fc-fraction-bar {
    background: #15803d;
}

/* Controls */
.fc-controls {
    display: flex;
    flex-direction: column;
    gap: var(--t-space-3);
    width: 100%;
}

.fc-control-group {
    display: flex;
    flex-direction: column;
    gap: var(--t-space-1);
}

.fc-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.fc-slider-row {
    display: flex;
    align-items: center;
    gap: var(--t-space-2);
}

/* Slider styling */
.fc-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.fc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--t-primary) 0%, var(--t-primary-light) 100%);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(21, 174, 191, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fc-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(21, 174, 191, 0.5);
}

.fc-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
}

.fc-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--t-primary) 0%, var(--t-primary-light) 100%);
    border-radius: 50%;
    cursor: grab;
    border: none;
    box-shadow: 0 2px 8px rgba(21, 174, 191, 0.4);
}

/* Buttons */
.fc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-2);
    padding: var(--t-space-3) var(--t-space-5);
    border: none;
    border-radius: var(--t-radius-2xl);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-transition-fast);
    min-height: 48px;
}

.fc-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(21, 174, 191, 0.3);
}

.fc-btn:active {
    transform: translateY(1px);
}

.fc-btn-primary {
    background: linear-gradient(135deg, var(--t-primary) 0%, var(--t-primary-light) 100%);
    color: white;
    box-shadow: var(--t-shadow-primary);
}

.fc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--t-shadow-primary-lg);
}

.fc-btn-secondary {
    background: white;
    color: #475569;
    border: 2px solid #cbd5e1;
}

.fc-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: var(--t-shadow-sm);
}

.fc-btn-small {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 1.25rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
    border-radius: var(--t-radius-lg);
}

.fc-btn-small:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* Comparison indicator */
.fc-comparison {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--t-space-4);
    transition: all 0.4s ease;
}

.fc-comparison-symbol {
    font-size: 3rem;
    font-weight: 800;
    color: #94a3b8;
    transition: all 0.4s ease;
    line-height: 1;
}

.fc-comparison.fc-is-equivalent .fc-comparison-symbol {
    color: #22c55e;
    transform: scale(1.2);
}

.fc-comparison-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #94a3b8;
    margin-top: var(--t-space-2);
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.fc-comparison.fc-is-equivalent .fc-comparison-text {
    color: #15803d;
    opacity: 1;
    transform: translateY(0);
}

/* Bottom controls */
.fc-bottom-controls {
    display: flex;
    gap: var(--t-space-3);
    margin-top: var(--t-space-6);
}

/* ============================================
   EXPLORE MODE
   ============================================ */
.fc-explore-mode {
    width: 100%;
    max-width: 900px;
}

.fc-explore-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--t-space-6);
}

/* Circle Section with Vertical Sliders */
.fc-explore-circle-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: var(--t-radius-2xl);
    padding: var(--t-space-5);
    box-shadow: var(--t-shadow-lg);
}

.fc-explore-circle-wrapper {
    display: flex;
    align-items: center;
    gap: var(--t-space-4);
}

.fc-explore-circle-section .fc-circle-container {
    margin-bottom: 0;
}

/* Number Input Wrappers (beside circle) */
.fc-number-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-2);
}

.fc-input-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    white-space: nowrap;
}

.fc-input-label-numerator {
    color: #3b82f6;
}

.fc-input-label-denominator {
    color: #8b5cf6;
}

/* Number Input Styling */
.fc-number-input {
    width: 72px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    border: 3px solid #e2e8f0;
    border-radius: var(--t-radius-xl);
    background: white;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
    appearance: textfield;
}

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

.fc-number-input:focus {
    border-color: var(--t-primary);
    box-shadow: 0 0 0 4px rgba(21, 174, 191, 0.2);
}

.fc-number-input-numerator {
    border-color: #bfdbfe;
}

.fc-number-input-numerator:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.fc-number-input-denominator {
    border-color: #ddd6fe;
}

.fc-number-input-denominator:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

/* Explore Fraction Display */
.fc-explore-fraction {
    margin-top: var(--t-space-4);
    margin-bottom: 0;
    font-size: 3rem;
}

.fc-explore-fraction .fc-numerator,
.fc-explore-fraction .fc-denominator {
    min-width: 70px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--t-radius-lg);
}

.fc-tappable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.fc-tappable:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.fc-tappable:focus {
    outline: 3px solid var(--t-primary);
    outline-offset: 2px;
}

/* Hidden input for direct editing */
.fc-hidden-input {
    display: none;
    width: 80px;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem;
    border: 3px solid var(--t-primary);
    border-radius: var(--t-radius-lg);
    outline: none;
    font-family: inherit;
}

.fc-hidden-input:focus {
    box-shadow: 0 0 0 4px rgba(21, 174, 191, 0.2);
}

/* Bar Section */
.fc-explore-bar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--t-space-3);
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: var(--t-radius-2xl);
    padding: var(--t-space-5);
    box-shadow: var(--t-shadow-lg);
}

.fc-bar-container {
    width: 100%;
    padding: 0 var(--t-space-2);
}

.fc-bar {
    width: 100%;
    height: 60px;
    background: #f1f5f9;
    border-radius: var(--t-radius-xl);
    overflow: hidden;
    border: 3px solid #cbd5e1;
}

.fc-bar-segments {
    display: flex;
    height: 100%;
    width: 100%;
}

.fc-bar-segment {
    height: 100%;
    box-sizing: border-box;
    border-right: 2px solid #94a3b8;
    transition: all 0.3s ease;
}

.fc-bar-segment:last-child {
    border-right: none;
}

.fc-bar-segment-filled {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
}

.fc-bar-segment-empty {
    background: #f1f5f9;
}

/* Bar Input Row (above/below the fraction bar) */
.fc-bar-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-3);
}

.fc-bar-input-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    white-space: nowrap;
}

.fc-bar-input-row .fc-number-input {
    width: 72px;
    height: 44px;
    font-size: 1.25rem;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 900px) {
    .fc-display {
        flex-direction: column;
        gap: var(--t-space-3);
    }

    .fc-comparison {
        transform: rotate(90deg);
        padding: var(--t-space-2);
    }

    .fc-comparison-symbol {
        font-size: 2.5rem;
    }

    .fc-comparison-text {
        transform: rotate(-90deg);
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .fc-container {
        padding: var(--t-space-3) var(--t-space-2);
    }

    .fc-mode-toggle {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .fc-mode-btn {
        width: 100%;
    }

    .fc-explore-circle-section,
    .fc-explore-bar-section {
        padding: var(--t-space-4);
        width: 100%;
        max-width: 400px;
    }

    .fc-circle-container {
        width: 160px;
        height: 160px;
    }

    .fc-number-input-wrapper .fc-number-input {
        width: 56px;
        height: 42px;
        font-size: 1.25rem;
    }

    .fc-explore-fraction {
        font-size: 2.5rem;
    }

    .fc-explore-fraction .fc-numerator,
    .fc-explore-fraction .fc-denominator {
        min-width: 60px;
    }

    .fc-bar {
        height: 50px;
    }

    .fc-explore-bar-section {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .fc-container {
        padding: var(--t-space-3) var(--t-space-2);
    }

    .fc-fraction-panel {
        padding: var(--t-space-4);
        width: 100%;
        max-width: 320px;
    }

    .fc-circle-container {
        width: 160px;
        height: 160px;
    }

    .fc-fraction-display {
        font-size: 2rem;
    }

    .fc-numerator,
    .fc-denominator {
        min-width: 50px;
    }

    .fc-fraction-bar {
        width: 60px;
    }

    .fc-comparison {
        transform: none;
    }

    .fc-comparison-symbol {
        font-size: 2rem;
    }

    .fc-comparison-text {
        transform: none;
        font-size: 0.75rem;
    }

    .fc-btn {
        padding: var(--t-space-2) var(--t-space-4);
        font-size: 0.875rem;
        min-height: 44px;
    }

    .fc-bottom-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .fc-explore-circle-wrapper {
        gap: var(--t-space-2);
    }

    .fc-circle-container {
        width: 130px;
        height: 130px;
    }

    .fc-number-input-wrapper .fc-number-input {
        width: 50px;
        height: 38px;
        font-size: 1.1rem;
    }

    .fc-input-label {
        font-size: 0.6rem;
    }

    .fc-explore-fraction {
        font-size: 2rem;
        margin-top: var(--t-space-3);
    }

    .fc-explore-fraction .fc-numerator,
    .fc-explore-fraction .fc-denominator {
        min-width: 50px;
    }

    .fc-hidden-input {
        width: 60px;
        font-size: 1.75rem;
    }

    .fc-bar {
        height: 40px;
    }

    .fc-bar-input-row .fc-number-input {
        width: 50px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .fc-circle-container {
        width: 140px;
        height: 140px;
    }

    .fc-fraction-display {
        font-size: 1.75rem;
    }

    .fc-btn-small {
        width: 32px;
        height: 32px;
        min-height: 32px;
        font-size: 1rem;
    }
}

/* ============================================
   RTL Support
   ============================================ */
[dir="rtl"] .fc-slider-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .fc-explore-circle-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .fc-bar-segments {
    flex-direction: row-reverse;
}

[dir="rtl"] .fc-bar-segment {
    border-right: none;
    border-left: 2px solid #94a3b8;
}

[dir="rtl"] .fc-bar-segment:last-child {
    border-left: none;
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .fc-fraction-panel,
    .fc-slice,
    .fc-bar-segment,
    .fc-comparison,
    .fc-comparison-symbol,
    .fc-comparison-text,
    .fc-btn,
    .fc-numerator,
    .fc-denominator {
        transition: none;
    }

    .fc-slider::-webkit-slider-thumb:hover {
        transform: none;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.fc-slider:focus,
.fc-number-input:focus {
    outline: 3px solid var(--t-primary);
    outline-offset: 2px;
}

.fc-btn:focus-visible {
    outline: 3px solid var(--t-primary);
    outline-offset: 2px;
}

/* Animation for equivalent state */
@keyframes fc-pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
}

.fc-fraction-panel.fc-equivalent {
    animation: fc-pulse-green 1.5s ease-out;
}

/* ============================================
   INTERACTIVE MODE - Drag and Drop Fraction Pieces
   ============================================ */
.fc-interactive-mode {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--t-space-4);
}

.fc-interactive-workspace {
    display: flex;
    flex-direction: column;
    gap: var(--t-space-4);
    width: 100%;
    align-items: center;
}

/* Pieces Palette - Horizontal Layout */
.fc-pieces-palette {
    background: white;
    border-radius: var(--t-radius-2xl);
    box-shadow: var(--t-shadow-lg);
    padding: var(--t-space-3) var(--t-space-4);
    width: 100%;
}

.fc-palette-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--t-space-2);
    text-align: center;
}

.fc-palette-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--t-space-3);
}

.fc-palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.fc-palette-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
}

.fc-draggable-piece {
    width: 44px;
    height: 44px;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    box-shadow: var(--t-shadow-sm);
}

.fc-draggable-piece:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.fc-draggable-piece:active {
    cursor: grabbing;
    transform: scale(1.2);
}

.fc-draggable-piece svg {
    width: 100%;
    height: 100%;
}

.fc-piece-path {
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 1;
    transition: filter 0.2s ease;
}

.fc-draggable-piece:hover .fc-piece-path {
    filter: brightness(1.1);
}

/* Infinite supply indicator */
.fc-palette-item {
    position: relative;
}

.fc-palette-item::after {
    content: '∞';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.6rem;
    color: white;
    background: var(--t-primary);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.fc-palette-item:hover::after {
    opacity: 1;
}

/* Fraction piece colors */
.fc-piece-halves { fill: #ef4444; }
.fc-piece-thirds { fill: #f97316; }
.fc-piece-fourths { fill: #eab308; }
.fc-piece-fifths { fill: #22c55e; }
.fc-piece-sixths { fill: #14b8a6; }
.fc-piece-eighths { fill: #3b82f6; }
.fc-piece-tenths { fill: #8b5cf6; }
.fc-piece-twelfths { fill: #ec4899; }

/* Drop Circles Area */
.fc-circles-area {
    display: flex;
    gap: var(--t-space-4);
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.fc-drop-circle {
    position: relative;
    width: 180px;
    height: 180px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--t-shadow-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 3px solid #e2e8f0;
}

.fc-drop-circle.fc-drag-over {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(21, 174, 191, 0.3), var(--t-shadow-lg);
    border-color: var(--t-primary);
}

.fc-drop-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.fc-drop-bg {
    fill: #f8fafc;
    stroke: #e2e8f0;
    stroke-width: 2;
}

.fc-circle-label {
    display: none;
}

/* Placed pieces in circles */
.fc-placed-piece {
    cursor: grab;
    transition: filter 0.2s ease;
}

.fc-placed-piece:hover {
    filter: brightness(1.1);
}

.fc-placed-piece:active {
    cursor: grabbing;
}

/* Piece label styling */
.fc-piece-label-group {
    pointer-events: none;
}

.fc-piece-label-group text,
.fc-fraction-text {
    font-family: 'Segoe UI', Arial, sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

/* Palette piece labels */
.fc-palette-piece-label {
    pointer-events: none;
}

/* Trash Zone */
.fc-trash-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-2);
    padding: var(--t-space-3) var(--t-space-5);
    margin-top: var(--t-space-4);
    background: #fef2f2;
    border: 2px dashed #fca5a5;
    border-radius: var(--t-radius-xl);
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.fc-trash-zone.fc-drag-active {
    opacity: 1;
    background: #fee2e2;
    border-color: #ef4444;
    transform: scale(1.05);
}

/* Interactive Controls */
.fc-interactive-controls {
    display: flex;
    gap: var(--t-space-3);
    margin-top: var(--t-space-2);
}

/* Dragging State */
.fc-dragging {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.9;
    transform: scale(1.2);
}

.fc-piece-ghost {
    opacity: 0.4;
}

/* Interactive Mode Responsive */
@media (max-width: 600px) {
    .fc-drop-circle {
        width: 140px;
        height: 140px;
    }

    .fc-draggable-piece {
        width: 32px;
        height: 32px;
    }

    .fc-circle-label {
        font-size: 1.25rem;
    }

    .fc-palette-label {
        font-size: 0.65rem;
    }

    .fc-palette-grid {
        gap: var(--t-space-2);
    }
}

@media (max-width: 480px) {
    .fc-circles-area {
        gap: var(--t-space-6);
    }

    .fc-drop-circle {
        width: 120px;
        height: 120px;
    }

    .fc-circle-label {
        font-size: 1rem;
    }

    .fc-draggable-piece {
        width: 28px;
        height: 28px;
    }
}
