/* ── Page layout ── */

body {
    margin: 0;
    padding: 24px;
    font-family: sans-serif;
    background: #f0f0f0;
}

.page-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 860px;
    margin: 0 auto;
}

/* ── Calculator ── */

.calculator-section h1 {
    margin: 0 0 16px 0;
    font-size: 22px;
}

.container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

table {
    min-width: 300px;
    border-collapse: collapse;
}

td {
    width: 25%;
    height: 72px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    transition: transform 80ms ease, filter 80ms ease;
}

td:active {
    transform: scale(0.94);
    filter: brightness(0.85);
}

#display {
    height: 60px;
    padding: 0 12px;
    font-size: 32px;
    text-align: right;
    background: #1c1c1e;
    color: white;
    border: none;
    cursor: default;
}

#display:active {
    transform: none;
    filter: none;
}

.cancel {
    background-color: #a33;
    color: white;
}

.modifier {
    background-color: #b8960c;
    color: white;
}

.digit {
    background-color: #e8e8e8;
    color: #111;
}

.operator {
    background-color: #555;
    color: white;
}

/* ── Handlers panel ── */

.handlers-panel {
    min-width: 180px;
}

/* ── Info panel ── */

.info-panel {
    flex: 1;
    min-width: 200px;
}

.info-panel h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.handlers-panel h3,
.info-panel h3 {
    margin: 20px 0 6px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #888;
}

.explanation {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

.explanation code {
    background: #e8e8e8;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
}

/* ── State list ── */

.state-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.state-item {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #777;
    border-left: 3px solid transparent;
}

.state-item.current {
    background: #fff8e1;
    border-left-color: #f0a500;
    color: #222;
    font-weight: 600;
}

/* ── Handler table ── */

.handler-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    min-height: 0;
}

.handler-table td {
    padding: 4px 8px;
    height: auto;
    font-size: 13px;
    border: none;
    border-bottom: 1px solid #eee;
    cursor: default;
    user-select: text;
    transition: none;
    transform: none;
    filter: none;
}

.handler-table td:active {
    transform: none;
    filter: none;
}

.handler-table tr:last-child td {
    border-bottom: none;
}

.handler-table td:first-child {
    font-family: monospace;
    font-weight: 600;
    width: 65px;
    color: inherit;
}

.active-handler td {
    color: #111;
}

.inactive-handler td {
    color: #bbb;
}
