/* pod-calculator.css — the on-screen calculator (pod-calculator.js).
   Loaded by the pod player, Daily Review and the Sheet player (Work/Index) for
   every student. Self-contained: no host's stylesheet is assumed, so the panel
   looks the same on each. */

.pod-calc {
    --calc-bg: #ffffff;
    --calc-fg: #1e293b;
    --calc-muted: #64748b;
    --calc-border: #cbd5e1;
    --calc-screen: #f1f5f9;
    --calc-key: #f8fafc;
    --calc-key-hover: #e2e8f0;
    --calc-op: #e0e7ff;
    --calc-op-fg: #3730a3;
    --calc-eq: #4f46e5;
    --calc-eq-fg: #ffffff;
    --calc-error: #b91c1c;
    --calc-focus: #6366f1;

    position: fixed;
    top: 84px;
    right: 16px;
    z-index: 2100;              /* above the player's sticky header and nav */
    width: 248px;
    max-width: calc(100vw - 32px);
    background: var(--calc-bg);
    color: var(--calc-fg);
    border: 1px solid var(--calc-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;            /* fixed: the player's Text size control must not reflow the keypad */
    user-select: none;
}
.pod-calc[hidden] { display: none; }
.pod-calc:focus { outline: none; }
.pod-calc:focus-visible { box-shadow: 0 0 0 3px var(--calc-focus), 0 12px 32px rgba(15, 23, 42, 0.22); }

html[data-theme="dark"] .pod-calc {
    --calc-bg: #212121;
    --calc-fg: #e9e9e9;
    --calc-muted: #a5a5a5;
    --calc-border: #434343;
    --calc-screen: #151515;
    --calc-key: #2d2d2d;
    --calc-key-hover: #2a335c;
    --calc-op: #312e81;
    --calc-op-fg: #c7d2fe;
    --calc-eq: #6366f1;
    --calc-eq-fg: #ffffff;
    --calc-error: #fca5a5;
    --calc-focus: #a5b4fc;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.pod-calc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 6px 12px;
    cursor: move;
    touch-action: none;         /* the header drags; the page must not scroll under the finger */
}
.pod-calc-title { font-size: 0.85rem; font-weight: 600; color: var(--calc-muted); }
.pod-calc-title i { margin-right: 4px; }
.pod-calc-close {
    width: 30px; height: 30px;
    border: none; border-radius: 8px;
    background: transparent; color: var(--calc-muted);
    cursor: pointer;
}
.pod-calc-close:hover { background: var(--calc-key-hover); color: var(--calc-fg); }

.pod-calc-screen {
    margin: 0 10px;
    padding: 8px 10px;
    background: var(--calc-screen);
    border-radius: 10px;
    text-align: right;
    min-height: 62px;
}
.pod-calc-expr {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    user-select: text;          /* a student can copy the answer */
}
.pod-calc-expr::-webkit-scrollbar { display: none; }
.pod-calc-result {
    min-height: 1.3em;
    font-size: 0.95rem;
    color: var(--calc-muted);
    font-variant-numeric: tabular-nums;
    user-select: text;
}
.pod-calc-result.is-error { color: var(--calc-error); font-weight: 600; }

.pod-calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 10px;
}
.pod-calc-key {
    height: 42px;
    border: 1px solid var(--calc-border);
    border-radius: 9px;
    background: var(--calc-key);
    color: var(--calc-fg);
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation; /* no double-tap zoom on fast entry */
}
.pod-calc-key:hover { background: var(--calc-key-hover); }
.pod-calc-key:focus-visible { outline: 3px solid var(--calc-focus); outline-offset: 1px; }
.pod-calc-key-op { background: var(--calc-op); color: var(--calc-op-fg); border-color: transparent; }
.pod-calc-key-fn { color: var(--calc-muted); }
.pod-calc-key-eq { background: var(--calc-eq); color: var(--calc-eq-fg); border-color: transparent; }
.pod-calc-key-eq:hover { background: var(--calc-eq); filter: brightness(1.1); }
.pod-calc-key-wide { grid-column: span 3; }

/* The toggle button's "open" state, on either host. */
[data-pod-calculator-toggle][aria-pressed="true"] {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #ffffff !important;
}
