.newton-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.nw-expr {
    display: block;
    text-align: center;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.45;
    padding: 1rem .75rem;
    white-space: normal;
}

.nw-unit {
    display: inline;
    white-space: nowrap;
    border-bottom: 1px dotted currentColor;
    cursor: help;
}

.nw-timer {
    font-size: 1.4rem;
    font-weight: 700;
    min-width: 2.5rem;
    text-align: center;
}

.nw-display {
    display: block;
    font-size: 2.4rem;
    font-weight: 700;
    text-align: right;
    padding: .5rem .9rem;
    border: 2px solid #444;
    border-radius: .6rem;
    background: #111;
    color: #fff;
    min-height: 3.6rem;
    overflow-x: auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.nw-display-unit {
    font-size: 1.2rem;
    font-weight: 500;
    opacity: .75;
    margin-left: .45rem;
}

.nw-canvas {
    display: block;
    width: 100%;
    height: 240px;
    border: 2px solid #444;
    border-radius: .6rem;
    background: #0d0d0d;
    touch-action: none;
    cursor: crosshair;
}

.nw-fix {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nw-fix-label {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 1.6rem;
    text-align: center;
    opacity: .6;
}

.nw-fix-btn {
    flex: 1 1 0;
    min-width: 2rem;
    font-size: 1rem;
    font-weight: 600;
    padding: .3rem 0;
    border: 1px solid #ced4da;
    border-radius: .35rem;
    background: #fff;
    color: #212529;
    cursor: pointer;
    touch-action: manipulation;
}

.nw-fix-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.nw-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
}

.nw-key {
    font-size: 1.5rem;
    font-weight: 600;
    padding: .6rem 0;
    border: 1px solid #adb5bd;
    border-radius: .6rem;
    background: #f8f9fa;
    color: #212529;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nw-key:active {
    background: #dee2e6;
    transform: translateY(1px);
}

.nw-key-fn {
    font-size: 1.3rem;
    background: #e9ecef;
}

.nw-key-wide {
    grid-column: span 4;
    font-size: 1.3rem;
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.nw-key-wide:active {
    background: #0a58ca;
}

#nw-sign.active {
    background: #343a40;
    border-color: #343a40;
    color: #fff;
}

.nw-feedback {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    min-height: 2.6rem;
}

.nw-correct-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .nw-expr { font-size: 1.2rem; padding: .75rem .5rem; }
    .nw-display { font-size: 2rem; }
    .nw-canvas { height: 200px; }
    .nw-key { font-size: 1.3rem; }
    .nw-feedback { font-size: 1.6rem; }
}
