/* Bolt 웹 UI — 단계 2 채팅 화면 (다크 + 시안 자비스 톤)
   본격 자비스 비주얼(힉스필드 영상·HUD 애니메이션)은 단계 6에서. */

:root {
  --bg: #060a12;
  --bg-2: #0b1322;
  --panel: rgba(18, 28, 46, 0.72);
  --line: rgba(80, 160, 220, 0.18);
  --accent: #25c8ff;
  --accent-dim: #1a90c0;
  --text: #dce7f2;
  --text-dim: #7d93ab;
  --user: rgba(37, 200, 255, 0.12);
  --user-line: rgba(37, 200, 255, 0.45);
}

* { box-sizing: border-box; }

/* hidden 속성이 .app/.login 의 display 규칙에 덮이지 않게 — 화면 전환(로그인↔채팅)의 핵심 */
.app[hidden],
.login[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 50% -10%, #102036 0%, var(--bg) 60%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
}

/* ── 상단바 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.core {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #aef1ff, var(--accent) 55%, var(--accent-dim));
  box-shadow: 0 0 10px var(--accent), 0 0 22px rgba(37, 200, 255, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.82); opacity: 0.7; }
}
.title { font-weight: 700; letter-spacing: 4px; font-size: 18px; }
.status { font-size: 12.5px; color: var(--text-dim); }
.status[data-state="open"] { color: #4fe39a; }
.status[data-state="thinking"] { color: var(--accent); }
.status[data-state="error"] { color: #ff6b6b; }

/* ── 메시지 영역 ── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.bolt { justify-content: flex-start; }
.bubble {
  max-width: 80%;
  padding: 11px 15px;
  border-radius: 14px;
  line-height: 1.62;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .bubble {
  background: var(--user);
  border: 1px solid var(--user-line);
  border-bottom-right-radius: 4px;
}
.msg.bolt .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg.bolt .bubble.streaming::after {
  content: "▋";
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.bubble.error { border-color: #ff6b6b; color: #ffb3b3; }

/* ── 입력 영역 ── */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(6, 10, 18, 0.6));
}
.icon-btn, .send-btn {
  flex: 0 0 auto;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.icon-btn { width: 42px; }
.icon-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.icon-btn.recording {
  background: #c0392b;
  border-color: #ff6b6b;
  color: #fff;
  animation: pulse 1s ease-in-out infinite;
}
.send-btn {
  width: 46px;
  color: var(--accent);
  font-size: 18px;
}
.send-btn:hover { border-color: var(--accent); background: rgba(37, 200, 255, 0.1); }
#input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
}
#input:focus { border-color: var(--accent-dim); }
#input::placeholder { color: var(--text-dim); }

/* 스크롤바 */
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

@media (max-width: 600px) {
  .bubble { max-width: 88%; font-size: 14.5px; }
  .title { font-size: 16px; }
}

/* ── 로그인 화면 (단계 3) ── */
.login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  padding: 36px 28px 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  text-align: center;
}
.brand-lg { justify-content: center; gap: 13px; margin-bottom: 6px; }
.brand-lg .core { width: 18px; height: 18px; }
.brand-lg .title { font-size: 24px; letter-spacing: 6px; }
.login-sub { color: var(--text-dim); font-size: 14px; margin: 8px 0 24px; }
#gsi-button { display: flex; justify-content: center; align-items: center; min-height: 44px; }
/* GIS 인앱 폴백 버튼의 SVG 로고가 카드 폭만큼 커지는 것 방지 */
#gsi-button svg { max-width: 22px; max-height: 22px; }
/* GIS 폴백 버튼의 스크린리더용 중복 라벨(.L6cTce, "…새 탭에서 열림") 숨김 — 시각 라벨은 유지 */
#gsi-button .L6cTce { display: none !important; }
.login-msg { color: #ffb3b3; font-size: 13px; margin-top: 16px; min-height: 18px; }

/* ── 상단바 우측 (상태 + 로그아웃) ── */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 12.5px; color: var(--text-dim); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.logout-btn:hover { border-color: var(--accent-dim); color: var(--text); }
