@charset "utf-8";
.basic-calc-wrap {
    max-width: 800px;
    margin: 28px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
  }
 
  /* ── Calculator card ──────────────────────────────────── */
  .calc-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--gray-l);
  }
 
  /* ── Display ──────────────────────────────────────────── */
  .calc-display {
    background: var(--navy);
    padding: 20px 20px 14px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
  }
  .calc-display__expr {
    font-size: .82rem;
    color: rgba(255,255,255,.45);
    font-family: var(--font-head);
    min-height: 20px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
  }
  .calc-display__main {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 2.4rem;
    color: var(--white);
    text-align: right;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: font-size .1s;
  }
  .calc-display__main.long { font-size: 1.6rem; }
  .calc-display__copy {
    position: absolute;
    top: 12px; right: 14px;
    background: rgba(255,255,255,.1);
    border: none; cursor: pointer;
    color: rgba(255,255,255,.5);
    font-size: .72rem; padding: 3px 8px;
    border-radius: 6px; transition: all .2s;
  }
  .calc-display__copy:hover { background: rgba(255,255,255,.2); color: var(--white); }
 
  /* ── Buttons grid ─────────────────────────────────────── */
  .calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--gray-l);
  }
  .cb {
    padding: 18px 6px;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: filter .1s, transform .08s;
    user-select: none;
    background: var(--white);
    color: var(--navy);
  }
  .cb:active { filter: brightness(.88); transform: scale(.96); }
  .cb.span2  { grid-column: span 2; }
 
  /* Button colour groups */
  .cb-func   { background: #f3f4f6; color: var(--gray); font-size: .95rem; }
  .cb-op     { background: var(--orange); color: var(--white); font-size: 1.2rem; }
  .cb-op:hover   { background: #e05a1e; }
  .cb-eq     { background: var(--green); color: var(--white); font-size: 1.2rem; }
  .cb-eq:hover   { background: var(--green-d); }
  .cb-clear  { background: #fee2e2; color: #dc2626; }
  .cb-num:hover  { background: var(--light); }
  .cb-func:hover { background: #e5e7eb; }
 
  /* ── History panel ────────────────────────────────────── */
  .history-panel {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--gray-l);
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  .history-panel__head {
    background: var(--light);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-l);
  }
  .history-panel__title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .88rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .history-panel__title i { color: var(--green); }
  .history-clear-btn {
    background: none; border: none;
    font-size: .75rem; color: var(--gray);
    cursor: pointer; transition: color .2s;
  }
  .history-clear-btn:hover { color: #dc2626; }
  .history-list { max-height: 320px; overflow-y: auto; }
  .history-item {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(229,231,235,.5);
    cursor: pointer;
    transition: background .15s;
  }
  .history-item:last-child { border-bottom: none; }
  .history-item:hover { background: var(--light); }
  .history-item__expr {
    font-size: .78rem;
    color: var(--gray);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .history-item__result {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .95rem;
    color: var(--navy);
  }
  .history-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: .82rem;
    color: var(--gray);
  }
  .history-empty i { display: block; font-size: 1.8rem; margin-bottom: 8px; opacity: .3; }
 
  /* ── Keyboard hint ────────────────────────────────────── */
  .keyboard-hint {
    text-align: center;
    font-size: .72rem;
    color: var(--gray);
    padding: 8px 0 0;
  }
  .keyboard-hint kbd {
    background: var(--light);
    border: 1px solid var(--gray-l);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .7rem;
    font-family: monospace;
  }
 
  /* ── Responsive ───────────────────────────────────────── */
  @media (max-width: 768px) {
    .basic-calc-wrap {
      grid-template-columns: 1fr;
      max-width: 380px;
    }
    .history-list { max-height: 200px; }
  }
  @media (max-width: 400px) {
    .cb { padding: 15px 4px; font-size: 1rem; }
  }