.livestream-ui-root {
  position: absolute;
  z-index: 44;
  inset: 116px 8px calc(var(--dialogue-height) + 60px);
  overflow: hidden;
  pointer-events: none;
}

.livestream-ui-root[hidden] {
  display: none;
}

.viewport-root[data-node-layout="choice"] .livestream-ui-root {
  bottom: calc(var(--choice-height) + 60px);
}

.livestream-ui-canvas {
  --live-accent: #58d4c3;
  --live-accent-dark: #1b6d64;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid rgba(88, 212, 195, 0.88);
  background:
    linear-gradient(rgba(8, 13, 12, 0.48), rgba(8, 13, 12, 0.48)),
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(88, 212, 195, 0.04) 15px),
    repeating-linear-gradient(90deg, transparent 0 14px, rgba(88, 212, 195, 0.04) 15px);
  box-shadow: inset 0 0 0 2px rgba(3, 8, 7, 0.72);
  color: #f1f3ef;
  font-family: var(--font-ui);
  text-shadow: 1px 1px 0 #000;
}

.livestream-ui-root.theme-korea .livestream-ui-canvas {
  --live-accent: #ff745d;
  --live-accent-dark: #9f3c2d;
  border-color: rgba(255, 116, 93, 0.9);
}

.live-corner {
  position: absolute;
  z-index: 5;
  width: 13px;
  height: 13px;
  border-color: var(--live-accent);
  border-style: solid;
}

.corner-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; }
.corner-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; }
.corner-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; }
.corner-br { right: -2px; bottom: -2px; border-width: 0 4px 4px 0; }

.live-status-row {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 20px;
}

.live-badge,
.live-phase {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(7, 11, 10, 0.82);
  font: 900 8px/1 var(--font-ui);
}

.live-badge {
  border-color: var(--live-accent);
  color: #fff;
}

.live-badge b {
  width: 6px;
  height: 6px;
  margin-right: 4px;
  background: var(--coral);
  box-shadow: 0 0 0 2px rgba(255, 104, 77, 0.18);
  animation: livestream-live-blink 1.2s steps(2, end) infinite;
}

.live-phase {
  color: #dce4df;
}

.live-account {
  position: absolute;
  z-index: 3;
  top: 32px;
  left: 8px;
  display: grid;
  grid-template-columns: 36px auto 44px;
  align-items: center;
  width: 192px;
  height: 47px;
  padding: 4px;
  border-left: 3px solid var(--live-accent);
  background: rgba(5, 9, 8, 0.82);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.live-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid #07100e;
  background: var(--live-accent);
  box-shadow: inset -4px -4px 0 var(--live-accent-dark);
  color: #07100e;
  font: 900 16px/1 var(--font-display);
  text-shadow: none;
}

.live-account-copy {
  display: grid;
  min-width: 0;
  padding-left: 5px;
}

.live-account-copy strong {
  overflow: hidden;
  font: 900 11px/1.1 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-account-copy small {
  margin-top: 3px;
  color: #c8d2cc;
  font: 8px/1 var(--font-ui);
}

.live-follow {
  width: 42px;
  height: 25px;
  padding: 0;
  border: 2px solid #3c1711;
  border-radius: 0;
  background: var(--coral);
  color: #130805;
  font: 900 9px/1 var(--font-ui);
  text-shadow: none;
  touch-action: manipulation;
}

.live-follow.is-following {
  border-color: #455048;
  background: #28322c;
  color: #dce4df;
}

.live-viewers {
  position: absolute;
  z-index: 3;
  top: 32px;
  right: 8px;
  display: grid;
  min-width: 71px;
  height: 47px;
  align-content: center;
  padding: 3px 7px;
  border-right: 3px solid var(--live-accent);
  background: rgba(5, 9, 8, 0.82);
  text-align: right;
}

.live-viewers span {
  color: #c8d2cc;
  font: 8px/1 var(--font-ui);
}

.live-viewers strong {
  margin-top: 4px;
  color: var(--yellow);
  font: 900 15px/1 var(--font-number);
}

.theme-korea .live-viewers strong {
  color: #ff8c72;
}

.live-comment-list {
  position: absolute;
  z-index: 3;
  right: 42px;
  bottom: 56px;
  left: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  min-height: 105px;
}

.live-comment {
  display: flex;
  max-width: 100%;
  min-height: 18px;
  margin: 0;
  padding: 3px 6px;
  overflow: hidden;
  background: rgba(4, 7, 6, 0.72);
  font: 8px/1.45 var(--font-reading);
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: livestream-comment-enter 260ms steps(4, end) both;
}

.live-comment:nth-child(4n + 1) { border-left: 2px solid #58d4c3; }
.live-comment:nth-child(4n + 2) { border-left: 2px solid #ffd451; }
.live-comment:nth-child(4n + 3) { border-left: 2px solid #ff8ba7; }
.live-comment:nth-child(4n) { border-left: 2px solid #8fc8ed; }
.live-comment strong { flex: none; margin-right: 5px; color: var(--live-accent); font-family: var(--font-ui); }
.live-comment span { overflow: hidden; text-overflow: ellipsis; }

.live-reactions {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 62px;
  width: 26px;
  height: 110px;
  overflow: hidden;
}

.live-reactions i {
  position: absolute;
  right: 3px;
  bottom: -16px;
  color: var(--coral);
  font: 18px/1 sans-serif;
  text-shadow: 2px 2px 0 #000;
  animation: livestream-reaction-rise 4.2s ease-out infinite;
}

.live-reactions i + i {
  color: var(--yellow);
  animation-delay: 2.1s;
}

.live-composer {
  position: absolute;
  z-index: 4;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  grid-template-columns: 1fr 30px 30px;
  gap: 5px;
  height: 36px;
  pointer-events: auto;
}

.live-composer > span {
  display: flex;
  align-items: center;
  padding: 0 9px;
  overflow: hidden;
  border: 2px solid #aab5af;
  background: rgba(4, 8, 7, 0.74);
  color: #aab5af;
  font: 9px/1 var(--font-reading);
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

.live-composer button {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 2px solid #d7dfda;
  border-radius: 0;
  background: var(--live-accent);
  color: #07100e;
  font: 900 16px/1 var(--font-display);
  text-shadow: none;
}

.live-composer button:last-child {
  background: var(--yellow);
}

@keyframes livestream-live-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.24; }
}

@keyframes livestream-comment-enter {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes livestream-reaction-rise {
  0% { opacity: 0; transform: translate(0, 0) scale(0.72); }
  15% { opacity: 1; }
  75% { opacity: 0.8; }
  100% { opacity: 0; transform: translate(-5px, -100px) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .livestream-ui-root *,
  .livestream-ui-root *::before,
  .livestream-ui-root *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
