:root {
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --bg-gradient: linear-gradient(135deg, #a855f7, #ec4899, #f43f5e);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-dark: #1e293b;
    --text-light: #64748b;
    --success: #22c55e;
    --error: #ef4444;
    
    /* Slice colors */
    --slice-default: #f1f5f9;
    --slice-filled: var(--primary-color);
    --slice-hover: #e2e8f0;
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kantumruy Pro', 'Outfit', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-dark);
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-header {
    text-align: center;
    margin-bottom: 10px;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

.app-header p {
    color: #fff;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Tabs */
.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.tab-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Content Area */
.content-area {
    display: flex;
    flex-direction: column;
}

.mode-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.4s ease-in-out;
}

.mode-section.hidden {
    display: none;
}

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

/* Cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    color: var(--primary-color);
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.fraction-display, .target-fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary-color);
    width: 100px;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.fraction-display hr, .target-fraction hr {
    width: 80%;
    border: 0;
    border-top: 4px solid var(--primary-color);
    margin: 5px 0;
}

.slider-group {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-group label {
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.slider-group label span {
    color: var(--primary-color);
    font-weight: 700;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #cbd5e1;
    border-radius: 4px;
}

/* Visuals */
.visuals-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 600px) {
    .visuals-panel {
        grid-template-columns: 1fr;
    }
}

.visual-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.visual-container h3 {
    font-size: 1.2rem;
    color: var(--text-light);
}

svg {
    width: 100%;
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.slice {
    fill: var(--slice-default);
    stroke: #fff;
    stroke-width: 0.02;
    transition: fill 0.3s ease;
}

.slice.filled {
    fill: var(--slice-filled);
}

.interactive .slice {
    cursor: pointer;
}

.interactive .slice:hover {
    fill: var(--slice-hover);
}

.interactive .slice.filled {
    fill: var(--slice-filled);
}

/* Fraction Bar */
.fraction-bar {
    width: 100%;
    height: 60px;
    display: flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: #fff;
}

.bar-segment {
    flex: 1;
    background: var(--slice-default);
    border-right: 2px solid #fff;
    transition: background 0.3s ease;
}

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

.bar-segment.filled {
    background: var(--slice-filled);
}

.interactive .bar-segment {
    cursor: pointer;
}

.interactive .bar-segment:hover {
    background: var(--slice-hover);
}

.interactive .bar-segment.filled {
    background: var(--slice-filled);
}

/* Quiz Specific */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    font-size: 1.2rem;
}

.quiz-shape-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.quiz-shape-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

.quiz-interactive-area {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    margin-bottom: 25px;
}

.quiz-actions {
    display: flex;
    justify-content: center;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.6);
    background: #4f46e5;
}

.btn-secondary {
    background: #fff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Feedback */
.feedback-msg {
    margin-top: 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    min-height: 30px;
}

.feedback-msg.correct {
    color: var(--success);
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-msg.incorrect {
    color: var(--error);
    animation: shake 0.4s ease-in-out;
}

@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Hide helper */
.hidden {
    display: none !important;
}

/* Back Button */
.btn-back {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateX(-3px);
}

