/* Living Word desk. Scripture is gilt and serif; speech and interface are
   vellum and sans. Sage marks Preview and terracotta marks Live. */

.desk {
  color-scheme: dark;
  --bg: #17120d;
  --glow-gilt: rgb(217 174 95 / 0.08);
  --glow-live: rgb(224 105 74 / 0.06);
  --surface: #201912;
  --surface-2: #2a2118;
  --surface-3: #352a1f;
  --line: #3a2f24;
  --line-strong: #514333;
  --ink: #f3eadb;
  --ink-2: #cdbfab;
  --ink-3: #a5957f;
  --gilt: #ddb265;
  --gilt-wash: rgb(221 178 101 / 0.13);
  --gilt-sheen: rgb(255 226 168 / 0.16);
  --live: #e3714f;
  --live-wash: rgb(227 113 79 / 0.15);
  --preview: #9db38f;
  --preview-wash: rgb(157 179 143 / 0.14);
  --primary: #c0532f;
  --primary-hover: #cf6039;
  --on-primary: #fff7ec;
  --stop: #f3eadb;
  --on-stop: #1f1811;
  --screen: #2d2418;
  --screen-ink: #faf7f2;
  --screen-gilt: #d4a853;
  --toast: #31271d;
  --toast-ink: #f3eadb;
  --toast-ink-2: #cdbfab;
  --toast-shadow: 0 24px 48px -16px rgb(0 0 0 / 0.6);
  --scrim: rgb(10 7 4 / 0.6);
  --page-hi: #ecdfc6;
  --page-lo: #d5c3a2;
  --page-line: rgb(90 64 34 / 0.3);
  --page-shade: rgb(60 40 18 / 0.34);
  --page-edge: #a38c66;
  --shadow-3d: rgb(0 0 0 / 0.6);
  --card-face: #352b20;
  --card-rim: rgb(255 255 255 / 0.07);
  --card-edge: #1d160f;
  --card-line: #56483a;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --mask-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --mask-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E");
  --mask-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 7.5v.01'/%3E%3C/svg%3E");
  --mask-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='2' width='8' height='13' rx='4'/%3E%3Cpath d='M5 10v2a7 7 0 0 0 14 0v-2M12 19v3m-4 0h8'/%3E%3C/svg%3E");
  --mask-display: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='13' rx='2'/%3E%3Cpath d='M12 16v5m-4 0h8M8 8h8m-3-3 3 3-3 3'/%3E%3C/svg%3E");
  --mask-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 6 12 12M6 18 18 6'/%3E%3C/svg%3E");

  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 8% -12%, var(--glow-gilt), transparent 64%),
    radial-gradient(
      900px 480px at 100% 112%,
      var(--glow-live),
      transparent 62%
    ),
    var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
}

:root[data-theme="light"] .desk {
  color-scheme: light;
  --bg: #f3ede3;
  --glow-gilt: rgb(196 145 52 / 0.1);
  --glow-live: rgb(196 93 62 / 0.07);
  --surface: #fffcf7;
  --surface-2: #f7f1e7;
  --surface-3: #efe6d8;
  --line: #e4d9c9;
  --line-strong: #cdbfab;
  --ink: #2d2418;
  --ink-2: #554839;
  --ink-3: #75685a;
  --gilt: #8a6418;
  --gilt-wash: rgb(176 128 36 / 0.13);
  --gilt-sheen: rgb(255 214 140 / 0.42);
  --live: #b4502f;
  --live-wash: rgb(196 93 62 / 0.12);
  --preview: #4d6a43;
  --preview-wash: rgb(111 130 102 / 0.16);
  --primary: #b4502f;
  --primary-hover: #a3462a;
  --stop: #2d2418;
  --on-stop: #faf7f2;
  --toast: #2d2418;
  --toast-ink: #faf7f2;
  --toast-ink-2: #d6cab9;
  --toast-shadow: 0 24px 48px -18px rgb(45 36 24 / 0.45);
  --scrim: rgb(45 36 24 / 0.32);
  --page-hi: #fffdf8;
  --page-lo: #f0e4cf;
  --page-line: rgb(90 64 34 / 0.2);
  --page-shade: rgb(90 64 34 / 0.16);
  --page-edge: #d6c4a6;
  --shadow-3d: rgb(70 50 25 / 0.3);
  --card-face: #fffdf8;
  --card-rim: rgb(45 36 24 / 0.1);
  --card-edge: #d9ccb8;
  --card-line: #e6dccd;
}

.desk :focus-visible {
  outline: 2px solid var(--gilt);
  outline-offset: 2px;
}

.desk button:disabled {
  cursor: default;
}

.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.desk kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font: 500 11px/1 var(--sans);
}

/* Header */

.desk-header {
  height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.desk-brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
}

.desk-brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.desk-wordmark {
  font: 500 22px/1 var(--display);
  letter-spacing: -0.03em;
}

.desk-product {
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.activity {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.activity time {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.activity-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background 0.3s;
}

.desk[data-preparing="true"] .activity-dot {
  background: var(--gilt);
  animation: blink 1s ease-in-out infinite;
}

.desk[data-recording="true"] .activity-dot {
  background: var(--live);
}

.desk[data-recording="true"] .activity-dot::after,
.monitor[data-state="live"] .tally::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ripple 1.8s var(--ease-out) infinite;
}

.desk[data-recording="true"] .activity {
  background: color-mix(in oklab, var(--live) 16%, var(--surface));
  border-color: color-mix(in oklab, var(--live) 50%, var(--line));
  color: var(--ink);
}

.activity-meter {
  display: none;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.activity-meter i {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--live);
  transform: scaleY(0.3);
}

.desk[data-recording="true"] .activity-meter {
  display: flex;
}

.activity-search {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 0;
  margin-left: -10px;
  overflow: hidden;
  opacity: 0;
  transition:
    width 0.3s var(--ease-out) 0.6s,
    margin 0.3s var(--ease-out) 0.6s,
    opacity 0.2s 0.6s;
}

.activity-search i {
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gilt);
}

.activity.searching .activity-search {
  width: 18px;
  margin-left: 0;
  opacity: 1;
  transition-delay: 0s;
}

.activity.searching .activity-search i {
  animation: hop 1s ease-in-out infinite;
}

.activity.searching .activity-search i:nth-child(2) {
  animation-delay: 0.15s;
}

.activity.searching .activity-search i:nth-child(3) {
  animation-delay: 0.3s;
}

.desk-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

.quiet-link {
  margin-right: 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.quiet-link:hover {
  color: var(--ink);
}

.theme-moon,
:root[data-theme="light"] .theme-sun {
  display: none;
}

:root[data-theme="light"] .theme-moon {
  display: block;
}

/* Controls */

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-3);
  transition:
    background 0.15s,
    color 0.15s;
}

.icon-button:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-button:disabled {
  opacity: 0.35;
}

.icon-button.compact {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.2s var(--ease-spring);
}

.primary-button svg,
.secondary-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.primary-button {
  background: var(--primary);
  color: var(--on-primary);
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: scale(0.96);
}

.primary-button kbd {
  background: rgb(255 255 255 / 0.16);
  border-color: transparent;
  color: inherit;
}

.desk .primary-button:disabled {
  opacity: 1;
  background: var(--surface-2);
  color: var(--ink-3);
}

.primary-button:disabled kbd {
  display: none;
}

.secondary-button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  background: var(--surface-3);
}

.secondary-button kbd {
  margin-right: -6px;
}

.secondary-button.compact,
.primary-button.compact {
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.text-button {
  padding: 6px 2px;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.text-button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button.danger {
  color: var(--live);
}

/* Desk layout */

.desk-grid {
  height: calc(100dvh - 64px);
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(
      270px,
      340px
    );
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "listen monitors feed"
    "listen reader feed";
  gap: 16px 24px;
  padding: 0 24px 24px;
}

.listen {
  grid-area: listen;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.monitors {
  grid-area: monitors;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reader {
  grid-area: reader;
}

.feed {
  grid-area: feed;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin-bottom: 4px;
}

.column-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.column-meta {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Empty states and illustrations */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.empty-title {
  max-width: 26ch;
  margin: 0 0 6px;
  color: var(--ink);
  font: 500 17px/1.35 var(--display);
  letter-spacing: -0.01em;
}

.empty-text {
  max-width: 36ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
}

/* Illustrations are small 3D scenes built from CSS planes. They move only
   with transform and opacity, so they stay on the compositor. */

.scene {
  position: relative;
  width: 184px;
  height: 132px;
  margin-bottom: 14px;
  perspective: 520px;
  perspective-origin: 50% 30%;
  transition: transform 0.6s var(--ease-spring);
}

.empty-state:hover .scene {
  transform: translateY(-4px) scale(1.04);
}

.stage {
  position: absolute;
  inset: 0;
  transform: rotateX(56deg) rotateZ(-10deg);
  transform-style: preserve-3d;
  animation: orbit 12s ease-in-out infinite;
}

.stage > *,
.page3d {
  position: absolute;
  transform-style: preserve-3d;
}

.floor-shadow {
  inset: 14px 10px 6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--shadow-3d), transparent);
  transform: translateZ(-2px);
}

.book3d {
  top: 23px;
  left: 26px;
  width: 132px;
  height: 86px;
  transform: translateZ(6px);
}

.page3d {
  top: 0;
  width: 66px;
  height: 86px;
}

.page-left,
.page-face.back {
  border-radius: 7px 2px 2px 7px;
  background:
    linear-gradient(to left, var(--page-shade), transparent 40%),
    repeating-linear-gradient(
        to bottom,
        transparent 0 8px,
        var(--page-line) 8px 9.5px
      )
      10px 13px / 44px 60px no-repeat,
    linear-gradient(var(--page-hi), var(--page-lo));
}

.page-right,
.page-face {
  border-radius: 2px 7px 7px 2px;
  background:
    linear-gradient(to right, var(--page-shade), transparent 40%),
    repeating-linear-gradient(
        to bottom,
        transparent 0 8px,
        var(--page-line) 8px 9.5px
      )
      12px 13px / 44px 60px no-repeat,
    linear-gradient(var(--page-hi), var(--page-lo));
}

.page-left {
  left: 0;
  transform: rotateY(18deg);
  transform-origin: right center;
}

.page-right {
  left: 66px;
  transform: rotateY(-18deg);
  transform-origin: left center;
}

.page-left::before,
.page-right::before,
.card3d::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--page-edge);
  transform: translateZ(-4px);
}

.page-turn {
  left: 66px;
  transform-origin: left center;
  animation: page-turn 5.6s cubic-bezier(0.45, 0.05, 0.3, 1) infinite;
}

.page-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  animation: page-fade 5.6s linear infinite;
}

.page-face.back {
  transform: rotateY(180deg);
}

.ring {
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  border: 1.5px solid var(--gilt);
  opacity: 0;
  animation: ring-rise 3.6s var(--ease-out) infinite;
}

.ring + .ring {
  animation-delay: 1.2s;
}

.ring + .ring + .ring {
  animation-delay: 2.4s;
}

.desk[data-preparing="true"] .ring,
.desk[data-recording="true"] .ring {
  border-width: 2px;
  animation-duration: 2.1s;
}

.mote {
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gilt);
  opacity: 0;
  animation: mote-rise 4.8s ease-in infinite;
}

.mote + .mote {
  left: 36%;
  animation-delay: 1.6s;
}

.mote + .mote + .mote {
  left: 66%;
  animation-delay: 3.2s;
}

.lens,
.lens-shadow {
  top: 24px;
  left: 96px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.lens {
  border: 3px solid var(--gilt);
  background: radial-gradient(
    circle at 32% 28%,
    rgb(255 255 255 / 0.8) 0 9%,
    rgb(255 250 235 / 0.3) 32%,
    rgb(255 238 205 / 0.16) 62%,
    rgb(221 178 101 / 0.3)
  );
  animation: lens-glide 7s ease-in-out infinite;
}

.lens::after {
  content: "";
  position: absolute;
  top: 36px;
  left: 34px;
  width: 26px;
  height: 7px;
  border-radius: 4px;
  background: var(--gilt);
  transform: rotate(45deg);
  transform-origin: left center;
}

.lens-shadow {
  background: radial-gradient(closest-side, var(--shadow-3d), transparent);
  animation: lens-shadow 7s ease-in-out infinite;
}

.scene-tickets .stage {
  animation-name: orbit-steep;
}

.card3d {
  --bar: var(--card-line);
  top: 34px;
  left: 38px;
  width: 108px;
  height: 64px;
  border-radius: 12px;
  background:
    linear-gradient(var(--bar), var(--bar)) 12px 13px / 44px 6px no-repeat,
    linear-gradient(var(--card-line), var(--card-line)) 12px 30px / 80px 4px
      no-repeat,
    linear-gradient(var(--card-line), var(--card-line)) 12px 41px / 56px 4px
      no-repeat,
    var(--card-face);
  box-shadow: inset 0 0 0 1px var(--card-rim);
  transform: translateZ(4px);
}

.card3d::before {
  background: var(--card-edge);
  transform: translateZ(-3px);
}

.card3d + .card3d {
  transform: translate3d(-5px, -5px, 20px);
  animation: card-breathe 4.2s ease-in-out 0.2s infinite;
}

.card3d + .card3d + .card3d {
  --bar: var(--gilt);
  transform: translate3d(-10px, -10px, 36px);
  animation: card-float 4.2s ease-in-out infinite;
}

.spark {
  position: absolute;
  top: 12px;
  right: 26px;
  width: 14px;
  height: 14px;
  background: var(--gilt);
  clip-path: polygon(
    50% 0,
    61% 39%,
    100% 50%,
    61% 61%,
    50% 100%,
    39% 61%,
    0 50%,
    39% 39%
  );
  animation: twinkle 3.2s ease-in-out infinite;
}

.spark + .spark {
  top: 40px;
  right: 14px;
  width: 9px;
  height: 9px;
  animation-delay: 1.4s;
}

/* Transcript */

.transcript-frame {
  position: relative;
  flex: 1;
  min-height: 0;
}

.transcript {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 40px 8px 16px 0;
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent, #000 72px);
}

.transcript::-webkit-scrollbar {
  display: none;
}

.transcript .segment {
  transition: color 1.6s ease;
  animation: illuminate 1.4s ease-out;
}

.transcript .segment:nth-last-child(-n + 4) {
  color: var(--ink-2);
}

.transcript .segment:nth-last-child(2) {
  color: var(--ink);
}

.transcript-partial {
  color: var(--ink-3);
}

.desk[data-recording="true"] .transcript-partial::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.16em;
  border-radius: 1px;
  background: var(--gilt);
  animation: blink 1.1s steps(2, jump-none) infinite;
}

.transcript-empty {
  position: absolute;
  inset: 0;
}

.transcript-frame:has(.transcript-empty:not([hidden]))
  .transcript-partial::after {
  display: none;
}

/* Record control */

.record-dock {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 0 2px;
  border-top: 1px solid var(--line);
}

.record-dock::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--live), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}

.desk[data-recording="true"] .record-dock::before {
  animation: breathe 2.4s ease-in-out infinite;
}

.mic-picker {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 260px;
}

.mic-picker svg {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  stroke-width: 1.8;
  pointer-events: none;
}

.mic-picker select {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 34px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a8b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E")
    right 11px center / 14px no-repeat;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: none;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.mic-picker select:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--ink);
}

.mic-picker select:disabled {
  opacity: 0.6;
  cursor: default;
}

.mic-hint {
  max-width: 260px;
  margin: -6px 0 0;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 34px;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 22%,
    #000 78%,
    transparent
  );
}

.waveform span {
  flex: none;
  width: 3px;
  height: 34px;
  border-radius: 2px;
  background: var(--line-strong);
  transform: scaleY(0.1);
  transition: background 0.4s;
}

.desk[data-recording="true"] .waveform span {
  background: var(--live);
}

.desk[data-preparing="true"] .waveform span {
  background: var(--gilt);
}

.record-wrap {
  position: relative;
  width: 100%;
  max-width: 260px;
}

.record-glow {
  position: absolute;
  inset: 4px 18px;
  z-index: -1;
  border-radius: 999px;
  background: var(--live);
  filter: blur(18px);
  opacity: 0;
  transform: scale(calc(1 + var(--level, 0) * 0.16));
  transition: opacity 0.4s;
  will-change: transform;
}

.desk[data-recording="true"] .record-glow {
  opacity: calc(0.22 + var(--level, 0) * 0.5);
  transition: none;
}

.record-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 15px;
  font-weight: 600;
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.25s var(--ease-spring);
}

.record-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.record-button:active:not(:disabled) {
  transform: scale(0.97);
}

.record-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.stop-icon,
.record-spinner {
  display: none;
}

.stop-icon {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: currentColor;
}

.record-spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.record-button[aria-pressed="true"],
.record-button[aria-pressed="true"]:hover {
  background: var(--stop);
  color: var(--on-stop);
}

.record-button[aria-pressed="true"] .mic-icon {
  display: none;
}

.record-button[aria-pressed="true"] .stop-icon {
  display: block;
}

.desk[data-preparing="true"] .record-button .stop-icon {
  display: none;
}

.desk[data-preparing="true"] .record-button .record-spinner {
  display: block;
}

.record-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

/* Monitors */

.monitor {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.4s;
}

.monitor::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    90% 70% at 50% 0%,
    var(--live-wash),
    transparent 72%
  );
  opacity: 0;
  transition: opacity 0.6s;
  pointer-events: none;
}

.monitor[data-state="live"] {
  border-color: color-mix(in oklab, var(--live) 45%, var(--line));
}

.monitor[data-state="live"]::before {
  opacity: 1;
}

#preview-monitor[data-state="ready"] {
  border-color: color-mix(in oklab, var(--preview) 35%, var(--line));
}

.monitor-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 4px;
}

.monitor-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.monitor-meta {
  margin-left: auto;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor[data-state="live"] .monitor-meta {
  color: var(--live);
  font-weight: 600;
}

.tally {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.3s;
}

#preview-monitor[data-state="ready"] .tally {
  background: var(--preview);
}

.monitor[data-state="live"] .tally {
  background: var(--live);
}

.monitor[data-state="blank"] .tally {
  background: var(--gilt);
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: var(--screen);
  container-type: inline-size;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    120% 95% at 50% 42%,
    transparent 58%,
    rgb(0 0 0 / 0.3)
  );
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.05);
  pointer-events: none;
}

.screen-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.9cqw 9cqw;
  color: var(--screen-ink);
  text-align: center;
  transition: opacity 0.35s;
}

.screen-reference {
  margin: 0 0 2.2cqw;
  color: var(--screen-gilt);
  font: 500 3.55cqw/1.15 var(--display);
  letter-spacing: -0.02em;
}

.screen-reference .version {
  margin-left: 0.6em;
  color: rgb(250 247 242 / 0.5);
  font: 600 0.4em/1 var(--sans);
  letter-spacing: 0.06em;
  vertical-align: 0.4em;
}

.screen-text {
  max-height: 68%;
  overflow: hidden;
  font: 400 3.1cqw/1.5 var(--sans);
}

.screen-text p {
  margin: 0 0 1em;
}

.screen-text p:last-child {
  margin-bottom: 0;
}

.screen-text sup {
  margin-right: 0.5cqw;
  color: #bcae99;
  font-size: 0.4em;
}

.screen-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 14%;
  color: rgb(250 247 242 / 0.6);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

.monitor[data-state="blank"] .screen-content {
  opacity: 0.16;
}

.monitor[data-state="blank"] .screen::before {
  content: "Display blanked";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgb(250 247 242 / 0.75);
  font-size: 12px;
  font-weight: 600;
}

.take-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 28%,
    rgb(255 222 160 / 0.42) 50%,
    transparent 72%
  );
  mix-blend-mode: screen;
  transform: translateX(-110%);
  pointer-events: none;
}

.monitor-foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 36px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  color: var(--ink-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pager span {
  min-width: 46px;
  text-align: center;
}

#blank-display[aria-pressed="true"] {
  background: var(--gilt-wash);
  border-color: color-mix(in oklab, var(--gilt) 40%, var(--line));
  color: var(--gilt);
}

/* Reader */

.reader {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.reader-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 44px 0 42px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input::-webkit-search-cancel-button {
  appearance: none;
}

.desk .search input:focus-visible {
  outline: none;
  background: var(--bg);
  border-color: var(--gilt);
  box-shadow: 0 0 0 4px var(--gilt-wash);
}

.search-key,
.search-spinner {
  position: absolute;
  right: 12px;
  transition: opacity 0.15s;
}

.search input:focus ~ .search-key,
.search input:not(:placeholder-shown) ~ .search-key,
.search.busy .search-key {
  opacity: 0;
}

.search-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gilt-wash);
  border-top-color: var(--gilt);
  opacity: 0;
}

.search.busy .search-spinner {
  opacity: 1;
  animation: spin 0.8s linear infinite;
}

.reader-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.version-select {
  height: 30px;
  padding: 0 26px 0 10px;
  border-radius: 10px;
  background: var(--surface-2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a8b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E")
    right 7px center / 14px no-repeat;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  appearance: none;
  cursor: pointer;
}

.version-select:hover {
  color: var(--ink);
}

#reader-title {
  min-width: 7ch;
  margin: 0 6px;
  color: var(--ink);
  font: 500 19px/1 var(--display);
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
}

.reader-verses {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  mask-image: linear-gradient(to bottom, transparent, #000 18px);
}

.verse-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 68ch);
  gap: 8px;
  width: 100%;
  padding: 9px 14px 9px 6px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font: 500 16px/1.65 var(--display);
  text-align: left;
  transition:
    background 0.15s,
    color 0.15s;
}

.verse-row:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.verse-number {
  padding-top: 0.42em;
  color: var(--ink-3);
  font: 600 12px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.verse-row.in-preview {
  background: var(--preview-wash);
  color: var(--ink);
}

.verse-row.in-preview:has(+ .verse-row.in-preview) {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.verse-row.in-preview + .verse-row.in-preview {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.verse-row.in-preview .verse-number {
  color: var(--preview);
}

.verse-row.on-live .verse-number {
  color: var(--live);
}

.verse-row.on-live .verse-number::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 6px 1px 0;
  border-radius: 50%;
  background: var(--live);
}

.reader-empty {
  flex: 1;
}

.example-link {
  padding: 0;
  background: none;
  color: var(--gilt);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--gilt) 45%, transparent);
  text-underline-offset: 3px;
}

.example-link:hover {
  text-decoration-color: currentColor;
}

/* Detected passages */

.feed-searching {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--gilt);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s 0.6s;
}

.feed-searching i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.feed-searching.active {
  opacity: 1;
  transition-delay: 0s;
}

.feed-searching.active i {
  animation: blink 1.2s ease-in-out infinite;
}

.feed-empty {
  flex: 1;
  margin-top: 4px;
  border-radius: 20px;
  border: 1px dashed var(--line-strong);
}

.tickets {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 -4px;
  padding: 4px 4px 16px;
  overflow-y: auto;
  scrollbar-width: none;
}

.tickets::-webkit-scrollbar {
  display: none;
}

.ticket {
  position: relative;
  flex: none;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    background 0.15s,
    border-color 0.3s;
}

.ticket:hover {
  background: var(--surface-2);
}

.ticket[data-state="preview"] {
  border-color: color-mix(in oklab, var(--preview) 50%, var(--line));
}

.ticket[data-state="live"] {
  border-color: color-mix(in oklab, var(--live) 55%, var(--line));
}

.ticket-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 14px 52px 12px 16px;
  border-radius: inherit;
  background: none;
  text-align: left;
}

.ticket-reference {
  color: var(--gilt);
  font: 500 18px/1.25 var(--display);
  letter-spacing: -0.01em;
}

.ticket-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 12px;
}

.ticket-meta svg {
  width: 14px;
  height: 14px;
  color: var(--preview);
  stroke-width: 2;
}

.ticket-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.ticket-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.ticket[data-state="preview"] .ticket-state {
  color: var(--preview);
}

.ticket[data-state="live"] .ticket-state {
  color: var(--live);
}

.ticket-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.ticket-live {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink-2);
  opacity: 0;
  transform: translateX(4px);
  transition:
    opacity 0.15s,
    transform 0.2s var(--ease-out),
    background 0.15s,
    color 0.15s;
}

.ticket-live svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.ticket:hover .ticket-live,
.ticket:focus-within .ticket-live {
  opacity: 1;
  transform: none;
}

.ticket-live:hover {
  background: var(--primary);
  color: var(--on-primary);
}

.ticket.is-new::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    var(--gilt-sheen) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: sheen 1.2s 0.12s var(--ease-out) both;
  pointer-events: none;
}

.other-matches {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.other-matches p {
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 12px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Toasts */

.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  overflow: hidden;
  padding: 14px 10px 16px 14px;
  border-radius: 18px;
  background: var(--toast);
  color: var(--toast-ink);
  box-shadow: var(--toast-shadow);
  pointer-events: auto;
  animation: toast-in 0.5s var(--ease-spring);
}

.toast.leaving {
  animation: toast-out 0.24s ease-in forwards;
}

.toast-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.07);
  color: var(--toast-ink-2);
}

.toast-icon::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: var(--mask-info) center / contain no-repeat;
}

.toast[data-tone="success"] .toast-icon {
  color: #a8c49a;
}

.toast[data-tone="success"] .toast-icon::before {
  mask-image: var(--mask-check);
}

.toast[data-tone="error"] .toast-icon {
  color: #f08a68;
}

.toast[data-tone="error"] .toast-icon::before {
  mask-image: var(--mask-alert);
}

.toast[data-art="display"] .toast-icon::before {
  mask-image: var(--mask-display);
}

.toast[data-tone="progress"] .toast-icon {
  color: #e7bf74;
}

.toast[data-tone="progress"] .toast-icon::before {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  background: none;
  mask: none;
  animation: spin 0.8s linear infinite;
}

.toast[data-tone="progress"][data-art="speech"] .toast-icon::before {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  mask: var(--mask-mic) center / contain no-repeat;
  animation: none;
}

.toast[data-tone="progress"][data-art="speech"] .toast-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px currentColor;
  animation: ripple-soft 1.6s var(--ease-out) infinite;
}

.toast-title {
  margin: 1px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.toast-message {
  margin: 3px 0 0;
  color: var(--toast-ink-2);
  font-size: 13px;
  line-height: 1.5;
}

.toast-message:empty {
  display: none;
}

.toast-action {
  margin-top: 10px;
}

.desk .toast .secondary-button {
  background: rgb(255 255 255 / 0.1);
  border-color: transparent;
  color: var(--toast-ink);
}

.toast-close {
  color: var(--toast-ink-2);
}

.desk .toast-close:hover {
  background: rgb(255 255 255 / 0.08);
  color: var(--toast-ink);
}

.toast-close::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: var(--mask-close) center / contain no-repeat;
}

.toast-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  transform-origin: left;
}

.toast[data-tone="progress"] .toast-bar {
  background: linear-gradient(90deg, transparent, #e7bf74, transparent);
  animation: indeterminate 1.5s ease-in-out infinite;
}

.toast[data-tone="success"] .toast-bar,
.toast[data-tone="info"] .toast-bar {
  background: rgb(255 255 255 / 0.18);
  animation: countdown 5s linear forwards;
}

.toast[data-progress="set"] .toast-bar {
  background: #e7bf74;
  animation: none;
  transition: transform 0.3s var(--ease-out);
}

.toast:hover .toast-bar {
  animation-play-state: paused;
}

/* Settings */

.settings {
  width: min(460px, calc(100vw - 32px));
  max-height: 86dvh;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--toast-shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 0.22s,
    transform 0.32s var(--ease-out),
    overlay 0.32s allow-discrete,
    display 0.32s allow-discrete;
}

.settings[open] {
  opacity: 1;
  transform: none;
}

@starting-style {
  .settings[open] {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.settings::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition:
    opacity 0.25s,
    overlay 0.3s allow-discrete,
    display 0.3s allow-discrete;
}

.settings[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .settings[open]::backdrop {
    opacity: 0;
  }
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 20px 20px 12px 26px;
}

.settings-head h2 {
  margin: 0;
  font: 500 22px/1.2 var(--display);
  letter-spacing: -0.02em;
}

.settings-section {
  padding: 18px 26px;
  border-top: 1px solid var(--line);
}

.settings-label {
  display: block;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.settings-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}

.settings-line .settings-label {
  margin: 0;
}

.settings .settings-line select {
  width: auto;
  min-width: 210px;
}

.settings-value {
  color: var(--ink-2);
  font-size: 13px;
  text-align: right;
}

#jev-connection {
  margin-top: 18px;
}

.settings select,
.settings input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}

.settings-note {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.settings-section > .settings-row:first-of-type:not(:first-child) {
  margin-top: 0;
}

.disclosure summary {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.disclosure[open] summary {
  margin-bottom: 16px;
}

/* Motion */

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@keyframes hop {
  0%,
  100% {
    transform: translateY(1px);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes ripple {
  from {
    transform: scale(1);
    opacity: 0.55;
  }
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

@keyframes ripple-soft {
  from {
    transform: scale(0.9);
    opacity: 0.6;
  }
  to {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes orbit {
  0%,
  100% {
    transform: rotateX(56deg) rotateZ(-10deg);
  }
  50% {
    transform: rotateX(47deg) rotateZ(8deg);
  }
}

@keyframes orbit-steep {
  0%,
  100% {
    transform: rotateX(58deg) rotateZ(-40deg);
  }
  50% {
    transform: rotateX(50deg) rotateZ(-24deg);
  }
}

@keyframes page-turn {
  0%,
  20% {
    transform: rotateY(-18deg) translateZ(1px);
  }
  64%,
  100% {
    transform: rotateY(-162deg) translateZ(1px);
  }
}

@keyframes page-fade {
  0%,
  16% {
    opacity: 0;
  }
  22%,
  72% {
    opacity: 1;
  }
  84%,
  100% {
    opacity: 0;
  }
}

@keyframes ring-rise {
  0% {
    transform: translateZ(10px) scale(0.35);
    opacity: 0;
  }
  18% {
    opacity: 0.9;
  }
  100% {
    transform: translateZ(76px) scale(1.55);
    opacity: 0;
  }
}

@keyframes mote-rise {
  0% {
    transform: translate3d(0, 6px, 8px);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate3d(10px, -16px, 98px);
    opacity: 0;
  }
}

@keyframes lens-glide {
  0%,
  100% {
    transform: translate3d(0, 0, 44px);
  }
  25% {
    transform: translate3d(-34px, 18px, 52px);
  }
  50% {
    transform: translate3d(-64px, 6px, 42px);
  }
  75% {
    transform: translate3d(-30px, -8px, 50px);
  }
}

@keyframes lens-shadow {
  0%,
  100% {
    transform: translate3d(10px, 16px, 8px) scale(0.9);
  }
  25% {
    transform: translate3d(-22px, 34px, 8px) scale(1);
  }
  50% {
    transform: translate3d(-54px, 22px, 8px) scale(0.86);
  }
  75% {
    transform: translate3d(-20px, 8px, 8px) scale(0.98);
  }
}

@keyframes card-float {
  0%,
  100% {
    transform: translate3d(-10px, -10px, 36px) rotateZ(0deg);
  }
  50% {
    transform: translate3d(-12px, -12px, 52px) rotateZ(-4deg);
  }
}

@keyframes card-breathe {
  0%,
  100% {
    transform: translate3d(-5px, -5px, 20px);
  }
  50% {
    transform: translate3d(-6px, -6px, 27px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  45% {
    transform: scale(1) rotate(45deg);
    opacity: 1;
  }
  70% {
    transform: scale(0.4) rotate(90deg);
    opacity: 0.4;
  }
}

@keyframes illuminate {
  from {
    color: var(--gilt);
    opacity: 0;
  }
  25% {
    color: var(--gilt);
    opacity: 1;
  }
}

@keyframes sheen {
  to {
    transform: translateX(100%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

@keyframes toast-out-reduced {
  to {
    opacity: 0;
  }
}

@keyframes indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes countdown {
  to {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .desk .toast[data-tone="success"] .toast-bar,
  .desk .toast[data-tone="info"] .toast-bar {
    animation: countdown 5s linear forwards !important;
  }

  .desk .toast.leaving {
    animation: toast-out-reduced 1ms forwards !important;
  }
}

/* Smaller desks: Detected sits beside the stage and the transcript tucks
   under it. Phones stack everything in working order. */

@media (max-width: 1279px) {
  .desk-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    grid-template-rows: auto minmax(0, 1fr) minmax(260px, 0.75fr);
    grid-template-areas:
      "monitors feed"
      "reader feed"
      "reader listen";
  }

  .listen {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .listen .column-head {
    margin-bottom: 0;
  }

  .transcript {
    padding-top: 24px;
    font-size: 16px;
  }

  .transcript-empty .scene,
  .transcript-empty .empty-text {
    display: none;
  }

  .record-dock {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 12px;
  }

  .waveform {
    flex: 1;
    width: auto;
  }

  .mic-picker,
  .mic-hint {
    flex-basis: 100%;
    max-width: none;
  }

  .mic-hint {
    margin: -4px 0 0;
    text-align: left;
  }

  .record-wrap {
    width: 170px;
  }

  .record-button {
    height: 46px;
  }

  .record-hint {
    display: none;
  }
}

@media (max-width: 899px) {
  .desk-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 16px;
  }

  .activity {
    display: none;
  }

  .quiet-link {
    display: none;
  }

  .desk-grid {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas:
      "listen"
      "monitors"
      "feed"
      "reader";
    gap: 20px;
    padding: 0 16px 24px;
  }

  .listen {
    height: 380px;
    padding-top: 0;
    border-top: 0;
  }

  .transcript-empty .scene,
  .transcript-empty .empty-text {
    display: block;
  }

  .feed {
    max-height: 520px;
  }

  .feed-empty {
    min-height: 220px;
  }

  .reader {
    height: 72dvh;
  }

  .search-key {
    display: none;
  }

  .toasts {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 599px) {
  .desk-product {
    display: none;
  }

  .monitors {
    grid-template-columns: minmax(0, 1fr);
  }

  .reader-bar {
    flex-wrap: wrap;
  }

  .search {
    flex-basis: 100%;
    max-width: none;
  }

  .reader-nav {
    margin: 0 auto;
  }

  .monitor-foot kbd {
    display: none;
  }
}

@media (hover: none) {
  .ticket-live {
    opacity: 1;
    transform: none;
  }
}

.lookup-time {
  margin-right: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
}

.possible-match {
  border: 1px solid var(--line, #ddd5c8);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}
.possible-reference {
  font-weight: 600;
  margin: 0 0 8px;
}
.possible-match blockquote {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-muted, #726b60);
}
.possible-match details {
  margin-bottom: 12px;
  font-size: 13px;
}
.possible-match summary {
  cursor: pointer;
}
.possible-text {
  max-height: 200px;
  overflow: auto;
}
.suggestions {
  align-items: stretch;
}

/* Service controls share the desk's ink rules and restrained sage state. */
.service-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 10px;
}
.service-controls button[aria-pressed="true"] {
  color: var(--preview);
  border-color: var(--preview);
}
.service-context,
.connection-status,
.plan-status {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
}
.service-context {
  flex-basis: 100%;
}
.connection-status {
  margin: 0;
  color: var(--gilt);
}
.service-plan {
  flex: none;
  margin-top: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  max-height: 50%;
  overflow: auto;
}
.service-plan summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
}
.service-plan summary span {
  float: right;
  color: var(--ink-3);
}
.main-reading {
  margin-top: 14px;
}
#main-reference {
  font-family: Fraunces, serif;
  color: var(--gilt);
  font-size: 17px;
}
.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.queue-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.queue-form input {
  min-width: 0;
  flex: 1;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  font: inherit;
  font-size: 12px;
}
.reading-queue {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.reading-queue li {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.queue-reference {
  flex: 1;
  text-align: left;
  min-width: 0;
}
.plan-status {
  margin: 8px 0;
}
@media (max-width: 760px) {
  .service-plan {
    max-height: none;
  }
}
