/* ══════════════════════════════════════════════════════════════════════
   Pevra Humaniser — writing command deck

   Same language as chat's command deck: Pevra tokens, display type for
   empty states, Geist Mono kickers, an ember spine on what you wrote,
   the rewrite as the card. Nothing here restyles a shared class — every
   rule is #view-humaniser or .hm- / #hm- — so Codex and Claude's chrome
   cannot be moved by this sheet.

   Desktop fills the view. Editors scroll. The page does not.
   Motion is scoped here too: enter, busy, land, reduced-motion.
   ══════════════════════════════════════════════════════════════════════ */

#view-humaniser {
  min-height: 0;
  position: relative;
  isolation: isolate;
}
#view-humaniser::before {
  content: "";
  position: absolute;
  inset: -8%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(420px 280px at 92% -6%, var(--accent-glow), transparent 62%),
    radial-gradient(640px 520px at -8% 110%, var(--accent-wash), transparent 58%);
  opacity: .5;
  animation: hm-sweep 18s ease-in-out infinite;
}
#view-humaniser .view-header,
#view-humaniser .hm-wrap { position: relative; z-index: 1; }

#view-humaniser .hm-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 16px 12px;
  overflow: hidden;
}

.hm-intro { display: none; }

.hm-hint {
  margin: -4px 2px 2px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--fg-3);
}
.hm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex: none;
  flex-wrap: wrap;
  padding: 6px 8px 6px 10px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 1px color-mix(in srgb, var(--fg) 8%, transparent);
}
.hm-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  margin: 0;
}
.hm-ctl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hm-ctl-wide { min-width: 132px; }
.hm-ctl > label, .hm-ctl-label {
  font-family: var(--code, var(--mono));
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.hm-select, .hm-input {
  width: 100%;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--ink-0);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  min-height: 32px;
}
.hm-select:focus-visible, .hm-input:focus-visible,
.hm-editor:focus-visible, .hm-vp-sample:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hm-seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--ink-0);
  border: 1px solid var(--line-2);
  border-radius: 10px;
}
.hm-seg button {
  flex: 1;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, transform .14s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1));
}
.hm-seg button.on { background: var(--accent); color: var(--accent-ink, #fff); }
.hm-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hm-seg button:active { transform: scale(.97); }
@media (hover: hover) {
  .hm-seg button:not(.on):hover { background: var(--ink-3); color: var(--fg); }
}

.hm-more { position: relative; }
.hm-more > summary {
  list-style: none;
  cursor: pointer;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--ink-0);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  user-select: none;
  transition: border-color .16s ease, color .16s ease, transform .14s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1));
}
.hm-more > summary::-webkit-details-marker { display: none; }
.hm-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hm-more[open] > summary { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); color: var(--fg); }
.hm-more > summary:active { transform: scale(.97); }
.hm-more-body {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 8;
  width: min(420px, calc(100vw - 48px));
  padding: 14px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: 0 18px 48px -20px rgba(20, 14, 10, .45), inset 0 1px color-mix(in srgb, var(--fg) 8%, transparent);
  display: grid;
  gap: 10px;
  transform-origin: 12px -6px;
  animation: hm-menu .22s cubic-bezier(.16,1,.3,1) both;
}
.hm-ctl-checks { gap: 8px; }
.hm-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  line-height: 1.4;
}
.hm-check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin-top: 1px; }
.hm-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  flex: none;
}
.hm-actions button { min-height: 32px; }
.hm-actions button:disabled { opacity: .45; cursor: not-allowed; }
.hm-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#view-humaniser .hm-actions .btn-ghost {
  transition: background .14s ease, color .14s ease, transform .14s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1));
}
#view-humaniser .hm-actions .btn-ghost:active { transform: scale(.97); }
@media (hover: hover) {
  #view-humaniser .hm-actions .btn-ghost:hover:not(:disabled) { transform: translateY(-1px); }
}

/* ── Studio: one surface, split ───────────────────────────────────── */
.hm-studio {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ink-2);
  overflow: hidden;
  box-shadow:
    0 14px 34px -28px rgba(33, 28, 23, .42),
    inset 0 1px color-mix(in srgb, var(--fg) 8%, transparent);
  transition: border-color .24s ease, box-shadow .28s var(--pevra-motion, cubic-bezier(.16,1,.3,1));
}
.hm-pane-out.hm-landed {
  animation: hm-land .7s cubic-bezier(.16,1,.3,1);
}
.hm-studio:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line-2));
  box-shadow:
    0 18px 40px -25px var(--accent-glow),
    0 0 0 3px var(--accent-wash),
    inset 0 1px color-mix(in srgb, var(--fg) 10%, transparent);
}

/* Stacked by default — the mobile layout is the base case, not an override. */
.hm-grid { display: grid; grid-template-columns: 1fr; gap: 0; flex: 1; min-height: 0; }

.hm-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
.hm-pane-out { border-top: 1px solid var(--line); }
.hm-pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.hm-pane-head h3 {
  margin: 0;
  font-family: var(--code, var(--mono));
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  flex: none;
}
.hm-count {
  font-family: var(--code, var(--mono));
  font-size: 11px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  flex: 1;
  text-align: right;
}
.hm-count.hm-tick { animation: hm-tick .38s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1)); }
.hm-chip {
  flex: none;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--code, var(--mono));
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line-2));
}
.hm-mini {
  flex: none;
  padding: 3px 9px;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1));
}
.hm-mini[aria-pressed="true"] {
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2));
  color: var(--accent);
}
.hm-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hm-mini:active { transform: scale(.96); }
@media (hover: hover) {
  .hm-mini:hover { transform: translateY(-1px); }
}

.hm-stage { position: relative; display: flex; flex: 1; min-height: 0; }
#hm-out-shell { position: relative; display: flex; flex: 1; min-height: 0; }

.hm-editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 18px 22px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  overflow-y: auto;
}
.hm-pane-in .hm-editor {
  box-shadow: inset 2px 0 0 var(--accent);
  padding-left: 20px;
  transition: box-shadow .28s var(--pevra-motion, cubic-bezier(.16,1,.3,1));
}
.hm-pane-in .hm-editor:focus {
  box-shadow: inset 3px 0 0 var(--accent), inset 12px 0 24px -18px var(--accent-glow);
}
.hm-editor::placeholder { color: transparent; }

.hm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 28px 36px 36px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .32s var(--pevra-ease, cubic-bezier(.16,1,.3,1)),
              transform .32s var(--pevra-ease, cubic-bezier(.16,1,.3,1));
}
.hm-stage:has(> .hm-editor:placeholder-shown:not(:focus)) > .hm-empty,
#hm-out-shell:has(> .hm-editor:placeholder-shown:not(:focus)):not(.showing-diff) > .hm-empty {
  opacity: 1;
  transform: none;
}
.hm-empty-kicker {
  font-family: var(--code, var(--mono));
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.hm-empty-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.12;
  letter-spacing: -.025em;
  color: var(--fg);
  text-wrap: balance;
  max-width: 16ch;
}
.hm-empty-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 36ch;
  text-wrap: pretty;
}
.hm-empty-mark {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  background: var(--accent);
  -webkit-mask: var(--pevra-mark) center / contain no-repeat;
  mask: var(--pevra-mark) center / contain no-repeat;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.hm-diff {
  display: none;
  flex: 1;
  min-height: 0;
  padding: 18px 22px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#hm-out-shell.showing-diff .hm-diff { display: block; }
#hm-out-shell.showing-diff .hm-editor { display: none; }
.hm-diff ins {
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-bottom: 1.5px solid var(--accent);
  border-radius: 2px;
  padding: 0 1px;
  animation: hm-ink .7s cubic-bezier(.16,1,.3,1) both;
}
.hm-diff del {
  color: var(--fg-4);
  text-decoration: line-through;
  opacity: .75;
  animation: hm-fade .45s cubic-bezier(.16,1,.3,1) both;
}

.hm-state {
  padding: 0 16px;
  font-size: 12px;
  color: var(--fg-3);
  min-height: 0;
  flex: none;
}
.hm-state:not(:empty) {
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  animation: hm-rise .28s cubic-bezier(.16,1,.3,1) both;
}
.hm-state.err { color: var(--neg, #d14545); }
.hm-state.busy::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 7px;
  border: 2px solid var(--line-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hm-spin .7s linear infinite;
  vertical-align: -1px;
}

/* ── Humanise on the seam ─────────────────────────────────────────── */
.hm-runway {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  z-index: 5;
}
#view-humaniser .hm-go {
  position: relative;
  overflow: hidden;
  min-height: 40px;
  min-width: 132px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13.5px;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px -12px var(--accent-glow);
  transition: transform .18s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1)),
              filter .18s ease, box-shadow .24s ease;
}
#view-humaniser .hm-go::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 15%, rgba(255,255,255,.22), transparent 70%);
  transform: translateX(-140%);
  transition: transform .48s var(--pevra-motion, cubic-bezier(.16,1,.3,1));
  pointer-events: none;
}
@media (hover: hover) {
  #view-humaniser .hm-go:hover { filter: brightness(1.06); transform: translateY(-1px); }
  #view-humaniser .hm-go:hover::after { transform: translateX(120%); }
}
#view-humaniser .hm-go:active { transform: scale(.97); }
#view-humaniser .hm-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#view-humaniser .hm-go:disabled { transform: none; filter: none; }

/* ── Quality strip ────────────────────────────────────────────────── */
.hm-report {
  margin: 0;
  display: grid;
  gap: 6px;
  flex: none;
  max-height: 26%;
  overflow: auto;
  padding: 0 4px;
}
.hm-report:not(.hidden) {
  animation: hm-rise .45s cubic-bezier(.16,1,.3,1) both;
}
.hm-quality {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 4px 2px;
}
.hm-metric { padding: 0; background: transparent; border: 0; animation: hm-rise .4s cubic-bezier(.16,1,.3,1) both; }
.hm-metric:nth-child(1) { animation-delay: .02s; }
.hm-metric:nth-child(2) { animation-delay: .08s; }
.hm-metric:nth-child(3) { animation-delay: .14s; }
.hm-metric:nth-child(4) { animation-delay: .2s; }
.hm-metric:nth-child(5) { animation-delay: .26s; }
.hm-metric:nth-child(6) { animation-delay: .32s; }
.hm-metric b {
  display: inline;
  font-family: var(--code, var(--mono));
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.hm-metric span {
  display: inline;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-3);
  margin-left: 6px;
}
.hm-metric i { font-style: normal; font-size: 11px; color: var(--fg-3); margin-left: 4px; }
.hm-metric i.up { color: var(--pos, #2f9e6b); }
.hm-metric i.down { color: var(--fg-3); }

.hm-changes, .hm-flags {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 2px 2px;
  animation: hm-rise .4s .12s cubic-bezier(.16,1,.3,1) both;
}
.hm-changes:empty, .hm-flags:empty { display: none; }
.hm-changes h4, .hm-flags h4 {
  margin: 0 0 6px;
  font-family: var(--code, var(--mono));
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--fg-3);
}
.hm-changes ul, .hm-flags ul { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.hm-changes li, .hm-flags li { font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
.hm-changes li b { color: var(--fg); font-weight: 600; }
.hm-flags { border-color: color-mix(in srgb, var(--warn, #d98a2b) 40%, var(--line)); }

.hm-advice {
  flex: none;
  padding: 12px 4px 4px;
  animation: hm-rise .4s cubic-bezier(.16,1,.3,1) both;
}
.hm-advice[hidden] { display: none; }
.hm-advice-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.hm-advice-head h4 {
  margin: 0;
  font-family: var(--code, var(--mono));
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
}
.hm-advice-verdict {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
}
.hm-advice-note, .hm-advice-after {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--fg-3);
  max-width: 72ch;
}
.hm-advice-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.hm-advice-list li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  background: var(--accent-wash);
  border-radius: 0 10px 10px 0;
}
.hm-advice-list b { font-size: 13px; color: var(--fg); }
.hm-advice-list span { font-size: 13px; line-height: 1.45; color: var(--fg-2); }
.hm-advice-list i { font-style: normal; font-size: 11.5px; color: var(--fg-3); }

/* ── Footer ───────────────────────────────────────────────────────── */
.hm-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  flex: none;
  align-items: flex-start;
  padding: 0 4px;
}
.hm-voice-panel, .hm-privacy {
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  flex: 1 1 260px;
  min-width: 0;
}
.hm-voice-panel > summary, .hm-privacy > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--fg-2);
  list-style: none;
  min-height: 28px;
}
.hm-voice-panel > summary::-webkit-details-marker,
.hm-privacy > summary::-webkit-details-marker { display: none; }
.hm-voice-panel > summary:focus-visible,
.hm-privacy > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r);
}
.hm-voice-panel[open] > :not(summary),
.hm-privacy[open] > :not(summary) {
  animation: hm-rise .28s cubic-bezier(.16,1,.3,1) both;
}
.hm-vp-state { margin-left: auto; font-weight: 500; font-size: 11.5px; color: var(--fg-3); }
.hm-vp-note { font-size: 13px; line-height: 1.55; color: var(--fg-2); margin: 8px 0 12px; max-width: 70ch; }
.hm-vp-lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); margin: 10px 0 5px; }
.hm-vp-sample {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--ink-0);
  color: var(--fg);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
}
.hm-consent { margin: 12px 0; align-items: flex-start; max-width: 70ch; }
.hm-vp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  margin-bottom: 8px;
}
.hm-vp-card b { font-size: 13.5px; color: var(--fg); }
.hm-vp-card .hm-vp-meta { font-size: 12px; color: var(--fg-3); flex: 1; min-width: 120px; }
.hm-vp-card .hm-vp-del {
  padding: 6px 10px;
  min-height: 30px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--neg, #d14545);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hm-vp-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hm-vp-reads { width: 100%; margin: 8px 0 0; padding-left: 17px; display: grid; gap: 5px; }
.hm-vp-reads li { font-size: 12.5px; color: var(--fg-2); line-height: 1.5; }

.hm-privacy h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); }
.hm-privacy ul { margin: 8px 0 10px; padding-left: 18px; display: grid; gap: 6px; }
.hm-privacy li, .hm-privacy p { font-size: 12.5px; line-height: 1.55; color: var(--fg-2); max-width: 78ch; }
.hm-privacy p { margin: 0 0 8px; }
.hm-privacy p:last-child { margin-bottom: 0; }
.hm-detector-note { border-left: 2px solid var(--line-3); padding-left: 11px; }

@keyframes hm-spin { to { transform: rotate(360deg); } }
@keyframes hm-sweep {
  0%   { opacity: .38; transform: translate(-4%, -3%) scale(1); }
  50%  { opacity: .58; transform: translate(3%, 2%) scale(1.05); }
  100% { opacity: .38; transform: translate(-4%, -3%) scale(1); }
}
@keyframes hm-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes hm-pop {
  0%   { opacity: 0; transform: scale(.86); }
  70%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: none; }
}
@keyframes hm-menu {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes hm-breathe {
  0%, 100% { box-shadow: 0 14px 34px -28px rgba(33,28,23,.42), 0 0 0 3px var(--accent-wash), inset 0 1px color-mix(in srgb, var(--fg) 8%, transparent); }
  50%      { box-shadow: 0 18px 40px -22px var(--accent-glow), 0 0 0 5px var(--accent-wash), inset 0 1px color-mix(in srgb, var(--fg) 10%, transparent); }
}
@keyframes hm-land {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.08); }
  100% { filter: brightness(1); }
}
@keyframes hm-sheen {
  from { transform: translateX(-140%); }
  to   { transform: translateX(140%); }
}
@keyframes hm-ink {
  from { background: color-mix(in srgb, var(--accent) 42%, transparent); }
  to   { background: color-mix(in srgb, var(--accent) 16%, transparent); }
}
@keyframes hm-fade {
  from { opacity: .35; }
  to   { opacity: .75; }
}
@keyframes hm-tick {
  from { color: var(--accent); }
  to   { color: var(--fg-3); }
}
@keyframes hm-mark-breathe {
  0%, 100% { filter: drop-shadow(0 0 8px var(--accent-glow)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 16px var(--accent-glow)); transform: scale(1.08); }
}

#view-humaniser.hm-live .hm-bar {
  animation: hm-rise .55s .04s cubic-bezier(.16,1,.3,1) both;
}
#view-humaniser.hm-live .hm-studio {
  animation: hm-rise .65s .1s cubic-bezier(.16,1,.3,1) both;
}
#view-humaniser.hm-live .hm-runway {
  animation: hm-pop .55s .42s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1)) both;
}
#view-humaniser.hm-live .hm-empty-kicker {
  animation: hm-rise .5s .32s cubic-bezier(.16,1,.3,1) both;
}
#view-humaniser.hm-live .hm-empty-title {
  animation: hm-rise .58s .4s cubic-bezier(.16,1,.3,1) both;
}
#view-humaniser.hm-live .hm-empty-sub {
  animation: hm-rise .58s .48s cubic-bezier(.16,1,.3,1) both;
}
#view-humaniser.hm-live .hm-empty-mark {
  animation: hm-pop .6s .28s var(--pevra-spring, cubic-bezier(.34,1.4,.64,1)) both,
             hm-mark-breathe 2.8s 1s ease-in-out infinite;
}

/* Busy must beat the enter animation (same ID+class count, later wins). */
#view-humaniser.hm-live .hm-studio.hm-busy,
#view-humaniser .hm-studio.hm-busy {
  animation: hm-breathe 1.8s ease-in-out infinite;
}
#view-humaniser .hm-studio.hm-busy .hm-go::after {
  animation: hm-sheen 1.15s ease-in-out infinite;
}
#view-humaniser .hm-studio.hm-busy .hm-go {
  filter: brightness(1.05);
}

/* ── Desktop: side by side, Humanise on the seam ──────────────────── */
@media (min-width: 1000px) {
  .hm-grid { grid-template-columns: 1fr 1fr; }
  .hm-pane-in { grid-column: 1; grid-row: 1; }
  .hm-pane-out { grid-column: 2; grid-row: 1; border-top: 0; border-left: 1px solid var(--line); }
  .hm-runway {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    padding: 0;
    width: auto;
  }
  #view-humaniser .hm-go {
    box-shadow:
      0 0 0 5px var(--ink-2),
      0 10px 28px -12px var(--accent-glow);
  }
  .hm-pane-in .hm-editor, .hm-pane-in .hm-empty { padding-right: 40px; }
  .hm-pane-out .hm-editor, .hm-pane-out .hm-diff, .hm-pane-out .hm-empty { padding-left: 40px; }
  #view-humaniser .hm-wrap { padding: 8px 18px 10px; }
}

@media (max-width: 999px) {
  #view-humaniser .hm-wrap {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }
  .hm-bar { gap: 8px; }
  .hm-hint { display: block; }
  .hm-studio {
    flex: 1 0 auto;
    min-height: 58dvh;
    overflow: hidden;
    border-radius: 14px;
  }
  .hm-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 58dvh;
  }
  .hm-pane-in { order: 1; flex: 1 1 40%; min-height: 200px; }
  .hm-pane-out { order: 2; flex: 1 1 40%; min-height: 200px; }
  .hm-runway {
    order: 3;
    position: sticky;
    bottom: 0;
    z-index: 9;
    flex: none;
    width: 100%;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--ink-2) 94%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .hm-editor, .hm-diff, .hm-stage, #hm-out-shell { min-height: 180px; }
  .hm-editor { font-size: 16px; }
  .hm-more-body { position: static; width: 100%; box-shadow: none; }
  .hm-actions { width: 100%; }
  .hm-actions button { min-height: 44px; min-width: 44px; }
  .hm-seg button { min-height: 44px; }
  .hm-more > summary { min-height: 44px; }
  .hm-select, .hm-input { min-height: 44px; font-size: 16px; }
  #view-humaniser .hm-go {
    flex: 1 1 auto;
    width: 100%;
    min-height: 52px;
    font-size: 17px;
    border-radius: 14px;
  }
  .hm-empty-title { font-size: 20px; }
  .hm-intro { display: none; }
  .hm-check { min-height: 44px; align-items: center; }
  .hm-check input { width: 22px; height: 22px; }
}

@media (max-width: 560px) {
  .hm-ctl-wide { min-width: 0; width: 100%; }
  .hm-pane-head { padding: 0 10px; gap: 6px; }
  .hm-chip { max-width: 34%; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  #view-humaniser::before,
  #view-humaniser.hm-live .hm-bar,
  #view-humaniser.hm-live .hm-studio,
  #view-humaniser.hm-live .hm-runway,
  #view-humaniser.hm-live .hm-empty-kicker,
  #view-humaniser.hm-live .hm-empty-title,
  #view-humaniser.hm-live .hm-empty-sub,
  #view-humaniser.hm-live .hm-empty-mark,
  #view-humaniser.hm-live .hm-studio.hm-busy,
  #view-humaniser .hm-studio.hm-busy,
  #view-humaniser .hm-studio.hm-busy .hm-go,
  #view-humaniser .hm-studio.hm-busy .hm-go::after,
  .hm-empty,
  .hm-more-body,
  .hm-report,
  .hm-report:not(.hidden),
  .hm-metric,
  .hm-changes, .hm-flags,
  .hm-pane-out.hm-landed,
  .hm-state:not(:empty),
  .hm-state.busy::before,
  .hm-seg button,
  .hm-mini,
  .hm-count.hm-tick,
  .hm-diff ins, .hm-diff del,
  .hm-voice-panel[open] > :not(summary),
  .hm-privacy[open] > :not(summary),
  #view-humaniser .hm-actions .btn-ghost,
  #view-humaniser .hm-go,
  #view-humaniser .hm-go::after {
    animation: none !important;
    transition: none !important;
  }
}


/* Mobile Humaniser is a focused workspace: one editor at a time. */
.hm-mobile-tabs { display: none; }

@media (max-width: 560px) {
  .hm-mobile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    position: sticky;
    top: calc(var(--topbar-h, 56px) + env(safe-area-inset-top, 0px));
    z-index: 11;
    margin: 0 0 10px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--ink-1) 94%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .hm-mobile-tabs button {
    min-height: 44px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fg-2);
    font: 600 14px/1 var(--font-body, inherit);
    cursor: pointer;
  }
  .hm-mobile-tabs button.on {
    background: var(--accent);
    color: var(--accent-ink, #fff);
  }
  .hm-mobile-tabs button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  .hm-grid[data-mobile-pane="original"] .hm-pane-out,
  .hm-grid[data-mobile-pane="humanised"] .hm-pane-in {
    display: none;
  }
  .hm-grid[data-mobile-pane] .hm-pane {
    min-height: min(58dvh, 620px);
  }
  #view-humaniser {
    overflow-x: clip;
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hm-mobile-tabs,
  .hm-mobile-tabs button { scroll-behavior: auto; transition: none !important; }
}
