/* Buttons, meters, cards, toasts, sheets. No page chrome — there is no top bar:
 * the page is short enough that a persistent header would be the biggest thing
 * on screen and would say nothing. */

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border-radius: var(--r-pill);
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 620;
  line-height: 1.2;
  border: 2px solid transparent;
  /* Colour moves noticeably slower than the press, so the fill reads as a
     deliberate transition rather than a state flipping from 0 to 1. */
  transition: background-color 260ms var(--ease),
              border-color 260ms var(--ease),
              color 200ms var(--ease),
              transform var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.is-busy { opacity: 0.55; pointer-events: none; }

/* The main action: a pale fill inside a firm outline, which fills in and
   inverts on approach. Loud enough to find, quiet enough to live with. */
.btn-primary {
  background: var(--pink-50);
  border-color: var(--pink-500);
  color: var(--pink-700);
}
@media (hover: hover) {
  .btn-primary:hover {
    background: var(--pink-600);
    border-color: var(--pink-600);
    color: #ffffff;
    transform: translateY(-1px);
  }
}
/* Touch has no hover, so the press does the inverting instead. */
.btn-primary:active {
  background: var(--pink-600);
  border-color: var(--pink-600);
  color: #ffffff;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-soft);
}
@media (hover: hover) {
  .btn-outline:hover { border-color: var(--ink-400); color: var(--text); transform: translateY(-1px); }
}

.btn-text {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 550;
  padding: 6px 4px;
  border-radius: 8px;
}
@media (hover: hover) { .btn-text:hover { color: var(--accent); } }

.btn-lg { padding: 13px 38px; font-size: 16.5px; }
.btn-block { width: 100%; }

/* A small persistent sound control, separate from page chrome. It stays under
   sheets so an open dialog remains the only active surface. */
.audio-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 60;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1;
  transition: color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.audio-toggle:active { transform: scale(0.96); }
.audio-toggle.is-muted { color: var(--text-faint); background: rgba(255, 255, 255, 0.72); }
@media (hover: hover) {
  .audio-toggle:hover { border-color: var(--accent-line); background: var(--surface); }
}
.audio-panel {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 61;
  width: min(276px, calc(100vw - 24px));
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: audio-panel-in 180ms var(--ease-out) both;
}
@keyframes audio-panel-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.audio-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.audio-panel-head strong { font-size: 14px; font-weight: 680; }
.audio-panel-head output { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.audio-volume-row { display: flex; align-items: center; gap: var(--s-3); color: var(--accent); }
.audio-volume-row input {
  width: 100%;
  min-width: 0;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.audio-mute {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 620;
}
@media (hover: hover) { .audio-mute:hover { border-color: var(--accent-line); color: var(--accent); } }

/* ------------------------------------------------------------------ meters */
.meter { height: 4px; border-radius: var(--r-pill); background: var(--ink-100); overflow: hidden; }
.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--brand-gradient);
  transition: width var(--t-slow) var(--ease-out);
}
.meter-fill.is-indeterminate {
  width: 35% !important;
  animation: meter-sweep 1.4s var(--ease) infinite;
}
@keyframes meter-sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}
.meter-lg { height: 5px; }

/* ------------------------------------------------------------------ avatar */
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-sunken); flex: 0 0 auto; }
.avatar-36 { width: 36px; height: 36px; }
.avatar-48 { width: 48px; height: 48px; }

/* ------------------------------------------------------------------ banner */
/* News that must not be missed lands at the top of the screen, where the eye
 * already is, rather than at the bottom with the incidental confirmations. */
.banner-host {
  position: fixed;
  left: 50%;
  /* Floating clear of the top edge rather than glued to it: a notice pinned to
     the very top reads as page chrome and gets skipped. */
  top: clamp(76px, 15vh, 168px);
  transform: translateX(-50%);
  z-index: 85;
  width: min(92vw, 380px);
  pointer-events: none;
}
.banner {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-text);
  box-shadow: var(--shadow-md);
  animation: banner-in 420ms var(--ease-spring) both;
}
.banner.is-leaving { animation: banner-out 220ms var(--ease) both; }
.banner .icon { margin-top: 1px; flex: 0 0 auto; }
.banner b { display: block; font-size: 13.5px; font-weight: 660; }
.banner span { font-size: 13px; line-height: 1.55; }
@keyframes banner-in {
  from { opacity: 0; transform: translate3d(0, -14px, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes banner-out {
  to { opacity: 0; transform: translate3d(0, -10px, 0); }
}

/* ------------------------------------------------------------------- toast */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s-6));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: var(--s-2);
  width: max-content;
  max-width: min(90vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--ink-900);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 550;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--t-base) var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out var(--t-fast) var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* --------------------------------------------------------------- overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  background: rgba(52, 22, 34, 0.34);
  backdrop-filter: blur(5px);
  animation: overlay-in var(--t-base) var(--ease) both;
}
.overlay.is-leaving { animation: overlay-out var(--t-fast) var(--ease) both; pointer-events: none; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { to { opacity: 0; } }

.sheet {
  position: relative;
  width: min(100%, 380px);
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-7) var(--s-6) var(--s-6);
  animation: sheet-in var(--t-slow) var(--ease-out) both;
  max-height: calc(100dvh - var(--s-8));
  overflow-y: auto;
}
.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sheet-close:hover { background: var(--surface-muted); color: var(--text); }
.sheet-close.is-delayed {
  opacity: 0;
  transform: scale(0.78);
  pointer-events: none;
  transition: opacity 2000ms var(--ease-out), transform 2000ms var(--ease-out),
              background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sheet-close.is-delayed.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ evidence card */
.ev {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  animation: ev-in 480ms var(--ease-out) both;
}
@keyframes ev-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.ev-head { display: flex; align-items: center; gap: var(--s-3); }
.ev-head .icon { color: var(--accent); }
.ev-title { font-size: 14.5px; font-weight: 640; }
.ev-badge {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 620;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.ev-summary { margin-top: var(--s-2); font-size: 12.5px; color: var(--text-muted); }
.ev-hero {
  margin-top: var(--s-3);
  width: 72px; height: 72px;
  border-radius: var(--r-md);
  object-fit: cover;
}
.ev-items { margin-top: var(--s-2); }
.ev-item { display: flex; gap: var(--s-3); align-items: center; padding: 8px 0; min-width: 0; }
.ev-item + .ev-item { border-top: 1px solid var(--border); }
.ev-item.is-link:hover .ev-item-title { color: var(--accent); }
.ev-thumb { width: 42px; height: 28px; border-radius: 5px; object-fit: cover; background: var(--surface-sunken); flex: 0 0 auto; }
.ev-item-body { min-width: 0; flex: 1 1 auto; }
.ev-item-title { font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.ev-item-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; word-break: break-word; }
.ev-kv { display: grid; grid-template-columns: minmax(52px, auto) 1fr; gap: var(--s-3); align-items: baseline; width: 100%; }
.ev-kv dt { font-size: 12.5px; color: var(--text-faint); }
.ev-kv dd { font-size: 13.5px; font-weight: 550; word-break: break-word; }
.ev-more {
  margin-top: var(--s-2);
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------------------------------------- skeletons */
/* Placeholders for content that is on its way. Without them the two-column run
 * screen opens with an empty right half and reads as a broken layout rather
 * than as "cards are coming". One sweep per card, not per bar. */
.sk { background: var(--ink-100); border-radius: 5px; }
.is-skeleton { position: relative; overflow: hidden; pointer-events: none; }
.is-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.85) 50%, transparent 80%);
  transform: translate3d(-100%, 0, 0);
  animation: shimmer 1.7s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translate3d(100%, 0, 0); } }

.sk-icon { width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto; }
.sk-title { height: 12px; width: 92px; }
.sk-line { height: 11px; margin: 13px 0; }
.sk-bar { height: 13px; }
.sk-button { height: 44px; border-radius: var(--r-pill); width: 100%; }

#poster-canvas { position: fixed; left: -10000px; top: 0; }
