/* Center Javis on the open floor. The shell has no plate. The transcript
   is a bare column at the bottom left. */

#talk {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  color: var(--ink);
}

.talk-center {
  --reactor: min(100vw, 80vh, 640px);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Turnstile only shows when it needs a click. .talk-center passes clicks
   through, so the box gets its own centered layer above the whole shell. */
#turnstile-live,
#turnstile-widget {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: auto;
}







.talk-reactor {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  width: var(--reactor);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.talk-orb-canvas,
.talk-orb-gl {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The logo sits under the Javis orb and over the graph (#stage): an opaque disc, so the
   graph never shows through, with the photo at 30% on it. Spins with the orb. */
.talk-logo {
  position: absolute;
  z-index: 0;
  width: 34%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #05060c;
  pointer-events: none;
  animation: talk-logo-spin 6s linear infinite;
}
.talk-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .3;
}

@keyframes talk-logo-spin {
  to { rotate: 360deg; }
}

.talk-mic {
  position: relative;
  z-index: 2;
  width: 15%;
  height: 15%;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: rgba(215, 243, 250, .78);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  touch-action: none;
  pointer-events: auto;
}

.talk-mic svg { display: none; fill: currentColor; width: 36%; height: 36%; }
.talk-mic[data-icon="mic"] .i-mic,
.talk-mic[data-icon="brain"] .i-brain,
.talk-mic[data-icon="speaker"] .i-speaker { display: block; }
.talk-mic .i-brain,
.talk-mic .i-speaker {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.talk-mic.recording {
  color: #fff;
  background: rgba(45, 212, 240, .22);
  border-color: rgba(45, 212, 240, .35);
}
.talk-mic[data-icon="brain"] { color: #ffcb6b; border-color: rgba(255, 203, 107, .6); }

.talk-name {
  position: absolute;
  left: 50%;
  top: 65%;
  z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  pointer-events: none;
}

.talk-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 11px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(45, 219, 240, .16), rgba(4, 8, 14, .72) 70%);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font: 12px/1 var(--mono);
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  animation: control-breathe 3.2s ease-in-out infinite;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.talk-control:nth-child(2) { animation-delay: .4s; }
.talk-control-label { position: relative; }
.talk-voice-settings .talk-control { animation-delay: .8s; }
.talk-control::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(215, 243, 250, .35) 50%, transparent 65%);
  content: "";
  pointer-events: none;
  transform: translateX(-110%);
}
.talk-control svg { position: relative; flex: none; width: 18px; height: 18px; fill: none; stroke: var(--cy); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.talk-control svg.is-hidden { display: none; }
.talk-control:hover,
.talk-control:focus-visible {
  border-color: var(--cy);
  background: linear-gradient(135deg, rgba(45, 219, 240, .3), rgba(4, 8, 14, .6) 75%);
  color: #fff;
  transform: translateY(-1px);
}
.talk-control:hover::before,
.talk-control:focus-visible::before { transform: translateX(110%); transition: transform .7s ease; }
.talk-control:hover svg,
.talk-control:focus-visible svg { transform: scale(1.12); }
.talk-voice-settings .talk-control:hover svg,
.talk-voice-settings .talk-control:focus-visible svg { transform: scale(1.12) rotate(60deg); }
.talk-control:active { transform: scale(.97); }
.talk-control[aria-pressed="true"],
.talk-voice-settings[open] > .talk-control {
  border-color: var(--cy);
  background: rgba(45, 219, 240, .26);
  color: #fff;
  animation: none;
  box-shadow: 0 0 18px rgba(45, 219, 240, .5), inset 0 0 10px rgba(45, 219, 240, .25);
}
@keyframes control-breathe {
  0%, 100% { box-shadow: 0 0 6px rgba(45, 219, 240, .16); }
  50% { box-shadow: 0 0 16px rgba(45, 219, 240, .42); }
}
.talk-mode-tabs {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: rgba(4, 8, 14, .72);
  backdrop-filter: blur(6px);
  animation: control-breathe 3.2s ease-in-out .4s infinite;
}
.talk-mode-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 12px/1 var(--mono);
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}
.talk-mode-tab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.talk-mode-tab:hover,
.talk-mode-tab:focus-visible { color: var(--cy); }
.talk-mode-tab[aria-checked="true"] {
  background: rgba(45, 219, 240, .28);
  color: #fff;
  box-shadow: 0 0 12px rgba(45, 219, 240, .4);
}
.talk-mode-tab:focus-visible { outline: 2px solid var(--cy); outline-offset: 2px; }
.talk-mode-tab[hidden] { display: none; }
#talk-form.is-live-off,
#talk-voice-settings.is-live-off { display: none; }
.talk-mic[data-tooltip]::after {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 12;
  width: max-content;
  max-width: min(240px, calc(100vw - 24px));
  padding: 6px 9px;
  border: 1px solid rgba(45, 212, 240, .28);
  border-radius: 6px;
  background: rgba(4, 8, 14, .96);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 11px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity .12s ease, transform .12s ease;
  visibility: hidden;
}
.talk-mic[data-tooltip]:hover::after,
.talk-mic[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}
.talk-control:focus-visible, .talk-mic:focus-visible { outline: 2px solid var(--cy); outline-offset: 3px; }

/* The menu hangs from the whole control bar (.graph-controls), not this button, so its
   screen-width cap keeps it on screen whatever sits left of the Voice button. */
.talk-voice-settings { position: static; }
.talk-voice-settings summary { list-style: none; cursor: pointer; }
.talk-voice-settings summary::-webkit-details-marker { display: none; }
.talk-voice-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: auto;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: min(860px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 10px;
  background: rgba(4, 8, 14, .96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  color: var(--ink);
  font-size: 12px;
}
.talk-voice-menu > * { min-width: 0; }
.talk-voice-menu label { display: grid; gap: 5px; min-width: 0; }
.talk-voice-menu > label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.talk-voice-menu select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 6px;
  background: #08121d;
  color: var(--ink);
  font: inherit;
}
.talk-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}
.talk-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.talk-picker-title {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.talk-picker-tools {
  display: flex;
  gap: 6px;
}
.talk-picker-tools .talk-table-select {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}
/* Language and engine details wrap, so the Status column stays in view on narrow menus. */
.talk-voice-picker .talk-table td:nth-child(2),
.talk-voice-picker .talk-table td:nth-child(3) { white-space: normal; }
.talk-table-select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 6px;
  background: #08121d;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
}
.talk-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.talk-sortable::after {
  content: '';
  display: inline-block;
  width: 1em;
  color: var(--cy);
}
.talk-sortable[aria-sort="ascending"]::after { content: ' \25B4'; }
.talk-sortable[aria-sort="descending"]::after { content: ' \25BE'; }
.talk-sortable:hover, .talk-sortable:focus-visible { color: var(--ink); }
.talk-picker-link {
  margin-left: auto;
  color: var(--cy);
  font-size: 11px;
  letter-spacing: .06em;
  text-decoration: none;
  white-space: nowrap;
}
.talk-picker-link:hover, .talk-picker-link:focus-visible { text-decoration: underline; }
.talk-picker-note {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talk-table-filter {
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 6px;
  background: #08121d;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  outline: none;
  width: 140px;
  max-width: 50%;
}
.talk-table-filter:focus {
  border-color: var(--cy);
  box-shadow: 0 0 6px rgba(45, 212, 240, .25);
}
.talk-table-scroll {
  max-height: min(50vh, 360px);
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid rgba(45, 212, 240, .22);
  border-radius: 6px;
  background: rgba(8, 18, 29, .8);
}
.talk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}
.talk-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #08121d;
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(45, 212, 240, .25);
}
.talk-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(45, 212, 240, .08);
  white-space: nowrap;
  vertical-align: middle;
}
.talk-table tbody tr {
  cursor: pointer;
  transition: background .12s ease;
  outline: none;
}
.talk-table tbody tr:hover {
  background: rgba(45, 212, 240, .08);
}
.talk-table tbody tr:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: -2px;
}
.talk-table tbody tr.is-selected,
.talk-table tbody tr[aria-selected="true"] {
  background: rgba(45, 212, 240, .18);
  color: var(--cy);
}
.talk-table tbody tr[hidden] {
  display: none;
}
.talk-voice-lang-header td {
  padding-top: 10px;
  color: var(--cy);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: rgba(45, 212, 240, .06);
  cursor: default;
}
.talk-voice-group-header td {
  font-weight: 600;
}
.talk-voice-expander::before {
  content: '\25B8';
  display: inline-block;
  color: var(--muted);
  transition: transform .12s ease;
}
.talk-voice-group-header[aria-expanded="true"] .talk-voice-expander::before {
  transform: rotate(90deg);
  color: var(--cy);
}
.talk-voice-variant td:first-child {
  padding-left: 20px;
  color: var(--muted);
}
.talk-voice-variant.is-selected td:first-child,
.talk-voice-variant[aria-selected="true"] td:first-child {
  color: inherit;
}
.talk-remove-btn {
  padding: 2px 7px;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 4px;
  background: #08121d;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  margin-left: 6px;
}
.talk-remove-btn:hover {
  border-color: var(--cy);
  color: var(--cy);
}
.talk-remove-btn {
  border-color: rgba(255, 120, 120, .4);
  color: #ff9999;
}
.talk-remove-btn:hover {
  border-color: #ff7878;
  color: #fff;
}
.talk-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(45, 212, 240, .3);
  border-radius: 4px;
  background: #08121d;
  color: var(--ink);
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
}
.talk-download-btn:hover {
  border-color: var(--cy);
  color: var(--cy);
}
.talk-preview-btn { color: var(--cy); }
.talk-delete-btn:hover {
  border-color: #ff8f8f;
  color: #ff8f8f;
}
.talk-voice-progress {
  color: var(--cy);
  font-variant-numeric: tabular-nums;
}
.talk-btn-icon {
  display: inline-flex;
  width: 13px;
  height: 13px;
}
.talk-btn-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.talk-voice-avatar {
  position: relative;
  display: inline-flex;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: -5px;
  flex: none;
}
.talk-voice-avatar > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.talk-voice-gender {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #08121d;
  border: 1px solid rgba(45, 212, 240, .3);
}
.talk-voice-gender svg {
  display: block;
  width: 8px;
  height: 8px;
}

.talk-status {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--reactor) * .44 + 24px);
  z-index: 2;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  min-height: 1.2em;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}


.talk-hold {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  transform: translateX(-50%);
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: .03em;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.talk-form {
  position: absolute;
  left: 50%;
  top: calc(50% + min(31vh, 210px) + 82px);
  transform: translateX(-50%);
  width: min(280px, calc(100% - 32px));
  pointer-events: auto;
}

.talk-input {
  width: 100%;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid rgba(45, 212, 240, .35);
  background: transparent;
  color: var(--ink);
  font: inherit;
  outline: none;
  text-align: center;
}

.talk-transcript {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  width: min(380px, calc(100% - 36px));
  max-height: 36vh;
  overflow: auto;
  pointer-events: auto;
  background: none;
  border: 0;
  box-shadow: none;
}

.talk-turn { margin: 0 0 12px; }

.talk-role {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.talk-turn.user .talk-said { color: var(--ink); }
.talk-said { color: var(--ink); white-space: pre-line; }

@media (max-width: 1023px) {
  .graph-controls { flex-wrap: wrap; max-width: calc(100vw - 380px); }
}

/* One voice for the page's text: the ink colour on every line a visitor reads, errors
   included, and one soft cyan glow. The glow is animated once, on the floor, and every line
   inherits it (text-shadow inherits), so all text breathes in step at the cost of one
   animation. Button labels follow their button's colour for hover and selection. */
.talk-hold,
.talk-status,
.talk-name,
.site-footer a,
.talk-said,
.talk-role,
.talk-turn.user .talk-said,
.talk-mode-tab {
  color: var(--ink);
}
.floor {
  animation: text-glow 4s ease-in-out infinite;
}
@keyframes text-glow {
  0%, 100% { text-shadow: 0 0 4px rgba(45, 219, 240, .25); }
  50% { text-shadow: 0 0 10px rgba(45, 219, 240, .6); }
}

@media (max-width: 600px) {
  .graph-controls {
    flex-direction: column;
    align-items: flex-start;
    max-width: none;
  }
  .talk-hold {
    bottom: calc(50px + env(safe-area-inset-bottom, 0px));
    font-size: 12px;
    letter-spacing: .02em;
    max-width: calc(100% - 32px);
    white-space: nowrap;
  }
  .talk-transcript {
    left: calc(18px + env(safe-area-inset-left, 0px));
    bottom: calc(50px + env(safe-area-inset-bottom, 0px));
    width: min(380px, calc(100% - 36px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  }
  .talk-transcript:not(:empty) ~ .talk-hold {
    display: none;
  }
  .talk-voice-menu select {
    height: 36px;
  }
  .talk-voice-menu {
    position: fixed;
    top: calc(144px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: auto;
    max-width: none;
  }
  .talk-table tbody tr {
    min-height: 36px;
  }
  .talk-table td, .talk-table th {
    padding: 8px 10px;
  }
  .talk-table-filter {
    height: 36px;
    width: 150px;
    font-size: 13px;
  }
  .talk-remove-btn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 12px;
  }
  .talk-download-btn {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .talk-orb { transition: none; }
  .floor {
    animation: none;
    text-shadow: 0 0 6px rgba(45, 219, 240, .35);
  }
  .talk-control, .talk-control svg, .talk-control::before, .talk-mode-tabs, .talk-mode-tab, .site-footer a { animation: none; transition: none; transform: none; }
}

.talk-model-icon {
  width: 14px;
  height: 14px;
  margin-right: 7px;
  border-radius: 3px;
  vertical-align: -2px;
  object-fit: contain;
}
