:root {
  --ink: #171307;
  --muted: #5f5540;
  --paper: #ffd84d;
  --panel: #fff7c4;
  --line: #211a08;
  --black: #15120b;
  --yellow: #ffd21f;
  --gold: #f5a900;
  --cream: #fff9da;
  --shadow: 0 24px 70px rgba(21, 18, 11, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 249, 218, 0.76), transparent 34%),
    radial-gradient(circle at 80% 14%, rgba(21, 18, 11, 0.24), transparent 26%),
    repeating-linear-gradient(45deg, rgba(21, 18, 11, 0.08) 0 10px, transparent 10px 24px),
    var(--paper);
}

.corner-chick {
  position: fixed;
  z-index: 0;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 3px solid var(--black);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 6px 6px 0 var(--black);
  font-size: 2rem;
  pointer-events: none;
}

.corner-chick-top-left {
  top: 18px;
  left: 18px;
}

.corner-chick-top-right {
  top: 18px;
  right: 18px;
}

.corner-chick-bottom-left {
  bottom: 16px;
  left: 16px;
}

.corner-chick-bottom-right {
  right: 16px;
  bottom: 16px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  padding: 22px 92px 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--black);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 900px;
  font-size: clamp(2.2rem, 5vw, 5.25rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2.1rem);
  line-height: 1.05;
}

.top-actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost,
.primary,
.menu-button {
  border: 2px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 249, 218, 0.92);
  font-weight: 800;
  box-shadow: 4px 4px 0 rgba(21, 18, 11, 0.9);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.ghost:hover,
.primary:hover,
.menu-button:hover {
  transform: translateY(-1px);
  box-shadow: 6px 6px 0 rgba(21, 18, 11, 0.9);
}

.ghost.active,
.menu-button.active,
.primary {
  border-color: var(--black);
  color: var(--yellow);
  background: var(--black);
}

.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1.05fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 10px;
}

.menu-button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.menu-button.accent {
  border-color: var(--black);
  background: var(--yellow);
}

.panel {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 247, 196, 0.95);
  box-shadow: var(--shadow);
}

.knowledge,
.assistant-panel,
.tool-panel {
  padding: 22px;
}

.panel-heading {
  margin-bottom: 18px;
}

.quick-actions {
  margin-bottom: 18px;
}

.quick-actions button {
  border: 2px solid var(--black);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--black);
  background: var(--cream);
  font-size: 0.9rem;
  font-weight: 800;
}

.quick-actions button.active {
  color: var(--yellow);
  background: var(--black);
}

.answer-box {
  display: grid;
  gap: 14px;
}

.answer-card {
  border-left: 8px solid var(--black);
  border-radius: 8px;
  padding: 15px 16px;
  background: var(--cream);
}

.answer-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.answer-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.chat-log {
  display: grid;
  gap: 10px;
  min-height: 320px;
  max-height: 430px;
  overflow: auto;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 18, 11, 0.08);
}

.message {
  width: fit-content;
  max-width: 92%;
  border-radius: 8px;
  padding: 11px 13px;
  line-height: 1.55;
}

.message.bot {
  border: 2px solid var(--black);
  background: var(--cream);
}

.message.user {
  justify-self: end;
  color: var(--yellow);
  background: var(--black);
}

.chat-form,
.tool-panel {
  display: grid;
  gap: 12px;
}

.chat-form {
  margin-top: 12px;
}

textarea,
input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--cream);
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 4px rgba(255, 210, 31, 0.48);
}

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result {
  min-height: 24px;
  color: var(--muted);
  line-height: 1.6;
}

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

.result a {
  color: var(--black);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .topbar {
    padding-right: 0;
  }

  .layout {
    grid-template-columns: 190px 1fr;
  }

  .assistant-panel {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .corner-chick {
    width: 46px;
    height: 46px;
    box-shadow: 4px 4px 0 var(--black);
    font-size: 1.45rem;
  }

  .corner-chick-bottom-left,
  .corner-chick-bottom-right {
    display: none;
  }

  .shell {
    width: min(100% - 20px, 680px);
    padding-top: 72px;
  }

  .topbar,
  .layout,
  .tools,
  .form-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
    padding-right: 0;
    padding-left: 0;
  }

  .rail {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .assistant-panel {
    grid-column: auto;
  }
}
