/* TikTok Live — tiny host inside the camera rectangle */

#panel-live.panel[hidden] {
  display: none !important;
}

#panel-live.panel.active {
  display: block;
  min-height: calc(100vh - 100px);
}

body.lv-tab-active #panel-live {
  background: #07080c;
}

.lv-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  min-height: 28rem;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0.55rem 0.85rem 0.85rem;
  box-sizing: border-box;
  color: #eceef4;
}

.lv-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.lv-top h2 {
  margin: 0 0 0.15rem;
  font-size: 1.22rem;
  color: #ff5a7a;
  letter-spacing: 0.02em;
}

.lv-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(200, 208, 222, 0.82);
  max-width: 42rem;
}

.lv-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.lv-controls button,
.lv-controls select,
.lv-desk button,
.lv-desk input {
  font: inherit;
  font-size: 0.76rem;
}

.lv-controls button,
.lv-desk button {
  appearance: none;
  padding: 0.34rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 122, 0.35);
  background: rgba(22, 14, 20, 0.95);
  color: #f4e8ee;
  cursor: pointer;
}

.lv-controls select,
#lv-tiktok {
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 122, 0.3);
  background: #141018;
  color: #f4eef8;
}

#lv-tiktok {
  width: 10.5rem;
}

#lv-go.live {
  background: linear-gradient(180deg, #ff4d6d, #c01840);
  border-color: #ff8aa0;
  font-weight: 800;
}

.lv-clock {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: #ffd0da;
  min-width: 4.6rem;
}

.lv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 0.7rem;
}

.lv-fit {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05060a;
  border-radius: 14px;
  border: 1px solid rgba(255, 90, 122, 0.18);
}

.lv-camera {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #0b0c12;
  box-shadow: 0 0 0 2px #1a1b22, 0 12px 40px rgba(0, 0, 0, 0.55);
}

#lv-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  pointer-events: none;
}

.lv-ui {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.lv-slots {
  position: absolute;
  left: 8%;
  width: 84%;
  top: 58%;
  z-index: 6;
  display: flex;
  gap: 0.35rem;
  pointer-events: auto;
}

.lv-slot {
  position: relative;
  flex: 1;
  aspect-ratio: 1;
  max-height: 4.6rem;
  padding: 0;
  border: 1px solid rgba(212, 168, 74, 0.55);
  border-radius: 8px;
  overflow: hidden;
  background: #0c0d12;
  cursor: pointer;
  color: #f4e8c8;
}

.lv-slot img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.lv-slot-num {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 0.08rem 0.15rem;
}

.lv-slot-nav {
  position: absolute;
  top: 0;
  bottom: 1.1rem;
  width: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: rgba(255, 240, 200, 0.9);
  text-shadow: 0 1px 4px #000;
}

.lv-slot-nav[data-dir="-1"] {
  left: 0;
}

.lv-slot-nav[data-dir="1"] {
  right: 0;
}

.lv-slot.active {
  border-color: #ffe08a;
  box-shadow: 0 0 0 1px #ffe08a;
}

.lv-camera::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.lv-hud {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  right: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
  z-index: 3;
}

.lv-badge {
  background: #fe2c55;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
}

.lv-badge.off {
  background: #3a3d48;
}

.lv-viewers,
.lv-likes {
  font-size: 0.72rem;
  color: #fff;
  text-shadow: 0 1px 4px #000;
}

.lv-comments {
  position: absolute;
  left: 0.5rem;
  bottom: 5.4rem;
  width: min(70%, 15.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  pointer-events: none;
  z-index: 2;
}

.lv-cmt {
  pointer-events: auto;
  background: rgba(8, 8, 12, 0.55);
  border-radius: 8px;
  padding: 0.22rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #f3f4f8;
  max-width: 100%;
  word-break: break-word;
}

.lv-cmt b {
  color: #7ee0ff;
  font-weight: 700;
  margin-right: 0.28rem;
}

.lv-cmt.host b {
  color: #e8c56a;
}

.lv-cmt.rude {
  opacity: 0.4;
  text-decoration: line-through;
}

.lv-cmt button {
  pointer-events: auto;
  margin-left: 0.3rem;
  font-size: 0.62rem;
  padding: 0.08rem 0.3rem;
  border-radius: 5px;
  border: 1px solid rgba(255, 180, 190, 0.35);
  background: rgba(40, 10, 16, 0.8);
  color: #ffc4ce;
  cursor: pointer;
}

.lv-gifts {
  position: absolute;
  right: 0.45rem;
  top: 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: flex-end;
  z-index: 2;
  pointer-events: none;
}

.lv-gift {
  background: rgba(20, 8, 14, 0.78);
  border: 1px solid rgba(255, 200, 80, 0.45);
  color: #ffe7a8;
  font-size: 0.7rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
}

.lv-caption {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 4.6rem;
  z-index: 2;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 1px 6px #000;
  min-height: 1.2rem;
  pointer-events: none;
}

.lv-prompt-bar {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 1.6%;
  z-index: 6;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.28rem 0.45rem 0.32rem;
  border-radius: 8px;
  background: rgba(8, 6, 12, 0.88);
  border: 1px solid rgba(212, 168, 74, 0.5);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.lv-camera:has(#lv-book.on) .lv-prompt-bar {
  display: none;
}

.lv-prompt-kicker {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  color: #ffe08a;
}

#lv-prompt {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.12rem 0;
  border: 0;
  background: transparent;
  color: #f4e8c8;
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.3;
  text-align: center;
  outline: none;
}

#lv-prompt::placeholder {
  color: rgba(244, 232, 200, 0.42);
}

.lv-desk {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lv-desk h3 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 180, 196, 0.75);
}

.lv-desk textarea,
.lv-desk input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 122, 0.28);
  background: #120e12;
  color: #f4e8ee;
  padding: 0.4rem 0.5rem;
  resize: vertical;
}

.lv-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.lv-book {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 5%;
  bottom: 2%;
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid rgba(212, 168, 74, 0.45);
  border-radius: 12px;
  background: rgba(8, 7, 12, 0.96);
  padding: 0.45rem;
  pointer-events: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.lv-book[hidden] {
  display: none !important;
}

.lv-book.on {
  display: flex !important;
}

.lv-book-top,
.lv-book-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.lv-book-top strong {
  color: #ffe08a;
  font-size: 0.78rem;
}

#lv-book-page {
  margin-left: auto;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: rgba(230, 210, 170, 0.9);
}

.lv-book-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.22rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
  align-content: start;
}

.lv-book-tile {
  display: block;
  width: 100%;
  position: relative;
  padding: 0;
  border: 1px solid rgba(212, 168, 74, 0.28);
  border-radius: 5px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
  aspect-ratio: 1;
  appearance: none;
  -webkit-appearance: none;
}

.lv-book-tile img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.lv-book-tile span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.55rem;
  font-weight: 700;
  text-align: center;
  color: #f4e8c8;
  background: rgba(0, 0, 0, 0.62);
}

.lv-book-tile.on {
  border-color: #ffe08a;
  box-shadow: 0 0 0 1px #ffe08a;
}

.lv-mod {
  flex: 1;
  min-height: 5rem;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 122, 0.2);
  background: rgba(12, 8, 10, 0.9);
  padding: 0.4rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #e8c8ce;
}

.lv-status {
  margin: 0;
  font-size: 0.74rem;
  color: rgba(210, 200, 208, 0.8);
  min-height: 1.1rem;
}

body.embed-spellforge-wall #panel-spellforge {
  zoom: 0.52;
}

@media (max-width: 860px) {
  .lv-shell {
    height: auto;
    min-height: calc(100vh - 96px);
  }

  .lv-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(22rem, 62vh) auto;
  }

  .lv-fit {
    min-height: 22rem;
  }
}
