* {
  box-sizing: border-box;
}
html {
  scrollbar-width: thin;
  scrollbar-color: #23324d #0b1220;
  scrollbar-gutter: stable;
  overflow-y: scroll;
  background: #0b1220;
}
body {
  background: #0b1220;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0b1220;
}
::-webkit-scrollbar-thumb {
  background: #23324d;
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
  background: #2e445f;
}
html,
body {
  margin: 0;
  padding: 0;
  background: #0b1220;
  color: #e6e8ee;
}
a {
  color: #93c5fd;
}
body {
  font-family: "Noto Serif", serif;
  font-size: 15px;
  line-height: 1.6;
}
header,
header nav,
header nav a,
h1,
h2,
h3,
h4,
h5,
h6,
.brand {
  font-family: Montserrat, sans-serif;
}
.mono,
code,
kbd,
pre,
samp {
  font-family: "JetBrains Mono", monospace;
}
.topbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  padding-top: env(safe-area-inset-top);
}
.header-disclaimer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 24px;
  border-top: 1px solid #1f2a44;
  background: #0f172a;
}
.header-disclaimer a {
  color: #93c5fd;
  text-decoration: none;
}
.header-disclaimer a:hover {
  text-decoration: underline;
}
.topbar-inner,
.disclaimer-inner,
.layout,
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 1.05rem;
}
.brand img {
  width: 32px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  flex: none;
}
.disclaimer {
  padding: 8px 16px;
  background: #12203a;
  color: #cbd5e1;
  font-size: 0.78rem;
  border-bottom: 1px solid #1f2a44;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
}
.disclaimer-main {
  line-height: 1.4;
}
.disclaimer-crisis {
  line-height: 1.4;
}
.disclaimer a {
  color: #93c5fd;
  text-decoration: none;
}
.disclaimer a:hover {
  text-decoration: underline;
}
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 760px);
  gap: 16px;
  padding: 16px;
  justify-content: center;
  min-height: calc(100vh - 140px);
  min-height: calc(100dvh - 140px);
}
.selector {
  background: #0f172a;
  border: 1px solid #1f2a44;
  border-radius: 0;
  padding: 14px;
  align-self: start;
  position: sticky;
  top: 60px;
}
.select-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-top: 10px;
  display: block;
}
.disciple-select {
  width: 100%;
  margin: 6px 0 4px;
  height: 44px;
  min-height: 44px;
  padding: 0 32px 0 10px;
  background: #0b1220;
  color: #e6e8ee;
  border: 1px solid #24324d;
  border-radius: 0;
  font-size: 12px;
  line-height: 44px;
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
}
.disciple-select:focus {
  border-color: #3b82f6;
  outline: none;
}
.disciple-select:hover {
  border-color: #2e4a6b;
}
.select-hint {
  margin: 0 0 10px;
}
.history-box {
  margin-top: 12px;
  border-top: 1px solid #1f2a44;
  padding-top: 10px;
}
.history-list {
  max-height: 180px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.history-item {
  padding: 6px 8px;
  border: 1px solid #1f2a44;
  border-radius: 0;
  background: #0b1220;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-del {
  flex: none;
  min-width: 44px;
  min-height: 36px;
  padding: 2px 6px;
}
.chat-panel {
  background: #0f172a;
  border: 1px solid #1f2a44;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow: hidden;
}
.voice-header {
  padding: 14px 16px;
  border-bottom: 1px solid #1f2a44;
  background: linear-gradient(180deg, #111d33, #0f172a);
}
.voice-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.voice-header p {
  margin: 4px 0 0;
  color: #9fb0cc;
  font-size: 0.86rem;
}
.chat-log {
  flex: 1;
  overflow: auto;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0b1220;
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 0;
  line-height: 1.5;
  font-size: 0.93rem;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-radius: 0;
}
.bubble.assistant {
  align-self: flex-start;
  background: #162132;
  border: 1px solid #1f2a44;
  border-radius: 0;
  color: #e6e8ee;
}
.cite {
  font-size: 0.68em;
  color: #7d8db0;
  cursor: default;
  margin-left: 1px;
}
.sources {
  margin-top: 8px;
  font-size: 0.68rem;
  line-height: 1.6;
  color: #64748b;
}
.citation-bar {
  padding: 8px 12px;
  border-top: 1px solid #1f2a44;
  min-height: 28px;
  color: #9fb0cc;
  font-size: 0.78rem;
  background: #0f172a;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.resources {
  margin-top: 8px;
  padding: 8px;
  background: #0b1220;
  border: 1px dashed #2a3a5c;
  border-radius: 0;
}
.chat-form {
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #1f2a44;
  background: #0f172a;
}
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #0b1220;
  border: 1px solid #24324d;
  padding: 8px;
  transition: border-color 0.15s;
}
.composer:focus-within {
  border-color: #3b82f6;
}
.composer textarea {
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  padding: 6px 6px;
  border: none;
  background: transparent;
  color: #e6e8ee;
  outline: none;
  resize: none;
  overflow-y: auto;
  line-height: 1.5;
  font-family: inherit;
  font-size: 16px;
}
.composer-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.composer .btn.icon {
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}
.composer .btn.icon.send {
  min-width: 44px;
  font-size: 1rem;
  line-height: 1;
}
.chat-form textarea:disabled {
  opacity: 0.6;
}
.btn {
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 0;
  border: 1px solid #24324d;
  background: #162132;
  color: #e6e8ee;
  cursor: pointer;
  font-size: 0.86rem;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.btn.primary:hover {
  background: #1d4ed8;
}
.btn.small {
  padding: 5px 10px;
  font-size: 0.82rem;
  min-height: 36px;
  min-width: 36px;
}
.btn.active {
  border-color: #3b82f6;
  background: #1e3a5f;
  color: #dbeafe;
}
.bubble.streaming {
  opacity: 0.95;
}
.bubble.streaming .bubble-text::after {
  content: " ▌";
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn[hidden] {
  display: none !important;
}
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(480px, 90vw);
}
.toast {
  background: #162132;
  border: 1px solid #2a3a5c;
  color: #e6e8ee;
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 10px 16px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s;
}
.toast.hide {
  opacity: 0;
}
.auth-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 290px;
  min-height: 36px;
  flex: none;
}
#userLabel {
  display: inline-block;
  width: 130px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  flex: none;
}
#btnSignIn,
#btnSignOut {
  width: 150px;
  flex: none;
}
.footer {
  border-top: 1px solid #1f2a44;
  background: #0f172a;
  margin-top: 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #94a3b8;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
}
.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 150ms;
}
.footer-links a:hover {
  color: #e6e8ee;
}
.footer-links span {
  color: #475569;
}
.footer-note {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 24px;
  text-align: center;
  font-size: 11px;
  line-height: 20px;
  color: #64748b;
}
.foot-tabs,
.foot-legal {
  display: none;
}
.muted {
  color: #94a3b8;
}
.muted-link {
  color: #94a3b8;
  text-decoration: none;
}
.muted-link:hover {
  text-decoration: underline;
}
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
  .selector {
    position: static;
  }
  .bubble {
    max-width: 85%;
  }
  .chat-panel {
    min-height: 0;
    max-height: none;
  }
  .chat-log {
    overflow: visible;
  }
  .chat-form {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }
}
@media (max-width: 560px) {
  .chat-log {
    padding: 12px;
  }
  .disclaimer {
    font-size: 0.74rem;
  }
}
@media (max-width: 640px) {
  .topbar-row {
    padding: 10px 12px;
    gap: 8px;
  }
  .brand {
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .brand-text {
    display: none;
  }
  .topbar-row nav {
    gap: 10px !important;
  }
  .topbar-row nav a {
    font-size: 12px;
  }
  .auth-area {
    min-width: 0;
    gap: 6px;
  }
  #userLabel {
    display: none;
  }
  #btnSignIn,
  #btnSignOut {
    width: auto;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .chip {
    min-height: 44px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 8px;
  }
  .footer-links,
  .footer-inner > span {
    display: none;
  }
  .foot-tabs {
    display: flex;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    gap: 4px;
  }
  .install-btn {
    margin-top: 14px;
  }
  .foot-tabs a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    min-height: 56px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 11px;
  }
  .foot-tabs a.active {
    color: #38bdf8;
  }
  .foot-legal {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #64748b;
  }
  .foot-legal a {
    color: #94a3b8;
    text-decoration: none;
  }
  .foot-legal .dot {
    margin: 0 6px;
    color: #475569;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8edf5;
  text-decoration: none;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}
.nav-brand img {
  width: 32px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: Montserrat, sans-serif;
  padding: 8px 16px;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active {
  color: #e8edf5;
  background: #1a212c;
}
@supports (text-wrap: pretty) {
  body {
    text-wrap: pretty;
  }
}
.topbar-row nav a {
  font-family: Montserrat, sans-serif;
}
html {
  overscroll-behavior: none;
}
body {
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
.topbar,
.foot-tabs,
.chat-form {
  user-select: none;
  -webkit-user-select: none;
}
.chat-log,
.bubble,
textarea,
input {
  user-select: text;
  -webkit-user-select: text;
}
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top);
  }
  .chat-form {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
