:root {
  color-scheme: light;
  --bg: #f5f1ff;
  --panel: #fff;
  --ink: #29174e;
  --muted: #62557b;
  --line: #e1d7f3;
  --accent: #5b31cb;
  --chip: #ede3ff;
  --shadow: 0 5px 18px #42247d0b;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(ellipse 29rem 25rem at 90% 0, #ffebf8 0, transparent 100%), var(--bg);
  font-size: 16px;
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:where(button, a, input, textarea, select):focus-visible {
  outline: 3px solid #7645df;
  outline-offset: 3px;
}
a { color: var(--accent); overflow-wrap: anywhere; }
.top, main { width: min(calc(100% - 36px), 1040px); margin-inline: auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 14px;
}
.wordmark, .header-actions, .profile { display: flex; align-items: center; }
.wordmark {
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -.055em;
}
.wordmark img { border-radius: 12px; box-shadow: 0 3px 8px #582bad29; }
.header-actions { gap: clamp(7px, 2vw, 14px); }
.subscription-link { font-size: 13px; font-weight: 700; white-space: nowrap; }
.profile, .secondary, .back, .section-nav button {
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  font-weight: 700;
}
.profile { min-height: 42px; gap: 7px; font-size: 13px; }
.profile-icon { position: relative; width: 14px; height: 15px; color: var(--accent); }
.profile-icon::before, .profile-icon::after { position: absolute; left: 50%; content: ""; transform: translateX(-50%); }
.profile-icon::before { top: 0; width: 5px; height: 5px; border: 1.5px solid; border-radius: 50%; }
.profile-icon::after { bottom: 0; width: 12px; height: 5px; border: 1.5px solid; border-radius: 8px 8px 3px 3px; }
main { padding-bottom: max(40px, env(safe-area-inset-bottom)); }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 235px;
  border-radius: 30px;
  overflow: hidden;
  padding: clamp(20px, 5vw, 56px);
  color: #fff;
  background:
    radial-gradient(ellipse at 93% 19%, #ed7dff 0, #cc85ff66 19%, transparent 46%),
    radial-gradient(ellipse at 78% 108%, #5b8cff 0, transparent 53%),
    linear-gradient(118deg, #4626ae 8%, #6839df 58%, #8863f5 100%);
  box-shadow: 0 12px 30px #6135bd33;
}
.hero::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 63% 20%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 89% 14%, #fff9 0 2px, transparent 3px),
    radial-gradient(circle at 91% 73%, #ffdb99 0 2px, transparent 3px),
    radial-gradient(circle at 53% 79%, #fff9 0 1px, transparent 2px),
    radial-gradient(circle at 77% 90%, #fff8 0 2px, transparent 3px),
    radial-gradient(circle at 96% 46%, #fff8 0 1px, transparent 2px);
}
.hero-copy { position: relative; z-index: 1; width: min(64%, 380px); }
.hero h1 { margin: 0; font-size: clamp(32px, 6.2vw, 62px); line-height: 1; letter-spacing: -.062em; text-wrap: balance; }
.hero p { margin: 10px 0 16px; max-width: 26ch; color: #fff; font-size: clamp(13px, 3.3vw, 16px); }
.hero-action {
  position: relative;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #ffd7a8;
  border-radius: 100px;
  background: #fff4df;
  color: #4d2587;
  font-size: clamp(12px, 3.3vw, 15px);
  font-weight: 800;
  box-shadow: 0 4px 16px #2b0d7a30;
}
.hero-action:hover { background: #fff; }
.hero-action:focus-visible { outline-color: #ffe29d; }
.hero-mascot {
  position: absolute;
  right: clamp(-17px, 1.5vw, 28px);
  top: 50%;
  width: clamp(133px, 42%, 377px);
  height: auto;
  transform: translateY(-50%) rotate(-6deg);
  mask-image: radial-gradient(ellipse closest-side, #000 78%, transparent 100%);
  pointer-events: none;
}
.search-box { position: relative; margin-top: 19px; }
.search-box::before {
  position: absolute;
  top: 16px;
  left: 17px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.search-box::after {
  position: absolute;
  top: 31px;
  left: 29px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transform: rotate(45deg);
  content: "";
  pointer-events: none;
}
input:not([type=file]):not([type=checkbox]):not([type=radio]), textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  background: #faf7ff;
  color: var(--ink);
}
.search-box input.search[type=search] { padding-left: 46px; min-height: 50px; background: var(--panel); box-shadow: var(--shadow); }
textarea { min-height: 142px; resize: vertical; }
input[type=file] { max-width: 100%; color: var(--muted); font-size: 13px; }
input[type=file]::file-selector-button {
  margin-right: 8px;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  background: var(--chip);
  color: var(--accent);
  font: inherit;
  font-weight: 700;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.section-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 11px 2px 7px;
  scrollbar-width: thin;
  scrollbar-color: #bb9aef transparent;
}
.section-nav button { flex: none; min-height: 38px; font-size: 13px; color: var(--accent); }
.section-nav button:hover, .secondary:hover, .back:hover, .profile:hover { background: var(--chip); }
h2 { margin: 25px 0 11px; font-size: clamp(22px, 5.5vw, 29px); line-height: 1.16; letter-spacing: -.045em; scroll-margin-top: 13px; }
.cards {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 11px;
  min-height: 53px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: transparent;
  color: var(--ink);
}
.card:first-child { border-radius: 18px 18px 0 0; }
.card:last-child { border-radius: 0 0 18px 18px; }
.card:only-child { border-radius: 18px; }
.card + .card::before {
  position: absolute;
  top: 0;
  right: 12px;
  left: 57px;
  height: 1px;
  background: var(--line);
  content: "";
  pointer-events: none;
}
.card:hover { background: #f8f3ff; }
.card:focus-visible { z-index: 1; outline-offset: -3px; }
.glyph, .detail-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 23px;
  font-variant-emoji: emoji;
  line-height: 1;
}
.card-copy { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.card-name { font-size: 15px; font-weight: 750; line-height: 1.2; }
.card-desc { color: var(--muted); line-height: 1.25; font-size: 12px; }
.arrow { justify-self: end; color: var(--accent); font-size: 21px; line-height: 1; }

.back { margin: 4px 0 13px; font-size: 14px; }
.detail {
  padding: clamp(19px, 5vw, 35px);
  border: 1px solid var(--line);
  border-top: 4px solid #a67ef5;
  border-radius: 23px;
  background: linear-gradient(150deg, #fff 52%, #fbf6ff);
  box-shadow: var(--shadow);
}
.detail-glyph { width: 52px; height: 52px; margin-bottom: 12px; font-size: 28px; }
.detail h1 { margin: 0; font-size: clamp(26px, 6.5vw, 42px); line-height: 1.07; letter-spacing: -.052em; }
.detail p, .hint { color: var(--muted); }
form, label { display: grid; gap: 8px; }
form { gap: 15px; margin-top: 20px; }
.primary {
  min-height: 46px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(112deg, #5530c6, #7938d4);
  color: #fff;
  font-weight: 800;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.status:empty { display: none; }
.status[data-busy] {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--chip);
  color: var(--accent);
  font-weight: 700;
}
.status[data-busy]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid #ad8de9;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orbit-spin .7s linear infinite;
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status[data-busy]::before { animation: none; } }

.result { padding: 15px; border-radius: 14px; background: #f2eaff; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.rich-answer { white-space: normal; line-height: 1.5; }
.detail .rich-answer p { margin: .65em 0; color: inherit; }
.rich-answer h1, .rich-answer h2, .rich-answer h3, .rich-answer h4, .rich-answer h5, .rich-answer h6 {
  margin: 1.05em 0 .35em;
  color: inherit;
  font-size: 1.08em;
  line-height: 1.35;
  letter-spacing: normal;
}
.rich-answer > :first-child { margin-top: 0; }
.rich-answer > :last-child { margin-bottom: 0; }
.rich-answer ul, .rich-answer ol { margin: .5em 0; padding-left: 1.35em; }
.rich-answer li + li { margin-top: .32em; }
.rich-answer hr { margin: 1em 0; border: 0; border-top: 1px solid var(--line); }
.rich-answer pre, .rich-answer table { display: block; max-width: 100%; overflow-x: auto; }
.rich-answer table { border-collapse: collapse; }
.rich-answer td, .rich-answer th { padding: 5px 8px; border: 1px solid var(--line); text-align: left; }
.rich-answer a, .answer-sources a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.answer-citation { font-size: .83em; white-space: nowrap; }
.answer-sources { margin-top: 10px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; }
.answer-sources summary { min-height: 44px; padding: 10px 0; color: var(--ink); cursor: pointer; }
.answer-sources ul { margin: 0 0 6px; padding-left: 1.2em; overflow-wrap: anywhere; }
.answer-sources a { display: inline-block; min-height: 44px; padding: 10px 0; }
.site-preview {
  display: block;
  width: 100%;
  height: clamp(300px, 56vh, 580px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.site-preview-link { display: inline-flex; align-items: center; text-decoration: none; }
.site-source { margin-top: 12px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; }
.site-source summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
.site-source .site-code { height: 180px; margin-bottom: 8px; font: 13px/1.5 ui-monospace, monospace; }
.site-source button { margin-bottom: 8px; }
.site-source ul { padding-left: 20px; }
.site-source li + li { margin-top: 8px; }
.dialog-turn { display: grid; gap: 14px; margin-top: 24px; }
.dialog-question {
  justify-self: end;
  max-width: 92%;
  min-width: 0;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.dialog-question h2, .dialog-answer > h2 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.dialog-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-photo { display: block; max-width: min(100%, 230px); max-height: 180px; border-radius: 9px; object-fit: contain; }
.dialog-photo + .dialog-message { margin-top: 8px; }
.dialog-answer { min-width: 0; scroll-margin-top: 76px; }
.dialog-answer .result { margin: 0; }
.reply-form { padding-top: 15px; border-top: 1px solid var(--line); }
.reply-form textarea { min-height: 80px; }
.reply-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.reply-controls .primary { flex: 1; }
.dictation { display: grid; gap: 8px; }
.dictation-input { position: relative; }
.dictation-input textarea { display: block; padding-right: 66px; }
.dictation-with-attachment textarea { padding-right: 114px; }
.dictation-mic, .dictation-attachment {
  position: absolute;
  bottom: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--accent);
  background: var(--chip);
}
.dictation-mic { right: 12px; }
.dictation-attachment { right: 62px; display: grid; place-items: center; font-size: 18px; }
.reply-photo-draft {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 0 3px 0 10px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 14px;
}
.reply-photo-draft span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-photo-remove {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
}
.dictation-mic-glyph {
  position: absolute;
  inset: 0;
  background: linear-gradient(currentColor, currentColor) center 31px / 8px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center 28px / 2px 4px no-repeat;
}
.dictation-mic-glyph::before, .dictation-mic-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
}
.dictation-mic-glyph::before { top: 10px; width: 8px; height: 15px; border-radius: 4px; background: currentColor; }
.dictation-mic-glyph::after {
  top: 17px;
  width: 16px;
  height: 13px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
.dictation-mic[data-recording] { color: #a32149; background: #fce4ec; }
.dictation-mic[data-recording] .dictation-mic-glyph { background: none; }
.dictation-mic[data-recording] .dictation-mic-glyph::before { top: 15px; width: 14px; height: 14px; border-radius: 3px; }
.dictation-mic[data-recording] .dictation-mic-glyph::after { content: none; }
.dictation-mic[data-recording]::before, .dictation-mic[data-recording]::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
}
.dictation-mic[data-recording]::before {
  transform: scale(calc(1.04 + var(--voice-level, 0) * .24));
  opacity: calc(.24 + var(--voice-level, 0) * .3);
}
.dictation-mic[data-recording]::after {
  transform: scale(calc(1.12 + var(--voice-level, 0) * .37));
  opacity: calc(.16 + var(--voice-level, 0) * .22);
}
@media (prefers-reduced-motion: reduce) {
  .dictation-mic[data-recording]::before { transform: scale(1.06); opacity: .3; }
  .dictation-mic[data-recording]::after { transform: scale(1.16); opacity: .2; }
}
.dictation .status { margin: 0; font-size: 14px; }
.generated { display: block; max-width: 100%; border-radius: 14px; }
.generated-video { width: 100%; max-height: 70vh; background: #171225; }
fieldset { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 14px; }
fieldset legend { padding: 0 5px; }
.workflow-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.workflow-row p { margin: 0; overflow-wrap: anywhere; }
.workflow-stack { display: grid; gap: 8px; }
.workflow-stack button { text-align: left; white-space: normal; }
.bot-template-hint { margin: -8px 0 0; font-size: 14px; }
label:has(input[type=checkbox]) { display: flex; align-items: center; }

@media (min-width: 740px) { .hero { min-height: 294px; } }
@media (max-width: 365px) {
  .top, main { width: calc(100% - 24px); }
  .top { gap: 7px; }
  .wordmark { font-size: 21px; }
  .profile { padding-inline: 8px; }
  .subscription-link { font-size: 11px; }
  .hero { border-radius: 24px; }
  .hero-copy { width: 65%; }
}

.home-hero {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: auto;
  padding: 14px 20px 23px;
  text-align: center;
  background:
    radial-gradient(circle at 13% 15%, #ffe9baaa 0 1.25px, transparent 2px),
    radial-gradient(circle at 21% 26%, #efdfff8c 0 1px, transparent 1.7px),
    radial-gradient(circle at 30% 10%, #fff9 0 1px, transparent 1.6px),
    radial-gradient(circle at 7% 32%, #fff7 0 .65px, transparent 1.3px),
    radial-gradient(circle at 16% 49%, #ead8ffad 0 1.3px, transparent 2px),
    radial-gradient(circle at 6% 60%, #d9ddff8a 0 .8px, transparent 1.5px),
    radial-gradient(circle at 12% 83%, #ffdcaabb 0 1.2px, transparent 2px),
    radial-gradient(circle at 24% 90%, #fff7 0 .75px, transparent 1.5px),
    radial-gradient(circle at 69% 7%, #ffffffe0 0 .9px, transparent 1.6px),
    radial-gradient(circle at 78% 23%, #ffe5bba6 0 1.25px, transparent 2px),
    radial-gradient(circle at 93% 31%, #e8d9ff88 0 .8px, transparent 1.5px),
    radial-gradient(circle at 81% 44%, #fff8 0 .8px, transparent 1.5px),
    radial-gradient(circle at 94% 90%, #fff7 0 .75px, transparent 1.5px),
    radial-gradient(ellipse at 50% 17%, #6587f6 0, transparent 48%),
    radial-gradient(ellipse at 90% 105%, #c967eb 0, transparent 55%),
    linear-gradient(135deg, #4824a8, #6946e7);
}
.home-hero .hero-mascot {
  position: relative;
  top: auto;
  right: auto;
  width: clamp(115px, 29vw, 146px);
  transform: rotate(-5deg);
  animation: mascot-orbit 4.4s ease-in-out infinite alternate;
}
.home-hero .hero-mascot img { display: block; width: 100%; height: auto; }
.hero-eyelid {
  position: absolute;
  top: 34%;
  left: 51.5%;
  width: 17.6%;
  height: 19.2%;
  border-radius: 56% 47% 44% 52%;
  background: radial-gradient(ellipse at 27% 20%, #dfadff, #bc80f1 76%);
  opacity: 0;
  transform: scaleY(.18) rotate(7deg);
  animation: mascot-wink 8.8s ease-in-out infinite;
}
.hero-eyelid::after {
  position: absolute;
  top: 46%;
  left: 18%;
  width: 63%;
  height: 24%;
  border-bottom: 2px solid #402050;
  border-radius: 0 0 50% 50%;
  content: "";
}
.hero-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-meteor {
  position: absolute;
  top: var(--meteor-top);
  left: var(--meteor-left);
  width: var(--meteor-length);
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #e5c7ff, #fff6c8);
  box-shadow: 0 0 5px #f1ccff70;
  opacity: 0;
  transform: rotate(46deg);
  animation: starfall 8.8s linear var(--meteor-delay, 0s) infinite;
}
.hero-meteor:nth-child(1) {
  --meteor-top: 11%; --meteor-left: 9%; --meteor-length: 33px;
}
.hero-meteor:nth-child(2) {
  --meteor-top: -4%; --meteor-left: 64%; --meteor-length: 24px; --meteor-delay: 1.65s;
}
.hero-meteor:nth-child(3) {
  --meteor-top: 8%; --meteor-left: 76%; --meteor-length: 28px; --meteor-delay: 3.3s;
}
.hero-meteor:nth-child(4) {
  --meteor-top: 26%; --meteor-left: 0%; --meteor-length: 20px; --meteor-delay: 4.95s;
}
.hero-meteor:nth-child(5) {
  --meteor-top: -7%; --meteor-left: 38%; --meteor-length: 23px; --meteor-delay: 6.6s;
}
.home-hero::before { animation: stars-glow 4.4s ease-in-out infinite alternate; }
@keyframes mascot-orbit {
  from { transform: translateY(2px) rotate(-7deg); }
  to { transform: translateY(-14px) rotate(11deg) scale(1.035); }
}
@keyframes mascot-wink {
  0%, 37.8%, 40.5%, 100% {
    opacity: 0;
    transform: scaleY(.18) rotate(7deg);
  }
  38.82%, 38.98% {
    opacity: 1;
    transform: scaleY(1) rotate(7deg);
  }
}
@keyframes starfall {
  0%, 10% { opacity: 0; transform: rotate(46deg); }
  13% { opacity: .96; }
  19% { opacity: .82; }
  23%, 100% { opacity: 0; transform: translate(70px, 72px) rotate(46deg); }
}
@keyframes stars-glow {
  from { opacity: .72; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero .hero-mascot, .home-hero::before, .hero-eyelid,
  .hero-meteor { animation: none; }
}
.home-hero .hero-copy { width: 100%; }
.home-hero h1 { max-width: 100%; font-size: clamp(27px, 7vw, 44px); overflow-wrap: anywhere; }
.home-hero p { max-width: none; margin: 7px 0 12px; }
.home-hero .hero-action { min-height: 40px; }
.catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 9px;
}
.catalog-heading h2 {
  min-width: 0;
  margin: 0;
  font-size: clamp(19px, 5.4vw, 29px);
}

.task-logo { display: block; width: 23px; height: 23px; object-fit: contain; }
.detail-glyph .task-logo { width: 34px; height: 34px; }
