/* 따스히 소통 카드 v3 추가 스타일 — 분류 칩, 출처, 조건 띠, 꼬리 질문, 헤더 배지, 설정 패널.
   색·글꼴·크기는 style.css의 :root 변수만 쓴다. */

/* ---------- 카드 머리: 태그 + 별풍선 개수 ---------- */
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
/* 이 카드가 나오는 별풍선 개수 (⚙에서 별풍선으로 받기를 켰을 때만) */
.card__balloon {
  font-family: var(--font-head);
  font-size: var(--fs-tag);
  color: var(--ink);
  background: var(--sun-soft);
  border: 2px solid var(--sun);
  padding: 3px 14px;
  border-radius: var(--radius-pill);
}

/* ---------- 밸런스: 조건 띠 ---------- */
.twist {
  margin: 0;
  max-width: 100%;
  font-family: var(--font-head);
  font-size: 22px;
  line-height: 1.35;
  color: var(--ink);
  background: var(--sun-soft);
  border: 2px dashed var(--sun);
  padding: 10px 22px;
  border-radius: 16px;
  word-break: keep-all;
}
.twist.is-pop { animation: twist-pop 0.42s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes twist-pop {
  from { opacity: 0; transform: scale(0.86) translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 토크: 꼬리 질문 ---------- */
.talk__more { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; width: min(640px, 100%); }
.talk__more:empty { display: none; }
.talk__more li {
  position: relative;
  text-align: left;
  font-size: var(--fs-body);
  line-height: 1.45;
  padding: 10px 16px 10px 42px;
  background: var(--sky-50);
  border: 2px solid var(--sky-100);
  border-radius: 16px;
  word-break: keep-all;
}
.talk__more li::before {
  content: '↳';
  position: absolute;
  left: 15px;
  top: 9px;
  font-family: var(--font-head);
  color: var(--sky-600);
}
.talk__more li.is-new { animation: rise 0.3s ease-out; }

/* ---------- 헤더: 방송 화면 숨김 배지 ---------- */
.hidden-badge {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--blush-deep);
  background: var(--white);
  border: 2px solid var(--blush);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

/* ---------- 헤더: 설정 버튼 ---------- */
.gear {
  font-family: var(--font-head);
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--cloud);
  border: 2px solid var(--sky-200);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.gear:hover { background: var(--sky-100); color: var(--ink); }
.gear.is-active { background: var(--sky-500); border-color: var(--sky-500); color: var(--white); }

/* ---------- 설정 패널 ---------- */
.settings-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 8px 32px 24px;
}
.settings { width: min(1180px, 100%); align-items: stretch; text-align: left; gap: 14px; padding: 20px 26px 22px; }
.settings__head { display: flex; align-items: center; gap: 12px; }
.settings__head .card__title { flex: 1; font-size: 26px; }
.settings__saved {
  font-family: var(--font-head);
  font-size: 15px;
  color: var(--mint-deep);
  background: var(--mint);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}
.settings__offline { margin: 0; font-size: var(--fs-body); color: var(--ink-soft); }
.settings__offline code { font-family: var(--font-body); background: var(--sky-100); padding: 2px 8px; border-radius: 8px; }
.settings__body { display: grid; gap: 18px; }
/* 설정 한 칸 = 하늘색 상자 하나. 칸끼리 또렷하게 나뉘고, 흰 입력칸이 도드라진다. */
.set {
  display: grid;
  gap: 8px;
  padding: 12px 18px 14px;
  background: var(--sky-50);
  border: 2px solid var(--sky-100);
  border-radius: 18px;
  transition: background 0.15s;
}
.set h3 { margin: 0; font-family: var(--font-head); font-weight: 400; font-size: 20px; color: var(--ink); }
.set__title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.set__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 16px; color: var(--ink); }
.set__arrow { font-family: var(--font-head); font-size: 16px; color: var(--sky-700); }
/* 스위치가 꺼진 칸: 상자는 하얗게, 내용은 흐리게 (값은 미리 바꿔둘 수 있다) */
.set.is-off { background: var(--white); }
.set.is-off > :not(.set__title) { opacity: 0.45; }
.set__field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.settings input[type='text'],
.settings input[type='number'],
.settings input[type='password'],
.settings select {
  font: inherit;
  font-size: 16px;
  min-height: 38px;
  padding: 5px 10px;
  border: 2px solid var(--sky-300);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}
.settings input[type='number'] { width: 90px; }
.settings input[type='password'] { width: 170px; }
.settings input:focus,
.settings select:focus { outline: 3px solid var(--sky-200); outline-offset: 1px; border-color: var(--sky-500); }
.settings input:disabled { background: var(--sky-50); color: var(--ink-soft); }
.settings input.is-invalid { border-color: var(--blush-deep); background: var(--blush); }
.settings .btn { min-height: 38px; font-size: 16px; padding: 0 16px; }
.settings .btn:not(.btn--primary):not(.btn--ghost) { background: var(--white); border: 2px solid var(--sky-300); }
.settings .btn:not(.btn--primary):not(.btn--ghost):hover { background: var(--sky-100); }
.settings .btn--stop,
.settings .btn--stop:hover { background: var(--blush); border-color: var(--blush-deep); color: var(--blush-deep); }
.settings .btn--stop:hover { background: #ffc2cf; }
/* SOOP 연동 상태: 점 색으로 꺼짐(회색)·기다림(노랑)·연동 중(초록)·다시 붙는 중(분홍) */
.set__status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-head);
  font-size: 17px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--white);
  border: 2px solid var(--sky-200);
  color: var(--ink-soft);
  word-break: keep-all;
}
.set__status::before { content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%; background: #b8c3d1; }
.set__status[data-state='live'] { background: var(--mint); border-color: var(--mint-deep); color: var(--mint-deep); }
.set__status[data-state='live']::before { background: var(--mint-deep); box-shadow: 0 0 0 4px rgba(46, 158, 107, 0.2); }
.set__status[data-state='retrying'] { background: var(--blush); border-color: var(--blush-deep); color: var(--blush-deep); }
.set__status[data-state='retrying']::before { background: var(--blush-deep); }
.set__status[data-state='checking'],
.set__status[data-state='waiting'],
.set__status[data-state='connecting'] { background: var(--sun-soft); border-color: var(--sun); color: var(--ink); }
.set__status[data-state='checking']::before,
.set__status[data-state='waiting']::before,
.set__status[data-state='connecting']::before { background: #f0b429; }
.set__help { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-soft); word-break: keep-all; }
.set__help b { color: var(--ink); font-weight: 400; font-family: var(--font-head); }
.set__help code,
.set__url {
  font-family: var(--font-body);
  background: var(--sky-100);
  padding: 2px 8px;
  border-radius: 8px;
  color: var(--ink);
  word-break: break-all;
}
.set__rules,
.set__commands { display: grid; gap: 8px; }
.set__rule,
.set__cmd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; }
.set__cmd input[type='text'] { width: 150px; }
/* 켜짐/꺼짐 스위치: 진짜 체크박스는 투명하게 겹쳐 두고(키보드·저장 그대로) 옆에 큰 손잡이를 그린다 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch__text { font-family: var(--font-head); font-size: 16px; min-width: 2.6em; text-align: right; }
.switch__on { display: none; color: var(--sky-700); }
.switch__off { color: var(--ink-soft); }
.switch input:checked ~ .switch__text .switch__on { display: inline; }
.switch input:checked ~ .switch__text .switch__off { display: none; }
.switch__track {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: #cdd6e1;
  transition: background 0.15s;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(43, 58, 78, 0.25);
  transition: transform 0.15s;
}
.switch input:checked ~ .switch__track { background: var(--sky-500); }
.switch input:checked ~ .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible ~ .switch__track { outline: 3px solid var(--sky-300); outline-offset: 2px; }

@media (max-width: 760px) {
  .settings-wrap { padding: 6px 16px 16px; }
  .settings { padding: 22px 16px; }
  .set { padding: 12px 12px 14px; }
  .set__cmd input[type='text'] { width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .twist.is-pop,
  .talk__more li.is-new { animation: none !important; }
}

@media (max-width: 760px) {
  .twist { font-size: 18px; padding: 8px 16px; }
  .talk__more li { font-size: 17px; }
}

/* ---------- v4 운세: ~~행운의 숫자~~ 용돈받을 숫자 · ~~행운의 시간~~ 용돈시간 ---------- */
.fortune__lucky-k s { color: var(--ink-faint); text-decoration-thickness: 2px; margin-right: 2px; }

/* ---------- v4 설정 패널: 페이지 탭, 체크 목록, 겹침 안내 ---------- */
.settings__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--sky-100);
  border-radius: var(--radius-pill);
}
.settings__tab {
  flex: 1 1 auto;
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.settings__tab:hover { color: var(--ink); background: var(--white); }
.settings__tab.is-active { background: var(--sky-500); color: var(--white); box-shadow: 0 3px 0 var(--sky-600); }
/* 두 단: 칸마다 들어갈 단이 정해져 있다(높이가 바뀌어도 다른 단으로 옮겨 가지 않게). 좁으면 한 단. */
.settings__page { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 12px 14px; align-items: start; }
.set-col { display: grid; gap: 12px; min-width: 0; }
.set__row .set__note { white-space: nowrap; }
.set__checks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 2px solid var(--sky-200);
  color: var(--ink-soft);
  cursor: pointer;
}
.check:has(input:checked) { background: var(--sky-100); border-color: var(--sky-500); color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--sky-500); }
.check:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }
.set__note { margin: 0; font-family: var(--font-head); font-size: 15px; color: var(--blush-deep); }
.set__help kbd,
.set__help code { font-family: var(--font-body); background: var(--sky-100); padding: 0 6px; border-radius: 6px; white-space: nowrap; }

/* ---------- v4: ⚙ 아이콘, 운세 탭 숫자 배지, 운세 화면 + 시청자 운세보관함 ---------- */
.gear { width: 46px; height: 46px; padding: 0; display: inline-grid; place-items: center; }
.gear svg { width: 24px; height: 24px; }
.tab { position: relative; }
.tab__badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 13px;
  line-height: 1;
  color: var(--white);
  background: var(--blush-deep);
  border: 2px solid var(--white);
  border-radius: var(--radius-pill);
}
.fortune-layout { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 20px; }
.inbox {
  flex: 0 1 300px;
  display: grid;
  gap: 10px;
  padding: 18px 18px 16px;
  text-align: left;
  background: var(--white);
  border: 2px solid var(--sky-200);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.inbox__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inbox__title { margin: 0; font-family: var(--font-head); font-weight: 400; font-size: 20px; color: var(--ink); }
.inbox__count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  margin-left: 4px;
  font-size: 15px;
  color: var(--white);
  background: var(--sky-500);
  border-radius: var(--radius-pill);
}
.inbox__clear { min-height: 34px; padding: 0 12px; font-size: 15px; }
.inbox__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 460px; overflow-y: auto; }
.inbox__item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  background: var(--sky-50);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}
.inbox__item:hover { border-color: var(--sky-300); background: var(--white); }
.inbox__item b { font-family: var(--font-head); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox__item span { flex: none; font-size: 13px; color: var(--ink-soft); }
.inbox__empty,
.inbox__hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-faint); word-break: keep-all; }
.inbox__hint kbd { font-family: var(--font-body); background: var(--sky-100); padding: 0 6px; border-radius: 6px; }
@media (max-width: 1240px) {
  .inbox { flex-basis: 100%; max-width: 840px; }
  .inbox__list { max-height: 200px; }
}

/* ---------- v4: 자동 넘기기 안내 줄 (조작 화면 카드 아래) ---------- */
.card__auto { margin: -4px 0 0; font-family: var(--font-head); font-size: 15px; color: var(--ink-soft); }
.card__auto.is-paused { color: var(--blush-deep); }

/* ---------- v5: 채팅 투표 타이머 ---------- */
.vote-timer { display: flex; align-items: center; gap: 12px; width: min(560px, 100%); }
.vote-timer__bar { flex: 1; height: 12px; border-radius: var(--radius-pill); background: var(--sky-100); overflow: hidden; }
.vote-timer__bar i { display: block; height: 100%; border-radius: inherit; background: var(--sky-500); transition: width 0.25s linear; }
.vote-timer__text { font-family: var(--font-head); font-weight: 400; font-size: 24px; color: var(--sky-700); min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.vote-timer.is-low .vote-timer__bar i { background: var(--blush-deep); }
.vote-timer.is-low .vote-timer__text { color: var(--blush-deep); }
@media (prefers-reduced-motion: reduce) {
  .vote-timer__bar i { transition: none; }
}

/* ---------- 카드 위 작은 돌고래 (js/lib/mascot.js) — 카드 윗변에 엎드려 있다 ---------- */
.mascot {
  position: absolute;
  top: 2px;
  width: 64px;
  transform: translateY(-82%);
  pointer-events: none;
  z-index: 1;
}
.mascot--right { right: 34px; }
.mascot--left { left: 34px; }
.mascot__svg { display: block; width: 100%; height: auto; }
.ov .mascot { width: 76px; }
@media (max-width: 760px) {
  .mascot { width: 48px; right: 20px; }
  .mascot--left { left: 20px; right: auto; }
}
/* 카드 왼쪽 위: 시청자가 이 카드를 부르는 방법 (운세·밸런스·토크·퀴즈 같은 자리) */
.card__corner { position: absolute; top: 18px; left: 22px; z-index: 1; }

/* ---------- 비밀번호 창 (서버에 올린 버전의 조작 화면) ---------- */
.lock {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--sky-50) 82%, transparent);
  backdrop-filter: blur(6px);
}
.lock__card { width: min(420px, 100%); gap: 12px; }
.lock__help { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.lock__input {
  width: 100%;
  font: inherit;
  font-size: 20px;
  text-align: center;
  padding: 10px 14px;
  border: 2px solid var(--sky-300);
  border-radius: 14px;
}
.lock__input:focus { outline: 3px solid var(--sky-200); border-color: var(--sky-500); }
.lock__error { margin: 0; font-family: var(--font-head); color: var(--blush-deep); }
.lock-state { font-family: var(--font-head); font-size: 15px; padding: 2px 12px; border-radius: var(--radius-pill); background: #e4e9f0; color: var(--ink-soft); }
.lock-state[data-on='true'] { background: var(--mint); color: var(--mint-deep); }

/* ---------- 밸런스: 따스히의 선택 (스트리머가 1번·2번을 누르면) ---------- */
.vs__side { position: relative; transition: transform 0.18s, opacity 0.18s, border-color 0.18s; }
.vs__side[role='button'] { cursor: pointer; }
.vs__side[role='button']:hover { border-color: var(--sky-300); }
.vs__pick {
  display: none;
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-head);
  font-size: 16px;
  color: var(--ink);
  background: var(--sun);
  padding: 3px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
}
.vs__side.is-chosen,
.vs__side.is-chosen[role='button']:hover { border: 4px solid var(--sky-500); background: var(--sky-100); transform: scale(1.04); }
.vs__side.is-chosen .vs__pick { display: inline-block; }
.card[data-pick] .vs__side:not(.is-chosen) { opacity: 0.55; }
.ov .vs__pick { font-size: 20px; top: -18px; }
@media (prefers-reduced-motion: reduce) {
  .vs__side { transition: none; }
}

/* 톱니바퀴 바로 아래 책 버튼 → 설명서(위키) */
.docs-btn { position: absolute; top: 76px; right: 32px; text-decoration: none; }
@media (max-width: 760px) {
  .docs-btn { position: static; }
}
/* 위쪽 막대를 본문보다 앞으로 — 막대 밖으로 내려온 책 버튼 아랫부분도 눌리게 */
.top { z-index: 3; }
