:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #5f6963;
  --paper: #f7f4ed;
  --surface: #fffdf8;
  --line: #ded8cc;
  --teal: #1d766f;
  --teal-deep: #124842;
  --rose: #c85f63;
  --gold: #d5a43b;
  --lavender: #d9d2ef;
  --mint: #dcebe2;
  --shadow: 0 22px 55px rgba(32, 42, 36, .14);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(220, 235, 226, .88), rgba(247, 244, 237, .9) 42%, rgba(217, 210, 239, .5)),
    var(--paper);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

h1,
p {
  margin: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  min-height: 76px;
  padding: 16px clamp(18px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(24, 32, 29, .12);
  background: rgba(255, 253, 248, .78);
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-deep);
  box-shadow: inset 0 -8px 18px rgba(255, 255, 255, .08);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  fill: var(--gold);
}

.brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .8rem;
}

.auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.status {
  max-width: 210px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.25;
  text-align: right;
}

.button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 780;
}

.primary,
.send {
  background: var(--teal);
  color: #ffffff;
}

.secondary {
  background: #ebe6dc;
  color: var(--teal-deep);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(286px, 390px) minmax(0, 1fr);
}

.guide {
  min-height: 0;
  padding: clamp(20px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(24, 32, 29, .12);
}

.spark-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid rgba(24, 32, 29, .12);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(18, 72, 66, .96), rgba(29, 118, 111, .78) 48%, rgba(200, 95, 99, .78)),
    #124842;
  box-shadow: var(--shadow);
}

.spark-card svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.path {
  fill: none;
  stroke: rgba(255, 253, 248, .7);
  stroke-width: 4;
  stroke-linecap: round;
}

.point {
  fill: #fffdf8;
  stroke: var(--gold);
  stroke-width: 3;
}

.pulse {
  position: absolute;
  left: 18%;
  top: 23%;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: rgba(255, 253, 248, .16);
  transform: rotate(45deg);
}

.guide-copy {
  display: grid;
  gap: 12px;
}

.eyebrow,
.mini-label {
  color: var(--rose);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  max-width: 340px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: .98;
  letter-spacing: 0;
}

.guide-copy p:last-child,
.mini-panel p {
  color: var(--muted);
  font-size: .97rem;
  line-height: 1.55;
}

.mini-panel {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(200, 95, 99, .25);
  border-radius: 8px;
  background: rgba(255, 253, 248, .7);
}

.mini-panel p {
  margin-top: 8px;
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: rgba(255, 253, 248, .55);
}

.notice {
  margin: 18px clamp(18px, 4vw, 40px) 0;
  padding: 12px 14px;
  border: 1px solid rgba(213, 164, 59, .5);
  border-radius: 8px;
  background: #fff8df;
  color: #755919;
  line-height: 1.35;
}

.notice.error {
  border-color: rgba(200, 95, 99, .42);
  background: #fff0ef;
  color: #8f3438;
}

.notice.ok {
  border-color: rgba(29, 118, 111, .35);
  background: #ecf8f2;
  color: var(--teal-deep);
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 40px);
}

.message {
  display: grid;
  grid-template-columns: 42px minmax(0, 740px);
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.message.user {
  grid-template-columns: minmax(0, 740px) 42px;
  justify-content: end;
}

.message.user .avatar {
  grid-column: 2;
  background: var(--rose);
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: var(--teal-deep);
  color: #ffffff;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #ffffff;
  font-size: .82rem;
  font-weight: 850;
}

.bubble {
  width: fit-content;
  max-width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(24, 32, 29, .1);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(32, 42, 36, .08);
}

.bubble p {
  line-height: 1.48;
}

.bubble p + p {
  margin-top: 9px;
}

.bubble.status {
  color: var(--muted);
  font-size: .93rem;
}

.typing {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 72px;
  min-height: 45px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  opacity: .35;
  animation: breathe 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: .15s;
}

.typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes breathe {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: .32;
  }
  40% {
    transform: translateY(-4px);
    opacity: .9;
  }
}

.quick-actions {
  padding: 0 clamp(18px, 4vw, 40px) 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.quick-actions button {
  min-height: 34px;
  border: 1px solid rgba(24, 32, 29, .12);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 253, 248, .8);
  color: var(--teal-deep);
  font-size: .9rem;
  font-weight: 740;
}

.composer {
  padding: 16px clamp(18px, 4vw, 40px) 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-top: 1px solid rgba(24, 32, 29, .12);
  background: rgba(255, 253, 248, .78);
}

textarea {
  width: 100%;
  min-height: 52px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  line-height: 1.4;
}

textarea:focus {
  border-color: rgba(29, 118, 111, .72);
  box-shadow: 0 0 0 4px rgba(29, 118, 111, .14);
}

.send {
  min-width: 82px;
}

.send:disabled {
  opacity: .5;
}

.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: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .guide {
    border-right: 0;
    border-bottom: 1px solid rgba(24, 32, 29, .12);
  }

  .spark-card {
    min-height: 160px;
  }

  .guide-copy p:last-child,
  .mini-panel {
    max-width: 720px;
  }

  h1 {
    max-width: 720px;
  }

  .chat-panel {
    min-height: 62vh;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth {
    width: 100%;
    justify-content: space-between;
  }

  .status {
    max-width: none;
    text-align: left;
  }

  .message,
  .message.user {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .message.user .avatar {
    grid-column: 1;
  }

  .message.user .bubble {
    grid-column: 2;
    justify-self: stretch;
  }

  .avatar {
    width: 34px;
    height: 34px;
    font-size: .72rem;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send {
    width: 100%;
  }
}
