:root {
  --font-sans: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, serif;

  --bg-1: #f3f6fb;
  --bg-2: #e8eef7;
  --surface-1: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(249, 251, 255, 0.92);
  --surface-3: rgba(240, 245, 252, 0.85);
  --border-soft: rgba(18, 34, 58, 0.12);
  --border-strong: rgba(18, 34, 58, 0.2);
  --text-strong: #13253f;
  --text-mid: #334a66;
  --text-soft: #5e7691;
  --brand-1: #0d5fb8;
  --brand-2: #1f7ce0;
  --brand-3: #e8f2ff;
  --danger-1: #b12f31;
  --warn-1: #9e6415;
  --good-1: #1f7b42;
  --shadow-1: 0 10px 28px rgba(15, 30, 50, 0.1);
  --shadow-2: 0 20px 48px rgba(12, 24, 45, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-strong);
  background:
    radial-gradient(900px 380px at 85% -40%, rgba(35, 120, 220, 0.18), transparent 65%),
    radial-gradient(760px 340px at -10% 5%, rgba(58, 159, 115, 0.14), transparent 68%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

.skipLink {
  position: absolute;
  left: 12px;
  top: -44px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--text-strong);
  border: 1px solid var(--border-strong);
  z-index: 20;
}
.skipLink:focus {
  top: 12px;
}

.wrap {
  width: min(1220px, calc(100% - 32px));
  margin: 18px auto;
  padding: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  margin-bottom: 14px;
}

.brandBlock {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.eyebrow {
  margin: 0 0 5px 0;
  color: var(--brand-1);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 33px;
  line-height: 1.15;
  letter-spacing: 0.1px;
}

.brandHeadingRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brandHeadingRow h1 {
  flex: 1 1 auto;
}

.brandLogo {
  width: 82px;
  height: 82px;
  border-radius: 16px;
  object-fit: contain;
  background: #031018;
  border: 1px solid rgba(18, 34, 58, 0.16);
  box-shadow: 0 10px 20px rgba(15, 32, 50, 0.16);
  flex: 0 0 auto;
}

.sub {
  margin: 8px 0 0 0;
  color: var(--text-mid);
}

.readinessCard {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 255, 0.96));
  box-shadow: var(--shadow-1);
  display: grid;
  gap: 7px;
}

.readinessRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(19, 37, 63, 0.15);
}
.readinessRow:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.readinessRow span {
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.readinessRow strong {
  font-size: 14px;
  color: var(--text-strong);
}
.readinessRow .buildTag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toneGood {
  color: var(--good-1);
}
.toneWarn {
  color: var(--warn-1);
}
.toneBad {
  color: var(--danger-1);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.chk {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(18, 34, 58, 0.13);
  background: #fff;
  color: var(--text-mid);
  font-size: 14px;
}

.voicePick {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(18, 34, 58, 0.13);
  background: #fff;
}
.voicePick span {
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

#voiceSelect,
#voiceEngineSelect {
  min-width: 178px;
  max-width: 260px;
  border-radius: 10px;
  border: 1px solid rgba(18, 34, 58, 0.19);
  padding: 6px 9px;
  background: #fff;
  color: var(--text-strong);
}
#voiceSelect:disabled,
#voiceEngineSelect:disabled {
  opacity: 0.58;
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  border-radius: 11px;
  border: 1px solid rgba(18, 34, 58, 0.2);
  background: #fff;
  color: var(--text-strong);
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
button:hover {
  border-color: rgba(18, 34, 58, 0.3);
  background: #fcfeff;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

#sendBtn {
  background: linear-gradient(180deg, var(--brand-2), var(--brand-1));
  border-color: #0a4f9a;
  color: #fff;
  font-weight: 600;
}
#sendBtn:hover {
  background: linear-gradient(180deg, #3389e7, #156bc8);
}

#talkBtn {
  background: linear-gradient(180deg, #f2f9ff, #e5f2ff);
  border-color: rgba(21, 98, 182, 0.35);
  color: #124a86;
  font-weight: 600;
}

#knockBtn {
  border-color: rgba(14, 91, 173, 0.38);
  background: linear-gradient(180deg, #f5fbff, #ebf5ff);
  color: #0f538f;
  font-weight: 600;
}

#resetBtn {
  border-color: rgba(168, 79, 25, 0.35);
  background: linear-gradient(180deg, #fff7f1, #fff0e5);
  color: #86431c;
  font-weight: 600;
}

#retryBtn {
  border-color: rgba(19, 84, 154, 0.28);
  background: #edf5ff;
  color: #134a87;
}

.grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 14px;
  align-items: start;
}

.left,
.right {
  min-width: 0;
}

.avatarCard,
.roleCard,
.right {
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
}

.avatarCard {
  padding: 12px;
  display: grid;
  justify-items: center;
  align-content: start;
}

.avatarStage {
  position: relative;
  width: min(100%, 340px);
  max-width: 340px;
  height: 320px;
}

.avatarBackdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 58, 0.08);
  background:
    radial-gradient(170px 95px at 50% 8%, rgba(255, 242, 211, 0.56), rgba(255, 242, 211, 0) 72%),
    linear-gradient(180deg, rgba(187, 211, 239, 0.8), rgba(142, 173, 210, 0.62)) 9% 12% / 24% 30% no-repeat,
    linear-gradient(180deg, rgba(187, 211, 239, 0.8), rgba(142, 173, 210, 0.62)) 67% 12% / 24% 30% no-repeat,
    linear-gradient(90deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 9% 12% / 24% 2% no-repeat,
    linear-gradient(90deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 67% 12% / 24% 2% no-repeat,
    linear-gradient(90deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 9% 40% / 24% 2% no-repeat,
    linear-gradient(90deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 67% 40% / 24% 2% no-repeat,
    linear-gradient(180deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 20.5% 12% / 1.6% 30% no-repeat,
    linear-gradient(180deg, rgba(244, 247, 252, 0.92), rgba(244, 247, 252, 0.92)) 78.5% 12% / 1.6% 30% no-repeat,
    radial-gradient(120px 48px at 50% 70%, rgba(97, 117, 136, 0.36), rgba(97, 117, 136, 0) 75%),
    linear-gradient(180deg, rgba(141, 157, 172, 0.58), rgba(90, 108, 126, 0.72)) 17% 60% / 66% 18% no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)) 17% 60% / 66% 5% no-repeat,
    linear-gradient(180deg, rgba(227, 234, 243, 0.98) 0%, rgba(213, 224, 238, 0.98) 57%, rgba(202, 168, 132, 0.94) 57%, rgba(168, 128, 87, 0.98) 100%);
  box-shadow: inset 0 -18px 30px rgba(62, 47, 33, 0.22);
  pointer-events: none;
}

#avatarCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  height: 100%;
  display: block;
  margin: 0;
  border-radius: 14px;
  background: transparent;
  border: 1px solid rgba(18, 34, 58, 0.08);
}

.doorOverlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
  perspective: 2200px;
  opacity: 1;
  transition: opacity 280ms ease;
}

.doorOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.44), rgba(0, 0, 0, 0) 62%),
    radial-gradient(110% 120% at 52% 108%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 50%),
    linear-gradient(180deg, #d7d9dd 0%, #c8ccd2 52%, #b8bdc4 100%);
  transition: opacity 300ms ease;
}

.doorOverlay::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 2px rgba(26, 30, 38, 0.72),
    inset 0 0 0 7px rgba(52, 57, 68, 0.62),
    inset 0 16px 26px rgba(255, 255, 255, 0.1),
    inset 0 -18px 28px rgba(8, 10, 14, 0.3);
  pointer-events: none;
  transition: opacity 260ms ease;
}

.doorFrame {
  position: absolute;
  inset: 6px;
  z-index: 1;
  display: grid;
  grid-template-columns: 19% 62% 19%;
  gap: 8px;
  align-items: stretch;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(28, 34, 44, 0.82);
  background:
    linear-gradient(168deg, #3d4350 0%, #2f3440 36%, #232933 72%, #1a2028 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0.02) 2px, rgba(0, 0, 0, 0.04) 2px, rgba(0, 0, 0, 0.04) 4px);
  box-shadow:
    inset 0 0 0 1px rgba(177, 190, 209, 0.15),
    inset 0 14px 22px rgba(255, 255, 255, 0.07),
    inset 0 -18px 24px rgba(9, 12, 17, 0.38),
    0 10px 20px rgba(0, 0, 0, 0.26);
  transition: opacity 360ms ease 150ms;
}

.sidelight {
  position: relative;
  border-radius: 4px;
  border: 1px solid rgba(40, 45, 54, 0.76);
  background:
    linear-gradient(180deg, #3c414c, #2d323c),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 2px, rgba(0, 0, 0, 0.06) 2px, rgba(0, 0, 0, 0.06) 4px);
  box-shadow:
    inset 0 0 0 1px rgba(182, 194, 211, 0.14),
    inset 0 12px 16px rgba(255, 255, 255, 0.06),
    inset 0 -14px 18px rgba(8, 11, 15, 0.28);
}

.sidelightGlass {
  position: absolute;
  top: 7%;
  bottom: 30%;
  left: 20%;
  right: 20%;
  border-radius: 2px;
  border: 1px solid rgba(77, 91, 109, 0.58);
  background:
    linear-gradient(180deg, rgba(216, 227, 237, 0.95), rgba(184, 198, 214, 0.92) 40%, rgba(162, 178, 197, 0.92)),
    radial-gradient(180% 80% at 50% 0%, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 56%),
    repeating-linear-gradient(0deg, rgba(70, 86, 106, 0.16) 0, rgba(70, 86, 106, 0.16) 1px, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0) 18px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    inset 0 16px 22px rgba(255, 255, 255, 0.18);
}

.sidelightGlass::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  margin-left: -0.5px;
  background: rgba(62, 78, 97, 0.34);
}

.sidelightPanel {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 8%;
  height: 22%;
  border-radius: 2px;
  border: 1px solid rgba(56, 63, 74, 0.72);
  background:
    linear-gradient(180deg, #505765, #3a424f),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, rgba(0, 0, 0, 0.07) 2px, rgba(0, 0, 0, 0.07) 4px);
  box-shadow:
    inset 0 0 0 1px rgba(180, 194, 213, 0.1),
    inset 0 -10px 12px rgba(8, 11, 15, 0.24);
}

.doorMain {
  position: relative;
  border-radius: 4px;
  border: 1px solid rgba(46, 52, 62, 0.82);
  background:
    linear-gradient(172deg, #5a6270 0%, #4a5260 38%, #3a424f 66%, #2e3541 100%),
    repeating-linear-gradient(95deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, rgba(0, 0, 0, 0.06) 2px, rgba(0, 0, 0, 0.06) 5px),
    radial-gradient(260px 120px at 34% 10%, rgba(255, 255, 255, 0.16), transparent 72%);
  box-shadow:
    inset 0 0 0 1px rgba(183, 197, 216, 0.16),
    inset 0 20px 24px rgba(255, 255, 255, 0.11),
    inset 0 -24px 30px rgba(7, 10, 14, 0.42),
    inset -10px 0 14px rgba(6, 9, 13, 0.2),
    0 14px 24px rgba(0, 0, 0, 0.36);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transform-origin: 2% 50%;
  transform: translateX(0) rotateY(0deg);
  opacity: 1;
  transition: transform 980ms cubic-bezier(0.16, 0.74, 0.18, 1), box-shadow 980ms ease, opacity 320ms ease 260ms;
}

.doorMain::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.5%;
  width: 2px;
  background: linear-gradient(180deg, rgba(234, 241, 250, 0.28), rgba(33, 40, 49, 0.35));
  opacity: 0.8;
}

.doorMain::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 8px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(14, 18, 24, 0.46));
  opacity: 0.7;
}

.doorArchPanel,
.doorLowerPanel {
  position: absolute;
  left: 9%;
  right: 9%;
  border: 1px solid rgba(64, 73, 87, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(19, 24, 32, 0.2)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 2px, rgba(0, 0, 0, 0.05) 2px, rgba(0, 0, 0, 0.05) 4px);
  box-shadow:
    inset 0 0 0 1px rgba(201, 212, 228, 0.12),
    inset 0 -12px 14px rgba(7, 10, 14, 0.24);
}

.doorArchPanel {
  top: 8%;
  height: 46%;
  border-radius: 8px;
}

.doorLowerPanel {
  bottom: 8%;
  height: 28%;
  border-radius: 8px;
}

.doorHouseNumber {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(168, 177, 191, 0.7);
  background: linear-gradient(180deg, rgba(26, 30, 38, 0.82), rgba(12, 15, 20, 0.82));
  color: #f2f5f8;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.34), inset 0 1px 1px rgba(255, 255, 255, 0.16);
}

/* Door cleanup: hide legacy peephole/lock artifacts if older markup is cached. */
.doorPeephole,
.doorLockPlate,
.doorViewer,
.doorLock,
.doorKnob,
.doorDeadbolt,
.doorCylinder,
.doorThumbturn,
.doorRosette,
.doorBolt,
.doorLatch,
.doorAccentDot,
.doorBadge,
.doorMain [class*="peephole"],
.doorMain [class*="Peephole"],
.doorMain [class*="lock"],
.doorMain [class*="Lock"],
.doorMain [class*="knob"],
.doorMain [class*="Knob"],
.doorMain [class*="deadbolt"],
.doorMain [class*="Deadbolt"],
.doorMain [class*="cylinder"],
.doorMain [class*="Cylinder"],
.doorMain [class*="thumbturn"],
.doorMain [class*="Thumbturn"],
.doorMain [class*="rosette"],
.doorMain [class*="Rosette"] {
  display: none !important;
}

.doorKickPlate {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 3.5%;
  height: 8%;
  border-radius: 2px;
  border: 1px solid rgba(108, 124, 141, 0.52);
  background:
    linear-gradient(180deg, rgba(188, 200, 214, 0.5), rgba(121, 136, 151, 0.33)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.1) 0,
      rgba(255, 255, 255, 0.1) 1px,
      rgba(0, 0, 0, 0.06) 1px,
      rgba(0, 0, 0, 0.06) 3px
    );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.34),
    inset 0 -1px 2px rgba(0, 0, 0, 0.22);
}

.doorHandleBar {
  position: absolute;
  right: 8%;
  top: 49%;
  width: 9px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d7dde4 0%, #a8b2be 56%, #6a7682 100%);
  box-shadow:
    0 0 0 1px rgba(44, 52, 61, 0.8),
    0 2px 5px rgba(0, 0, 0, 0.42),
    inset 0 1px 1px rgba(255, 255, 255, 0.48);
}

.doorHandleBar::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -28px;
  width: 30px;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(180deg, #d8dee5, #8f9aa7);
  box-shadow: 0 0 0 1px rgba(48, 56, 66, 0.72), inset 0 1px 1px rgba(255, 255, 255, 0.48);
}

.doorHandleBar::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.doorOverlay.closed {
  opacity: 1;
}

.doorOverlay.open {
  opacity: 0;
  transition-delay: 540ms;
}

.doorOverlay.open .doorMain {
  transform: translateX(-13%) rotateY(-92deg);
  opacity: 0.14;
  box-shadow:
    inset 0 0 0 1px rgba(255, 216, 176, 0.08),
    inset 0 14px 18px rgba(255, 224, 192, 0.04),
    inset 0 -18px 24px rgba(22, 12, 6, 0.2),
    -14px 16px 22px rgba(0, 0, 0, 0.3);
}

.doorOverlay.open::before {
  opacity: 0;
}

.doorOverlay.open::after {
  opacity: 0;
}

.doorOverlay.open .doorFrame {
  opacity: 0.18;
}

.doorOverlay.closed {
  transition-delay: 0ms;
}

.avatarStatus {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.roleCard {
  margin-top: 12px;
  padding: 12px 14px;
  color: var(--text-mid);
}
.roleCard strong {
  color: var(--text-strong);
}
.roleCard .tip {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(18, 34, 58, 0.08);
  background: var(--surface-3);
}

.right {
  padding: 12px;
}

.engagementPanel,
.debriefPanel {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 58, 0.1);
  background: var(--surface-2);
}

.engagementPanel {
  margin-bottom: 10px;
}

.engagementHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.engagementHead strong {
  color: var(--text-strong);
}
.engagementHeadRight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#engagementScore {
  font-weight: 700;
}

.engagementLive {
  font-size: 12px;
  color: var(--text-soft);
}
.engagementLive.live {
  color: var(--good-1);
  font-weight: 700;
}

.engagementScale {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(18, 34, 58, 0.08);
  background: linear-gradient(90deg, #cc3939, #f2aa36, #2a9c56);
}

.engagementFill {
  width: 0%;
  height: 100%;
  background: rgba(255, 255, 255, 0.5);
  transition: width 0.2s ease;
}

.engagementMeta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.engagementLabel {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 999px;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 1px solid transparent;
}

.label-green {
  color: var(--good-1);
  background: rgba(31, 123, 66, 0.12);
  border-color: rgba(31, 123, 66, 0.28);
}
.label-amber {
  color: var(--warn-1);
  background: rgba(158, 100, 21, 0.11);
  border-color: rgba(158, 100, 21, 0.26);
}
.label-red {
  color: var(--danger-1);
  background: rgba(177, 47, 49, 0.1);
  border-color: rgba(177, 47, 49, 0.25);
}

#engagementHint {
  color: var(--text-mid);
  font-size: 13px;
}

.debriefPanel {
  margin-bottom: 10px;
}
.debriefHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.debriefStage {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-1);
  background: var(--brand-3);
  border: 1px solid rgba(14, 91, 173, 0.25);
  border-radius: 999px;
  padding: 4px 8px;
}
.debriefSummary {
  margin: 8px 0 0 0;
  color: var(--text-mid);
}
.debriefSignals {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-mid);
}
.debriefSignals li {
  margin-bottom: 4px;
}

.chat {
  height: 315px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 58, 0.1);
  background: var(--surface-2);
  padding: 12px;
}
.chat::-webkit-scrollbar {
  width: 10px;
}
.chat::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(25, 73, 126, 0.26);
}

.msg {
  padding: 10px 11px;
  border-radius: 13px;
  margin-bottom: 9px;
  border: 1px solid rgba(18, 34, 58, 0.08);
  background: #fff;
}

.msg.role-practitioner {
  border-left: 4px solid rgba(13, 95, 184, 0.55);
}
.msg.role-caregiver {
  border-left: 4px solid rgba(48, 122, 80, 0.48);
}
.msg.role-system {
  border-left: 4px solid rgba(143, 104, 29, 0.45);
  background: #fcfdff;
}

.msg b {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#userInput {
  width: 100%;
  margin-top: 10px;
  min-height: 70px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 58, 0.19);
  background: #fff;
  color: var(--text-strong);
  resize: vertical;
}

.actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.transcriptActions button {
  background: #f2f7ff;
}

.redactionControl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(21, 64, 114, 0.24);
  background: #edf5ff;
  color: #1b3f66;
  font-size: 12px;
  font-weight: 600;
}

.redactionControl select {
  min-width: 92px;
  border-radius: 8px;
  border: 1px solid rgba(21, 64, 114, 0.28);
  background: #fff;
  color: #17385b;
  font-size: 12px;
  padding: 5px 6px;
}

.reviewPanel {
  margin-top: 12px;
  border: 1px solid rgba(23, 52, 88, 0.16);
  border-radius: 16px;
  background: #fff;
  padding: 12px 12px 10px;
}

.reviewHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.reviewControls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reviewToggle,
.reviewThreshold {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(20, 48, 80, 0.16);
  border-radius: 10px;
  background: #f6faff;
  color: var(--text-soft);
  font-size: 12px;
}

.reviewThreshold select {
  border-radius: 8px;
  border: 1px solid rgba(20, 48, 80, 0.24);
  background: #fff;
  padding: 4px 6px;
  font-size: 12px;
}

.reviewSummary {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.reviewList {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.reviewTurn {
  border: 1px solid rgba(21, 47, 80, 0.14);
  border-radius: 12px;
  background: #fcfdff;
  padding: 9px 10px;
}

.reviewTurnHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.reviewTurnMeta {
  color: var(--text-soft);
  font-size: 12px;
}

.reviewTurnScore {
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
  color: #10385f;
  background: rgba(15, 99, 176, 0.12);
}

.reviewTurnScore.low {
  color: #6d160f;
  background: rgba(189, 53, 26, 0.14);
}

.reviewTurnLine {
  margin: 2px 0;
  font-size: 13px;
  color: #1b2f48;
}

.reviewTurnLine b {
  color: #0f2740;
}

.reviewCoaching {
  margin-top: 6px;
  border-top: 1px dashed rgba(24, 51, 83, 0.18);
  padding-top: 6px;
  font-size: 12px;
  color: #294665;
}

.footer {
  margin-top: 12px;
  color: var(--text-soft);
  font-size: 13px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.skipLink:focus-visible {
  outline: 2px solid rgba(13, 95, 184, 0.85);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(13, 95, 184, 0.18);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
  }
  .readinessCard {
    max-width: 360px;
  }
}

@media (max-width: 980px) {
  .wrap {
    width: calc(100% - 22px);
    margin: 12px auto;
    padding: 10px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .avatarStage {
    width: min(100%, 320px);
    max-width: 320px;
    height: 300px;
  }
  #avatarCanvas {
    height: 100%;
  }
  .chat {
    height: 280px;
  }
  #voiceSelect {
    min-width: 140px;
    max-width: 220px;
  }
  .brandLogo {
    width: 70px;
    height: 70px;
  }
}

@media (max-width: 620px) {
  .brandLogo {
    width: 58px;
    height: 58px;
    border-radius: 12px;
  }
  h1 {
    font-size: 29px;
  }
}
