* { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #f4f6f9; --card: #fff; --primary: #4a90e2; --primary-soft: #e8f1fc;
    --text: #2c3e50; --text-sub: #7b8a99; --border: #eef1f5;
    --shadow: 0 2px 12px rgba(0,0,0,.06); --radius: 16px;
  }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh;
    display: flex; align-items: center; justify-content: center; padding: 24px;
  }
  .app { width: 100%; max-width: 1440px; }
  .card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
  .header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .header h1 { font-size: 19px; font-weight: 600; }
  .back { font-size: 13px; color: var(--text-sub); text-decoration: none; padding: 6px 12px; background: var(--bg); border-radius: 8px; }
  .back:hover { background: var(--primary-soft); color: var(--primary); }
  .mode-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12px; color: var(--text-sub); }
  .mode-bar .toggle { cursor: pointer; padding: 4px 10px; border-radius: 6px; background: var(--bg); }
  .mode-bar .toggle.active { background: var(--primary-soft); color: var(--primary); }
  .display {
    background: linear-gradient(135deg, var(--primary), #6aa9e9);
    border-radius: 14px; padding: 18px; color: #fff; text-align: right; margin-bottom: 14px;
    min-height: 104px; display: flex; flex-direction: column; justify-content: flex-end;
  }
  .expr { font-size: 15px; opacity: .82; min-height: 20px; word-break: break-all; }
  .result { font-size: 34px; font-weight: 700; word-break: break-all; line-height: 1.1; margin-top: 6px; }
  .keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
  button {
    height: 48px; border: none; border-radius: 11px; font-size: 16px; font-weight: 500;
    cursor: pointer; transition: all .12s; font-family: inherit;
  }
  button:active { transform: scale(.94); }
  .num { background: #f5f7fa; color: var(--text); }
  .num:hover { background: #eaeef3; }
  .op { background: var(--primary-soft); color: var(--primary); }
  .op:hover { background: #d4e4f7; }
  .fn { background: #eef1f5; color: #5a6b7b; font-size: 14px; }
  .fn:hover { background: #e1e6ec; }
  .fn-sci { background: #f0eefe; color: #7c6dd1; font-size: 14px; }
  .fn-sci:hover { background: #e3dffa; }
  .eq { background: var(--primary); color: #fff; }
  .eq:hover { opacity: .88; }
  .span2 { grid-column: span 2; }
  .toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--text); color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px;
    opacity: 0; transition: all .3s; pointer-events: none; z-index: 10; }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }