/**
 * Soft Margins ask surface — Phyllux Tech theme.
 * Forest ink, lime TECH accent, logo wallpaper.
 */

:root {
  --sm-bg: #050807;
  --sm-bg-rail: rgba(6, 14, 10, 0.72);
  --sm-surface: rgba(10, 22, 16, 0.78);
  --sm-ink: #eef6ef;
  --sm-muted: #a8c4b0;
  --sm-faint: #7a9684;
  --sm-line: rgba(125, 206, 58, 0.22);
  --sm-line-strong: rgba(125, 206, 58, 0.45);
  --sm-accent: #7dce3a;
  --sm-accent-2: #9fe05a;
  --sm-forest: #0f3d28;
  --sm-forest-deep: #0a281a;
  --sm-accent-soft: rgba(125, 206, 58, 0.14);
  --sm-user-bg: rgba(15, 61, 40, 0.85);
  --sm-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --sm-radius: 1rem;
  --sm-rail-w: 16rem;
  --sm-col: 76rem;
  --sm-font: "Outfit", system-ui, sans-serif;
  --sm-read: "Cormorant Garamond", Georgia, serif;
  --sm-wall: url("../soft-margins/wallpaper.jpg?v=pt1");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.sm-chat {
  margin: 0;
  color: var(--sm-ink);
  font-family: var(--sm-font);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--sm-bg);
  background-image:
    radial-gradient(ellipse at 72% 40%, rgba(5, 8, 7, 0.28) 0%, rgba(5, 8, 7, 0.82) 72%),
    linear-gradient(180deg, rgba(5, 8, 7, 0.35), rgba(5, 8, 7, 0.7)),
    var(--sm-wall);
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-attachment: fixed, fixed, fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

.sm-app {
  display: grid;
  grid-template-columns: var(--sm-rail-w) minmax(0, 1fr);
  min-height: 100%;
  height: 100dvh;
}

.sm-rail {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.85rem;
  background: var(--sm-bg-rail);
  border-right: 1px solid var(--sm-line);
  backdrop-filter: blur(18px);
  box-shadow: inset -20px 0 40px rgba(0, 0, 0, 0.22);
}

.sm-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.45rem 0.85rem;
  text-decoration: none;
  color: inherit;
}

.sm-brand picture {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
}

.sm-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 0 16px rgba(125, 206, 58, 0.35);
  background: var(--sm-forest);
}

.sm-brand picture .sm-mark,
.sm-brand picture source + img,
.sm-brand picture img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(125, 206, 58, 0.35);
  background: var(--sm-forest);
}

.sm-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sm-brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.sm-brand-sub {
  font-size: 0.72rem;
  color: var(--sm-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sm-new {
  appearance: none;
  border: 1px solid var(--sm-line-strong);
  background: rgba(125, 206, 58, 0.12);
  color: var(--sm-ink);
  border-radius: 0.7rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}

.sm-new:hover {
  background: rgba(125, 206, 58, 0.28);
}

.sm-new--promo {
  background: rgba(125, 206, 58, 0.2);
  border-color: var(--sm-accent);
  color: var(--sm-ink);
}

body.sm-promo-mode .sm-composer {
  border-color: rgba(125, 206, 58, 0.55);
  box-shadow: var(--sm-shadow), 0 0 28px rgba(125, 206, 58, 0.18);
}

body.sm-promo-mode .sm-topbar strong {
  color: var(--sm-accent-2);
}

.sm-rail-foot {
  margin-top: auto;
  padding: 0.65rem 0.45rem 0.2rem;
  font-size: 0.75rem;
  color: var(--sm-faint);
  line-height: 1.4;
}

.sm-rail-foot a {
  color: var(--sm-accent-2);
  text-decoration: none;
}

.sm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.sm-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(125, 206, 58, 0.1), transparent 40%),
    radial-gradient(ellipse at 90% 100%, rgba(15, 61, 40, 0.35), transparent 48%),
    linear-gradient(180deg, rgba(5, 8, 7, 0.28), rgba(5, 8, 7, 0.58));
  z-index: 0;
}

.sm-topbar,
.sm-thread-wrap,
.sm-composer-dock {
  position: relative;
  z-index: 1;
}

.sm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(5, 8, 7, 0.42);
  border-bottom: 1px solid var(--sm-line);
  backdrop-filter: blur(12px);
}

.sm-topbar strong {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sm-accent);
}

.sm-top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sm-depth {
  display: inline-flex;
  padding: 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--sm-line);
  background: rgba(5, 8, 7, 0.5);
}

.sm-depth-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--sm-muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.sm-depth-btn.is-active {
  background: var(--sm-accent);
  color: #061008;
}

.sm-topic {
  appearance: none;
  border: 1px solid var(--sm-line-strong);
  background: rgba(5, 8, 7, 0.78);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--sm-ink);
  max-width: min(100%, 18rem);
}

.sm-menu-btn {
  display: none;
  appearance: none;
  border: 1px solid var(--sm-line);
  background: rgba(5, 8, 7, 0.78);
  color: var(--sm-ink);
  border-radius: 0.65rem;
  width: 2.4rem;
  height: 2.4rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.sm-thread-wrap {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.sm-thread {
  width: min(100% - 2rem, var(--sm-col));
  margin: 0 auto;
  padding: 1.15rem 0 14rem;
}

.sm-empty {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  gap: 0.85rem;
  padding: 0.4rem 0 1rem;
}

.sm-empty[hidden] {
  display: none !important;
}

.sm-empty-head h1 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--sm-font);
  font-weight: 800;
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--sm-ink);
  text-shadow: 0 0 40px rgba(125, 206, 58, 0.18);
}

.sm-kicker {
  margin: 0;
  color: var(--sm-accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.sm-empty-head p {
  margin: 0;
  max-width: 40rem;
  color: var(--sm-muted);
  font-family: var(--sm-read);
  font-size: 1.2rem;
}

.sm-promo {
  margin-top: 0.85rem;
  max-width: 40rem;
  padding: 1rem 1.1rem 1.05rem;
  border: 1px solid var(--sm-line-strong);
  border-radius: 1rem;
  background: rgba(6, 14, 10, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 28px rgba(125, 206, 58, 0.08);
}

.sm-promo-kicker {
  margin: 0 0 0.25rem;
  color: var(--sm-accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
}

.sm-promo h2 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--sm-ink);
}

.sm-promo p {
  margin: 0 0 0.65rem;
  color: var(--sm-muted);
  font-family: var(--sm-read);
  font-size: 1.05rem;
  line-height: 1.45;
}

.sm-promo ul {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: var(--sm-ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.sm-promo li {
  margin: 0.2rem 0;
}

.sm-promo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin: 0 !important;
  font-family: var(--sm-font) !important;
  font-size: 0.88rem !important;
}

.sm-promo-links a {
  color: var(--sm-accent-2);
  text-decoration: none;
  font-weight: 700;
}

.sm-promo-links a:hover {
  color: var(--sm-accent);
  text-decoration: underline;
}

.sm-wall-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
  align-items: center;
}

.sm-search {
  flex: 1 1 16rem;
}

.sm-search input {
  width: 100%;
  border: 1px solid var(--sm-line-strong);
  background: rgba(5, 8, 7, 0.7);
  color: var(--sm-ink);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}

.sm-search input:focus {
  border-color: var(--sm-accent);
  box-shadow: 0 0 0 3px rgba(125, 206, 58, 0.22);
}

.sm-all {
  appearance: none;
  border: 1px solid var(--sm-line-strong);
  background: rgba(15, 61, 40, 0.45);
  color: var(--sm-ink);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sm-all.is-active,
.sm-all:hover {
  background: rgba(125, 206, 58, 0.28);
}

.sm-count {
  margin: 0.45rem 0 0;
  color: var(--sm-accent);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.sm-starters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.55rem;
  width: 100%;
  margin-top: 0.35rem;
}

.sm-starter {
  appearance: none;
  border: 1px solid var(--sm-line);
  background: rgba(6, 14, 10, 0.62);
  color: var(--sm-ink);
  border-radius: 0.95rem;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sm-starter small {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--sm-accent);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.sm-starter:hover {
  transform: translateY(-2px);
  border-color: var(--sm-accent);
  background: rgba(10, 28, 18, 0.82);
}

.sm-starter[data-tone="0"],
.sm-starter[data-tone="1"],
.sm-starter[data-tone="2"],
.sm-starter[data-tone="3"],
.sm-starter[data-tone="4"],
.sm-starter[data-tone="5"] {
  border-color: rgba(125, 206, 58, 0.35);
}

.sm-msg {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1.35rem;
  animation: sm-in 0.28s ease;
}

@keyframes sm-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sm-msg--user {
  justify-items: end;
}

.sm-msg--assistant {
  justify-items: start;
}

.sm-who {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sm-accent);
  padding: 0 0.35rem;
}

.sm-bubble {
  max-width: min(100%, 48rem);
  padding: 0.9rem 1.1rem;
  border-radius: var(--sm-radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sm-msg--user .sm-bubble {
  background: linear-gradient(145deg, rgba(15, 61, 40, 0.92), rgba(8, 32, 20, 0.92));
  color: #f2faf3;
  border: 1px solid rgba(125, 206, 58, 0.4);
  border-bottom-right-radius: 0.4rem;
  font-size: 1.02rem;
  line-height: 1.5;
}

.sm-msg--assistant .sm-bubble {
  background: rgba(6, 14, 10, 0.82);
  border: 1px solid rgba(125, 206, 58, 0.28);
  backdrop-filter: blur(10px);
  font-family: var(--sm-read);
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--sm-ink);
}

.sm-load-label {
  font-family: var(--sm-font);
  font-size: 0.9rem;
  color: var(--sm-muted);
  margin-left: 0.35rem;
}

.sm-msg--error .sm-bubble {
  color: #ffd0c8;
  font-family: var(--sm-font);
  font-size: 0.95rem;
  border-color: rgba(220, 100, 80, 0.55);
}

.sm-msg--loading .sm-bubble {
  color: var(--sm-muted);
  font-family: var(--sm-font);
  font-size: 0.95rem;
}

.sm-dots {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  height: 1.2rem;
}

.sm-dots span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--sm-accent);
  animation: sm-dot 1.1s ease infinite;
}

.sm-dots span:nth-child(2) { animation-delay: 0.15s; }
.sm-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes sm-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.sm-meta {
  font-size: 0.75rem;
  color: var(--sm-faint);
  padding: 0 0.35rem;
}

.sm-meta a {
  color: var(--sm-accent-2);
  text-decoration: none;
}

.sm-composer-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 1.25rem 1rem calc(1.1rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(5, 8, 7, 0) 0%, rgba(5, 8, 7, 0.9) 28%);
  pointer-events: none;
}

.sm-composer {
  pointer-events: auto;
  width: min(100%, var(--sm-col));
  margin: 0 auto;
  background: rgba(6, 14, 10, 0.88);
  border: 1px solid var(--sm-line-strong);
  border-radius: 1.25rem;
  box-shadow: var(--sm-shadow), 0 0 22px rgba(125, 206, 58, 0.12);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  align-items: end;
}

.sm-composer textarea {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--sm-ink);
  max-height: 10rem;
  min-height: 1.45rem;
  padding: 0.55rem 0;
}

.sm-composer textarea::placeholder {
  color: var(--sm-faint);
}

.sm-send {
  appearance: none;
  border: 0;
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 0.9rem;
  background: linear-gradient(145deg, #b8ef6e, #7dce3a 50%, #4f9a22);
  color: #061008;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 0 16px rgba(125, 206, 58, 0.45);
}

.sm-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sm-send:not(:disabled):hover {
  transform: translateY(-1px);
}

.sm-send svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.sm-hint {
  width: min(100%, var(--sm-col));
  margin: 0.45rem auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--sm-faint);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .sm-dots span,
  .sm-msg {
    animation: none;
  }
}

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

  .sm-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(18rem, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--sm-shadow);
  }

  body.sm-rail-open .sm-rail {
    transform: none;
  }

  .sm-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 7, 0.7);
    z-index: 30;
  }

  body.sm-rail-open .sm-scrim {
    display: block;
  }

  .sm-menu-btn {
    display: inline-grid;
    place-items: center;
  }

  .sm-topbar {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .sm-starters {
    grid-template-columns: 1fr;
  }
}
