:root {
  --bg: #ececf0;
  --paper: #f7f7fb;
  --panel: #ffffff;
  --ink: #2f2767;
  --ink-soft: #615d88;
  --pink: #f0088a;
  --violet: #3a2d6d;
  --violet-dark: #2e2459;
  --line: #deddee;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Montserrat", "Segoe UI", sans-serif;
}

.hero {
  background: linear-gradient(100deg, #f0088a 0%, #e30889 38%, #5f236f 100%);
  color: #fff;
}

.hero-inner {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: clamp(10px, 1.2vw, 16px) clamp(14px, 3.2vw, 52px) clamp(10px, 1.3vw, 18px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(10px, 1.2vw, 20px);
  align-items: end;
}

.brand-mark {
  color: #30246a;
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.04em;
  font-size: clamp(2rem, 6vw, 4.6rem);
  user-select: none;
}

.hero-copy {
  min-width: 0;
}

.hero-copy h1 {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.018em;
  line-height: 0.93;
  font-size: clamp(1.2rem, 2.8vw, 3rem);
  text-wrap: balance;
}

.hero-copy p {
  margin: 6px 0 0;
  font-size: clamp(0.86rem, 1vw, 1.02rem);
  color: rgba(255, 255, 255, 0.92);
  max-width: 54ch;
}

.lang-toggle {
  align-self: start;
  display: inline-flex;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
  padding: clamp(10px, 1.1vw, 13px) clamp(12px, 1.6vw, 22px);
  cursor: pointer;
}

.lang-btn.active {
  color: var(--pink);
}

.page {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: clamp(10px, 1.8vw, 26px) clamp(14px, 3.2vw, 52px) 150px;
}

.intro {
  background: #e6e6ef;
  border: 1px solid #d9d8ea;
  color: #3c366f;
  padding: clamp(12px, 1.5vw, 18px);
  font-size: clamp(0.95rem, 1.05vw, 1.15rem);
  line-height: 1.4;
}

.workspace {
  margin-top: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 0;
}

.workspace-head {
  margin-bottom: 0;
}

.workspace-head h2 {
  margin: 0;
  color: var(--violet-dark);
  font-size: clamp(1.2rem, 2.1vw, 2.2rem);
  letter-spacing: -0.02em;
  font-weight: 900;
}

.workspace-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.2vw, 1.2rem);
}

.chat-log {
  min-height: 0;
  max-height: none;
  overflow: auto;
  background: #f1f1f7;
  border: 1px solid var(--line);
  padding: clamp(10px, 1.5vw, 18px);
  padding-bottom: 20px;
}

.message {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 8px;
}

.message .role {
  margin: 0 0 7px;
  font-size: clamp(0.88rem, 1.1vw, 1.1rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--violet);
}

.message .text {
  margin: 0;
  line-height: 1.55;
  font-size: clamp(1rem, 1.25vw, 1.3rem);
  color: #2f2b57;
}

.message .text table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: inherit;
  display: block;
  overflow-x: auto;
}

.message .text th,
.message .text td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.message .text thead {
  background: #ecebf6;
}

.message .text ol {
  margin: 0;
  padding-left: 18px;
}

.message .text li {
  margin-bottom: 10px;
}

.message .text li a {
  color: var(--pink);
  text-decoration: none;
  word-break: break-all;
}

.message .text li a:hover {
  text-decoration: underline;
}

.chat-form {
  margin-top: 0;
  background: #f1f1f7;
  border: 1px solid var(--line);
  padding: 10px;
}

.composer-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 8px clamp(10px, 2.8vw, 52px) 12px;
  background: linear-gradient(to top, rgba(236, 236, 240, 0.96), rgba(236, 236, 240, 0.75), transparent);
  backdrop-filter: blur(4px);
}

.composer-dock .chat-form {
  width: min(1800px, 100%);
  margin: 0 auto;
  box-shadow: 0 6px 18px rgba(30, 24, 70, 0.08);
}

.chat-form label {
  display: block;
  margin-bottom: 8px;
  color: #3a336f;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border: 1px solid #ccc9e3;
  background: #fff;
  color: #2d2856;
  padding: 10px 12px;
  font: inherit;
  font-size: clamp(0.98rem, 1vw, 1.08rem);
  line-height: 1.35;
}

.actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

button[type="submit"] {
  border: 0;
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  font-size: clamp(0.9rem, 1vw, 1.05rem);
}

button[type="submit"]:hover {
  filter: brightness(1.05);
}

code {
  background: #f1eefc;
  color: #3b3170;
  padding: 1px 4px;
  border-radius: 4px;
}

@media (max-width: 1100px) {
  .hero-inner {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .brand-mark {
    grid-column: 1 / -1;
    line-height: 0.88;
    margin-top: 4px;
  }

  .hero-copy {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .hero-inner {
    gap: 8px;
  }

  .lang-toggle {
    justify-self: end;
  }

  .intro {
    font-size: 1rem;
  }

  textarea {
    font-size: 1rem;
  }

  .chat-log {
    max-height: 52vh;
  }

  .page {
    padding-bottom: 170px;
  }

  .composer-dock {
    padding: 8px 10px 10px;
  }

  .message .text th,
  .message .text td {
    white-space: normal;
  }
}

@media (min-width: 1280px) {
  .page {
    height: calc(100vh - 132px);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
  }

  .workspace {
    min-height: 0;
    height: 100%;
    grid-template-rows: auto 1fr auto;
  }

  .chat-log {
    min-height: 0;
    height: 100%;
  }

  textarea {
    min-height: 54px;
  }
}
