:root {
    --primary-color: #4f883d;
    --primary-hover: #3e702e;
    --accent-color: #e91e63;
    --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);
}

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

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

.checkbox-option input[type="checkbox"] {
    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;
    color: var(--primary-color);
}

.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%;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 136, 61, 0.1);
}

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: var(--primary-hover);
}

/* 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: 30px 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: 15px;
    font-size: 1.8rem;
    color: #000;
}

.instruction-text {
    text-align: center;
    font-size: 1rem;
    color: #555;
    margin-bottom: 20px;
}

.symbols-box {
    background: #fce4ec;
    border: 2px dashed var(--accent-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 0.9rem;
}

.symbols-box strong {
    width: 100%;
    margin-bottom: 4px;
}

.problems-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 30px;
    flex: 1;
    align-content: start;
}

.problem-item {
    font-size: 1.6rem;
    font-family: var(--font-mono);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.problem-item .number {
    font-weight: 500;
}

.problem-item .fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.1rem;
    line-height: 1.1;
}

.problem-item .fraction .numerator {
    border-bottom: 2px solid #333;
    padding: 0 4px 2px;
}

.problem-item .fraction .denominator {
    padding: 2px 4px 0;
}

.problem-item .box {
    width: 28px;
    height: 28px;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--accent-color);
}

.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: 340px;
        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;
    }
}