:root {
  --bg: #212121;
  --sidebar: #171717;
  --sidebar-soft: #202020;
  --panel: #212121;
  --panel-2: #2f2f2f;
  --panel-3: #3a3a3a;
  --text: #ececec;
  --muted: #b4b4b4;
  --muted-2: #8f8f8f;
  --line: #3d3d3d;
  --line-soft: #303030;
  --brand: #ececec;
  --brand-dark: #ffffff;
  --brand-soft: #2f2f2f;
  --success-soft: #23352b;
  --success-border: #3c684e;
  --warning-soft: #3a311e;
  --warning-border: #6f5b28;
  --danger-soft: #3a2222;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-width: 300px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sidebar);
  border-right: 1px solid var(--line-soft);
  color: var(--text);
}

.sidebar-top {
  display: grid;
  gap: 14px;
  padding: 16px 14px 12px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 4px 2px;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-text span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.25;
}

.new-chat-button,
.ghost-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.new-chat-button:hover,
.ghost-button:hover,
.topic-button:hover,
.quick-prompts button:hover,
.inline-prompt:hover,
.copy-answer:hover {
  border-color: #575757;
  background: var(--sidebar-soft);
}

.new-chat-button span {
  font-size: 1.25rem;
  line-height: 1;
}

.support-note,
.sidebar-section {
  padding: 10px 14px;
}

.support-note h2 {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-note p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--sidebar-soft);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.sidebar-section {
  min-height: 0;
  overflow: auto;
  padding-top: 6px;
  padding-bottom: 6px;
}

.sidebar-section::-webkit-scrollbar,
.messages::-webkit-scrollbar {
  width: 10px;
}

.sidebar-section::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #555;
  background-clip: content-box;
}

.suggestions-box {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.suggestions-box summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 4px 12px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.suggestions-box summary::-webkit-details-marker {
  display: none;
}

.suggestions-box summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 800;
}

.suggestions-box[open] summary::after {
  content: "–";
}

.suggestions-content {
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
}

.city-row {
  display: grid;
  gap: 8px;
}

.field-label {
  display: block;
  color: var(--muted-2);
  font-size: 0.82rem;
  font-weight: 650;
}

.select,
.composer input {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  outline: none;
}

.select {
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--sidebar-soft);
}

.select:focus,
.composer input:focus {
  border-color: #777;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.quick-prompts,
.related,
.link-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-prompts button,
.topic-button,
.inline-prompt,
.copy-answer {
  border: 1px solid var(--line-soft);
  background: var(--sidebar-soft);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.quick-prompts button {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-group h3 {
  margin: 8px 0 6px;
  color: var(--muted-2);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topic-button {
  width: 100%;
  display: block;
  margin-bottom: 6px;
  padding: 9px 11px;
  border-radius: 11px;
  color: var(--muted);
  text-align: left;
  font-size: 0.88rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 0.84rem;
}

.sidebar-backdrop {
  display: none;
}

.chat-panel {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg);
}

.chat-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid transparent;
  background: rgba(33, 33, 33, 0.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  gap: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: var(--panel-2);
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--text);
}

.chat-title-block {
  min-width: 0;
}

.quest-mascot {
  position: relative;
  margin-left: auto;
  width: 92px;
  min-width: 92px;
  height: 72px;
  display: block;
  text-decoration: none;
  transform: rotate(-7deg);
  transform-origin: bottom center;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.quest-mascot:hover {
  transform: rotate(-5deg) translateY(-2px);
  filter: brightness(1.08);
}

.quest-sign {
  position: absolute;
  top: -2px;
  right: 2px;
  min-width: 72px;
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
  border-radius: 4px;
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 100%);
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.7);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.quest-sign::after {
  display: none;
}

.quest-figure {
  position: absolute;
  right: 12px;
  bottom: 0;
  width: 44px;
  height: 50px;
  image-rendering: pixelated;
}

.quest-figure span {
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.q-head {
  top: 6px;
  left: 11px;
  width: 18px;
  height: 14px;
  background: #f3c29b;
  border: 2px solid #0f172a;
}

.q-hair {
  top: 4px;
  left: 10px;
  width: 20px;
  height: 8px;
  background: #111827;
  border: 2px solid #0f172a;
  border-bottom: 0;
}

.q-body {
  top: 20px;
  left: 10px;
  width: 20px;
  height: 16px;
  background: #10a37f;
  border: 2px solid #0f172a;
}

.q-arm.left {
  top: 21px;
  left: 5px;
  width: 7px;
  height: 16px;
  background: #f3c29b;
  border: 2px solid #0f172a;
}

.q-arm.right {
  top: 16px;
  right: 4px;
  width: 7px;
  height: 20px;
  background: #f3c29b;
  border: 2px solid #0f172a;
  transform: rotate(-12deg);
  transform-origin: bottom center;
}

.q-leg.left {
  top: 35px;
  left: 11px;
  width: 7px;
  height: 15px;
  background: #60a5fa;
  border: 2px solid #0f172a;
}

.q-leg.right {
  top: 35px;
  left: 22px;
  width: 7px;
  height: 15px;
  background: #60a5fa;
  border: 2px solid #0f172a;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h1 span {
  font-weight: 760;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 18px 18px 28px;
}

.message {
  width: min(100%, 850px);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 0 auto;
  padding: 18px 0;
}

.message.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
  padding-top: 10px;
  padding-bottom: 10px;
}

.message.user .avatar {
  display: none;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #10a37f;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.message.user .bubble {
  max-width: min(72%, 680px);
  border-radius: 22px;
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 16px;
}

.bubble {
  max-width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.answer-card h3 {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 1.13rem;
  line-height: 1.25;
}

.answer-card h4 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.answer-card p {
  margin-bottom: 12px;
  color: var(--text);
}

.answer-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted-2);
  font-size: 0.8rem;
  font-weight: 650;
}

.notice {
  display: grid;
  gap: 5px;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin: 14px 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.notice.soft {
  background: var(--brand-soft);
  border: 1px solid var(--line);
}

.notice.warning {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
}

.notice span,
.route-box span,
.template-box p {
  color: var(--muted);
}

.route-box,
.template-box {
  display: grid;
  gap: 5px;
  margin: 14px 0;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--success-border);
  background: var(--success-soft);
}

.template-box {
  border-color: var(--line);
  background: var(--panel-2);
}

.clean-list,
.refs ul {
  margin: 0;
  padding-left: 1.18rem;
}

.clean-list li,
.refs li {
  margin: 6px 0;
}

.link-section {
  margin-top: 16px;
}

.link-pills a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
}

.link-pills a:hover {
  background: var(--panel-3);
  text-decoration: none;
}

.refs {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
}

.refs summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
}

.refs a {
  color: var(--text);
}

.next-step {
  margin-top: 14px;
}

.related {
  align-items: center;
  margin-top: 14px;
}

.related h4 {
  flex-basis: 100%;
  margin-bottom: 0;
}

.inline-prompt,
.copy-answer {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.inline-prompt {
  background: var(--panel-2);
}

.copy-answer {
  margin-top: 16px;
  background: transparent;
}

.welcome {
  max-width: 760px;
  padding-top: 12vh;
}

.welcome h3 {
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  letter-spacing: -0.05em;
}

.composer-area {
  padding: 0 16px 14px;
  background: linear-gradient(to top, var(--bg) 76%, rgba(33, 33, 33, 0));
}

.composer {
  width: min(100%, 780px);
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid #4b4b4b;
  border-radius: 28px;
  background: #303030;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

.composer input {
  min-height: 42px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  padding: 0 10px 0 12px;
}

.composer input::placeholder {
  color: #aaa;
}

.composer input:focus {
  box-shadow: none;
}

.composer button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #1f1f1f;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.composer button:hover {
  transform: translateY(-1px);
  background: #fff;
}

.footer {
  width: min(100%, 780px);
  margin: 9px auto 0;
  color: var(--muted-2);
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: min(86vw, var(--sidebar-width));
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-101%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: grid;
  }

  .chat-header {
    padding-left: 10px;
  }

  .message {
    width: min(100%, 760px);
  }
}

@media (max-width: 640px) {
  .chat-header {
    min-height: 56px;
    padding-right: 12px;
  }

  .quest-mascot {
    width: 78px;
    min-width: 78px;
    height: 64px;
  }

  .quest-sign {
    min-width: 62px;
    font-size: 0.64rem;
  }

  .quest-figure {
    right: 10px;
    transform: scale(0.92);
    transform-origin: bottom right;
  }

  h1 {
    font-size: 0.98rem;
  }

  .messages {
    padding: 12px 14px 24px;
  }

  .message {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 0;
  }

  .avatar {
    display: none;
  }

  .message.user .bubble {
    max-width: 88%;
  }

  .welcome {
    padding-top: 7vh;
  }

  .welcome h3 {
    font-size: 1.8rem;
  }

  .composer-area {
    padding: 0 10px 10px;
  }

  .composer {
    min-height: 54px;
    border-radius: 24px;
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .composer button {
    width: 38px;
    height: 38px;
  }

  .footer {
    font-size: 0.68rem;
  }
}
