.mhdbot { border: 1px solid rgba(0,0,0,.15); border-radius: 12px; padding: 12px; max-width: 720px; }
.mhdbot__log { height: 360px; overflow: auto; padding: 8px; background: rgba(0,0,0,.03); border-radius: 10px; }
.mhdbot__bar { display: flex; gap: 8px; margin-top: 10px; }
.mhdbot__input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,.2); }
.mhdbot__send { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(0,0,0,.2); background: #fff; cursor: pointer; }
.mhdbot__row { display: flex; margin: 8px 0; }
.mhdbot__row--user { justify-content: flex-end; }
.mhdbot__row--bot { justify-content: flex-start; }
.mhdbot__bubble { max-width: 85%; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid rgba(0,0,0,.08); }
.mhdbot__row--user .mhdbot__bubble { background: rgba(0,0,0,.06); }
.mhdbot__hint { margin-top: 8px; font-size: 12px; opacity: .75; }
.mhdbot__title { font-weight: 700; margin-bottom: 6px; }
.mhdbot__small { font-size: 12px; opacity: .8; margin-bottom: 8px; }
.mhdbot__meta { font-size: 12px; opacity: .7; margin-left: 6px; }
.mhdbot__candlist { margin-top: 8px; }
.mhdbot__cand { padding: 4px 0; }
.mhdbot__content p { margin: 0 0 8px; }
.mhdbot__sources { margin-top: 10px; font-size: 12px; }
/* Floating widget base */
.mhdbot--floating {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483647; /* 最大級 */
  border: none;
  padding: 0;
  max-width: none;
}

.mhdbot--floating.mhdbot--right { right: 18px; }
.mhdbot--floating.mhdbot--left { left: 18px; }

/* Launcher button */
.mhdbot__launcher {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mhdbot__launcherText {
  font-size: 12px;
  opacity: .85;
}

/* Panel */
.mhdbot__panel {
  position: absolute;
  bottom: 68px;
  width: min(360px, calc(100vw - 36px));
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.15);
  background: #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  overflow: hidden;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

/* left/right alignment of panel */
.mhdbot--right .mhdbot__panel { right: 0; }
.mhdbot--left .mhdbot__panel { left: 0; }

.mhdbot[data-state="open"] .mhdbot__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Header */
.mhdbot__panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.03);
}

.mhdbot__panelTitle { font-weight: 700; }
.mhdbot__close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  cursor: pointer;
}

/* Inside panel reuse */
.mhdbot__log {
  height: 300px;
  overflow: auto;
  padding: 10px;
  background: #fff;
  border-radius: 0;
}

.mhdbot__bar { padding: 10px; margin-top: 0; background: #fff; }
.mhdbot__hint { padding: 0 10px 10px; margin-top: 0; }

/* ===== Dark Theme ===== */

.mhdbot__panel {
  background: #111827;
  border: 1px solid rgba(255,255,255,.08);
}

.mhdbot__panelHeader {
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #f3f4f6;
}

.mhdbot__log {
  background: #0f172a;
}

.mhdbot__bubble {
  background: #1f2937;
  border: 1px solid rgba(255,255,255,.06);
  color: #f3f4f6;
}

.mhdbot__row--user .mhdbot__bubble {
  background: #2b3344;
}

.mhdbot__meta {
  color: #9ca3af;
}

.mhdbot__small {
  color: #9ca3af;
}

.mhdbot__input {
  background: #1f2937;
  border: 1px solid rgba(255,255,255,.1);
  color: #f3f4f6;
}

.mhdbot__input::placeholder {
  color: #6b7280;
}

.mhdbot__send {
  background: #7c3aed;
  border: none;
  color: white;
}

.mhdbot__send:hover {
  background: #6d28d9;
}

.mhdbot__launcher {
  background: #7c3aed;
  color: white;
  border: none;
}
.mhdbot__panel {
  backdrop-filter: blur(12px);
  background: rgba(17, 24, 39, 0.85);
  z-index: 2147483647;
}

.mhdbot__candlist { margin-top: 8px; display: grid; gap: 8px; }

.mhdbot__candBtn{
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: inherit;
  cursor: pointer;
}

.mhdbot__candBtn:hover{
  background: rgba(255,255,255,.10);
}

.mhdbot__candNo{
  font-weight: 700;
  margin-right: 6px;
}

.mhdbot__candTitle{
  font-weight: 600;
  margin-right: 8px;
}

.mhdbot__tblwrap{display:flex;gap:10px;flex-wrap:wrap;margin:8px 0}
.mhdbot__tbl{border-collapse:collapse;min-width:170px;background:rgba(255,255,255,0.06)}
.mhdbot__tbl th,.mhdbot__tbl td{border:1px solid rgba(255,255,255,0.15);padding:6px 8px;font-size:13px}
.mhdbot__tbl thead th{text-align:left}
.mhdbot__legend{margin-top:6px;font-size:12px;opacity:.85}
.mhdbot__note{font-size:13px;line-height:1.5}
.mhdbot__m{display:inline-block;min-width:1.6em;text-align:center;border-radius:6px;padding:2px 6px;border:1px solid rgba(255,255,255,0.18)}
.mhdbot__m--ss{font-weight:700}
.mhdbot__m--s{font-weight:600}
.mhdbot__m--w{opacity:.9}
.mhdbot__m--n{opacity:.8}
.mhdbot__m--u{opacity:.7}