:root {
  --bg: #2a1020; --panel: #3a1630; --me: #e84a8a; --bot: #4f2142; --text: #fff4f8; --muted: #e0a9c4; --line: #5e2a4d;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; font-size: 17px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* 로그인 */
#login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 24px; padding: 32px 24px; display: flex; flex-direction: column; gap: 14px; }
.logo { font-size: 52px; text-align: center; }
.card h1 { margin: 0; text-align: center; font-size: 26px; }
.sub { margin: -8px 0 8px; text-align: center; color: var(--muted); }
.card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 15px; }
.card input:not([type=checkbox]) { font-size: 17px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.card .check { flex-direction: row; align-items: center; gap: 8px; }
.card .check input { width: 20px; height: 20px; }
.card button { margin-top: 6px; padding: 15px; border: 0; border-radius: 12px; background: var(--me); font-weight: 700; font-size: 17px; }
.error { color: #ff8a8a; min-height: 1.2em; margin: 0; text-align: center; font-size: 15px; }

/* 채팅 */
#chat { height: 100%; height: 100dvh; display: flex; flex-direction: column; }
.top { position: relative; display: flex; align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.title { flex: 1; font-weight: 700; font-size: 19px; }
.icon-btn { background: none; border: 0; font-size: 26px; padding: 0 6px; line-height: 1; }
.menu { position: absolute; right: 12px; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; z-index: 5; box-shadow: 0 8px 24px #0008; }
.menu button { display: block; width: 100%; padding: 14px 20px; background: none; border: 0; text-align: left; white-space: nowrap; }
.menu button + button { border-top: 1px solid var(--line); }

#messages { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 6px; }
.msg.pending { color: var(--muted); }
.msg.img { padding: 4px; background: var(--bot); }
.msg.img img { display: block; max-width: 100%; border-radius: 14px; }
.msg a { color: #9cc4ff; }
.msg.me a { color: #fff; }
.time { align-self: center; color: var(--muted); font-size: 13px; margin: 8px 0 2px; }
.empty { margin: auto; text-align: center; color: var(--muted); line-height: 1.7; }

.chips { display: flex; gap: 8px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px); }
.composer textarea { flex: 1; resize: none; max-height: 140px; font: inherit; font-size: 17px; padding: 11px 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.composer button { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--me); font-size: 22px; font-weight: 700; }
.composer button:disabled { opacity: .4; }

.viewer { position: fixed; inset: 0; background: #000e; display: flex; align-items: center; justify-content: center; z-index: 10; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.viewer img { max-width: 100%; max-height: 100%; }
