* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f0f2f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.problem {
    font-size: 2.5em;
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
}

.factor-selection {
    text-align: center;
    margin: 20px 0;
}

.factor-btn {
    padding: 10px 20px;
    margin: 0 10px;
    font-size: 1em;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
}

.ratio-table {
    display: flex;
    gap: 0;
    margin: 20px 0;
    padding: 0;
    border: 2px solid #000;
    border-radius: 0;
    min-height: 100px;
    background-color: white;
    overflow-x: scroll;
    overflow-y: hidden;
    width: 100%;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

/* Show scrollbar for better UX */
.ratio-table::-webkit-scrollbar {
    display: block;
    height: 8px;
}

.ratio-table::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ratio-table::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ratio-table::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.ratio-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border-right: 1px solid #000;
    cursor: pointer;
    width: 80px;
    min-width: 80px;
    flex: 0 0 auto;
}

.ratio-column:last-child {
    border-right: none;
}

.ratio-column span {
    width: 100%;
    padding: 10px;
    text-align: center;
    font-size: 1.2em;
}

.ratio-column span:first-child {
    border-bottom: 1px solid #000;
}

.ratio-column.active {
    background-color: #fff3e0;
}

.ratio-column.selected {
    background-color: #e3f2fd;
}

.operations {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.op-btn {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
}

.op-btn:hover {
    background-color: #1976D2;
}

.op-btn.active {
    background-color: #ff5722;
}

.answer-section {
    text-align: center;
    margin: 20px 0;
}

#answer {
    padding: 10px;
    font-size: 1em;
    width: 150px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#checkAnswer {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #FF9800;
    color: white;
    border: none;
    border-radius: 4px;
}

.new-problem {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #9C27B0;
    color: white;
    border: none;
    border-radius: 4px;
}

button:hover {
    opacity: 0.9;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Help Modal Styles */
.help-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #2196F3;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 50px auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    color: #2196F3;
    margin-bottom: 10px;
}

.help-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.help-section ul {
    list-style-type: none;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
    position: relative;
}

.help-section li:before {
    content: "•";
    color: #2196F3;
    font-weight: bold;
    position: absolute;
    left: -15px;
}

/* Verification Modal Styles */
.verify-section {
    padding: 20px 0;
}

.calculation-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.source-and-input {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
}

.source-columns {
    flex: 1;
    max-width: 300px;
}

.columns-display {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.display-column {
    border: 2px solid #2196F3;
    border-radius: 4px;
    min-width: 80px;
    background: #fff;
}

.display-column span {
    display: block;
    padding: 10px;
    text-align: center;
    font-size: 1.2em;
}

.display-column span:first-child {
    border-bottom: 2px solid #2196F3;
}

.operation-display {
    text-align: center;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    margin: 10px 0;
}

.calculation-input {
    flex: 1;
    max-width: 300px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-with-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-with-label label {
    font-weight: bold;
    color: #666;
}

.input-with-label input {
    padding: 10px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 4px;
    width: 100%;
}

.verify-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.verify-btn {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    min-width: 120px;
}

.verify-btn:not(.secondary) {
    background-color: #4CAF50;
    color: white;
}

.verify-btn.secondary {
    background-color: #FFC107;
    color: black;
}

.correct-answer {
    border-color: #4CAF50 !important;
    background-color: #E8F5E9 !important;
}

.wrong-answer {
    border-color: #f44336 !important;
    background-color: #FFEBEE !important;
}

/* Add at the beginning of the file */
.operation-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.mode-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #f0f0f0;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background-color: #2196F3;
    color: white;
    border-color: #1976D2;
} 