/* 실시간 참여: live.html(휴대폰) + live-host.html(진행 화면) */

/* ---------- 휴대폰 ---------- */

.lv-phone { min-height: 100dvh; }
.lv-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--navy);
  color: #fff;
  font-size: 0.95rem;
  gap: 10px;
}
.lv-net { flex: none; font-size: 0.75rem; color: #9fe3b7; white-space: nowrap; }
.lv-net.off { color: #ffb3ba; }

.lv-main { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.lv-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
  background: var(--paper);
  border-radius: 24px;
  border-top: 8px solid var(--blue);
  box-shadow: 0 6px 20px rgb(31 26 94 / 0.1);
}
.lv-title { font-size: 1.45rem; line-height: 1.4; word-break: keep-all; }
.lv-note { margin: 0; color: var(--muted); }

.lv-scale { display: flex; gap: 8px; }
.lv-scale .lv-opt { flex: 1; min-width: 0; padding: 0; font-family: var(--font-head); font-size: 1.4rem; }
.lv-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 0.9rem; }
.lv-ends span:last-child { text-align: right; }
.lv-choices { display: flex; flex-direction: column; gap: 10px; }

.lv-opt {
  min-height: 56px;
  padding: 10px 16px;
  border: 3px solid var(--blue-soft);
  border-radius: 16px;
  background: var(--paper);
  color: var(--navy);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.lv-scale .lv-opt { text-align: center; }
.lv-opt.on { border-color: var(--blue); background: var(--blue); color: #fff; }

.lv-form { display: flex; flex-direction: column; gap: 18px; }
.lv-words { display: flex; flex-direction: column; gap: 10px; }
.lv-input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 3px solid var(--blue-soft);
  border-radius: 14px;
  font: inherit;
  font-size: 1.1rem; /* 16px 넘게: 아이폰이 저절로 확대하지 않게 */
}
.lv-input:focus { outline: none; border-color: var(--blue); }
.lv-area { resize: vertical; }
.lv-count { display: block; text-align: right; color: var(--muted); font-size: 0.85rem; }
.lv-send { width: 100%; }
.lv-send:disabled { opacity: 0.45; box-shadow: none; }

.lv-done { border-top-color: var(--green); }
.lv-check { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--green); }
.lv-mine { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-weight: 700; word-break: break-all; }
.lv-mine small { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 600; }

.lv-wait { align-items: center; text-align: center; padding-block: 40px; }
.lv-dots { display: flex; gap: 8px; }
.lv-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); animation: lv-bounce 1.2s infinite ease-in-out; }
.lv-dots i:nth-child(2) { animation-delay: 0.15s; background: var(--red); }
.lv-dots i:nth-child(3) { animation-delay: 0.3s; background: var(--yellow); }
@keyframes lv-bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .lv-dots i { animation: none; } }

/* ---------- 진행 화면 ---------- */

.lv-host {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  min-height: 100vh;
  padding: 16px;
}
.lv-host > .login-box { grid-column: 1 / -1; }
.lv-presenting .lv-host { grid-template-columns: 1fr; }
.lv-presenting .lv-side { display: none; }

.lv-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgb(31 26 94 / 0.08);
  max-height: calc(100vh - 32px);
  position: sticky;
  top: 16px;
  overflow: auto;
}
.lv-side-head { display: flex; align-items: center; justify-content: space-between; }
.lv-side-head h2 { font-size: 1.3rem; }
.lv-side-link { margin-top: auto; color: var(--muted); font-size: 0.9rem; }
.lv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lv-item { border: 2px solid var(--line); border-radius: 14px; overflow: hidden; }
.lv-item.on { border-color: var(--blue); background: var(--blue-soft); }
.lv-item-main {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}
.lv-num {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.85rem;
}
.lv-item-text small { display: block; color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.lv-item-tools { display: flex; justify-content: flex-end; gap: 2px; padding: 0 6px 6px; }
.lv-item-tools button {
  width: 32px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.lv-item-tools button:hover:not(:disabled) { background: var(--paper); color: var(--navy); }
.lv-item-tools button:disabled { opacity: 0.3; cursor: default; }

.lv-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 24px 32px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgb(31 26 94 / 0.08);
}

.lv-join {
  display: flex;
  align-items: center;
  gap: 18px;
  align-self: flex-start;
  padding: 12px 20px 12px 12px;
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  cursor: zoom-in;
}
.lv-qr { width: 104px; height: 104px; padding: 6px; background: #fff; border-radius: 10px; box-sizing: content-box; }
.lv-qr:empty { display: none; }
.lv-qr img, .lv-qr canvas, .lv-qr-big img, .lv-qr-big canvas { display: block; }
.lv-join p { margin: 0; }
.lv-join-label { font-weight: 700; opacity: 0.85; }
.lv-join-url { font-family: var(--font-head); font-size: clamp(1.4rem, 2.4vw, 2.2rem); font-weight: 800; letter-spacing: -0.01em; word-break: break-all; }
.lv-join-hint { font-size: 0.85rem; opacity: 0.7; }
.lv-qr-dialog { text-align: center; }
.lv-qr-dialog .lv-join-url { color: var(--navy); margin: 12px 0; }
.lv-qr-big { display: inline-block; padding: 12px; background: #fff; }

.lv-q { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.lv-q-head { display: flex; align-items: center; gap: 14px; }
.lv-badge { padding: 6px 14px; border-radius: 999px; background: var(--line); color: var(--muted); font-weight: 800; }
.lv-badge.on { background: var(--green-soft); color: var(--green); }
.lv-total { margin-left: auto; font-size: 1.2rem; color: var(--muted); }
.lv-total b { font-family: var(--font-head); font-size: 2.2rem; color: var(--navy); margin-right: 4px; }
.lv-q-title { font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: 1.3; word-break: keep-all; }

.lv-empty, .lv-hidden {
  flex: 1;
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 300px;
  text-align: center;
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 700;
  border: 3px dashed var(--line);
  border-radius: var(--radius);
}

.lv-result { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.lv-avg { margin: 0; font-size: 1.3rem; color: var(--muted); font-weight: 700; }
.lv-avg b { font-family: var(--font-head); font-size: 2.4rem; color: var(--navy); }
.lv-cols {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(8px, 2vw, 28px);
  min-height: 150px;
}
.lv-col { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: center; min-width: 0; }
.lv-col-n { font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.lv-col-track { flex: 1; display: flex; align-items: flex-end; min-height: 60px; border-bottom: 3px solid var(--line); }
.lv-col-bar { width: 100%; min-height: 4px; border-radius: 10px 10px 0 0; transition: height 0.5s ease; }
.lv-col-label { font-weight: 700; font-size: 1.1rem; line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
.lv-ends-big { font-size: 1.1rem; font-weight: 700; }

.lv-cloud {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 6px 22px;
  min-height: 320px;
  padding: 12px;
}
.lv-word { font-weight: 800; line-height: 1.1; }

.lv-texts { columns: 3 260px; column-gap: 14px; }
.lv-text {
  break-inside: avoid;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border-left: 6px solid var(--c);
  background: var(--bg);
  font-size: 1.15rem;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.lv-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding-top: 6px; border-top: 2px solid var(--line); }
.lv-controls .btn:disabled { opacity: 0.4; }

.lv-edit { width: min(920px, 94vw); max-height: 92vh; overflow: auto; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.lv-edit[open] { display: flex; }
.lv-label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; color: var(--navy); }
.lv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lv-field {
  min-height: 46px;
  padding: 8px 12px;
  border: 2px solid var(--blue-soft);
  border-radius: 12px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}
.lv-field:focus { outline: none; border-color: var(--blue); }

/* 노트북·프로젝터: 한 화면에 다 들어오게 (결과 막대가 남은 높이만큼 늘어나요) */
@media (min-width: 901px) {
  .lv-host { height: 100vh; }
  .lv-stage { overflow: auto; }
}
@media (max-width: 900px) {
  .lv-host { grid-template-columns: 1fr; }
  .lv-side { position: static; max-height: none; }
  .lv-stage { padding: 18px 16px; }
}

/* ---------- 베트남어 함께 보기 ---------- */
/* 한국어 아래 줄에 조금 작게. 글꼴은 베트남어 성조 글자가 있는 본문 글꼴로 */
.vi { display: block; margin-top: 2px; font-family: var(--font); font-size: 0.82em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.lv-bar .vi, .lv-bar span[lang="vi"] { display: inline; font-weight: 500; opacity: 0.8; }
.lv-title .vi { font-size: 0.72em; margin-top: 6px; line-height: 1.45; }
.lv-opt.on .vi { color: rgb(255 255 255 / 0.85); }
.lv-scale .lv-opt { min-height: 60px; }
.lv-two-btn { flex-direction: column; gap: 0; padding-block: 6px; }
.lv-two-btn .vi { margin: 0; }
.lv-ends .vi { font-size: 0.85em; }
.lv-q-title .vi { font-size: 0.6em; margin-top: 8px; line-height: 1.4; font-weight: 700; color: var(--blue); }
.lv-col-label .vi { font-size: 0.85em; }
.lv-ends-big .vi { font-size: 0.85em; }
.lv-vi-tools { display: flex; justify-content: flex-end; }
.lv-vi-tools a { font-size: 0.85rem; color: var(--blue); }

/* ---------- 태블릿 (세로 768px 이상) : 글자·버튼을 조금 더 크게 ---------- */
@media (min-width: 700px) {
  .lv-main { max-width: 720px; padding: 32px 24px 48px; }
  .lv-card { padding: 36px 32px; gap: 20px; }
  .lv-title { font-size: 1.9rem; }
  .lv-opt { min-height: 64px; font-size: 1.25rem; }
  .lv-scale .lv-opt { min-height: 76px; font-size: 1.7rem; }
  .lv-choices { display: grid; grid-template-columns: 1fr 1fr; }
  .lv-input { font-size: 1.25rem; }
  .lv-note { font-size: 1.1rem; }
}
/* 아주 좁은 휴대폰(360px 아래): 척도 버튼이 10개여도 한 줄에 */
@media (max-width: 360px) {
  .lv-scale { gap: 4px; }
  .lv-scale .lv-opt { font-size: 1.15rem; border-width: 2px; }
}
/* 척도 눈금이 6개 넘으면 두 줄로 나눠도 되게 */
.lv-scale { flex-wrap: wrap; }
.lv-scale .lv-opt { flex: 1 0 calc(20% - 8px); }

/* ---------- 문항 여러 개 척도 · 퀴즈 정답 ---------- */
.lv-items { display: flex; flex-direction: column; gap: 18px; }
.lv-item-q { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 2px dashed var(--line); }
.lv-item-name { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.lv-miss { border-top-color: var(--red); }
.lv-wrong { margin: 0; font-size: 1.5rem; font-weight: 800; color: #c9505c; }
.lv-answer { background: var(--green-soft); }

/* 진행 화면: 문항별 평균 가로 막대 */
.lv-bars { justify-content: center; gap: 22px; }
.lv-bar-row { display: flex; flex-direction: column; gap: 8px; }
.lv-bar-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lv-bar-name { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.lv-bar-avg { font-family: var(--font-head); font-size: 2.2rem; color: var(--navy); line-height: 1; }
.lv-bar-track { height: 18px; border-radius: 999px; background: var(--line); overflow: hidden; }
.lv-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.lv-bar-scale { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; }

/* 퀴즈 정답 공개 */
.lv-revealed .lv-col.wrong { opacity: 0.35; }
.lv-col.right .lv-col-n { color: var(--green); font-size: 1.3rem; }
.lv-col.right .lv-col-label { color: var(--green); }

/* ---------- 언어 고르기 ---------- */
.lv-langs { align-items: stretch; text-align: center; }
.lv-langs .lv-note { margin-top: -10px; }
.lv-lang { text-align: center; font-size: 1.35rem; min-height: 64px; }
.lv-lang-btn {
  flex: none;
  padding: 6px 10px;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.lv-bar b { flex: 1; min-width: 0; }

/* ---------- 언어 3개 (진행 화면) ---------- */
.lv-langs-count { display: flex; gap: 10px; margin-left: auto; color: var(--muted); font-weight: 700; font-size: 0.95rem; }
.lv-langs-count span { padding: 4px 10px; border-radius: 999px; background: var(--bg); }
.lv-langs-count + .lv-total { margin-left: 12px; }
.lv-text-lang { display: block; margin-top: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.lv-sub { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.lv-sub select { min-height: 40px; padding: 0 10px; border: 2px solid var(--line); border-radius: 999px; font: inherit; background: var(--paper); color: var(--ink); }
.lv-edit-part { display: flex; flex-direction: column; gap: 12px; }
.lv-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lv-vi-tools { gap: 14px; }
.lv-q-title .vi + .vi { margin-top: 2px; }
@media (max-width: 700px) { .lv-grid3 { grid-template-columns: 1fr; } }
/* 질문 고치기 창: 확인 창(좁고 가운데 정렬) 모양을 넓게 풀어요 */
dialog.lv-edit { max-width: none; text-align: left; }
dialog.lv-edit p.muted, dialog.lv-edit p.login-error { margin: 0; font-family: var(--font); font-size: 0.9rem; font-weight: 600; line-height: 1.5; }
dialog.lv-edit h2 { text-align: center; }

/* ---------- 번역 (워드클라우드·개별 답변) ---------- */
.lv-word { cursor: pointer; }
.lv-word.tr { text-decoration: underline dotted rgb(0 0 0 / 0.25); text-underline-offset: 0.18em; text-decoration-thickness: 2px; }
.lv-cloud-hint, .lv-pending { margin: 0; text-align: center; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.lv-text-ko { display: block; margin-top: 4px; color: var(--blue); font-weight: 700; }

/* ---------- 자동 진행 · 남은 시간 ---------- */
.lv-countdown { padding: 6px 14px; border-radius: 999px; background: var(--blue-soft); color: var(--navy); font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; }
.lv-countdown.hurry { background: var(--red-soft); color: #c9505c; }
.lv-countdown[hidden] { display: none; }
.lv-auto { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.lv-auto h3 { font-size: 0.95rem; color: var(--navy); }
.lv-auto label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; cursor: pointer; }
.lv-auto input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); }
.lv-auto-num { width: 56px; min-height: 30px; padding: 0 6px; border: 2px solid var(--line); border-radius: 8px; font: inherit; text-align: center; }
.lv-auto p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
/* 휴대폰 남은 시간 */
.lv-timer { align-self: flex-start; margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--blue-soft); color: var(--navy); font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; }
.lv-timer.hurry { background: var(--red-soft); color: #c9505c; }
.lv-me { flex: none; font-size: 0.8rem; opacity: 0.85; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 대기 화면 ---------- */
.lv-stage-lobby .lv-join { align-self: center; padding: 18px 28px 18px 18px; gap: 26px; }
.lv-stage-lobby .lv-qr { width: 220px; height: 220px; }
.lv-stage-lobby .lv-join-url { font-size: clamp(2rem, 4vw, 3.4rem); }
.lv-lobby { flex: 1; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.lv-lobby-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lv-lobby-head h1 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
.lv-lobby-count { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.lv-lobby-count b { font-family: var(--font-head); font-size: 2.6rem; color: var(--navy); margin-right: 6px; }
.lv-names { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; overflow: auto; min-height: 80px; }
.lv-name { padding: 8px 16px; border-radius: 999px; background: var(--bg); border: 2px solid var(--c); color: var(--navy); font-weight: 800; font-size: 1.1rem; }
.lv-name.fresh { animation: lv-pop 0.35s ease; }
@keyframes lv-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lv-name.fresh { animation: none; } }
.lv-lobby-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
