:root {
    --primary: #ff6b6b;
    --secondary: #4ecdc4;
    --accent: #ffe66d;
    --background: #f7f7f7;
    --text: #2d3436;
    --success: #00b894;
    --error: #ff7675;
    
    --gradient-1: linear-gradient(45deg, var(--primary), var(--secondary));
    --gradient-2: linear-gradient(135deg, var(--accent), var(--primary));
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: 
        radial-gradient(circle at 100% 50%, rgba(255,107,107,0.1) 0%, transparent 50%),
        radial-gradient(circle at 0% 0%, rgba(78,205,196,0.1) 0%, transparent 50%),
        var(--background);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: titleGlow 3s ease-in-out infinite;
}

.operation-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.nav-btn {
    background: rgba(255,255,255,0.8);
    border: none;
    padding: 1rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-btn:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.9);
}

.nav-btn.active {
    background: var(--gradient-1);
    color: white;
}

.op-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: rgba(255,255,255,0.9);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.fraction-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2rem;
}

.fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.fraction input {
    width: 60px;
    text-align: center;
    font-size: 1.5rem;
    border: 2px solid var(--secondary);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.fraction-line {
    width: 100%;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.controls button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.solve-btn {
    background: var(--gradient-1);
    color: white;
}

.new-problem-btn {
    background: var(--gradient-2);
    color: var(--text);
}

.visual-helper {
    position: relative;
    width: 100%;
    height: 300px;
}

#fractionCanvas {
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    background: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    animation: modalPop 0.3s ease-out;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(255,107,107,0.2); }
    50% { text-shadow: 0 0 40px rgba(255,107,107,0.4); }
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.theme-toggle {
    width: 60px;
    height: 30px;
    background: var(--gradient-1);
    border-radius: 15px;
    position: relative;
    cursor: pointer;
}

.theme-switch {
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

[data-theme="dark"] {
    --background: #2d3436;
    --text: #f7f7f7;
}

