/* Clean black-on-white, with the PBLS logo's sunset orange as the only colour. HumanAmp appears only in the menu. */
:root {
  --paper: #ffffff;
  --card: #ffffff;
  --wash: #f5f5f4;
  --ink: #161616;
  --muted: #6b6b6b;
  --line: #ebebea;
  --sun-light: #f8b445;
  --sun: #ee8a1d;
  --sun-deep: #c2600e;
  --sun-soft: #fff1e0;
  --sun-text: #9c4c0a; /* Orange for text: at least 5:1 on white, the pill and the menu. */
  --danger: #a3341f;
  --shadow: 0 0 0 1px var(--line), 0 6px 20px -14px rgba(0, 0, 0, 0.25);
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  color-scheme: light;
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }

/* App bar */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.65rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) var(--gutter) 0.5rem;
  background: rgba(255, 255, 255, 0.86); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar .mark { border-radius: 50%; flex: none; }
.bar .title { flex: 1; min-width: 0; }
.bar h1 { font-size: 1.15rem; }
.bar p { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  font-size: 0.72rem; font-weight: 700; color: var(--sun-text); background: var(--sun-soft);
  border-radius: 999px; padding: 0.2rem 0.6rem;
}
.icon {
  width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
}
.icon svg { width: 22px; height: 22px; fill: currentColor; }
.icon[aria-expanded='true'] { background: var(--wash); }

/* Menu: bottom sheet on phones, anchored popover on wider screens (Chromebook). */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.25); }
.menu {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px -10px rgba(31, 29, 26, 0.35);
  padding: 0.5rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
  animation: sheet 0.2s ease-out;
}
.menu::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 0.4rem; }
.menu .group { border-bottom: 1px solid var(--line); padding: 0.25rem 0; }
.menu .group:empty, .menu .group:not(:has(> :not([hidden]))) { display: none; }
.item {
  display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 1.25rem;
  font: inherit; font-size: 1.05rem; font-weight: 600; color: var(--ink); text-align: left;
  background: none; border: 0; border-radius: 0; justify-content: flex-start; cursor: pointer; position: relative;
}
.item input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.item:disabled, .item:has(input:disabled) { opacity: 0.45; cursor: default; }
.item:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: -3px; }
#account { color: var(--danger); }
.powered {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem;
  background: var(--wash); color: var(--ink); text-decoration: none; font-size: 0.95rem;
}
.powered img { border-radius: 8px; flex: none; }
.powered span { display: grid; gap: 0.1rem; }
.powered b { font-weight: 500; }
.powered sup { font-size: 0.6em; }
.powered u { color: var(--sun-text); text-underline-offset: 3px; font-size: 0.9rem; }
.release { padding: 0.6rem 1.25rem 0; font-size: 0.78rem; color: var(--muted); }
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }

@media (min-width: 640px) {
  .menu {
    top: calc(3.6rem + env(safe-area-inset-top)); bottom: auto; left: auto; right: var(--gutter);
    width: 20rem; border-radius: 18px; max-height: calc(100dvh - 4.6rem - env(safe-area-inset-top)); padding: 0.35rem 0 0.75rem; box-shadow: var(--shadow), 0 20px 50px -20px rgba(31, 29, 26, 0.35);
    animation-name: pop;
  }
  .menu::before { display: none; }
  .scrim { background: transparent; }
  .item { min-height: 46px; font-size: 1rem; }
  @keyframes pop { from { transform: translateY(-6px) scale(0.98); opacity: 0; } }
}

/* Content */
main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: 0.75rem var(--gutter) 0; display: flex; flex-direction: column; }
#app { flex: 1; display: flex; flex-direction: column; gap: 0.85rem; }

button, .button {
  font: inherit; font-weight: 600; min-height: 48px; border-radius: 999px; padding: 0.7rem 1.2rem;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 0.4rem; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.primary { background: var(--ink); color: #fff; }
.primary.sun { background: var(--sun); color: var(--ink); }
.secondary { background: var(--card); color: var(--ink); border-color: var(--ink); }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.link {
  background: none; border: 0; color: var(--sun-text); font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; padding: 0.5rem; min-height: 44px; cursor: pointer;
}
@media (hover: hover) {
  .primary:hover:not(:disabled) { background: #333; }
  .primary.sun:hover:not(:disabled) { background: var(--sun-light); }
  .secondary:hover, .ghost:hover:not(:disabled) { background: var(--wash); }
  .item:hover:not(:disabled) { background: var(--wash); }
  .powered:hover { background: #ededec; }
  .icon:hover { background: var(--wash); }
}
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.row > * { flex: 1 1 10rem; }
.row.pair > * { flex-basis: 7rem; padding-inline: 0.75rem; }
.eyebrow {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--sun-text); display: flex; align-items: center; gap: 0.4rem;
}
.eyebrow img { border-radius: 50%; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.status { color: var(--muted); }
.feedback { color: var(--ink); text-align: center; font-size: 0.95rem; }
#draftError { color: var(--danger); }
.feedback:empty { display: none; }
.small { font-size: 0.85rem; color: var(--muted); }

.signin { flex: 1; text-align: center; display: grid; align-content: center; justify-items: center; gap: 0.85rem; padding: 2rem 0 4rem; }
.signin img { border-radius: 50%; box-shadow: 0 14px 34px -14px rgba(194, 96, 14, 0.6); }
.signin h2 { font-size: 1.75rem; }
.signin p { max-width: 24rem; color: var(--muted); }
.signin .primary { min-width: 16rem; }

/* Shown until Smiler has a reply or a draft to show. */
.welcome { padding: 1.5rem 0.25rem 0.5rem; display: grid; gap: 0.5rem; }
.welcome h2 { font-size: 1.6rem; }
.welcome p { color: var(--muted); max-width: 30rem; }
#app:has(.card:not([hidden])) .welcome { display: none; }

.card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1.2rem; display: grid; gap: 0.7rem;
}
.card h3 { font-size: 1.25rem; }
.card details { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.card summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.card details p { margin-top: 0.5rem; }
.reply.waiting .status::after { content: '…'; }
.reply:not(.waiting) .status { display: none; } /* The eyebrow already says it is Smiler. */

/* Record dock: always in thumb reach at the bottom of the screen. */
.dock {
  position: sticky; bottom: 0; margin: auto calc(-1 * var(--gutter)) 0; z-index: 10;
  display: grid; justify-items: center; gap: 0.5rem;
  padding: 0.85rem var(--gutter) calc(0.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(247, 241, 232, 0), var(--paper) 1.25rem);
}
.dock-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.dock-head h2 { font-size: 1.1rem; }
.dock:not(.changing) .dock-head { display: none; }
.dock.changing {
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px -14px rgba(31, 29, 26, 0.35);
}
.mic {
  width: 76px; height: 76px; border-radius: 50%; padding: 0; min-height: 0;
  background: linear-gradient(170deg, var(--sun-light), var(--sun) 55%, var(--sun-deep));
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--ink), 0 12px 24px -10px rgba(194, 96, 14, 0.7);
}
.mic svg { width: 34px; height: 34px; fill: var(--ink); }
.mic.live { background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
.mic.live svg { display: none; }
.mic.live::before { content: ''; width: 24px; height: 24px; border-radius: 6px; background: var(--sun); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--ink), 0 0 0 5px rgba(238, 138, 29, 0.5); } 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--ink), 0 0 0 18px rgba(238, 138, 29, 0); } }
.record-label { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.clip { width: 100%; display: grid; gap: 0.6rem; }
.clip audio { width: 100%; }

@media (min-width: 640px) {
  main { padding-top: 1.5rem; }
  .dock { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .dock.changing { padding: 1rem 1.25rem 1.25rem; border-radius: 22px; margin-bottom: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, .menu { animation: none !important; transition: none !important; }
}
