* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.calculator-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 360px;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #4285f4;
    border-bottom: 2px solid #4285f4;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.display {
    margin-bottom: 15px;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: right;
}

.result {
    margin-bottom: 15px;
}

.input-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.input-group label {
    min-width: 80px; /* Adjust as needed */
    margin-right: 10px;
    font-size: 14px;
    color: #555;
}

.input-display {
    flex-grow: 1;
    padding: 8px 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    min-height: 36px; /* Ensure height consistency */
    cursor: text; /* Indicate it's an input area */
    overflow-x: auto; /* Handle long inputs */
    white-space: nowrap;
}

.input-display:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.input-display.active-input {
    border-color: #4285f4;
    box-shadow: 0 0 3px rgba(66, 133, 244, 0.5);
}

.line-ops-buttons {
    display: flex;
    flex-direction: column; /* Stack buttons vertically */
    gap: 10px; /* Space between buttons */
    margin-top: 15px;
    margin-bottom: 15px;
}

/* Reusing .solve-btn for consistency, but specific styles might be needed */

.results-area {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.results-area h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.results-area .result {
    margin-bottom: 8px;
    text-align: left; /* Align results to the left */
    background-color: transparent; /* Remove background for individual results */
    padding: 5px 0; /* Adjust padding */
    font-size: 16px;
    min-height: auto; /* Reset min-height */
    border: none; /* Remove border if inherited */
    box-shadow: none; /* Remove shadow if inherited */
}

.result {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    text-align: right;
    font-size: 18px;
    min-height: 42px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.key {
    padding: 15px 0;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    background-color: #f1f1f1;
    cursor: pointer;
    transition: background-color 0.2s;
}

.key:hover {
    background-color: #e0e0e0;
}

.operator {
    background-color: #e8f0fe;
    color: #4285f4;
}

.equals {
    background-color: #4285f4;
    color: white;
}

.clear {
    background-color: #ff5252;
    color: white;
    /* grid-column: span 2; */ /* May need adjustment if keypad layout changes */
}

.solve-btn {
    width: 100%;
    padding: 10px; /* Adjusted padding */
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 10px; /* Adjusted margin */
    transition: background-color 0.3s ease; /* Added transition */
}

.solve-btn:hover {
    background-color: #3367d6;
}

.equation-results {
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 15px;
}

.equation-results div {
    margin-bottom: 10px;
    font-size: 16px;
}

.equation-results div:last-child {
    margin-bottom: 0;
}