/* ============================================================
   질문 게임 전용 스타일
   모티프: 손에 쥔 대화 카드. 종이 바탕(공통 토큰) 위에 덱마다
   상징색이 다른 카드가 놓인다. 색은 --deck 변수 하나로 흐르고,
   기본 포인트는 따뜻한 코랄(--ib-accent).
   ============================================================ */

:root {
  --ib-accent: #e2704a;
  --ib-card-shadow: 0 10px 30px rgba(60, 44, 24, 0.12);
  --ib-card-shadow-soft: 0 4px 14px rgba(60, 44, 24, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ib-accent: #ef8a63;
    --ib-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --ib-card-shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --ib-accent: #ef8a63;
  --ib-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ib-card-shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ---- 히어로: 부채꼴로 펼친 카드 3장 ---- */
.ib-hero {
  position: relative;
  overflow: hidden;
}
.ib-fan {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 26px 0 6px;
  height: 150px;
  pointer-events: none;
}
.ib-fan span {
  width: 104px;
  height: 148px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--ib-card-shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  transform-origin: 50% 120%;
}
.ib-fan span:nth-child(1) { transform: rotate(-14deg) translateX(14px); color: #e0618c; }
.ib-fan span:nth-child(2) { transform: rotate(0deg) translateY(-8px); color: var(--ib-accent); z-index: 1; }
.ib-fan span:nth-child(3) { transform: rotate(14deg) translateX(-14px); color: #3f7fc1; }
.ib-fan span::after { content: none; }

/* ---- 단계 라벨 ---- */
.ib-step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 34px 0 14px;
}
.ib-step b {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ib-accent);
  text-transform: uppercase;
}
.ib-step h2,
.ib-step .h {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.ib-step small {
  color: var(--color-text-sub);
  font-size: 0.85rem;
}

/* ---- 덱 선택 ---- */
.ib-decks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}
.ib-deck {
  --deck: var(--ib-accent);
  position: relative;
  text-align: left;
  padding: 14px 14px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  cursor: pointer;
  font: inherit;
  color: var(--color-text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.ib-deck:hover { transform: translateY(-2px); box-shadow: var(--ib-card-shadow-soft); }
.ib-deck.is-active {
  border-color: var(--deck);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--deck) 22%, transparent), var(--ib-card-shadow-soft);
  background: color-mix(in srgb, var(--deck) 7%, var(--color-surface));
}
.ib-deck-dot {
  display: block;
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--deck);
  margin-bottom: 9px;
}
.ib-deck-label { display: block; font-weight: 700; font-size: 0.98rem; }
.ib-deck-desc {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--color-text-sub);
  line-height: 1.4;
}

/* ---- 모드 카드(허브) ---- */
.ib-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.ib-mode {
  display: block;
  position: relative;
  padding: 20px 18px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.ib-mode:hover {
  transform: translateY(-3px);
  border-color: var(--ib-accent);
  box-shadow: var(--ib-card-shadow);
}
.ib-mode strong { display: block; font-size: 1.08rem; margin: 12px 0 6px; }
.ib-mode p { margin: 0; font-size: 0.86rem; color: var(--color-text-sub); line-height: 1.55; }
.ib-mode .ib-mode-go {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ib-accent);
}

/* 모드 글리프: CSS로 그린 미니 카드 (이모지 금지 원칙) */
.ib-glyph {
  position: relative;
  display: block;
  width: 46px;
  height: 38px;
}
.ib-glyph i {
  position: absolute;
  display: block;
  width: 24px;
  height: 32px;
  border-radius: 5px;
  border: 2px solid var(--ib-accent);
  background: var(--color-surface);
}
.ib-glyph.solo i:nth-child(1) { left: 10px; top: 1px; }
.ib-glyph.duo i:nth-child(1) { left: 2px; top: 2px; transform: rotate(-8deg); border-color: #e0618c; }
.ib-glyph.duo i:nth-child(2) { left: 20px; top: 1px; transform: rotate(8deg); border-color: #3f7fc1; }
.ib-glyph.host i:nth-child(1) { left: 4px; top: 4px; transform: rotate(-10deg); opacity: 0.35; }
.ib-glyph.host i:nth-child(2) { left: 11px; top: 2px; transform: rotate(-4deg); opacity: 0.65; }
.ib-glyph.host i:nth-child(3) { left: 19px; top: 0; }

/* ---- 무대(모드 페이지 공통) ---- */
.ib-stage {
  max-width: 660px;
  margin: 0 auto;
}
.ib-screen[hidden] { display: none; }

/* HUD */
.ib-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  min-height: 30px;
}
.ib-tag {
  --deck: var(--ib-accent);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--deck);
  background: color-mix(in srgb, var(--deck) 12%, transparent);
}
.ib-count { font-size: 0.86rem; color: var(--color-text-sub); font-variant-numeric: tabular-nums; }
.ib-count b { color: var(--color-text); }

/* ---- 질문 카드 ---- */
.ib-qcard {
  --deck: var(--ib-accent);
  position: relative;
  border-radius: 18px;
  border: 1.5px solid var(--color-border);
  border-top: 5px solid var(--deck);
  background: var(--color-surface);
  box-shadow: var(--ib-card-shadow);
  padding: 44px 30px 40px;
  text-align: center;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
/* 뒤에 깔린 카드 두 장: 덱에서 뽑는 느낌 */
.ib-qcard::before,
.ib-qcard::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  z-index: -1;
}
.ib-qcard::before { transform: rotate(-1.6deg) translateY(5px); opacity: 0.75; }
.ib-qcard::after { transform: rotate(1.4deg) translateY(9px); opacity: 0.45; }
.ib-qcard .q {
  font-size: clamp(1.18rem, 3.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.55;
  word-break: keep-all;
  margin: 0;
}
.ib-qcard .q-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--deck);
  margin: 0;
}
.ib-qcard.is-flip { animation: ib-draw 0.28s ease; }
@keyframes ib-draw {
  from { transform: translateY(10px) rotate(-1deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ib-qcard.is-flip { animation: none; }
}

/* ---- 버튼 ---- */
.ib-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.ib-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--ib-accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
}
.ib-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.ib-btn:active { transform: translateY(0); }
.ib-btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; }
.ib-btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.ib-btn-ghost:hover { border-color: var(--ib-accent); color: var(--ib-accent); filter: none; }
.ib-btn-big {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 26px auto 0;
  padding: 15px 24px;
  font-size: 1.05rem;
}

/* ---- 칩(문항 수 등) ---- */
.ib-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ib-chip {
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.1s ease, background 0.1s ease;
}
.ib-chip small { color: var(--color-text-sub); margin-left: 4px; }
.ib-chip.is-active {
  border-color: var(--ib-accent);
  background: color-mix(in srgb, var(--ib-accent) 10%, var(--color-surface));
  font-weight: 700;
}
.ib-chip:disabled { opacity: 0.4; cursor: default; }

/* ---- 입력 ---- */
.ib-field { margin: 16px 0; text-align: left; }
.ib-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-text-sub);
}
.ib-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 1.02rem;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}
.ib-input:focus {
  outline: none;
  border-color: var(--ib-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ib-accent) 20%, transparent);
}
.ib-hint { font-size: 0.8rem; color: var(--color-text-sub); margin-top: 6px; }

/* ---- duo: 넘겨주기 가림 화면 ---- */
.ib-handoff {
  text-align: center;
  padding: 56px 24px;
  border-radius: 18px;
  border: 1.5px dashed var(--color-border);
  background: color-mix(in srgb, var(--ib-accent) 5%, var(--color-bg));
}
.ib-handoff .who { font-size: 1.5rem; font-weight: 800; margin: 0 0 8px; }
.ib-handoff p { color: var(--color-text-sub); margin: 0 0 18px; }

/* ---- duo: 답 공개 ---- */
.ib-reveal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
@media (max-width: 520px) { .ib-reveal { grid-template-columns: 1fr; } }
.ib-answer {
  border-radius: 14px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  padding: 16px;
  text-align: left;
}
.ib-answer .who {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.ib-answer.a .who { color: #e0618c; }
.ib-answer.b .who { color: #3f7fc1; }
.ib-answer .txt { margin: 0; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

/* ---- 진행 점 ---- */
.ib-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 4px; flex-wrap: wrap; }
.ib-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}
.ib-dots i.on { background: var(--ib-accent); }

/* ---- host: 담은 질문 ---- */
.ib-basket-bar {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: center;
  margin-top: 22px;
  z-index: 5;
}
.ib-basket-btn {
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--ib-card-shadow-soft);
}
.ib-basket-btn b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ib-accent);
  color: #fff;
  font-size: 0.82rem;
}
.ib-list { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; }
.ib-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  margin-bottom: 8px;
}
.ib-list .no {
  flex: none;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ib-accent);
  min-width: 22px;
  font-variant-numeric: tabular-nums;
}
.ib-list .txt { flex: 1; line-height: 1.5; font-size: 0.95rem; }
.ib-list .ops { display: flex; gap: 4px; }
.ib-list .ops button {
  font: inherit;
  font-size: 0.8rem;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-sub);
  cursor: pointer;
}
.ib-list .ops button:hover { color: var(--ib-accent); border-color: var(--ib-accent); }

/* ---- 결과 미리보기 ---- */
.ib-preview { text-align: center; margin-top: 20px; }
.ib-preview img {
  max-width: min(420px, 100%);
  border-radius: 16px;
  box-shadow: var(--ib-card-shadow);
  border: 1px solid var(--color-border);
}

/* ---- 색 고르기(solo 카드) ---- */
.ib-swatches { display: flex; gap: 10px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.ib-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease;
}
.ib-swatch:hover { transform: scale(1.1); }
.ib-swatch.is-active {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-text) 18%, transparent);
}

/* ---- 안내 문단 ---- */
.ib-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-sub);
  margin-top: 14px;
}

/* color-mix 미지원 브라우저 대비: 핵심 상태는 단색으로도 성립 */
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .ib-deck.is-active { background: var(--color-surface); }
  .ib-chip.is-active { background: var(--color-surface); }
  .ib-handoff { background: var(--color-bg); }
  .ib-tag { background: transparent; border: 1px solid currentColor; }
}
