:root {
  --bg: #0b0b09;
  --surface: #11110e;
  --surface-2: #161610;
  --surface-3: #0e0e0b;
  --ink: #e9e2d0;
  --muted: #9c9484;
  --faint: #6f6759;
  --line: #373226;
  --line-soft: rgba(55, 50, 38, 0.72);
  --accent: #d4bd73;
  --accent-dim: #8d7743;
  --danger: #b98252;
  --input: #0f0f0c;
  --button-ink: #11110e;
  --page: min(920px, calc(100% - 32px));
  --sans: "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Bahnschrift", "Aptos Display", "Aptos", "Segoe UI", system-ui, sans-serif;
  --label: "Bahnschrift", "Aptos", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: inherit;
  text-decoration: none;
}

.field-hint a,
.check-row a,
.legal-copy a,
.site-footer a,
.topline a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p,
blockquote {
  margin: 0;
}

h1,
h2 {
  font-family: var(--display);
  letter-spacing: 0;
  line-height: 0.98;
}

h1 {
  max-width: 860px;
  font-size: clamp(42px, 8vw, 92px);
  font-weight: 760;
}

h2 {
  max-width: 740px;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 740;
}

h3 {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.page {
  width: var(--page);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 32px 0 80px;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.topline strong {
  color: var(--ink);
  font-weight: 650;
}

.hero,
.block,
.start-block {
  border-bottom: 1px solid var(--line);
}

.hero {
  padding: 72px 0 64px;
}

.block {
  padding: 48px 0;
}

.status,
.section-label {
  margin-bottom: 20px;
  color: var(--accent);
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.hero .status {
  display: inline-block;
  margin-bottom: 28px;
}

.lead,
.text {
  max-width: 720px;
  color: var(--muted);
  font-family: var(--sans);
}

.lead {
  margin-top: 28px;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
}

.text {
  margin-top: 18px;
  font-size: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 34px;
}

.button,
.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: var(--button-ink);
  font-family: var(--label);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.note,
.footer-note {
  color: var(--faint);
  font-size: 13px;
}

.hero-check {
  display: grid;
  gap: 18px;
  max-width: 820px;
  margin-top: 34px;
}

.topic-bar {
  display: grid;
  gap: 10px;
}

.topic-bar > span {
  color: var(--accent);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-chip {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.topic-chip:hover,
.topic-chip.is-selected {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(212, 189, 115, 0.11);
}

.stau-input-label textarea {
  min-height: 132px;
  background: #10100d;
  font-size: 1.03rem;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  align-items: center;
}

.first-win {
  margin-top: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
}

.preview-panel {
  border-right: 1px solid var(--line);
}

.preview-reply {
  padding: 15px;
}

.preview-reply .section-label {
  margin-bottom: 12px;
}

.preview-copy {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.preview-copy p,
.preview-copy li {
  line-height: 1.5;
}

.analysis-loader {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.analysis-loader strong {
  color: var(--ink);
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.analysis-loader p {
  margin-top: 3px;
  line-height: 1.45;
}

.loader-ring {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-ring {
    animation: none;
    border-color: var(--accent);
  }
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

body.is-analysis-loading .analysis-overlay {
  display: grid;
}

.analysis-float {
  width: min(320px, calc(100vw - 48px));
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px 22px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 14, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
  text-align: center;
  transform: translateY(-3vh);
}

.analysis-float strong {
  color: var(--ink);
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.analysis-float p {
  max-width: 250px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.loader-ring-large {
  width: 46px;
  height: 46px;
  border-width: 3px;
  box-shadow: 0 0 26px rgba(212, 189, 115, 0.16);
}

.case-list {
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.case {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.case-num {
  color: var(--faint);
}

.case p {
  margin-top: 4px;
  color: var(--muted);
}

.protocol {
  margin-top: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.protocol-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}

.protocol-row:last-child {
  border-bottom: 0;
}

.protocol-key,
.protocol-value {
  padding: 16px;
}

.protocol-key {
  border-right: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.protocol-value {
  color: var(--ink);
}

.protocol-value.muted {
  color: var(--muted);
}

.message-sample {
  margin-top: 24px;
  padding: 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface-3);
  color: var(--ink);
}

.no-list {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.no-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.no-list li::before {
  content: "- ";
  color: var(--danger);
}

.test-box {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.test-box p {
  color: var(--muted);
}

.start-block {
  display: grid;
  grid-template-columns: minmax(0, 0.74fr) minmax(340px, 0.68fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: start;
  padding: 64px 0 76px;
}

.soft-gate {
  margin-top: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface-2);
}

.soft-gate h2 {
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.05;
}

.start-block .footer-note {
  margin-top: 24px;
}

.access-form {
  display: grid;
  gap: 16px;
  padding: 0;
}

label {
  display: grid;
  gap: 8px;
}

label > span,
.result-row > span {
  color: var(--accent);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.field-hint,
.privacy-note {
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
}

.legal-hint {
  max-width: 740px;
}

.privacy-note {
  padding: 11px 0 2px;
  border-top: 1px solid var(--line);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: var(--input);
  color: var(--ink);
}

input {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  padding: 12px 13px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.check-row input {
  width: 17px;
  min-height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.check-row span {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
}

.state-view {
  width: min(760px, 100%);
  margin: clamp(40px, 10vw, 96px) auto;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.state-view h1 {
  max-width: 100%;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 24px 0 0;
  color: var(--muted);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.legal-page h1 {
  font-size: clamp(38px, 7vw, 72px);
}

.legal-copy {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 17px;
}

.legal-copy h2 {
  margin-top: 18px;
  font-size: clamp(24px, 3vw, 34px);
}

.legal-copy strong {
  color: var(--ink);
}

.imprint-address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.65;
}

.legal-list {
  margin: 0;
  padding-left: 20px;
}

.chat-view {
  min-height: calc(100dvh - 64px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.chat-topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.chat-topbar h1 {
  max-width: 640px;
  font-size: clamp(34px, 5vw, 64px);
}

.chat-topbar .button {
  flex: 0 0 auto;
}

.chat-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}

.chat-main,
.result-panel {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.chat-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--accent-dim) var(--surface-3);
  scrollbar-width: thin;
}

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

.messages::-webkit-scrollbar-track {
  background: var(--surface-3);
}

.messages::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-3);
  background: var(--accent-dim);
}

.message {
  width: fit-content;
  max-width: min(720px, 92%);
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  color: var(--ink);
  background: var(--surface-3);
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  max-width: min(640px, 86%);
  border-color: var(--accent);
  background: var(--accent);
  color: var(--button-ink);
}

.message.assistant {
  align-self: flex-start;
}

.message.is-loading {
  color: var(--accent);
}

.message-body {
  display: grid;
  gap: 8px;
}

.message-body p {
  margin: 0;
  line-height: 1.5;
  white-space: normal;
}

.message-body h3,
.message-body h4 {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.03rem;
  letter-spacing: 0;
  line-height: 1.25;
}

.message-body strong {
  color: var(--ink);
  font-weight: 780;
}

.message-body em {
  color: var(--muted);
  font-style: italic;
}

.message-body code {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--label);
  font-size: 0.9em;
}

.message-body ul,
.message-body ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.message-body li {
  margin: 0;
  padding-left: 2px;
}

.message-body blockquote {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: rgba(212, 189, 115, 0.08);
  color: var(--muted);
}

details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

summary {
  color: var(--accent);
  cursor: pointer;
  font-family: var(--label);
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

li {
  margin: 4px 0;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-3);
}

#message-input {
  min-height: 48px;
  max-height: 104px;
  resize: none;
}

.send-button {
  min-width: 110px;
}

.result-panel {
  align-content: start;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.result-head .section-label {
  margin: 0;
}

.status-chip {
  color: var(--faint);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.result-row {
  display: grid;
  gap: 7px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row.strong {
  background: var(--surface-2);
}

.result-row p {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .start-block,
  .chat-layout,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-panel {
    display: none;
  }
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 28px, 920px);
    padding: 22px 0 56px;
  }

  .topline,
  .chat-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .hero {
    padding: 44px 0 40px;
  }

  .block {
    padding: 38px 0;
  }

  h1 {
    font-size: clamp(40px, 13vw, 58px);
  }

  h2 {
    font-size: clamp(27px, 9vw, 42px);
  }

  .lead,
  .text {
    font-size: 17px;
    line-height: 1.55;
  }

  .case {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .protocol-row {
    grid-template-columns: 1fr;
  }

  .protocol-key {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .action-row {
    align-items: stretch;
  }

  .hero-check {
    margin-top: 28px;
  }

  .topic-chips {
    gap: 7px;
  }

  .topic-chip {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .stau-input-label textarea {
    min-height: 124px;
  }

  .preview-actions {
    align-items: stretch;
  }

  .button,
  .send-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  body.is-chat-view {
    min-height: 100dvh;
    overflow: hidden;
    background: var(--bg);
  }

  body.is-chat-view .page {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
  }

  body.is-chat-view .site-footer {
    display: none;
  }

  body.is-chat-view .chat-view {
    height: 100dvh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr);
    gap: 0;
  }

  body.is-chat-view .chat-topbar {
    height: 54px;
    flex-direction: row;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }

  body.is-chat-view .chat-topbar h1 {
    display: none;
  }

  body.is-chat-view .chat-topbar .section-label {
    margin: 0;
  }

  body.is-chat-view #reset-chat {
    width: auto;
    min-height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 0.92rem;
    letter-spacing: 0;
    text-transform: none;
  }

  body.is-chat-view .chat-layout {
    display: block;
    min-height: 0;
  }

  body.is-chat-view .chat-main {
    height: calc(100dvh - 54px);
    min-height: 0;
    border: 0;
    background: var(--bg);
  }

  body.is-chat-view .messages {
    gap: 16px;
    padding: 18px 14px 112px;
    scrollbar-width: none;
  }

  body.is-chat-view .messages::-webkit-scrollbar {
    display: none;
  }

  body.is-chat-view .message {
    max-width: 94%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.98rem;
    line-height: 1.5;
  }

  body.is-chat-view .message.user {
    max-width: 78%;
    padding: 10px 12px;
    background: var(--accent);
    color: var(--button-ink);
    font-family: var(--sans);
  }

  body.is-chat-view details {
    display: none;
  }

  body.is-chat-view .chat-form {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 12px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg);
  }

  body.is-chat-view #message-input {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
    padding: 15px 66px 15px 14px;
    border-color: var(--line);
    background: var(--surface);
    font-family: var(--sans);
    resize: none;
  }

  body.is-chat-view .send-button {
    position: absolute;
    right: 22px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    border-color: var(--accent);
    border-radius: 999px;
    font-size: 0;
  }

  body.is-chat-view .send-button::before {
    content: "↑";
    font-size: 1.08rem;
    font-weight: 800;
  }
}
