/* 05 / Hear it on your number: the voice and greeting picker. Setup panel (voice, greeting,
   emergency words) on the left, a greeting preview card on the right with a rule check.
   Every rule is scoped under #greeting. The TC palette is defined on the preview card only. */

/* ---------- Stage layout ---------- */

#greeting .vr-greet-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: stretch;
  gap: 28px;
  padding: 28px;
}

#greeting .vr-greet-in > * {
  min-width: 0;
}

@media (max-width: 1023px) {
  #greeting .vr-greet-in {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 18px;
  }
}

#greeting .vr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#greeting :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Setup panel ---------- */

#greeting .vr-setup {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

#greeting .vr-greet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 28px;
  margin-bottom: 18px;
}

#greeting .vr-greet-head-r {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  min-width: 0;
}

#greeting .vr-greet-head-s {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#greeting .vr-greet-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  background: none;
  border: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone-70);
  cursor: pointer;
  transition: color 0.2s;
}

#greeting .vr-greet-reset[hidden] {
  display: none;
}

#greeting .vr-greet-reset:hover {
  color: var(--accent);
}

#greeting .vr-greet-reset svg {
  width: 13px;
  height: 13px;
  flex: none;
}

#greeting .vr-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#greeting .vr-field + .vr-field {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

#greeting .vr-field-l {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--bone);
}

#greeting .vr-num {
  color: var(--accent);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

/* Voice cards: a radiogroup, one per voice, wrapping to a single column in a narrow panel */

#greeting .vr-voices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#greeting .vr-voice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  text-align: left;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--bone);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

#greeting .vr-voice:hover {
  border-color: var(--accent-40);
}

#greeting .vr-voice[aria-checked="true"] {
  border-color: var(--accent);
  background: rgb(255 255 255 / 0.06);
}

#greeting .vr-voice-g {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 36px;
  height: 22px;
  flex: none;
}

#greeting .vr-voice-g i {
  display: block;
  width: 3px;
  height: var(--h);
  border-radius: 2px;
  background: var(--ash);
  transition: background-color 0.2s;
}

#greeting .vr-voice[aria-checked="true"] .vr-voice-g i {
  background: var(--accent);
}

#greeting .vr-voice-n {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--bone);
}

#greeting .vr-voice-d {
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.1em;
}

/* A narrow panel stacks the voices as compact rows: glyph on the left, name and note on the right */
@container (max-width: 440px) {
  #greeting .vr-voices {
    grid-template-columns: minmax(0, 1fr);
  }

  #greeting .vr-voice {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas:
      "g n"
      "g d";
    align-items: center;
    column-gap: 14px;
    row-gap: 3px;
    padding: 12px 14px;
  }

  #greeting .vr-voice-g {
    grid-area: g;
  }

  #greeting .vr-voice-n {
    grid-area: n;
  }

  #greeting .vr-voice-d {
    grid-area: d;
  }
}

/* Greeting text */

#greeting .vr-greet-text {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 12px;
  resize: none;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--bone);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#greeting .vr-greet-text::placeholder {
  color: var(--ash);
  opacity: 1;
}

#greeting .vr-greet-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-20);
}

#greeting .vr-greet-count {
  margin: -4px 0 0;
  text-align: right;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Emergency words: chips with a remove button, then the add row */

#greeting .vr-greet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#greeting .vr-greet-chips:empty {
  display: none;
}

#greeting .vr-greet-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 10px;
  border: 1px solid hsl(0 70% 56% / 0.45);
  border-radius: 999px;
  background: hsl(0 70% 56% / 0.08);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: var(--bone);
  white-space: nowrap;
}

#greeting .vr-greet-x {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1;
  color: var(--bone-70);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

#greeting .vr-greet-x:hover {
  background: var(--bone-10);
  color: var(--bone);
}

#greeting .vr-greet-add {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

#greeting .vr-greet-word {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--bone);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#greeting .vr-greet-word::placeholder {
  color: var(--ash);
  opacity: 1;
}

#greeting .vr-greet-word:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-20);
}

#greeting .vr-greet-word:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#greeting .vr-greet-addbtn {
  flex: none;
  height: 38px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}

#greeting .vr-greet-addbtn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

#greeting .vr-greet-addbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#greeting .vr-greet-msg {
  min-height: 1.4em;
  margin: -4px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ash);
}

#greeting .vr-greet-msg.is-error {
  color: var(--danger);
}

#greeting .vr-greet-rule {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--bone);
}

#greeting .vr-greet-rule svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--danger);
}

/* ---------- Preview card (TC palette lives here, for the TC mark and the call tokens) ---------- */

#greeting .vr-prev {
  --tc-text: #eef3f1;
  --tc-muted: #8fa19d;
  --tc-line: rgba(255, 255, 255, 0.09);
  --tc-glass: rgba(255, 255, 255, 0.07);
  --tc-glass-2: rgba(255, 255, 255, 0.12);
  --tc-brand: #2f9e8f;
  --tc-brand-2: #1c6b61;
  --tc-glow: #134a44;
  --tc-glow-urgent: #561616;
  --tc-ai: rgb(255 255 255);
  --tc-caller: #8fb8ff;
  --tc-red: #ff453a;
  --tc-green: #30d158;

  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  container-type: inline-size;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

#greeting .vr-prev-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#greeting .vr-greet-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 28%;
  background: linear-gradient(145deg, #36b3a2, var(--tc-brand-2));
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
}

#greeting .vr-prev-id {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#greeting .vr-prev-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--bone);
}

#greeting .vr-prev-num {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

/* Player: play button, 40 bars, timer */

#greeting .vr-prev-player {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

#greeting .vr-play {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s, transform 0.2s var(--ease-out);
}

#greeting .vr-play:hover:not(:disabled) {
  background: var(--accent-soft);
}

#greeting .vr-play:active:not(:disabled) {
  transform: scale(0.96);
}

#greeting .vr-play:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#greeting .vr-play svg {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
}

#greeting .vr-play svg[hidden] {
  display: none;
}

#greeting .vr-play-go {
  margin-left: 2px;
}

#greeting .vr-greet-wave {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  min-width: 0;
}

#greeting .vr-greet-wave i {
  display: block;
  flex: none;
  width: 3px;
  height: 100%;
  border-radius: 1em;
  background: var(--tc-muted);
  opacity: 0.5;
  transform: scaleY(0.1);
  transform-origin: center;
  transition: transform 0.4s var(--ease-out), background-color 0.4s, opacity 0.4s;
}

/* Frozen gold profile: the finished greeting, and the static view */
#greeting .vr-greet-wave.is-on i {
  background: var(--tc-ai);
  opacity: 1;
  transform: scaleY(var(--h));
}

/* Live: each bar moves between its profile height and a low point */
#greeting .vr-greet-wave.is-live i {
  animation: vr-greet-bar var(--d) ease-in-out var(--dl) infinite;
  transition: none;
}

#greeting .vr-greet-wave.is-live.is-paused i {
  animation-play-state: paused;
}

@keyframes vr-greet-bar {
  0% { transform: scaleY(0.18); }
  50% { transform: scaleY(var(--h)); }
  100% { transform: scaleY(0.3); }
}

#greeting .vr-greet-time {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--bone-70);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The greeting on a call-screen panel: the same glow as the demo's call screen. It takes the
   spare height of the card, so the words sit in a finished block and the rule check at the foot. */

#greeting .vr-greet-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 132px;
  padding: 22px 22px;
  border-radius: var(--r-md);
  border: 1px solid var(--tc-line);
  background: radial-gradient(130% 55% at 50% 0%, var(--tc-glow) 0%, transparent 70%), linear-gradient(180deg, #0b1312, #070a0a);
}

/* The greeting as karaoke text */

#greeting .vr-greet-say {
  margin: 0;
  min-height: 4.35em;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--bone);
  overflow-wrap: anywhere;
}

#greeting .vr-greet-w {
  color: hsl(42 30% 94% / 0.35);
  transition: color 0.18s linear;
}

#greeting .vr-greet-w.is-said {
  color: var(--bone);
}

#greeting .vr-greet-w.is-now {
  color: var(--accent);
}

#greeting .vr-greet-empty {
  color: var(--ash);
}

#greeting .vr-greet-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: -4px;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

#greeting .vr-greet-meta-s {
  color: var(--bone-50);
}

/* Rule check: three sample lines and what the emergency words do to each */

#greeting .vr-greet-tests-wrap {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

#greeting .vr-greet-tests-h {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

#greeting .vr-greet-tests {
  display: flex;
  flex-direction: column;
}

#greeting .vr-greet-test {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 8px;
  margin: 0 -8px;
  border-radius: var(--r-md);
  border-bottom: 1px solid var(--line-soft);
}

#greeting .vr-greet-test:last-child {
  border-bottom: 0;
}

#greeting .vr-greet-test.is-flash {
  animation: vr-greet-flash 0.8s var(--ease-std);
}

@keyframes vr-greet-flash {
  from { background-color: rgb(255 255 255 / 0.08); }
  to { background-color: transparent; }
}

#greeting .vr-greet-q {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--bone-70);
  overflow-wrap: anywhere;
}

#greeting .vr-greet-hit {
  color: var(--bone);
  text-decoration: underline;
  text-decoration-color: var(--danger);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

#greeting .vr-greet-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--accent-40);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone-80);
  white-space: nowrap;
}

#greeting .vr-greet-out svg {
  flex: none;
  width: 13px;
  height: 13px;
  color: var(--accent);
}

#greeting .vr-greet-out.is-transfer {
  border-color: var(--danger);
}

#greeting .vr-greet-out.is-transfer svg {
  color: var(--danger);
}

/* A narrow card stacks each sample line above its outcome */
@container (max-width: 420px) {
  #greeting .vr-greet-test {
    grid-template-columns: minmax(0, 1fr);
  }

  #greeting .vr-greet-out {
    justify-self: start;
  }

  #greeting .vr-prev-num {
    letter-spacing: 0.06em;
  }
}

/* ---------- Mobile: the player's timer drops under the bars ---------- */

@media (max-width: 600px) {
  #greeting .vr-prev-player {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas:
      "play wave"
      "play time";
    gap: 8px 14px;
  }

  #greeting .vr-play {
    grid-area: play;
  }

  #greeting .vr-greet-wave {
    grid-area: wave;
  }

  #greeting .vr-greet-time {
    grid-area: time;
    justify-self: start;
  }

  #greeting .vr-greet-say {
    font-size: 17px;
  }
}

/* ---------- Under the stage ---------- */

#greeting .vr-greet-line {
  max-width: 44rem;
  margin: 24px auto 0;
  text-align: center;
}

/* Reduced motion: the bars stop at their profile heights; the words and timer still move */
@media (prefers-reduced-motion: reduce) {
  #greeting .vr-greet-wave.is-live i {
    animation: none;
    transform: scaleY(var(--h));
  }

  #greeting .vr-greet-wave i,
  #greeting .vr-greet-test.is-flash {
    transition: none;
    animation: none;
  }
}

/* ---------- Phones: one frame layer less, so the cards run to the gutters; the label sits under the title ---------- */

@media (max-width: 640px) {
  #greeting .vr-greet-in {
    padding: 12px;
  }

  #greeting .vr-setup,
  #greeting .vr-prev {
    padding: 16px;
  }

  #greeting .vr-greet-head-r {
    margin-left: 0;
  }

  #greeting .vr-greet-addbtn {
    min-height: 44px;
  }
}
