:root {
    --primary-color: #4f883d;
    --text-color: #333;
    --bg-color: #f7f9fc;
    --panel-bg: #ffffff;
    --border-color: #ddd;
    --font-family: 'Inter', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Radio Group Styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: auto;
    accent-color: var(--primary-color);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar Settings */
.settings-panel {
    background-color: var(--panel-bg);
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.settings-panel h1 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="text"],
input[type="number"] {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 0;
}

fieldset legend {
    padding: 0 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
}

.row {
    display: flex;
    gap: 12px;
}

.col {
    flex: 1;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0;
}


.btn-primary:hover {
    background-color: #3e702e;
}

/* Preview Area */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    background-color: #ededed;
    overflow-y: auto;
}

.paper {
    background: white;
    width: 100%;
    max-width: 210mm;
    min-height: 297mm;
    padding: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.paper h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: #000;
}

.problems-grid {
    display: grid;
    /* grid-template-columns set by JS */
    gap: 20px 40px;
    flex: 1;
    align-content: start;
}

.problem-item {
    font-size: 1.2rem;
    padding: 10px;
    border-bottom: 1px dashed #eee;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Fraction Styling */
.fraction-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.mixed-number {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.whole-part {
    font-size: 1.2em;
    font-weight: 500;
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    font-size: 0.9em;
    margin: 0 2px;
}

.fraction .numerator {
    border-bottom: 2px solid #000;
    padding: 0 2px;
    text-align: center;
    width: 100%;
    line-height: 1.2;
}

.fraction .denominator {
    padding: 0 2px;
    text-align: center;
    width: 100%;
    line-height: 1.2;
}

.operator {
    margin: 0 5px;
    font-weight: 600;
}

.paper-footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.preview-note {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #777;
}

/* Responsive >= 920px */
@media (min-width: 920px) {
    .app-container {
        flex-direction: row;
    }

    .settings-panel {
        width: 320px;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        height: 100vh;
        overflow-y: auto;
        position: sticky;
        top: 0;
    }

    .preview-area {
        height: 100vh;
    }

    .paper {
        margin-top: 20px;
        margin-bottom: 20px;
        transform-origin: top center;
    }
}
