* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef1f6;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.calc {
    width: 100%;
    max-width: 340px;
    margin: 16px;
    padding: 20px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(20, 30, 60, .15);
}
h1 { margin: 0 0 12px; font-size: 18px; color: #334; text-align: center; }
.display {
    background: #f3f5fa;
    border-radius: 12px;
    padding: 12px 14px;
    text-align: right;
    margin-bottom: 14px;
    min-height: 82px;
    overflow: hidden;
}
.expr { font-size: 15px; color: #778; min-height: 20px; word-break: break-all; }
.result { font-size: 34px; font-weight: 600; color: #223; word-break: break-all; }
.result.error { font-size: 16px; color: #c0392b; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.key {
    border: 0;
    border-radius: 12px;
    padding: 16px 0;
    font-size: 20px;
    background: #f0f2f7;
    color: #223;
    cursor: pointer;
    transition: transform .05s, background .15s;
}
.key:hover { background: #e3e7f0; }
.key:active { transform: scale(.95); }
.key.op { background: #dfe8ff; color: #2f5bd8; }
.key.fn { background: #ffe6e1; color: #c0392b; }
.key.eq { background: #2f5bd8; color: #fff; }
.key.eq:hover { background: #2549b3; }
.hint { margin: 12px 0 0; font-size: 12px; color: #889; text-align: center; }
.key.wide { grid-column: span 2; }
