/* Idea Chat — UI 리뉴얼 (클로드 디자인 핸드오프 1:1 포팅, 2026-06-11)
   테마 4종 CSS 변수 + 개인화(폰트/크기/말풍선/밀도)는 personalize.js가 주입 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");
@import url("https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Gowun+Batang:wght@400;700&family=IBM+Plex+Sans+KR:wght@400;500;700&display=swap");

/* ── 테마 토큰 (디자인 PALETTES 1:1) ── */
:root, :root[data-theme="warm"] {
  --app-bg: #E8E4DA; --chat-bg: #F3F0E9; --surface: #FFFFFF; --topbar: #F3F0E9;
  --line: #E6E1D6; --text: #2B2722; --sub: #8A8270;
  --accent: #FF9F1C; --accent-strong: #C9810F; --accent-ink: #2B2722;
  --my-bg: #FFB02E; --my-ink: #2B2722; --other-bg: #FFFFFF; --other-ink: #2B2722; --other-line: #ECE6DA;
  --div-bg: #E7E1D4; --div-ink: #8A8270; --field: #FFFFFF; --field-line: #E2DCCF;
  --chip-bg: #F4F0E6; --chip-ink: #8A8270; --chip-on-bg: #FFF2D6; --chip-on-ink: #B07A12;
  --av-bg: #7E8B6E; --hover: rgba(0,0,0,.05); --dim: rgba(10,12,16,.45);
  --ai-gemini: #4285F4; --ai-gpt: #10A37F; --ai-claude: #E8703A;
  --danger: #E5484D; --ok: #2CC36B;
  --msg-fs: 15px; --bub-r: 13px; --row-gap: 12px;
  --app-font: 'Pretendard', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  --safe-w: 430px;
}
:root[data-theme="mint"] {
  --app-bg: #D7E0DA; --chat-bg: #E3EAE5; --surface: #FFFFFF; --topbar: #F4F8F5;
  --line: #D6E2DA; --text: #1E2A24; --sub: #5E7368;
  --accent: #0F8A6D; --accent-strong: #0C7359; --accent-ink: #FFFFFF;
  --my-bg: #CDEFDA; --my-ink: #143226; --other-bg: #FFFFFF; --other-ink: #1E2A24; --other-line: #E2EAE5;
  --div-bg: #D4E0D8; --div-ink: #5E7368; --field: #FFFFFF; --field-line: #D2DED7;
  --chip-bg: #EEF5F0; --chip-ink: #5E7368; --chip-on-bg: #D6F2E1; --chip-on-ink: #0C7359;
  --av-bg: #5B8C7B; --hover: rgba(0,0,0,.04);
}
:root[data-theme="dark"] {
  --app-bg: #0C0D10; --chat-bg: #15171C; --surface: #1F232B; --topbar: #1A1D23;
  --line: #272B33; --text: #E6E9EF; --sub: #8A909C;
  --accent: #46E0C8; --accent-strong: #5DE9D2; --accent-ink: #0B2620;
  --my-bg: #46E0C8; --my-ink: #0B2620; --other-bg: #262B34; --other-ink: #DCE0E7; --other-line: #2C313B;
  --div-bg: #22262E; --div-ink: #7D838F; --field: #262B34; --field-line: #2C313B;
  --chip-bg: #262B34; --chip-ink: #9AA0AC; --chip-on-bg: #13352F; --chip-on-ink: #5DE9D2;
  --av-bg: #4A5160; --hover: rgba(255,255,255,.06);
}
:root[data-theme="editorial"] {
  --app-bg: #ECEDEF; --chat-bg: #FAFAFB; --surface: #FFFFFF; --topbar: #FFFFFF;
  --line: #ECEEF1; --text: #16181C; --sub: #9498A1;
  --accent: #FF5436; --accent-strong: #E5482A; --accent-ink: #FFFFFF;
  --my-bg: #16181C; --my-ink: #FFFFFF; --other-bg: #FFFFFF; --other-ink: #16181C; --other-line: #E9EBEE;
  --div-bg: #F2F3F5; --div-ink: #9498A1; --field: #F4F5F7; --field-line: #ECEEF1;
  --chip-bg: #F4F5F7; --chip-ink: #9498A1; --chip-on-bg: #FFEDE8; --chip-on-ink: #E5482A;
  --av-bg: #16181C; --hover: rgba(0,0,0,.04);
}

/* ── 베이스 ── */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; touch-action: manipulation; }
input, textarea, select { font-size: 16px !important; font-family: inherit; } /* iOS 포커스 줌 방지 */
body {
  font-family: var(--app-font);
  background: var(--app-bg); color: var(--text);
  display: flex; justify-content: center;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  transition: background .3s;
}
.app {
  width: 100%; max-width: var(--safe-w);
  height: 100dvh; max-height: 100dvh;
  background: var(--chat-bg);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  transition: background .3s;
}
@media (min-width: 500px) {
  body { padding: 24px 0; }
  .app { height: calc(100dvh - 48px); border-radius: 32px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.45); }
}

/* ── 모션 (디자인 키프레임) ── */
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }
@keyframes wave { to { transform: scaleY(.4); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-10px) scale(.96); } to { opacity: 1; transform: translate(-50%,0) scale(1); } }
@keyframes rowIn { from { transform: translateY(12px); } to { transform: none; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes popIn { from { transform: scale(.9); } to { transform: none; } }
@keyframes chipPop { 0% { opacity: 0; transform: scale(.5); } 60% { transform: scale(1.12); } 100% { opacity: 1; transform: scale(1); } }
.row-in { animation: rowIn .42s cubic-bezier(.22,.9,.32,1) both; }
.bubble { transition: transform .12s ease; }
.bubble:active { transform: scale(.975); }
.react-chips .rchip { animation: chipPop .28s cubic-bezier(.3,1.3,.5,1) both; }
@media (prefers-reduced-motion: reduce) { .row-in, .react-chips .rchip { animation: none; } }

/* ── 상단바 ── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--topbar); border-bottom: 1px solid var(--line);
  flex-shrink: 0; z-index: 10;
}
.topbar .title { font-weight: 700; font-size: 15.5px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 11.5px; color: var(--sub); margin-top: 1px; white-space: nowrap; }
.topbar a, .topbar button {
  background: none; border: none; cursor: pointer;
  text-decoration: none; color: var(--sub);
  padding: 4px; line-height: 0; display: flex;
}
.topbar .back { color: var(--text); opacity: .85; }
.topbar .badge-dot { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 700; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-strong); }
.topbar .badge-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-strong); }

/* ── 채팅 영역 ── */
.chat-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 13px 6px; display: flex; flex-direction: column; gap: var(--row-gap); }
.chat-scroll::-webkit-scrollbar { width: 0; }
.date-divider { align-self: center; margin: 4px 0 2px; }
.date-divider span { background: var(--div-bg); color: var(--div-ink); font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 11px; }

.msg-row { display: flex; gap: 8px; max-width: 86%; align-self: flex-start; }
.msg-row.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.ai { max-width: 90%; }
.msg-row .avatar {
  width: 34px; height: 34px; border-radius: 12px; flex-shrink: 0; align-self: flex-start;
  background: var(--av-bg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.msg-row.ai.gemini .avatar { background: var(--ai-gemini); }
.msg-row.ai.gpt    .avatar { background: var(--ai-gpt); }
.msg-row.ai.claude .avatar { background: var(--ai-claude); }
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg-row.me .msg-col { align-items: flex-end; }
.sender { font-size: 11.5px; font-weight: 600; color: var(--sub); margin: 0 3px 3px; display: flex; align-items: center; gap: 5px; }
.msg-row.ai .sender { font-weight: 700; }
.msg-row.ai .sender .role { font-weight: 600; color: var(--sub); font-size: 10.5px; }
.msg-row.ai.gemini .sender { color: var(--ai-gemini); }
.msg-row.ai.gpt    .sender { color: var(--ai-gpt); }
.msg-row.ai.claude .sender { color: var(--ai-claude); }

.brow { display: flex; gap: 6px; align-items: flex-end; } /* bubble + meta */
.msg-row.me .brow { flex-direction: row-reverse; }

.bubble {
  font-size: var(--msg-fs); line-height: 1.5; padding: 9px 13px;
  word-break: break-word; border-radius: var(--bub-r);
  background: var(--other-bg); color: var(--other-ink); border: 1px solid var(--other-line);
  border-top-left-radius: 5px; position: relative;
}
.msg-row.me .bubble { background: var(--my-bg); color: var(--my-ink); border: none; border-radius: var(--bub-r); border-top-right-radius: 5px; border-top-left-radius: var(--bub-r); }
.msg-row.ai .bubble { line-height: 1.55; padding: 10px 13px; }
.msg-row.ai.gemini .bubble { border-left: 3px solid var(--ai-gemini); }
.msg-row.ai.gpt    .bubble { border-left: 3px solid var(--ai-gpt); }
.msg-row.ai.claude .bubble { border-left: 3px solid var(--ai-claude); }
.bubble .mention { font-weight: 700; color: var(--accent-strong); }
.bubble ul { padding-left: 18px; margin: 4px 0; }
.bubble b { font-weight: 700; }

.meta { display: flex; flex-direction: column; gap: 1px; font-size: 10px; color: var(--sub); white-space: nowrap; padding-bottom: 1px; flex-shrink: 0; }
.msg-row.me .meta { align-items: flex-end; }
.meta .unread { color: var(--accent); font-weight: 800; }

/* 답장 인용 (말풍선 내) */
.reply-quote {
  display: flex; flex-direction: column; gap: 1px; padding: 4px 8px; margin-bottom: 5px;
  border-radius: 8px; border-left: 2.5px solid var(--accent); background: var(--chip-bg);
}
.msg-row.me .reply-quote { border-left-color: rgba(0,0,0,.35); background: rgba(0,0,0,.07); }
.reply-quote b { font-size: 10.5px; font-weight: 700; opacity: .8; }
.reply-quote span { font-size: 11.5px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* 스트리밍 커서 */
.stream-cursor::after { content: ""; display: inline-block; width: 2px; height: 1em; vertical-align: -2px; margin-left: 2px; background: currentColor; animation: blink 1s steps(1) infinite; }

/* ── 리액션 칩 ── */
.react-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.msg-row.me .react-chips { justify-content: flex-end; }
.react-chips .rchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 5px;
  border-radius: 12px; font-size: 12px !important; font-weight: 700; line-height: 1; cursor: pointer;
  background: var(--chip-bg); color: var(--chip-ink); border: 1px solid var(--line);
}
.react-chips .rchip.mine { background: var(--chip-on-bg); color: var(--chip-on-ink); border-color: var(--accent); }
.react-chips .rchip svg { display: block; }

/* 퀵 리액션 줄 */
.react-row {
  display: flex; align-items: center; gap: 2px; padding: 5px;
  background: var(--surface); border-radius: 24px; border: 1px solid var(--line);
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.32);
}
.react-row button {
  border: 0; background: transparent; padding: 5px; border-radius: 12px; cursor: pointer;
  display: flex; line-height: 0; transition: transform .12s, background .12s;
}
.react-row button:hover { background: var(--hover); transform: translateY(-3px) scale(1.12); }
.react-row .more {
  position: relative; background: var(--chip-bg); width: 36px; height: 36px; border-radius: 50%;
  align-items: center; justify-content: center; margin-left: 2px; flex: none;
}
.react-row .more::after {
  content: "＋"; position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; line-height: 16px;
  text-align: center; border: 2px solid var(--surface);
}

/* PC 호버 미니 툴바 */
.hbar { position: absolute; display: flex; gap: 4px; z-index: 8; }
.hbar button {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--sub); cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px -4px rgba(0,0,0,.2);
}
.hbar button:hover { color: var(--accent-strong); border-color: var(--accent); }

/* 롱프레스 컨텍스트 메뉴 */
.ctx-back { position: absolute; inset: 0; z-index: 80; background: var(--dim); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.ctx-react, .ctx-menu, .ctx-clone { position: absolute; z-index: 82; }
.ctx-react, .ctx-menu { animation: popIn .22s cubic-bezier(.3,1.1,.5,1) both; }
.ctx-clone { z-index: 81; }
.ctx-clone .bubble { box-shadow: 0 12px 30px -8px rgba(0,0,0,.4); max-height: 200px; overflow: hidden; }
.ctx-menu {
  width: 224px; background: var(--surface); border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 44px -10px rgba(0,0,0,.45); border: 1px solid var(--line);
}
.ctx-menu button {
  width: 100%; height: 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  font-size: 14.5px !important; font-weight: 500; color: var(--text); font-family: inherit;
}
.ctx-menu button + button { border-top: 1px solid var(--line); }
.ctx-menu button:hover { background: var(--hover); }
.ctx-menu button .mi-ico { color: var(--sub); display: flex; }
.ctx-menu button.danger, .ctx-menu button.danger .mi-ico { color: var(--danger); }

/* ── AI 선택 카드 ── */
.choice-card {
  background: var(--surface); border: 1px solid var(--other-line); border-radius: 16px;
  border-top-left-radius: 5px; padding: 12px; display: flex; flex-direction: column; gap: 9px;
}
.msg-row.ai.gemini .choice-card { border-left: 3px solid var(--ai-gemini); }
.msg-row.ai.gpt    .choice-card { border-left: 3px solid var(--ai-gpt); }
.msg-row.ai.claude .choice-card { border-left: 3px solid var(--ai-claude); }
.choice-card .cc-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--other-ink); }
.choice-card .cc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.choice-card .cc-grid.single { grid-template-columns: 1fr; }
.choice-card .cc-opt {
  text-align: left; border: 1px solid var(--line); background: var(--chip-bg); border-radius: 12px;
  padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  transition: all .14s; font-family: inherit;
}
.choice-card .cc-opt:hover { border-color: var(--accent); }
.choice-card .cc-opt .l { display: flex; align-items: center; gap: 6px; font-size: 13px !important; font-weight: 700; color: var(--other-ink); }
.choice-card .cc-opt .d { font-size: 11px !important; color: var(--sub); line-height: 1.4; }
.choice-card .cc-opt.picked { border-color: var(--accent); background: var(--chip-on-bg); }
.choice-card .cc-opt.dim { opacity: .45; pointer-events: none; }

/* ── 음성 + AI 요약 ── */
.voice-bubble {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 16px;
  background: var(--other-bg); color: var(--other-ink); border: 1px solid var(--other-line);
}
.msg-row.me .voice-bubble { background: var(--my-bg); color: var(--my-ink); border: none; }
.voice-bubble .play {
  width: 30px; height: 30px; border-radius: 50%; flex: none; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px !important;
}
.msg-row.me .voice-bubble .play { background: rgba(0,0,0,.14); color: var(--my-ink); }
.voice-bubble .play.playing { background: var(--danger); color: #fff; }
.voice-bubble .wave { display: flex; align-items: center; gap: 2px; height: 24px; }
.voice-bubble .wave i { width: 2.5px; border-radius: 2px; background: currentColor; opacity: .55; display: block; }
.voice-bubble .dur { font-size: 11px; opacity: .75; white-space: nowrap; }

.summary-card {
  margin-top: 6px; background: var(--surface); border: 1px solid var(--other-line);
  border-radius: 14px; padding: 11px 13px 9px; width: 100%; max-width: 280px;
}
.summary-card .sc-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--accent-strong); margin-bottom: 7px; }
.summary-card .sc-body { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.summary-card .sc-body li { display: flex; gap: 7px; font-size: 12.5px; line-height: 1.45; color: var(--other-ink); list-style: none; }
.summary-card .sc-body li::before { content: "·"; color: var(--accent); font-weight: 800; flex: none; }
.summary-card .sc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.summary-card .tag, .tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 8px; background: var(--chip-bg); color: var(--sub); }
.summary-card .sc-toggle {
  border: 0; background: transparent; color: var(--accent-strong);
  font-size: 11.5px !important; font-weight: 700; cursor: pointer; padding: 6px 0 2px; font-family: inherit;
}
.summary-card .sc-full { display: none; font-size: 11.5px; line-height: 1.6; color: var(--sub); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; white-space: pre-wrap; }
.summary-card.open .sc-full { display: block; }
.summary-card .pending { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--sub); font-weight: 600; }
.summary-card .pending i { animation: spin 1.4s linear infinite; display: inline-block; font-style: normal; }

/* 이미지 메시지 */
.bubble.image-bubble { padding: 4px; background: var(--surface); }
.bubble.image-bubble img { display: block; max-width: 100%; max-height: 280px; border-radius: 11px; cursor: pointer; }

/* ── 입력바 ── */
.inputbar {
  display: flex; align-items: flex-end; gap: 3px;
  padding: 9px 8px calc(10px + env(safe-area-inset-bottom));
  background: var(--topbar); border-top: 1px solid var(--line);
  flex-shrink: 0; position: relative;
}
.inputbar > button {
  width: 36px; height: 38px; border-radius: 50%; flex: none;
  background: transparent; border: 0; cursor: pointer; color: var(--sub);
  display: flex; align-items: center; justify-content: center;
}
.inputbar > button.on { color: var(--accent-strong); }
.inputbar #plusBtn span { display: inline-flex; transition: transform .22s cubic-bezier(.3,.9,.4,1); }
.inputbar #plusBtn.on span { transform: rotate(45deg); }
.inputbar .pill {
  flex: 1; min-width: 0; /* 아이콘이 밀려 잘리지 않도록 입력칸이 우선 축소 */
  background: var(--field); border: 1px solid var(--field-line); border-radius: 19px;
  display: flex; align-items: center; padding: 0 6px 0 14px; min-height: 38px;
}
.inputbar .field {
  flex: 1; border: 0; outline: none; resize: none; background: transparent;
  font-family: inherit; line-height: 1.4; color: var(--text); padding: 9px 0; max-height: 96px;
}
.inputbar .field::placeholder { color: var(--sub); opacity: .7; }
.inputbar .send {
  width: 38px; height: 38px; border-radius: 50%; flex: none; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  display: none; align-items: center; justify-content: center;
}
.inputbar.has-text .send { display: flex; }
.inputbar.has-text .mic { display: none; }
.inputbar .mic { user-select: none; -webkit-user-select: none; touch-action: none; }

/* 답장 미리보기 바 */
.reply-bar {
  flex-shrink: 0; display: none; align-items: center; gap: 9px; padding: 8px 14px;
  background: var(--topbar); border-top: 1px solid var(--line);
}
.reply-bar.show { display: flex; }
.reply-bar .rb-line { width: 3px; height: 30px; border-radius: 2px; background: var(--accent); flex: none; }
.reply-bar .rb-body { flex: 1; min-width: 0; }
.reply-bar .rb-name { font-size: 11.5px; font-weight: 700; color: var(--accent-strong); }
.reply-bar .rb-text { font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .rb-x { border: 0; background: transparent; color: var(--sub); font-size: 16px !important; cursor: pointer; flex: none; }

/* 멘션 플로팅 */
.mention-pop {
  position: absolute; bottom: 100%; left: 8px; right: 8px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px -12px rgba(0,0,0,.4); overflow: hidden; display: none; margin-bottom: 8px;
}
.mention-pop.show { display: block; animation: popIn .18s ease both; }
.mention-pop .mp-head { padding: 9px 13px; font-size: 12px; font-weight: 700; color: var(--sub); border-bottom: 1px solid var(--line); }
.mention-pop .mi { display: flex; align-items: center; gap: 10px; padding: 10px 13px; cursor: pointer; }
.mention-pop .mi:hover, .mention-pop .mi:active { background: var(--hover); }
.mention-pop .mi .dot { width: 28px; height: 28px; border-radius: 9px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: none; }
.mention-pop .mi b { font-size: 13px; color: var(--text); display: block; }
.mention-pop .mi small { font-size: 11px; color: var(--sub); }

/* ＋ 첨부 패널 (인앱 시트) */
.attach-panel {
  position: absolute; bottom: 100%; left: 8px; right: 8px; z-index: 60; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 12px 40px -12px rgba(0,0,0,.4); padding: 14px; display: none;
  grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.attach-panel.show { display: grid; animation: popIn .2s cubic-bezier(.3,1.05,.5,1) both; }
.attach-panel .at-tile { border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px; font-family: inherit; }
.attach-panel .at-tile .ti { width: 52px; height: 52px; border-radius: 18px; display: flex; align-items: center; justify-content: center; transition: transform .14s; }
.attach-panel .at-tile:active .ti { transform: scale(.92); }
.attach-panel .at-tile span { font-size: 11.5px !important; font-weight: 600; color: var(--sub); }

/* 사진 미리보기 시트 */
.photo-preview {
  position: absolute; inset: 0; z-index: 90; background: var(--dim);
  display: none; align-items: flex-end;
}
.photo-preview.show { display: flex; }
.photo-preview .pp-sheet {
  width: 100%; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; animation: sheetUp .25s cubic-bezier(.3,.8,.4,1);
}
.photo-preview h3 { font-size: 15px; color: var(--text); }
.photo-preview img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 14px; background: var(--chip-bg); }

/* 이모지 전체 그리드 시트 */
.emoji-sheet-back { position: absolute; inset: 0; z-index: 90; background: var(--dim); display: none; align-items: flex-end; }
.emoji-sheet-back.show { display: flex; }
.emoji-sheet {
  width: 100%; max-height: 64%; background: var(--surface); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; animation: sheetUp .25s cubic-bezier(.3,.8,.4,1);
}
.emoji-sheet .es-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; flex: none; }
.emoji-sheet .es-head b { font-size: 15px; color: var(--text); }
.emoji-sheet .es-x { border: 0; background: var(--chip-bg); color: var(--sub); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 13px !important; }
.emoji-sheet .es-scroll { overflow-y: auto; padding: 0 12px 18px; display: flex; flex-direction: column; gap: 6px; }
.emoji-sheet .es-cat { font-size: 11px; font-weight: 700; color: var(--sub); padding: 8px 4px 4px; }
.emoji-sheet .es-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.emoji-sheet .es-grid button { border: 0; background: transparent; aspect-ratio: 1; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.emoji-sheet .es-grid button:hover { background: var(--hover); }

/* 녹음 오버레이 */
.rec-overlay {
  position: absolute; inset: 0; z-index: 95; background: rgba(8,9,12,.92);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; color: #fff;
}
.rec-overlay.show { display: flex; }
.rec-overlay .rec-dot { width: 14px; height: 14px; border-radius: 50%; background: #ff4d4d; animation: pulse 1s ease-in-out infinite; }
.rec-overlay .rec-time { font-size: 44px; font-weight: 300; font-variant-numeric: tabular-nums; }
.rec-overlay .rec-wave { display: flex; gap: 3px; align-items: center; height: 40px; }
.rec-overlay .rec-wave i { width: 3px; border-radius: 2px; background: #ff7a7a; animation: wave .9s ease-in-out infinite alternate; height: 26px; }
.rec-overlay .hint { font-size: 13px; color: rgba(255,255,255,.7); }
.rec-overlay.cancel .hint-cancel { color: #ff7a7a; font-weight: 700; }

/* 토스트 */
.toast {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 98;
  padding: 9px 16px; border-radius: 12px; font-size: 12.5px; font-weight: 600; color: #fff;
  max-width: 88%; box-shadow: 0 8px 24px -8px rgba(0,0,0,.4);
  background: rgba(20,22,28,.95); animation: toastIn .25s ease; word-break: break-word;
}
.toast.warn { background: #f0883e; }
.toast.err { background: var(--danger); }

/* ── 방 목록 (rooms) ── */
.searchbar { padding: 10px 14px 6px; background: var(--chat-bg); }
.searchbar input {
  width: 100%; border: 1px solid var(--field-line); border-radius: 13px; padding: 10px 14px;
  background: var(--field); color: var(--text); outline: none;
}
.filter-row { display: flex; gap: 6px; padding: 4px 14px 10px; overflow-x: auto; background: var(--chat-bg); }
.filter-row::-webkit-scrollbar { height: 0; }
.filter-chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  font-size: 12.5px !important; font-weight: 600; padding: 6px 13px; cursor: pointer; white-space: nowrap; color: var(--sub); font-family: inherit;
}
.filter-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.page { flex: 1; overflow-y: auto; background: var(--chat-bg); }
.section-pad { padding: 14px; }
.empty-note { text-align: center; color: var(--sub); font-size: 13px; padding: 30px 0; }

/* 방 행 — 플랫 리스트 (디자인 RoomsScreen) */
.room-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; text-decoration: none; color: inherit;
}
.room-row:hover, .room-row:active { background: var(--hover); }
.room-row.pinned { background: var(--chip-on-bg); }
.room-row .ric {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.room-row .rmid { flex: 1; min-width: 0; }
.room-row .rt { display: flex; align-items: center; gap: 6px; }
.room-row .rt h3 { font-size: 14.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-row .pin-mark { font-size: 11px; }
.room-row .preview { font-size: 12.5px; color: var(--sub); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.room-row .rtime { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; color: var(--sub); flex-shrink: 0; align-self: flex-start; padding-top: 2px; }
.room-row .ub {
  background: #FF4848; color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 800; min-width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
/* 상태 뱃지 — 디자인 STATUS 토큰 (배경 = 컬러 13%, 점 포함) */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px !important; font-weight: 700; border-radius: 6px; padding: 1px 7px;
  flex-shrink: 0; white-space: nowrap;
}
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-발아 { background: rgba(44,195,107,.16); color: #2CC36B; }
.status-논의중 { background: rgba(255,159,28,.16); color: #E08508; }
.status-구체화 { background: rgba(69,150,255,.16); color: #4596FF; }
.status-프로토타입 { background: rgba(122,90,224,.16); color: #7A5AE0; }
.status-보류 { background: rgba(148,152,161,.18); color: #9498A1; }

.fab {
  position: absolute; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 19px; border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px -8px rgba(0,0,0,.4); z-index: 40; transition: transform .15s;
}
.fab:active { transform: scale(.92); }

/* 바텀시트 (새 방 / 방 관리 / + 메뉴) */
.sheet-back { position: absolute; inset: 0; background: var(--dim); z-index: 70; display: none; align-items: flex-end; }
.sheet-back.show { display: flex; }
.sheet {
  background: var(--surface); width: 100%; border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); animation: sheetUp .25s cubic-bezier(.3,.8,.4,1);
}
.sheet h3 { font-size: 17px; margin-bottom: 4px; color: var(--text); }
.sheet p { font-size: 12.5px; color: var(--sub); margin-bottom: 14px; }
.sheet input {
  width: 100%; border: 1.5px solid var(--field-line); border-radius: 12px; padding: 13px 14px;
  background: var(--field); color: var(--text); outline: none; margin-bottom: 14px; font-family: inherit;
}
.sheet input:focus { border-color: var(--accent); }
.sheet .as-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 14px 6px; font-size: 15px !important; color: var(--text);
  border-bottom: 1px solid var(--line); font-family: inherit;
}
.sheet .as-item:last-of-type { border-bottom: none; }
.sheet .as-item:active { background: var(--hover); }
.sheet .as-item .ic { font-size: 21px; width: 30px; text-align: center; }
.sheet .as-item small { display: block; color: var(--sub); font-size: 12px; }
.sheet .as-item.danger { color: var(--danger); }

.cta-row { display: flex; gap: 8px; padding: 4px 0 18px; }
.btn {
  flex: 1; border: none; border-radius: 13px; padding: 13px; font-size: 14.5px !important; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ── 아이디어 정보 (topic) ── */
.detail-block { background: var(--surface); border-radius: 16px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--other-line); }
.detail-block h4 { font-size: 12.5px; color: var(--sub); margin-bottom: 9px; font-weight: 700; }
.detail-block .timeline li { margin: 0 0 10px 16px; font-size: 13.5px; color: var(--text); }
.detail-block .timeline li b { display: block; font-size: 11.5px; color: var(--sub); font-weight: 500; }
.detail-block.conclusion { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.detail-block.conclusion h4 { color: var(--accent-strong); }
.detail-block .conclusion-text { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.detail-block .tl-row { display: flex; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--text); }
.detail-block .tl-row b { flex: none; width: 38px; font-weight: 700; }
.detail-block .issue { font-size: 13.5px; margin: 0 0 6px 16px; color: var(--text); }
.tc-top { display: flex; align-items: center; gap: 8px; }
.tc-top h3 { flex: 1; color: var(--text); }
.tc-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.tc-meta .date, .date { font-size: 11px; color: var(--sub); margin-left: auto; }
.spec-pre {
  white-space: pre-wrap; font-size: 12.5px; background: #1e2832; color: #d7e1ea;
  border-radius: 12px; padding: 14px; max-height: 50vh; overflow-y: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; line-height: 1.55;
}

/* ── 설정 ── */
.set-group { background: var(--surface); border-radius: 16px; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--other-line); }
.set-group .sg-title { font-size: 12px; color: var(--sub); font-weight: 700; padding: 13px 16px 4px; }
.set-item { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--text); }
.set-item:last-child { border-bottom: none; }
.set-item .grow { flex: 1; }
.set-item small { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }
.set-item select, .set-item textarea {
  background: var(--field); color: var(--text); border: 1px solid var(--field-line); border-radius: 10px; padding: 8px 10px; outline: none;
}
.toggle { width: 46px; height: 27px; border-radius: 999px; background: var(--line); position: relative; border: none; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 22px; }
.cost-bar { height: 8px; border-radius: 4px; background: var(--chip-bg); overflow: hidden; margin: 8px 0 4px; }
.cost-bar i { display: block; height: 100%; width: 25%; background: var(--ok); border-radius: 4px; }

/* 테마 선택 칩 (설정 개인화) */
.theme-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.theme-chips button {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 8px 9px; border-radius: 11px;
  cursor: pointer; text-align: left; border: 1.5px solid var(--line); background: var(--field); font-family: inherit;
}
.theme-chips button.on { border-color: var(--accent); background: var(--chip-on-bg); }
.theme-chips .sw { display: flex; flex: none; border-radius: 5px; overflow: hidden; }
.theme-chips .sw i { width: 12px; height: 18px; display: block; }
.theme-chips span { font-size: 11.5px; font-weight: 600; color: var(--text); }
.seg { display: flex; gap: 5px; }
.seg button {
  border: 1px solid var(--line); background: var(--field); color: var(--sub); border-radius: 9px;
  padding: 7px 12px; font-size: 12.5px !important; font-weight: 600; cursor: pointer; font-family: inherit;
}
.seg button.on { border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-ink); }

/* ── 로그인 ── */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 30px 40px; background: var(--chat-bg); }
.login .hero { display: flex; flex-direction: column; align-items: center; margin-bottom: 38px; }
.login .logo { width: 84px; height: 84px; border-radius: 22%; box-shadow: 0 16px 36px -14px var(--accent); display: block; }
.login h1 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 22px; color: var(--text); }
.login .sub { font-size: 14px; color: var(--sub); margin-top: 8px; text-align: center; line-height: 1.5; }
.login input {
  width: 100%; height: 50px; border-radius: 13px; border: 1px solid var(--field-line);
  background: var(--field); padding: 0 15px; outline: none; margin-bottom: 10px; font-family: inherit; color: var(--text);
}
.login input:focus { border-color: var(--accent); }
.login .error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 6px; }
.login .btn-login {
  width: 100%; margin-top: 26px; background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 13px; padding: 15px; font-size: 15.5px !important; font-weight: 700; cursor: pointer;
}
.login .foot { text-align: center; font-size: 11.5px; color: var(--sub); margin-top: 18px; }

.setup-note { background: var(--chip-on-bg); border: 1px solid var(--accent); color: var(--accent-strong); border-radius: 12px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px; }
