/* F2 Design: 整理された道具感 */

:root {
  --bg: #F4F4F1;
  --side: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #1A1A17;
  --ink-2: #54544D;
  --ink-3: #86867D;
  --ink-4: #8A8A81;
  --line: #E4E3DD;
  --line-2: #ECEBE5;
  --accent: #1F3A5F;
  --accent-2: #16294A;
  --accent-bg: rgba(31,58,95,0.06);
  --accent-bg-strong: rgba(31,58,95,0.14);
  --accent-weak: rgba(31,58,95,0.06);
  --r: 5px;
  --measure: 820px;
  --gutter: 40px;
  --shadow-2: 0 4px 18px rgba(28,33,31,0.05);
  --shadow-3: 0 10px 30px rgba(28,33,31,0.08);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
}

.side-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 16px;
  flex-shrink: 0;
}
.side-brand img { height: 44px; }
.side-brand .firm {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
}

.side-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
}

.side-version {
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}

.hist {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 12px;
}

.hist-empty {
  padding: 16px 12px;
  font-size: 12px;
  color: var(--ink-4);
}

.hist-i {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 36px 9px 14px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background .12s;
}
.hist-i::before {
  content: '';
  position: absolute;
  left: 4px; top: 9px; bottom: 9px;
  width: 2px; border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .12s;
}
.hist-i:hover { background: #F1F0EA; }
.hist-i.on { background: var(--surface); }
.hist-i.on::before { opacity: 1; }

.hist-t {
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-i.on .hist-t { color: var(--ink); font-weight: 500; }

.hist-d {
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 3px;
}

.hist-del {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; border: none;
  background: transparent; color: var(--ink-4);
  cursor: pointer; font-size: 14px;
  opacity: 0;
  transition: opacity .12s, color .12s;
}
.hist-i:hover .hist-del { opacity: 1; }
.hist-del:hover { color: #c0392b; background: rgba(192,57,43,0.08); }

.hist-clear-btn {
  flex-shrink: 0;
  margin: 0 10px 12px;
  padding: 7px 0;
  width: calc(100% - 20px);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-3);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color .13s, border-color .13s;
  display: none;
}
.hist-clear-btn.visible { display: block; }
.hist-clear-btn:hover { color: #c0392b; border-color: #c0392b; }

/* ===== Main ===== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ===== Top Bar ===== */
.topbar {
  height: 54px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 20;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.tb-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
}

.topbar-edition {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.topbar-edition.edition-free    { background: var(--line); color: var(--ink-2); }
.topbar-edition.edition-standard{ background: var(--line); color: var(--ink-2); }
.topbar-edition.edition-review  { background: #FEF3C7; color: #92400E; }

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s;
}
.menu-btn:hover { background: var(--bg); color: var(--ink); }
.menu-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.tb-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--r);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: .13s;
}
.tb-btn:hover { background: var(--bg); color: var(--ink); }
.tb-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-short { display: none; }

/* ===== Chat wrapper ===== */
.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scroll-behavior: auto;
}

/* ===== Welcome ===== */
.welcome {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding: 48px var(--gutter) 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.welcome h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.45;
  margin-bottom: 14px;
}

.welcome .sub {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.95;
}
.welcome .sub a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.welcome .sub a .lg-t { border-bottom: 1px solid var(--accent-weak); padding-bottom: 1px; transition: border-color .15s; }
.welcome .sub a:hover .lg-t { border-color: var(--accent); }
.welcome .sub a svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.welcome .sub a:hover svg { transform: translateX(3px); }

.ex-title {
  margin: 36px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ex-title h2 { font-size: 14px; font-weight: 600; color: var(--ink); }
.ex-title span { font-size: 12px; color: var(--ink-4); }

/* 質問例: ボタン行 */
.q-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.q {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: border-color .14s, background .14s, transform .05s;
}
.q:hover { border-color: var(--accent); background: #fff; }
.q:active { transform: translateY(1px); }

.q-mark {
  width: 7px; height: 7px;
  border-radius: 1.5px;
  background: var(--ink-4);
  flex-shrink: 0;
  transition: background .14s;
}
.q:hover .q-mark { background: var(--accent); }

.q-t {
  flex: 1;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.5;
  transition: color .14s;
}
.q:hover .q-t { color: var(--ink); }

.q-go {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  transition: .14s;
}
.q:hover .q-go { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateX(2px); }
.q-go svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Chat Inner ===== */
.chat-inner {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding: 24px var(--gutter);
}

/* ===== Messages ===== */
.msg { margin-bottom: 8px; animation: msgIn 0.2s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.msg-user { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.msg-user .msg-bubble {
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px 10px 4px 10px;
  max-width: 72%;
  font-size: 15px;
  line-height: 1.7;
}

.msg-bot { display: flex; justify-content: flex-start; }
.msg-bot .msg-wrap { max-width: 100%; width: 100%; position: relative; }
.msg-bot .msg-bubble {
  background: var(--surface);
  color: var(--ink);
  padding: 20px 24px;
  border-radius: 8px;
  max-width: 100%; width: 100%;
  font-size: 15px;
  line-height: 1.85;
  border: 1px solid var(--line);
}

.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.msg-bot .msg-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--ink); background: var(--bg); }
.copy-btn svg { width: 16px; height: 16px; }

/* Bot markdown */
.msg-bot .msg-bubble strong { color: var(--ink); font-weight: 600; }
.msg-bot .md-h1 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 20px 0 8px; padding-bottom: 8px; border-bottom: 2px solid var(--accent-bg-strong); }
.msg-bot .md-h2 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 18px 0 6px; }
.msg-bot .md-h3 { font-size: 15px; font-weight: 600; color: var(--accent); margin: 14px 0 4px; }
.msg-bot .md-h1:first-child, .msg-bot .md-h2:first-child, .msg-bot .md-h3:first-child { margin-top: 0; }
.msg-bot .md-list { margin: 8px 0; padding-left: 22px; }
.msg-bot .md-list li { margin-bottom: 3px; }
.msg-bot .md-blockquote { border-left: 3px solid var(--accent-bg-strong); background: var(--bg); padding: 10px 16px; margin: 12px 0; border-radius: 0 var(--r) var(--r) 0; color: var(--ink-2); font-size: 14px; }
.msg-bot .md-note { background: var(--accent-bg); border-left: 3px solid var(--accent); padding: 10px 16px; margin: 12px 0; border-radius: 0 var(--r) var(--r) 0; font-size: 14px; }
.msg-bot .md-warning { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 10px 16px; margin: 12px 0; border-radius: 0 var(--r) var(--r) 0; font-size: 14px; }
.msg-bot .md-hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.msg-bot p { margin-bottom: 6px; }
.msg-bot p:last-child { margin-bottom: 0; }

/* Citations */
.citations { margin-top: 12px; padding: 14px 16px; background: var(--bg); border-radius: var(--r); }
.citations-title { font-size: 11px; font-weight: 700; color: var(--ink-4); letter-spacing: 0.08em; margin-bottom: 8px; }
.citation { display: block; padding: 7px 12px; margin-bottom: 4px; background: var(--surface); border-radius: 4px; font-size: 13px; color: var(--accent); text-decoration: none; transition: background .15s; }
.citation:hover { background: var(--accent-bg); }
.citation-text { color: var(--ink-2); }

.article-link { color: var(--accent); text-decoration: none; font-weight: 500; background: var(--accent-bg); padding: 1px 5px; border-radius: 4px; transition: all .15s; }
.article-link:hover { background: var(--accent); color: #fff; }

/* ===== Scroll-to-bottom ===== */
.jump-bottom {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 18px;
  border-radius: 9999px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink-3);
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 5;
  transition: all .15s;
}
.jump-bottom:hover { color: var(--ink); box-shadow: var(--shadow-3); }
.jump-bottom.visible { display: flex; }
.jump-bottom svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ===== Input Dock ===== */
.input-dock {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 14px var(--gutter) 12px;
}

.dock-inner {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
}

.field {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 11px 13px 0;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.field textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.7;
  min-height: 46px;
  max-height: 190px;
}
.field textarea::placeholder { color: var(--ink-4); }

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--line-2);
}

.khint { font-size: 11px; color: var(--ink-3); letter-spacing: .01em; white-space: nowrap; }
.khint b { color: var(--ink-2); font-weight: 600; }

.ctrl { display: flex; align-items: center; gap: 8px; }

.mode-select {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 7px 10px;
  background: var(--surface);
  cursor: pointer;
  outline: none;
}
.mode-select:focus { border-color: var(--accent); }

.mode-dropdown { display: none; }
.mode-dropdown.active { display: flex; }

.send-btn {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: var(--r);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, transform .08s;
}
.send-btn:hover { background: var(--accent-2); }
.send-btn:active { transform: translateY(1px); }
.send-btn:disabled { background: var(--ink-4); cursor: not-allowed; transform: none; }
.send-btn svg { display: none; }
.send-btn.stop-mode { background: #c0392b; }
.send-btn.stop-mode:hover { background: #a93226; }

.disc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}
.disc span { font-size: 11px; color: var(--ink-3); line-height: 1.5; }
.disc a { font-size: 11px; color: var(--ink-2); text-decoration: none; margin-left: 14px; }
.disc a:hover { color: var(--ink); }

/* ===== Sidebar backdrop (モバイル用) ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  z-index: 49;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

/* ===== Drawer (会話履歴, 右から) ===== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  z-index: 51;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.drawer-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.drawer-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r); border: none;
  background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: 18px;
}
.drawer-close:hover { background: var(--bg); color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 24px 20px 20px; }
.drawer-body--hist { padding: 8px 0 0; }
.drawer-version { flex-shrink: 0; text-align: center; font-size: 12px; color: var(--ink-4); padding: 10px 20px; border-top: 1px solid var(--line); }
.drawer-section-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }
.drawer-section { margin-bottom: 24px; }
.drawer-label { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.drawer-text { font-size: 14.5px; color: var(--ink); line-height: 1.85; }
.drawer-text a { color: var(--accent); text-decoration: none; }
.drawer-text a:not(.terms-link):hover { text-decoration: underline; }

.terms-link { font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.terms-link .lg-t { border-bottom: 1px solid var(--accent-weak); padding-bottom: 1px; transition: border-color .15s; }
.terms-link:hover .lg-t { border-color: var(--accent); }
.terms-link svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.terms-link:hover svg { transform: translateX(3px); }

.ref-card-link { font-size: 13.5px; font-weight: 500; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.ref-card-link .lg-t { border-bottom: 1px solid var(--accent-weak); padding-bottom: 1px; transition: border-color .15s; }
.ref-card-link:hover .lg-t { border-color: var(--accent); }
.ref-card-link:hover svg { transform: translateX(3px); }

.ref-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ref-chip { font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 9999px; background: var(--accent-bg); color: var(--accent); text-decoration: none; transition: background .15s; }
.ref-chip:hover { background: var(--accent-bg-strong); }

/* ===== Loading ===== */
.loading { display: flex; align-items: center; gap: 8px; color: var(--ink-4); font-size: 14px; padding: 20px 24px; }
.dots { display: flex; gap: 4px; }
.dots span { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: pulse 1.4s infinite ease-in-out both; }
.dots span:nth-child(1) { animation-delay: -0.32s; }
.dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes pulse { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }

.warn-box { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 10px 14px; border-radius: 0 4px 4px 0; font-size: 14.5px; }

/* ===== Auth Overlay ===== */
.auth-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.35); backdrop-filter: blur(8px); align-items: center; justify-content: center; }
.auth-overlay.active { display: flex; }

.auth-card { background: var(--surface); border-radius: 8px; padding: 40px 36px 32px; max-width: 380px; width: 90%; text-align: center; box-shadow: var(--shadow-3); }
.auth-icon { width: 48px; height: 48px; border-radius: 10px; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; color: var(--accent); }
.auth-card h2 { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input { width: 100%; height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-family: inherit; outline: none; transition: box-shadow 0.2s, border-color 0.2s; }
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.auth-input::placeholder { color: var(--ink-4); }
.auth-btn { width: 100%; height: 44px; border-radius: var(--r); border: none; background: var(--accent); color: #fff; font-size: 15px; font-family: inherit; font-weight: 600; cursor: pointer; transition: background .15s; }
.auth-btn:hover { background: var(--accent-2); }
.auth-btn:disabled { background: var(--ink-4); cursor: not-allowed; }
.auth-error { margin-top: 12px; font-size: 13px; color: #c0392b; min-height: 20px; }
.auth-back { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--ink-3); text-decoration: none; transition: color .15s; }
.auth-back:hover { color: var(--ink); }

.confirm-modal { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.35); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.confirm-modal.active { display: flex; }
.confirm-dialog { background: var(--surface); border-radius: 8px; padding: 28px 28px 20px; max-width: 340px; width: 90%; box-shadow: var(--shadow-3); }
.confirm-msg { font-size: 15px; color: var(--ink); margin-bottom: 24px; line-height: 1.6; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-cancel { padding: 8px 18px; border-radius: var(--r); border: 1px solid var(--line); background: none; color: var(--ink-2); font-family: inherit; font-size: 14px; cursor: pointer; transition: background .13s; }
.confirm-cancel:hover { background: var(--bg); }
.confirm-ok { padding: 8px 18px; border-radius: var(--r); border: none; background: #c0392b; color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .13s; }
.confirm-ok:hover { background: #a93226; }

/* ===== Mobile ===== */
@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    box-shadow: 0 12px 40px rgba(0,0,0,.16);
    transition: transform .25s;
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; }
  .menu-btn { display: flex; }
  .tb-full { display: none; }
  .tb-short { display: inline; }
  :root { --gutter: 20px; }
  .welcome { padding: 32px var(--gutter) 20px; }
  .welcome h1 { font-size: 22px; }
  .input-dock { padding: 12px var(--gutter); }
  .foot { flex-wrap: wrap; gap: 10px; }
  .khint { order: 3; flex-basis: 100%; }
  .msg-user .msg-bubble { max-width: 88%; }
  .drawer { width: 100%; }
}

@media (max-width: 640px) {
  .chat-inner { padding: 16px var(--gutter); }
  .disc { flex-direction: column; align-items: flex-start; gap: 4px; }
  .disc a { margin-left: 0; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-dock { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (hover: none) { .copy-btn { opacity: 1; } }
