/* The phone text sheet (js/phone-sheet/phone_sheet.js) and the brain dump's
 * keyboard bar (js/brain-dump-sidebar/brain_dump_phone_bar.js).
 *
 * Neither is behind a media query: both are only ever MOUNTED on a phone, by JS
 * that asks `isPhone()`, so a rule here cannot leak onto a desktop layout.
 *
 * 🔴 `bottom` is the keyboard, not zero — `--dn-keyboard-inset` is published by
 * js/mobile/mobile.js (≈0 on Android, where the viewport already shrank; the
 * keyboard's height on iOS). Same contract as the long-term popup's phone sheet.
 */

.phone-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--dn-keyboard-inset, 0px);
  /* Above the board, the popup sheet (900) and the drag carry; BELOW the ⋯ and
     parent menus (4000), which only ever open after this has closed. */
  z-index: 3500;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border-subtle);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.42);
  animation: phone-sheet-rise 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes phone-sheet-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .phone-sheet { animation: none; }
}

.phone-sheet-grip {
  width: 36px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 2px;
  background: rgba(var(--overlay-rgb), 0.18);
}

.phone-sheet-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.phone-sheet-check {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 -6px 0 -8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
}

.phone-sheet-check svg {
  width: 22px;
  height: 22px;
}

/* 16px is the iOS focus-zoom threshold, not a style choice. */
.phone-sheet-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 8px 2px;
  border: 0;
  outline: none;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 17px;
  line-height: 24px;
}

.phone-sheet-input::placeholder {
  color: var(--text-muted);
}

.phone-sheet-done {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}

.phone-sheet-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.phone-sheet-chips::-webkit-scrollbar {
  display: none;
}

.phone-sheet-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 60vw;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(var(--overlay-rgb), 0.14);
  border-radius: 18px;
  background: rgba(var(--overlay-rgb), 0.05);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-sheet-chip[data-tone="danger"] {
  color: #f28b82;
}

.phone-sheet-chip-icon {
  font-size: 13px;
  line-height: 1;
}

/* ── Brain dump keyboard bar ─────────────────────────────────────────── */

.bds-phone-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--dn-keyboard-inset, 0px);
  z-index: 3500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border-subtle);
}

.bds-phone-bar[hidden] {
  display: none;
}

.bds-phone-bar button {
  height: 40px;
  min-width: 52px;
  padding: 0 12px;
  border: 1px solid rgba(var(--overlay-rgb), 0.14);
  border-radius: 10px;
  background: rgba(var(--overlay-rgb), 0.05);
  color: var(--text-primary);
  font: inherit;
  font-size: 18px;
}

.bds-phone-bar .bds-phone-bar-done {
  margin-left: auto;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

/* Room under the last line for the bar, so the line being typed never sits
   behind it. */
.bds-phone-bar-on {
  padding-bottom: 64px;
}
