:root {
  --bg: #141416;
  --surface: #38383a;
  --accent: #ff9500;
  --text: #ffffff;
  --muted: #8e8e93;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.calc-app {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#agent-layer, #status, #log { display: none !important; }

#calc-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

#calc-display {
  flex: 0 0 auto;
  text-align: right;
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  padding: 2rem 0.5rem 1.5rem;
  min-height: 5rem;
  word-break: break-all;
}

#calc-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  align-content: end;
}

.calc-btn {
  border: none;
  border-radius: 50%;
  aspect-ratio: 1;
  font-size: 1.6rem;
  font-weight: 400;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.calc-btn:active { filter: brightness(1.25); }

.calc-btn.op {
  background: var(--accent);
  color: #fff;
}

.calc-btn.fn { background: #a5a5a5; color: #000; }

.calc-btn.zero {
  grid-column: span 2;
  border-radius: 2.5rem;
  aspect-ratio: auto;
  height: 100%;
  text-align: left;
  padding-left: 1.6rem;
}

#install-hint {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.92);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  text-align: center;
  z-index: 9998;
}

#install-hint .hint-sm { color: var(--muted); font-size: 0.75rem; margin-top: 0.35rem; }

#permission-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: transparent;
}

.status .ok { color: #30d158; }
.status .warn { color: #ffd60a; }
.status .err { color: #ff453a; }
