/* Aidot Casting — 모바일 퍼스트, Twitch/YouTube Live 톤의 다크 UI */
:root {
  --bg: #0b0f17; --panel: #121826; --elev: #1a2230;
  --border: #232d3f; --text: #e7edf6; --dim: #8fa0b8;
  --accent: #17a3c4; --live: #f8285a; --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text);
  font-family: -apple-system, 'Pretendard', 'Noto Sans KR', sans-serif; }
.view { min-height: 100dvh; display: flex; flex-direction: column; }
.inp { background: var(--elev); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px 14px; font-size: 16px; /* iOS 줌 방지 */ width: 100%; }
.btn-primary { background: var(--accent); color: #04222b; border: 0; border-radius: 10px;
  padding: 12px 18px; font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none;
  display: inline-block; text-align: center; }
.btn-primary.big { width: 100%; padding: 15px; font-size: 16px; }
.btn-danger { background: var(--live); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 16px; font-weight: 800; cursor: pointer; }
.dim { color: var(--dim); font-size: 13px; }

/* ===== 공통 헤더 ===== */
.cast-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: rgba(11,15,23,.92); backdrop-filter: blur(8px); z-index: 10; }
.cast-top h1 { font-size: 17px; margin: 0; flex: 1; }
.brand { color: var(--dim); text-decoration: none; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px; }
.brand .back-ic { flex: none; }
.brand:hover { color: var(--text); }
.live-pill { background: rgba(248,40,90,.15); color: #ff8aa8; border: 1px solid rgba(248,40,90,.4);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 800; }
.live-pill.on { background: var(--live); color: #fff; border: 0; }

/* ===== 디스커버리 ===== */
.home-main { flex: 1; padding: 16px; max-width: 1100px; width: 100%; margin: 0 auto; }
.live-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px)  { .live-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .live-grid { grid-template-columns: repeat(3, 1fr); } }
.live-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .12s, border-color .12s; }
.live-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.live-thumb { aspect-ratio: 16/9; background:
  radial-gradient(circle at 30% 30%, #15314a, #0d1522); display: flex;
  align-items: center; justify-content: center; font-size: 42px; position: relative; }
.live-thumb .live-pill { position: absolute; top: 10px; left: 10px; }
.live-body { padding: 12px 14px; }
.live-body strong { display: block; font-size: 15px; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 70px 20px; color: var(--dim); }
.empty-ic { font-size: 56px; margin-bottom: 12px; }

/* ===== 스튜디오 ===== */
.studio-main { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 14px;
  max-width: 1200px; width: 100%; margin: 0 auto; }
.stage { position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; aspect-ratio: 16/9; border: 1px solid var(--border); }
#studio-preview { width: 100%; height: 100%; object-fit: contain; }
.stage-overlay { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--dim); background: rgba(0,0,0,.4); z-index: 6; }
.stage-overlay[hidden] { display: none !important; }
/* [v0.15.13 근본 수정] display 를 명시한 어떤 요소든 hidden 이 이기도록.
   .view 3종(display:flex)이 hidden 을 무시해 home/studio/watch 가 항상
   겹쳐 보였고 — '방송하기' 를 눌러도 화면이 그대로인 원인이었다. */
[hidden] { display: none !important; }
.studio-panel { display: flex; flex-direction: column; gap: 14px; }
.setup { display: flex; flex-direction: column; gap: 10px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.src-row { display: flex; gap: 8px; }
.src-btn { flex: 1; background: var(--elev); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 14px; cursor: pointer; }
.src-btn.active { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.src-btn.flip { flex: 0 0 auto; }
.onair { display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  flex-wrap: wrap; }
.onair-meta { flex: 1; min-width: 0; }
.onair-meta strong { display: block; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.onair-ctl { display: flex; gap: 8px; align-items: center; }
.ctl { width: 44px; height: 42px; border: 1px solid var(--border); background: var(--elev);
  color: var(--text); border-radius: 10px; cursor: pointer; font-size: 17px; }
.ctl.off { background: rgba(248,40,90,.15); border-color: rgba(248,40,90,.4); }

/* ===== 채팅 (공용) ===== */
.chat { display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  min-height: 200px; max-height: 320px; }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex;
  flex-direction: column; gap: 7px; }
.chat-msg { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.chat-msg b { color: var(--accent); margin-right: 6px; font-size: 12.5px; }
.chat-msg.sys { color: var(--dim); font-size: 12px; }
.chat-form { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--border); }
.chat-form .send { width: 46px; border: 0; border-radius: 9px; background: var(--accent);
  color: #04222b; font-size: 17px; cursor: pointer; }

/* ===== 시청 ===== */
#view-watch { flex-direction: row; height: 100dvh; }
.watch-stage { position: relative; flex: 1; background: #000; min-width: 0; }
#watch-video { width: 100%; height: 100%; object-fit: contain; }
.watch-top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px;
  align-items: center; padding: 12px 14px;
  background: linear-gradient(rgba(0,0,0,.65), transparent); }
.watch-title { flex: 1; font-weight: 800; font-size: 14.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.viewers { font-size: 12.5px; background: rgba(0,0,0,.45); border-radius: 999px;
  padding: 4px 10px; }
.watch-ended { position: absolute; inset: 0; background: rgba(5,8,13,.92); display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.unmute-cta { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px; padding: 13px 22px; font-size: 15px; font-weight: 800; cursor: pointer; }
.react-bar { position: absolute; bottom: calc(14px + var(--safe-b)); left: 50%;
  transform: translateX(-50%); display: flex; gap: 8px;
  background: rgba(10,14,22,.78); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 10px; backdrop-filter: blur(8px); }
.react-bar button { background: none; border: 0; font-size: 22px; cursor: pointer;
  padding: 4px 6px; transition: transform .1s; }
.react-bar button:active { transform: scale(1.35); }
.chat-toggle { font-size: 19px !important; }

/* 플로팅 리액션 */
.reactions { position: absolute; right: 18px; bottom: 70px; width: 60px; height: 55%;
  pointer-events: none; overflow: hidden; }
.float-emo { position: absolute; bottom: -36px; left: 50%; font-size: 28px;
  animation: floatUp 2.6s ease-out forwards; }
@keyframes floatUp {
  0%   { transform: translate(-50%, 0) scale(.7); opacity: 0; }
  12%  { opacity: 1; transform: translate(-50%, -8%) scale(1.1); }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), -480px) scale(1); opacity: 0; }
}

/* 시청 채팅: 데스크톱 사이드 / 모바일 오버레이 시트 */
.watch-chat { width: 340px; background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; }
.chat-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 800;
  font-size: 14px; }
.chat-head button { background: none; border: 0; color: var(--dim); font-size: 15px;
  cursor: pointer; display: none; }
.watch-chat .chat-form { padding-bottom: calc(8px + var(--safe-b)); }

@media (max-width: 820px) {
  #view-watch { flex-direction: column; }
  .watch-chat { position: fixed; inset: auto 0 0 0; height: 55dvh; width: auto;
    border-left: 0; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; transform: translateY(105%);
    transition: transform .22s ease; z-index: 30;
    box-shadow: 0 -12px 36px rgba(0,0,0,.5); }
  .watch-chat.open { transform: translateY(0); }
  .chat-head button { display: block; }
  .studio-main { padding: 10px; }
}
@media (min-width: 821px) {
  .chat-toggle { display: none; }
  .studio-main { display: grid; grid-template-columns: 1fr 360px; align-items: start; }
  .stage { grid-row: span 2; }
}

/* '방송하기' — 메인 '즉시 회의 시작'(hero primary) 색감으로 통일 (v0.15.13) */
#btn-go-studio, #btn-golive {
  background: linear-gradient(135deg, #1976ff 0%, #0c4dab 100%);
  border-color: transparent;
  color: white;
  border-radius: 10px; font-weight: 800; cursor: pointer; }
#btn-go-studio { padding: 10px 16px; }
/* 방송 시작 — 메인 화면 hero 버튼과 동일한 시각 언어(큰 버튼) */
#btn-golive { width: 100%; padding: 14px 18px; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#btn-go-studio:hover, #btn-golive:hover { filter: brightness(1.08); }
#btn-golive:disabled { opacity: .55; cursor: default; filter: none; }

/* ===================== 스튜디오 v2 (v0.16.0) ===================== */
.studio-top { gap: 10px; }
.title-inline { flex: 1; min-width: 0; background: transparent; border: 0;
  border-bottom: 1px dashed var(--border); color: var(--text); font-size: 16px;
  font-weight: 800; padding: 6px 4px; }
.title-inline:focus { outline: none; border-bottom-color: var(--accent); }
.title-inline[readonly] { border-bottom-color: transparent; }
.studio-top .viewers { font-size: 13px; color: var(--dim); white-space: nowrap; }
.btn-danger { background: #e24b4a; color: white; border: 0; border-radius: 9px;
  padding: 9px 14px; font-weight: 800; cursor: pointer; white-space: nowrap; }

.studio2 { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 14px;
  padding: 14px; max-width: 1280px; width: 100%; margin: 0 auto; min-height: 0; }
.stage-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* 스테이지 — 크기 단계 (⤢ 사이클, localStorage 기억) */
.stage { position: relative; background: #000; border-radius: 14px; overflow: hidden;
  aspect-ratio: 16 / 9; width: 100%; margin: 0 auto; transition: max-width .18s; }
.stage.size-s { max-width: 460px; }
.stage.size-m { max-width: 760px; }
.stage.size-l { max-width: 100%; }
.stage video { width: 100%; height: 100%; object-fit: contain; }
.cam-off-ph { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; font-size: 28px;
  color: var(--dim); background: #0a0f16; text-align: center; line-height: 1.5; }
.stat-pill { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55);
  color: #cfe8f5; font-size: 11.5px; border-radius: 999px; padding: 3px 10px;
  backdrop-filter: blur(4px); }

/* 온스크린 컨트롤 — 메인 화상회의 control-btn 과 동일한 시각 언어 */
.osc { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px;
  z-index: 2300;
  justify-content: center; padding: 14px 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.cbtn { background: var(--panel, #141d2b); border: 1px solid var(--border);
  color: var(--text); width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s; }
.cbtn:hover { background: var(--panel-2, #1b2738); }
.cbtn.active { background: var(--accent); border-color: var(--accent); color: #04222b; }
.cbtn.off { background: rgba(226,75,74,.16); border-color: rgba(226,75,74,.5); }
.cbtn.off:hover { background: rgba(226,75,74,.28); }

.setup-card { background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  max-width: 760px; width: 100%; margin: 0 auto; }
.dev-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dev-row label { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; }
.dev-row .sel { flex: 1; background: var(--bg, #0d1522); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px;
  min-width: 0; }

/* 우측 채팅·활동 패널 */
.studio-side { display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; min-height: 0; }
.studio-side .chat-head { display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 800;
  font-size: 14px; }
.studio-side .chat-head .dim { margin-left: auto; font-weight: 400; }
.studio-side .chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; min-height: 0; }
.chat-sys { color: var(--dim); font-size: 12px; padding: 4px 2px; }
.chat-pop { position: absolute; left: 10px; bottom: 70px; max-width: 80%;
  background: rgba(0,0,0,.62); color: #fff; font-size: 12.5px; border-radius: 999px;
  padding: 6px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  backdrop-filter: blur(4px); }
.chat-close { background: none; border: 0; color: var(--dim); font-size: 14px;
  cursor: pointer; }

.mobile-only { display: none !important; }

/* ---------- 모바일 (≤860px) ---------- */
@media (max-width: 860px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  .studio2 { grid-template-columns: 1fr; padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .stage { max-width: 100% !important; border-radius: 10px; }
  .cbtn { width: 48px; height: 48px; }            /* 터치 타깃 */
  .setup-card { padding: 12px; }
  /* 채팅 — 하단 시트 */
  .studio-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: 62dvh; border-radius: 16px 16px 0 0; transform: translateY(105%);
    transition: transform .22s ease; z-index: 60;
    box-shadow: 0 -12px 40px rgba(0,0,0,.5); }
  .studio-side.open { transform: translateY(0); }
  .studio-side .chat-form { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* ===================== v0.17.0 ===================== */
/* LIVE 배지 — 은은한 펄스 (점 + 글로우) */
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,40,90,.45); }
  55% { box-shadow: 0 0 0 7px rgba(248,40,90,0); }
}
@keyframes liveDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
/* v0.18.2: span(inline) 에는 ::first-letter 가 적용되지 않아 점 깜빡임이
   무효였다 → 실제 요소(.dot)로 재구현 + inline-flex 보장 */
.live-pill.on { display: inline-flex; align-items: center; gap: 6px;
  animation: livePulse 2.2s ease-out infinite; }
.live-pill.on .dot { width: 7px; height: 7px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.9);
  animation: liveDot 1.4s ease-in-out infinite; }
.studio-top .viewers.as-btn { background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--text); }
.studio-top .viewers.as-btn:hover { border-color: var(--accent); }

/* 시청자 목록 모달 */
.vw-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9000;
  display: flex; align-items: center; justify-content: center; }
.vw-modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: min(440px, calc(100% - 32px)); max-height: 76dvh; display: flex;
  flex-direction: column; overflow: hidden; }
.vw-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); }
.vw-head .dim { margin-left: auto; }
.vw-x { background: none; border: 0; color: var(--dim); font-size: 15px; cursor: pointer; }
.vw-list { overflow-y: auto; padding: 4px 8px; }
.vw-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-bottom: 1px solid var(--border); }
.vw-row:last-child { border-bottom: 0; }
.vw-main { flex: 1; min-width: 0; }
.vw-main b { display: block; font-size: 14px; }
.vw-main .dim { font-size: 12px; }
.vw-kick { background: rgba(226,75,74,.14); border: 1px solid rgba(226,75,74,.5);
  color: #ffb3b3; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; }
.vw-kick:hover { background: rgba(226,75,74,.26); }
.vw-overlay .inv-pager { display: flex; gap: 12px; align-items: center;
  justify-content: center; padding: 10px; border-top: 1px solid var(--border); }
.vw-overlay .inv-pager button { width: 30px; height: 28px; border-radius: 7px;
  background: var(--bg, #0d1522); color: var(--text); border: 1px solid var(--border);
  cursor: pointer; }

/* 오버레이 레이어/위젯 */
/* 구 위젯 레이어(#ov-layer/#watch-ov-layer) 전용 — 새 엔진(#overlay-layer)과
   셀렉터가 겹치지 않도록 id 로 한정. [v1.4.3] */
#ov-layer.ov-layer, #watch-ov-layer.ov-layer {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
#ov-layer.ov-layer.editing, #watch-ov-layer.ov-layer.editing {
  pointer-events: auto; background: rgba(23,163,196,.04);
  outline: 1.5px dashed rgba(23,163,196,.5); outline-offset: -2px; }
.ovw { position: absolute; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.8);
  font-weight: 800; white-space: nowrap; user-select: none; touch-action: none;
  padding: 4px 8px; border-radius: 8px; }
.ov-layer.editing .ovw { cursor: grab; outline: 1px dashed rgba(255,255,255,.4); }
.ov-layer.editing .ovw.sel { outline: 2px solid var(--accent);
  background: rgba(23,163,196,.12); }
.ovw-clock, .ovw-viewers { background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  font-variant-numeric: tabular-nums; }
.ovw-chatbox { background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  white-space: normal; min-width: 200px; max-width: 46%; font-weight: 400;
  font-size: .82em; line-height: 1.5; }
.ovw-chatbox b { color: #8fdcef; margin-right: 5px; }
.ovw-logo img { display: block; filter: drop-shadow(0 1px 4px rgba(0,0,0,.6)); }

/* 편집 바 */
.ov-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ov-add .spacer { flex: 1; }
.ov-add button[data-ov] { background: var(--bg, #0d1522); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 7px 11px; cursor: pointer;
  font-size: 12.5px; }
.ov-add button[data-ov]:hover { border-color: var(--accent); }
.btn-primary.sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.ov-tools { display: flex; gap: 8px; }
.ov-tools button { background: var(--bg, #0d1522); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.ov-tools button.danger { border-color: rgba(226,75,74,.5); color: #ffb3b3; }

/* ===================== v0.18.0 ===================== */
/* 목록 썸네일 */
.live-thumb { position: relative; overflow: hidden; }
.live-thumb img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 1; }
.live-thumb .thumb-ph { position: relative; z-index: 0; }
.live-thumb .live-pill { z-index: 2; }

/* 방송 종료 모달 */
.ended-modal { align-items: center; text-align: center; padding: 28px 24px; gap: 6px; }
.ended-modal .ended-ic { font-size: 44px; }
.ended-modal h3 { margin: 6px 0 2px; font-size: 18px; }
.ended-modal .btn-primary.big { margin-top: 16px; width: 100%; }

/* SVG 아이콘 버튼 — 수직 정렬/간격 */
.cbtn svg { display: block; }
#btn-golive svg, #btn-endlive svg, #btn-go-studio svg {
  display: inline-block; vertical-align: -4px; margin-right: 7px; }

/* v0.18.3 — 빈 방송 아이콘 전파 점멸 */
.empty-ic svg { display: block; margin: 0 auto 6px; }
.empty-ic .w1, .empty-ic .w2 { animation: bcWave 2.6s ease-in-out infinite; }
.empty-ic .w2 { animation-delay: .45s; }
@keyframes bcWave { 0%, 100% { opacity: .25; } 45% { opacity: 1; } }

/* v0.19.0 — 토스트 / 카드 메타 */
#cast-toast { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 14px);
  background: rgba(16,24,38,.94); color: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 20px; font-size: 13.5px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  box-shadow: 0 8px 28px rgba(0,0,0,.45); }
#cast-toast.show { opacity: 1; transform: translate(-50%, 0); }
.live-meta { display: block; margin-top: 3px; font-size: 12px; }

/* v0.20.1 — 오버레이 프리셋 행 */
.ov-preset-row { display: flex; gap: 8px; align-items: center; }
.ov-preset-row .sel { flex: 1; min-width: 140px; max-width: 260px;
  background: var(--bg, #0d1522); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.ov-preset-row button { background: var(--bg, #0d1522); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; height: 34px; padding: 0 12px; cursor: pointer;
  white-space: nowrap; font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
/* 아이콘 전용 버튼(이름변경·삭제)만 정사각 */
.ov-preset-row #ovp-rename, .ov-preset-row #ovp-del { width: 34px; padding: 0; }
.ov-preset-row button:disabled { opacity: .4; cursor: default; }
.ov-preset-row button.danger { border-color: rgba(226,75,74,.5); color: #ffb3b3; }

/* ===== v0.28.1 ===== */
/* [3] 확인 대화상자 버튼 — 취소(고스트)/확인(주황) 짝 스타일 */
.btn-ghost { background: transparent; color: var(--text, #e7edf5);
  border: 1px solid var(--border, #2a3a52); border-radius: 10px;
  padding: 9px 18px; cursor: pointer; font-size: 14.5px; }
.btn-ghost:hover { border-color: var(--accent, #ff7a2f); color: var(--accent, #ff7a2f); }
.btn-ghost.big { padding: 12px 22px; font-size: 15.5px; min-width: 96px; }
.vw-modal .btn-primary.big { min-width: 96px; }
.m-only { display: none; }

/* [1] 모바일 스튜디오 (v0.28.2 재설계)
   - 방송 전(setup): 설정 패널이 영상 아래에 그대로 보인다(스크롤)
   - ON-AIR: 영상이 남은 화면 전체를 채우고 패널은 숨김 —
     채팅은 💬(sc-chat), 장치는 ⚙️(sc-settings) 아이콘으로 접근 */
@media (max-width: 820px) {
  .studio2 { display: flex; flex-direction: column; gap: 10px; }
  .stage { aspect-ratio: auto; min-height: 44vh; }
  body.onair .studio2 { min-height: calc(100dvh - 118px); }
  body.onair .stage { flex: 1 1 auto; }
  body.onair .studio-side { display: none; }
}


/* ===== 회의 꾸미기 엔진(overlay.js) 공용 스타일 — cast 통합 v1.3.3 ===== */
/* ============================================================
   v1.1.0 — 방송 오버레이(꾸미기) Phase 1
   ============================================================ */
.ov-layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.ov-layer.ov-edit { pointer-events: auto; z-index: 2250; }
.ov-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ov-layer.ov-edit .ov-draw { pointer-events: auto; }

.ov-obj { position: absolute; user-select: none; -webkit-user-select: none;
  touch-action: none; will-change: transform; }
.ov-text { padding: 2px 10px; border-radius: 6px; line-height: 1.25;
  max-width: 80%; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.ov-text.ov-editing { outline: 2px dashed #60a5fa; background: rgba(0,0,0,.35); cursor: text; }
.ov-image { background-repeat: no-repeat; }
.ov-shape svg { display: block; width: 100%; height: 100%; }

.ov-obj.ov-selected { outline: 1.5px solid #60a5fa; outline-offset: 2px; }
.ov-handles { position: absolute; inset: 0; pointer-events: none; }
.ov-handle { position: absolute; width: 14px; height: 14px; background: #fff;
  border: 2px solid #2E6BD6; border-radius: 50%; pointer-events: auto;
  touch-action: none; }
.ov-h-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.ov-h-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.ov-h-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ov-h-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ov-h-rot { left: 50%; top: -28px; transform: translateX(-50%);
  background: #2E6BD6; cursor: grab; }

/* 호스트 편집 툴바 */
.ov-toolbar { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 2200; display: none; align-items: center; gap: 4px; padding: 8px 10px;
  background: rgba(20,24,33,.94); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
  backdrop-filter: blur(8px); max-width: 94vw; flex-wrap: wrap; }
.ov-toolbar .ovt { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 8px;
  border: 1px solid transparent; background: rgba(255,255,255,.06); color: #fff;
  font-size: 16px; cursor: pointer; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center; }
.ov-toolbar .ovt:hover { background: rgba(255,255,255,.14); }
.ov-toolbar .ovt.active { border-color: #60a5fa; background: rgba(96,165,250,.25); }
.ov-toolbar .ovt[data-tool="text"] { font-weight: 800; font-family: serif; }
.ov-toolbar .ovt-act:disabled { cursor: default; }
.ov-toolbar .ovt-sep { width: 1px; height: 24px; background: rgba(255,255,255,.18);
  margin: 0 4px; }
.ov-toolbar .ovt-color { width: 32px; height: 32px; padding: 0; border: none;
  background: none; cursor: pointer; }
.ov-toolbar .ovt-size { width: 80px; }

@media (max-width: 768px) {
  .ov-toolbar { bottom: 78px; gap: 3px; padding: 6px; }
  .ov-toolbar .ovt { min-width: 32px; height: 32px; font-size: 15px; }
  .ov-toolbar .ovt-size { width: 60px; }
}

/* ============================================================
   v1.2.0 — 방송 오버레이 Phase 2 (위젯)
   ============================================================ */
/* 로어서드 */
.ov-l3 { padding: 10px 16px 10px 20px; border-radius: 8px;
  border-left: 5px solid var(--l3-accent, #2E6BD6);
  min-width: 180px; backdrop-filter: blur(4px); }
.ov-l3-title { font-weight: 800; line-height: 1.15; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.ov-l3-sub { font-size: 1.9vh; opacity: .85; margin-top: 2px; color: #cbd5e1; }
.ov-anim-slide .ov-l3 { animation: ovSlideIn .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ovSlideIn { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 배너/티커 (transform translateX marquee) */
.ov-banner-box { overflow: hidden; display: flex; align-items: center;
  border-radius: 4px; }
.ov-banner-track { display: inline-flex; white-space: nowrap; will-change: transform;
  animation: ovMarquee linear infinite; }
.ov-banner-track span { padding: 0 3vw; }
@keyframes ovMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ov-banner-track { animation: none; } }

/* 프레임 */
.ov-frame { box-sizing: border-box; }

/* 타이머 */
.ov-timer-box { display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 10px 22px; border-radius: 12px; gap: 2px;
  backdrop-filter: blur(4px); }
.ov-timer-label { font-size: 2vh; opacity: .85; }
.ov-timer-time { font-weight: 800; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0,0,0,.5); letter-spacing: 1px; }
.ov-timer-done { color: #f87171; animation: ovBlink 1s steps(2) infinite; }
@keyframes ovBlink { 50% { opacity: .35; } }

/* 툴바: 위젯/장면 드롭다운 */
.ovt-menu { position: relative; display: inline-flex; }
.ovt-dropdown { position: absolute; bottom: 44px; left: 0; display: none;
  flex-direction: column; min-width: 200px; padding: 6px; gap: 2px;
  background: rgba(20,24,33,.98); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.ovt-dropdown.open { display: flex; }
.ovt-dropdown > button, .ovt-scene-apply { text-align: left; padding: 8px 10px;
  border: none; background: transparent; color: #e5e7eb; border-radius: 6px;
  cursor: pointer; font-size: 13px; }
.ovt-dropdown > button:hover, .ovt-scene-apply:hover { background: rgba(96,165,250,.22); }
.ovt-scene-list { display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid rgba(255,255,255,.12); margin-top: 4px; padding-top: 4px; }
.ovt-scene-row { display: flex; align-items: center; gap: 4px; }
.ovt-scene-apply { flex: 1; }
.ovt-scene-del { background: transparent; border: none; color: #9ca3af;
  cursor: pointer; padding: 6px; border-radius: 6px; }
.ovt-scene-del:hover { background: rgba(248,113,113,.2); color: #fca5a5; }
.ovt-scene-empty { padding: 8px 10px; color: #9ca3af; font-size: 12px; }

/* ============================================================
   v1.3.0 — 방송 오버레이 Phase 3 (후원/인터랙티브)
   ============================================================ */
/* 알림 슬롯 + 카드 */
.ov-alert-slot { position: absolute; left: 0; right: 0; top: 12%; z-index: 60;
  display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.ov-alert { display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  border-radius: 14px; background: linear-gradient(135deg, rgba(31,41,55,.96), rgba(17,24,39,.96));
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 10px 36px rgba(0,0,0,.5);
  color: #fff; max-width: 80%; opacity: 0; transform: translateY(-30px) scale(.96);
  transition: opacity .4s ease, transform .4s cubic-bezier(.2,.9,.3,1.2); }
.ov-alert-show { opacity: 1; transform: translateY(0) scale(1); }
.ov-alert-hide { opacity: 0; transform: translateY(-30px) scale(.96); }
.ov-alert-emoji { font-size: 5vh; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.ov-alert-title { font-weight: 800; font-size: 2.6vh; }
.ov-alert-msg { font-size: 2vh; opacity: .9; margin-top: 2px; }
.ov-alert-amount { font-size: 2.8vh; font-weight: 800; color: #ffd166; margin-top: 4px; }
.ov-alert-donation { border-color: rgba(255,209,102,.5); }
.ov-alert-follow { border-color: rgba(96,165,250,.5); }

/* 컨페티 */
.ov-confetti { position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px;
  opacity: .95; animation: ovConfetti 1.8s ease-in forwards; }
@keyframes ovConfetti {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--cx), var(--cy)) rotate(var(--cr)); opacity: 0; } }

/* 리액션 플로팅 */
.ov-reaction { position: absolute; bottom: 8%; z-index: 58; pointer-events: none;
  animation: ovFloatUp 3s ease-out forwards; will-change: transform, opacity; }
@keyframes ovFloatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-10%) scale(1.1); }
  100% { transform: translateY(-75vh) scale(1); opacity: 0; } }

/* 목표 게이지 */
.ov-goal { padding: 10px 14px; border-radius: 12px; background: rgba(17,24,39,.86);
  backdrop-filter: blur(4px); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.ov-goal-top { display: flex; justify-content: space-between; align-items: baseline;
  color: #fff; margin-bottom: 6px; gap: 10px; }
.ov-goal-label { font-weight: 700; font-size: 1.9vh; }
.ov-goal-num { font-size: 1.7vh; opacity: .85; font-variant-numeric: tabular-nums; }
.ov-goal-bar { height: 14px; border-radius: 8px; background: rgba(255,255,255,.14); overflow: hidden; }
.ov-goal-fill { height: 100%; border-radius: 8px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* 투표 */
.ov-poll { padding: 12px 14px; border-radius: 12px; background: rgba(17,24,39,.88);
  backdrop-filter: blur(4px); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.ov-poll-q { font-weight: 800; font-size: 2vh; margin-bottom: 8px; }
.ov-poll-row { margin-bottom: 6px; }
.ov-poll-opt { font-size: 1.7vh; margin-bottom: 2px; }
.ov-poll-track { position: relative; height: 18px; border-radius: 6px;
  background: rgba(255,255,255,.12); overflow: hidden; }
.ov-poll-fill { height: 100%; background: linear-gradient(90deg,#60a5fa,#2E6BD6);
  transition: width .5s ease; }
.ov-poll-pct { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 1.4vh; font-weight: 700; }

/* 채팅 오버레이 */
.ov-chat-overlay { position: absolute; left: 16px; bottom: 96px; z-index: 56;
  display: none; flex-direction: column; gap: 4px; max-width: 38%;
  pointer-events: none; }
.ov-chat-row { background: rgba(17,24,39,.72); border-radius: 10px; padding: 5px 10px;
  color: #fff; font-size: 1.7vh; backdrop-filter: blur(3px); animation: ovChatIn .3s ease;
  word-break: break-word; }
.ov-chat-name { font-weight: 800; color: #60a5fa; margin-right: 6px; }
@keyframes ovChatIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ov-confetti, .ov-reaction { animation-duration: .01s; }
}

/* v1.3.4 — 방송자 리액션 바 + 오버레이 프리셋 카드 */
.studio-react-bar {
  bottom: calc(64px + var(--safe-b));   /* 컨트롤 바 위로 띄움 */
  z-index: 2350;
  background: rgba(20,24,33,.92);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(8px);
  z-index: 30;
}
.ov-preset-card { margin-top: 8px; }
.ov-preset-row { flex-wrap: wrap; }
.ov-preset-row #ovp-apply { background: #2E6BD6; border-color: #2E6BD6; color: #fff; }
.ov-preset-row #ovp-apply:hover { background: #3a78e0; }
#sc-react.active { background: rgba(239,71,111,.3); }

/* v1.3.5 — 방송 공용 대화상자(alert/prompt/confirm 대체) */
.cast-dialog { min-width: 280px; max-width: 90vw; padding: 20px; }
.cast-dlg-title { margin: 0 0 8px; font-size: 17px; }
.cast-dlg-msg { margin: 0 0 14px; color: var(--dim, #9fb0c0); font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; }
.cast-dlg-input { width: 100%; box-sizing: border-box; margin-bottom: 12px;
  background: var(--bg, #0d1522); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.cast-dlg-input:focus { outline: none; border-color: #2E6BD6; }
.cast-dlg-btns { display: flex; gap: 10px; justify-content: flex-end; }
.cast-dlg-btns .danger { background: #e24b4a; border-color: #e24b4a; }


/* v1.3.7 — 대화상자 버튼: 명확한 대비 + 통일 레이아웃 */
/* 대화상자 오버레이는 항상 최상위(꾸미기 툴바/컨트롤바 위) */
.cast-dialog-ov, .vw-overlay.cast-dialog-ov { z-index: 9000 !important; }

/* 확인/취소 버튼 짝 — .vw-modal 내부 */
.vw-modal .btn-primary,
.vw-modal .btn-primary.big {
  background: #2E6BD6; color: #fff; border: 0; border-radius: 10px;
  padding: 11px 20px; font-weight: 700; font-size: 15px; min-width: 104px;
  width: auto; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; line-height: 1; transition: background .15s ease; }
.vw-modal .btn-primary:hover { background: #3a78e0; }
.vw-modal .btn-primary.danger { background: #e24b4a; }
.vw-modal .btn-primary.danger:hover { background: #ef5a59; }

.vw-modal .btn-ghost,
.vw-modal .btn-ghost.big {
  background: transparent; color: #cbd5e1; border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px; padding: 11px 20px; font-weight: 600; font-size: 15px;
  min-width: 104px; width: auto; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; line-height: 1;
  transition: border-color .15s ease, color .15s ease; }
.vw-modal .btn-ghost:hover { border-color: rgba(255,255,255,.5); color: #fff; }

/* 버튼 행 정렬 통일 */
.ended-modal .btn-primary.big { width: 100%; min-width: 0; margin-top: 18px; }
.cast-dialog .cast-dlg-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.cast-dialog .cast-dlg-btns button { min-width: 96px; }

/* v1.5.0 — 텍스트 속성 패널 (글꼴/크기/굵기/정렬) */
.ov-toolbar .ovt-textprops { display: inline-flex; align-items: center; gap: 3px; }
.ov-toolbar .ovt-font {
  height: 32px; border-radius: 8px; padding: 0 6px; font-size: 12.5px;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
  max-width: 92px; cursor: pointer; }
.ov-toolbar .ovt-font option { background: #1f2937; color: #fff; }
.ov-toolbar .ovt-fontsize { min-width: 32px; font-weight: 700; }
.ov-toolbar .ovt-fsval { min-width: 22px; text-align: center; font-size: 12.5px;
  color: #cbd5e1; font-variant-numeric: tabular-nums; }
.ov-toolbar .ovt-bold.active,
.ov-toolbar .ovt-align.active { border-color: #60a5fa; background: rgba(96,165,250,.28); }
