/* 무전 시트 — 대역 모드 전용. 장치를 가리지 않으면서 목소리를 같이 보여준다. */

.aisheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 26px rgba(0, 0, 0, .45);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 스냅 3단 — full 에서도 장치를 완전히 숨기지 않는다 */
.aisheet.snap-peek { height: 64px; }
.aisheet.snap-half { height: 46dvh; }
.aisheet.snap-full { height: 84dvh; }
.aisheet.snap-peek .ai-said,
.aisheet.snap-peek .ai-askbar { display: none; }
.aisheet.snap-peek .ai-log { -webkit-mask-image: none; }

.ai-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 6px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ai-handle:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
.ai-grip {
  width: 34px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  flex: 0 0 auto;
}
.ai-handle-t { font-size: .84rem; letter-spacing: .12em; color: var(--dim); }
.ai-budget { margin-left: auto; font-size: .78rem; color: var(--accent); }

/* 불러준 값 — 방 전체가 무엇을 아는지 항상 보인다 */
.ai-said {
  display: flex;
  gap: 6px;
  padding: 0 14px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ai-said::-webkit-scrollbar { display: none; }
.ai-said:empty { display: none; }
.ai-said-item {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .74rem;
  color: var(--dim);
  white-space: nowrap;
}

/* 질문 바 — 구획 칩 자체가 질문 버튼이다(탭 1회) */
.ai-askbar {
  display: flex;
  gap: 8px;
  padding: 4px 14px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.ai-askbar::-webkit-scrollbar { display: none; }
.ai-q {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 66px;
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ai-q:hover { background: #242c38; }
.ai-q:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.ai-q-t { font-size: .86rem; font-weight: 700; }
.ai-q-d { font-size: .66rem; color: var(--dim); letter-spacing: .05em; }
.ai-q-back { min-width: 44px; }

/* 로그 */
.ai-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-line {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel2);
  border-left: 4px solid var(--line);
  font-size: .92rem;
  line-height: 1.6;
}
.ai-cs { font-weight: 700; }
.ai-text { white-space: pre-wrap; }

/* 화자 색은 콜사인에 영구 고정 — 성격과 1:1이라 정보 유출이 없고, 색만으로 구분하지도 않는다 */
.cs-알파 { border-left-color: var(--info); }
.cs-브라보 { border-left-color: var(--ok); }
.cs-찰리 { border-left-color: var(--accent); }
.cs-델타 { border-left-color: var(--dim); }
.cs-에코 { border-left-color: var(--text); }

.ai-aidim { color: var(--dim); }
.ai-typing { color: var(--dim); letter-spacing: .3em; }
.ai-me {
  align-self: flex-end;
  max-width: 88%;
  background: transparent;
  border: 1px dashed var(--line);
  border-left-width: 1px;
  color: var(--dim);
  font-size: .86rem;
}
.ai-sys {
  align-self: center;
  background: transparent;
  border-left: 0;
  color: var(--dim);
  font-size: .82rem;
  text-align: center;
}

.ai-glyphs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ai-glyph {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.ai-gnum { font-style: normal; font-size: .72rem; color: var(--text); font-family: var(--font-mono); }

.ai-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-chip {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ai-chip:hover { background: rgba(255, 176, 32, .12); }
.ai-chip:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* 교차검증 카드 */
.ai-cmp {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg);
  font-size: .86rem;
}
.ai-cmp.is-conflict { border-color: var(--danger); }
.ai-cmp.is-agree { border-color: var(--ok); }
.ai-cmp-h { font-size: .76rem; color: var(--dim); margin-bottom: 4px; letter-spacing: .04em; }
.ai-cmp.is-conflict .ai-cmp-h { color: var(--danger); }
.ai-cmp.is-agree .ai-cmp-h { color: var(--ok); }
.ai-cmp-r { display: flex; gap: 8px; align-items: baseline; }
.ai-cmp-r b { flex: 0 0 52px; color: var(--dim); font-weight: 700; }

/* 시트가 장치를 덮지 않도록 본문 아래에 시트 높이만큼 여백을 준다 */
.screen.has-sheet .gamewrap { padding-bottom: calc(var(--sheet-h, 46dvh) + 16px); }

@media (prefers-reduced-motion: reduce) {
  .ai-typing { letter-spacing: normal; }
}

/* ══ 데스크톱 — 무전 시트를 우측 사이드바로 ═════════════════════
   하단 시트를 그대로 두면 화면 절반을 대화 로그가 먹고 장치가 위로 밀린다.
   이 게임은 장치와 목소리를 동시에 봐야 한다.
   1024 미만은 하단 시트 그대로 — 모바일이 1순위라는 제약을 지킨다. */
@media (min-width: 1024px) {
  :root { --sheet-w: 360px; }

  .aisheet {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: var(--sheet-w);
    max-width: none;
    margin: 0;
    height: auto !important;   /* snap-* 가 지정한 높이를 무효화한다 */
    border-top: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: -10px 0 30px rgba(0, 0, 0, .45);
    padding-top: env(safe-area-inset-top, 0px);
  }
  /* 세로가 넉넉하니 접을 이유가 없다 */
  .aisheet.snap-peek .ai-said,
  .aisheet.snap-peek .ai-askbar { display: flex; }

  .ai-grip { display: none; }
  .ai-handle { cursor: default; border-bottom: 1px solid var(--line-soft); }
  .ai-askbar { flex-wrap: wrap; overflow-x: visible; }
  .ai-q { flex: 1 1 auto; }

  html.has-sheet #app { padding-right: var(--sheet-w); }
  .screen.has-sheet .gamewrap { padding-bottom: 0; }
}
@media (min-width: 1440px) {
  :root { --sheet-w: 420px; }
}

/* 무전 줄도 같은 깊이 규칙을 따른다 */
.ai-line { border-left-width: 3px; }
.ai-handle-t { font-size: var(--fs-2xs); letter-spacing: .16em; }
.ai-chip { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ai-cmp { background: #0a0e13; }

