/* 工程計算機頁專用樣式；共用元件沿用 site.css */
.sc { max-width: 460px; margin-left: auto; margin-right: auto; padding: 10px; }
.sc-screen { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 8px; text-align: right; }
.sc-expr { min-height: 1.9em; line-height: 1.9; font-size: 1.05rem; color: var(--muted); overflow-x: auto; white-space: nowrap; font-variant-numeric: tabular-nums; scrollbar-width: none; }
.sc-expr::-webkit-scrollbar { display: none; }
.sc-res { font-size: 2.2rem; line-height: 1.3; font-weight: 700; color: var(--fg); overflow-x: auto; white-space: nowrap; font-variant-numeric: tabular-nums; scrollbar-width: none; min-height: 1.3em; }
.sc-res-m { font-size: 1.7rem; }
.sc-res-s { font-size: 1.3rem; }
.sc-res.sc-err { color: var(--bad); font-size: 1.1rem; white-space: normal; line-height: 1.4; text-align: left; }
.sc-mem { min-height: 1.3em; font-size: .9rem; color: var(--brand-dark); text-align: left; margin: 0; }
.sc-body { display: block; }
.sc-sci, .sc-pad { display: grid; gap: 6px; margin-bottom: 8px; }
.sc-sci { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sc-pad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sc .k, .sc .sc-sw {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--fg);
  font: inherit; font-size: 1.2rem; font-weight: 600; cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.sc .k:active, .sc .sc-sw:active { background: #dbe4ff; }
.sc .k:focus-visible, .sc .sc-sw:focus-visible { outline: 3px solid #93b4ff; }
.sc .k-fn { background: var(--soft); font-size: .98rem; }
.sc .k-mem { background: var(--soft); font-size: .95rem; color: var(--brand-dark); min-height: 40px; }
.sc .k-op { background: #eff4ff; color: var(--brand); font-size: 1.4rem; }
.sc .k-eq { background: var(--brand); color: #fff; border-color: var(--brand); grid-column: span 3; }
.sc .k-clr { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.sc .k-eq.k-eq2 { grid-column: span 2; }
.sc .sc-sw { background: var(--soft); font-size: .9rem; }
.sc .sc-sw[aria-pressed="true"] { border-color: var(--brand); background: #eff4ff; color: var(--brand); }
.sc-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sc-tools .btn { flex: 1 1 120px; }
.sc-msg { min-height: 1.4em; font-size: .95rem; color: var(--muted); margin: 6px 0 0; }
.sc-histbox { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.sc-histbox h2 { font-size: 1.05rem; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
#sc-hist { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; }
.sc-h { display: flex; justify-content: space-between; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-variant-numeric: tabular-nums; font-size: 1rem; }
.sc-h:hover { background: var(--soft); }
.sc-h-e { color: var(--muted); overflow-x: auto; white-space: nowrap; min-width: 0; scrollbar-width: none; }
.sc-h-r { font-weight: 700; white-space: nowrap; }
@media (max-width: 480px) {
  .sc { padding: 8px; }
  .sc .k { font-size: 1.1rem; }
  .sc .k-fn { font-size: .88rem; }
  .sc-sci { gap: 5px; }
}
/* 寬螢幕與手機橫放：函數區在左（下面接複製鈕與提示）、數字區在右 */
@media (min-width: 720px), (orientation: landscape) and (max-height: 560px) {
  .sc { max-width: 760px; }
  .sc-body { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr; column-gap: 12px; align-items: start; }
  .sc-sci { grid-column: 1; grid-row: 1; margin-bottom: 0; }
  .sc-tools { grid-column: 1; grid-row: 2; }
  .sc-msg { grid-column: 1; grid-row: 3; }
  .sc-pad { grid-column: 2; grid-row: 1 / span 3; margin-bottom: 0; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .sc { padding: 6px 10px; margin-top: .5rem; margin-bottom: .5rem; }
  .sc .k, .sc .sc-sw { min-height: 36px; font-size: 1rem; }
  .sc .k-fn { font-size: .85rem; }
  .sc .k-mem { min-height: 36px; }
  .sc-pad, .sc-sci { gap: 4px; }
  .sc-screen { padding: 2px 10px; margin-bottom: 6px; }
  .sc-res { font-size: 1.6rem; line-height: 1.2; min-height: 1.2em; }
  .sc-expr { min-height: 1.4em; line-height: 1.4; font-size: .95rem; }
  .sc-mem { min-height: 0; margin: 0; }
  .sc-tools .btn { min-height: 36px; }
  .sc-msg { margin: 2px 0 0; min-height: 1.2em; }
}
