@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0c2740;
  --ink: #14324a;
  --muted: #5a758c;
  --blue: #1678c8;
  --blue-deep: #0e5ea6;
  --cyan: #2eb4e6;
  --ice: #f3f9fd;
  --glass: rgba(255, 255, 255, 0.72);
  --line: rgba(18, 88, 140, 0.14);
  --gold: #b8942a;
  --shadow: 0 20px 48px rgba(10, 42, 72, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--ink);
  background: #cfe6f4;
}

button,
textarea {
  font-family: inherit;
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(720px 380px at 12% -8%, #ffffff 0%, transparent 55%),
    radial-gradient(640px 360px at 100% 8%, #9fd4f4 0%, transparent 52%),
    linear-gradient(165deg, #b9dcf0 0%, #e4f3fb 42%, #f6fbfe 100%);
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(22, 120, 200, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 120, 200, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 35%, transparent 78%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
}

.glow-a {
  width: 380px;
  height: 380px;
  background: #7ec4ee;
  top: -140px;
  left: -80px;
  opacity: 0.45;
}

.glow-b {
  width: 280px;
  height: 280px;
  background: #fff;
  top: 18%;
  right: -60px;
  opacity: 0.5;
}

.glow-c {
  width: 220px;
  height: 220px;
  background: #aad8f2;
  bottom: 8%;
  left: 38%;
  opacity: 0.35;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 18px 12px;
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 251, 255, 0.78));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mast-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fcff, #d5ebf8);
  box-shadow: inset 0 0 0 1px rgba(22, 120, 200, 0.18);
}

.titles {
  min-width: 0;
}

.kicker {
  margin: 0 0 3px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--blue-deep);
  direction: ltr;
  text-align: right;
}

.titles h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.45;
  color: var(--navy);
}

.platform {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.mast-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.spec-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.spec {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eaf4fb;
  color: var(--blue-deep);
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(22, 120, 200, 0.12);
}

.spec.model {
  background: #0e3a5c;
  color: #e8f6ff;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: 0.02em;
  border-color: transparent;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #e8f4fc;
  color: var(--blue-deep);
}

.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.live.ready {
  background: #e4f7eb;
  color: #187a46;
}

.live.wait {
  background: #fff6df;
  color: #9a6b12;
}

.live.err {
  background: #fdecea;
  color: #b42318;
}

.feed {
  overflow: auto;
  padding: 20px 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero {
  margin: auto 0;
  padding: 8px 2px 22px;
}

.hero-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 251, 255, 0.82));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px 26px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.badge {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0e3a5c, #1768a8);
  color: #eaf7ff;
  font-size: 0.74rem;
  font-weight: 600;
}

.hero-copy h2 {
  margin: 0 0 8px;
  font-size: 1.72rem;
  letter-spacing: -0.04em;
  color: var(--navy);
}

.lead {
  margin: 0 0 20px;
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.95;
  font-size: 0.98rem;
}

.specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 22px;
}

.specs > div {
  margin: 0;
  padding: 12px 12px 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.specs dt {
  margin: 0 0 4px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.specs dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}

.chips {
  display: grid;
  gap: 9px;
}

@media (min-width: 760px) {
  .chips {
    grid-template-columns: 1fr 1fr;
  }
}

.chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: right;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 13px;
  cursor: pointer;
  line-height: 1.7;
  font-size: 0.9rem;
  transition: 0.16s ease;
}

.chip-idx {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e8f3fb;
  color: var(--blue-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

.chip:hover,
.chip:focus-visible {
  transform: translateY(-1px);
  border-color: #7eb7e6;
  box-shadow: 0 12px 22px rgba(22, 120, 200, 0.12);
  outline: none;
}

.msg {
  display: flex;
  max-width: min(100%, 860px);
}

.msg.user {
  align-self: flex-start;
}

.msg.assistant {
  align-self: stretch;
}

.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.85;
  word-break: break-word;
}

.msg.user .bubble {
  background: linear-gradient(180deg, #2b8fe0, #156bb8);
  color: #fff;
  border-bottom-left-radius: 8px;
  box-shadow: 0 12px 22px rgba(21, 107, 184, 0.22);
  white-space: pre-wrap;
}

.msg.assistant .col {
  width: 100%;
  display: grid;
  gap: 10px;
}

.msg.assistant .bubble {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.bubble.md {
  white-space: normal;
}

.bubble.md > *:first-child {
  margin-top: 0;
}

.bubble.md > *:last-child {
  margin-bottom: 0;
}

.bubble.md h1,
.bubble.md h2,
.bubble.md h3 {
  margin: 0.9em 0 0.4em;
  line-height: 1.45;
  color: #0f4f86;
}

.bubble.md h1 {
  font-size: 1.22rem;
}

.bubble.md h2 {
  font-size: 1.08rem;
}

.bubble.md h3 {
  font-size: 1rem;
}

.bubble.md p {
  margin: 0.45em 0 0.7em;
}

.bubble.md ul,
.bubble.md ol {
  margin: 0.3em 0 0.8em;
  padding-inline-start: 1.3em;
}

.bubble.md li {
  margin: 0.2em 0;
}

.bubble.md strong {
  font-weight: 700;
  color: #0d3d68;
}

.bubble.md em {
  font-style: italic;
}

.bubble.md code {
  font-family: ui-monospace, Consolas, monospace;
  background: #eaf4fb;
  padding: 0 5px;
  border-radius: 6px;
  direction: ltr;
  display: inline-block;
  font-size: 0.88em;
}

.bubble.md pre {
  direction: ltr;
  text-align: left;
  background: #0f3a57;
  color: #e8f4ff;
  border-radius: 12px;
  padding: 12px 14px;
  overflow: auto;
  font-size: 0.84rem;
}

.bubble.md pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.bubble.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0 1em;
  font-size: 0.9rem;
  overflow: hidden;
  border-radius: 10px;
}

.bubble.md th,
.bubble.md td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: right;
}

.bubble.md th {
  background: #eaf4fb;
  font-weight: 700;
}

.bubble.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.bubble.md a {
  color: var(--blue);
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 6px 2px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5aa7e0;
  animation: pulse 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.sources {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}

.sources h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--blue-deep);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.thumb {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: center;
  color: inherit;
  transition: 0.16s ease;
}

.thumb:hover,
.thumb:focus-visible {
  border-color: #7eb7e6;
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(26, 122, 212, 0.14);
  outline: none;
}

.thumb img {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: cover;
  object-position: top;
  background: #edf5fa;
}

.thumb span {
  display: block;
  padding: 8px 8px 10px;
  font-size: 0.76rem;
  font-weight: 600;
}

.snippet-card {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--muted);
  direction: ltr;
  text-align: left;
}

.dock {
  padding: 4px 0 4px;
}

.composer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 251, 255, 0.84));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 10px 12px 10px 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 8px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-deep);
}

.composer-head .hint {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-weight: 600;
  color: var(--muted);
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.7;
  max-height: 160px;
  outline: none;
}

.send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(180deg, #3b9ae0, #1469b6);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(20, 105, 182, 0.28);
}

.send:hover,
.send:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.send svg {
  transform: scaleX(-1);
}

.send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.disclaimer {
  margin: 9px 8px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.viewer {
  width: min(960px, 94vw);
  max-height: 92vh;
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: #f4faff;
  box-shadow: 0 30px 80px rgba(15, 64, 110, 0.28);
}

.viewer::backdrop {
  background: rgba(12, 36, 54, 0.48);
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.viewer-body {
  overflow: auto;
  max-height: calc(92vh - 58px);
  background: #d4e6f2;
  padding: 16px;
}

.viewer-body img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 42, 61, 0.18);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue-deep);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 600;
}

.viewer-nav,
.viewer-actions {
  display: flex;
  gap: 6px;
}

.err-text {
  color: #b42318;
}

@media (max-width: 820px) {
  .masthead {
    flex-direction: column;
  }

  .mast-side {
    width: 100%;
    align-items: flex-start;
  }

  .spec-strip {
    justify-content: flex-start;
  }

  .kicker {
    text-align: right;
  }

  .specs {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 10px 10px 8px;
  }

  .hero-panel {
    padding: 22px 16px 16px;
  }

  .hero-copy h2 {
    font-size: 1.38rem;
  }

  .titles h1 {
    font-size: 1.02rem;
  }

  .thumb img {
    height: 140px;
  }
}
