*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { overflow: hidden; }
#app { height: 100%; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.35; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { display: block; flex: none; }
.grow { flex: 1; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.icon-btn:active:not(:disabled) { background: rgba(255, 255, 255, 0.1); transform: scale(0.94); }
.icon-btn.placeholder { visibility: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 999px;
  font-weight: 600; font-size: 14px;
  background: var(--panel-3);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); filter: brightness(1.1); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--divider); }
.btn.danger { background: var(--danger); color: #fff; }

.chip {
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}

.text-input, .composer-input {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 12px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
}
textarea { resize: none; }

.fatal { padding: 32px 20px; color: var(--text-2); line-height: 1.5; }

/* Toasts */
.toasts {
  position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; z-index: 100;
}
.toast {
  max-width: min(92vw, 420px);
  background: rgba(40, 40, 40, 0.96);
  border: 1px solid var(--divider);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px; line-height: 1.35;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0; transform: translateY(-8px);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { border-color: rgba(255, 91, 91, 0.5); }
