    :root {
      --bg-1: #0f172a;
      --bg-2: #1e293b;
      --card: rgba(15, 23, 42, 0.72);
      --card-border: rgba(255, 255, 255, 0.08);
      --text: #e5eefc;
      --muted: #94a3b8;
      --btn: rgba(255, 255, 255, 0.06);
      --btn-hover: rgba(255, 255, 255, 0.12);
      --op: linear-gradient(135deg, #8b5cf6, #6366f1);
      --accent: linear-gradient(135deg, #22c55e, #06b6d4);
      --danger: linear-gradient(135deg, #fb7185, #ef4444);
      --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    }

    body.light {
      --bg-1: #e2e8f0;
      --bg-2: #f8fafc;
      --card: rgba(255, 255, 255, 0.78);
      --card-border: rgba(15, 23, 42, 0.08);
      --text: #0f172a;
      --muted: #64748b;
      --btn: rgba(15, 23, 42, 0.05);
      --btn-hover: rgba(15, 23, 42, 0.1);
      --op: linear-gradient(135deg, #7c3aed, #4f46e5);
      --accent: linear-gradient(135deg, #10b981, #0ea5e9);
      --danger: linear-gradient(135deg, #f43f5e, #ef4444);
      --shadow: 0 22px 50px rgba(15, 23, 42, 0.12);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      display: grid;
      place-items: center;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.35), transparent 32%),
        radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.22), transparent 30%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2));
      padding: 24px;
      transition: background 0.3s ease, color 0.3s ease;
    }

    .calculator {
      width: min(100%, 380px);
      padding: 22px;
      border-radius: 28px;
      background: var(--card);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(18px);
      box-shadow: var(--shadow);
      position: relative;
      overflow: hidden;
    }

    .calculator::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, rgba(255,255,255,0.12), transparent 28%);
      pointer-events: none;
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 18px;
      position: relative;
      z-index: 1;
    }

    .brand h1 {
      margin: 0;
      font-size: 1.05rem;
      font-weight: 700;
      letter-spacing: 0.02em;
    }

    .brand p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 0.8rem;
    }

    .theme-toggle {
      border: none;
      width: 60px;
      height: 50px;
      border-radius: 14px;
      background: var(--btn);
      color: var(--text);
      cursor: pointer;
      font-size: 1.1rem;
      transition: transform 0.18s ease, background 0.2s ease;
    }

    .theme-toggle:hover,
    button:hover {
      transform: translateY(-2px);
    }

    .screen {
      position: relative;
      z-index: 1;
      border-radius: 24px;
      padding: 18px;
      min-height: 150px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      display: flex;
      flex-direction: column;
      justify-content: end;
      margin-bottom: 18px;
      overflow: hidden;
    }

    .history {
      min-height: 24px;
      text-align: right;
      color: var(--muted);
      font-size: 0.95rem;
      word-break: break-all;
    }

    .display {
      width: 100%;
      border: none;
      outline: none;
      background: transparent;
      color: var(--text);
      text-align: right;
      font-size: clamp(2rem, 6vw, 3rem);
      font-weight: 700;
      letter-spacing: 0.02em;
    }

    .hint {
      margin-top: 10px;
      text-align: right;
      color: var(--muted);
      font-size: 0.76rem;
    }

    .buttons {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
    }

    button {
      border: none;
      min-height: 62px;
      border-radius: 18px;
      background: var(--btn);
      color: var(--text);
      font-size: 1.05rem;
      font-weight: 600;
      cursor: pointer;
      transition: transform 0.18s ease, background 0.2s ease, box-shadow 0.2s ease;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    }

    button:hover {
      background: var(--btn-hover);
    }

    button:active {
      transform: scale(0.98);
    }

    .operator {
      background: var(--op);
      color: #fff;
    }

    .accent {
      background: var(--accent);
      color: #fff;
    }

    .danger {
      background: var(--danger);
      color: #fff;
    }

    .footer-note {
      margin-top: 14px;
      text-align: center;
      color: var(--muted);
      font-size: 0.78rem;
      position: relative;
      z-index: 1;
    }

    @media (max-width: 420px) {
      .calculator {
        padding: 16px;
        border-radius: 24px;
      }

      .screen {
        min-height: 132px;
      }

      button {
        min-height: 58px;
        border-radius: 16px;
      }
    }