/* Grays match Resources/Styles/Colors.xaml in the MAUI app; operator keys are green */
:root {
    --bg: #ffffff;
    --text: #000000;
    --muted: #6E6E6E;
    --key: #E1E1E1;
    --key-text: #000000;
    --function: #ACACAC;
    --operator: #15803D;
    --operator-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1f1f1f;
        --text: #ffffff;
        --muted: #ACACAC;
        --key: #404040;
        --key-text: #ffffff;
        --function: #6E6E6E;
        --operator: #4ADE80;
        --operator-text: #242424;
    }
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
    display: flex;
    justify-content: center;
}

.calculator {
    width: 100%;
    max-width: 480px;
    min-height: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
}

.display {
    padding: 0 8px;
    text-align: right;
    overflow: hidden;
}

/* Right-aligned flex rows clip overflow on the left, like LineBreakMode="HeadTruncation" */
.expression,
.result {
    display: flex;
    justify-content: flex-end;
    white-space: nowrap;
    overflow: hidden;
}

.expression {
    min-height: 1.4em;
    font-size: 20px;
    color: var(--muted);
}

.result {
    font-size: 56px;
    font-weight: 600;
}

.keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

button {
    height: 72px;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-size: 24px;
    font-weight: 600;
    background: var(--key);
    color: var(--key-text);
    cursor: pointer;
    transition: filter 0.1s;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

button:hover {
    filter: brightness(1.08);
}

button:active {
    filter: brightness(0.9);
}

button:focus-visible {
    outline: 3px solid var(--operator);
    outline-offset: 2px;
}

button.function {
    background: var(--function);
}

button.operator {
    background: var(--operator);
    color: var(--operator-text);
}
