@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/chakra-petch-500-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/chakra-petch-700-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./assets/fonts/ibm-plex-sans-latin-variable.woff2") format("woff2");
}

:root {
  --bg: #07060b;
  --panel: #12101a;
  --line: #2a2338;
  --text: #ece9f5;
  --dim: #9a93ad;
  --red: #e0143c;
  --vio: #9b5cff;
  --blue: #3ab8ff;
  --pink: #ff4fb0;
  --accent: #e0143c;
  --on-accent: #ffffff;
  --accent-dark: #e0143c;
  --on-accent-dark: #ffffff;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  --bg: #f4f1fa;
  --panel: #ffffff;
  --line: #d9d2e8;
  --text: #1b1528;
  --dim: #5f5878;
  --red: #c4123a;
  --vio: #6b36d6;
  --blue: #0a6fb0;
  --pink: #c2207c;
  color-scheme: light;
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    400 1rem/1.6 "IBM Plex Sans",
    system-ui,
    sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

h1,
h2,
h3,
.disp {
  font-family: "Chakra Petch", system-ui, sans-serif;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

body.scan:after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.45;
}

header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  margin-right: auto;
}

.logo b {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 4px;
}

nav button,
.ghost {
  background: none;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 4px;
}

nav button:hover,
nav button[aria-current="page"] {
  border-color: var(--vio);
  color: var(--vio);
}

.btn {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  transition:
    box-shadow 0.2s,
    transform 0.1s;
}

.btn:hover {
  box-shadow: 0 0 18px var(--accent);
}

.btn:active {
  transform: translateY(1px);
}

.btn.alt {
  background: transparent;
  border-color: var(--vio);
  color: var(--text);
}

.stage .btn.alt {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}

.btn.alt:hover {
  box-shadow: 0 0 18px var(--vio);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.guide-trigger {
  white-space: nowrap;
  border-color: var(--line);
  color: var(--text);
}

.quick-start {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
}

.quick-start-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.quick-start .eyebrow,
dialog .eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.quick-start h2 {
  font-size: 1.3rem;
}

.quick-start-steps,
.tutorial-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.quick-start-steps li,
.tutorial-steps li {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
}

.quick-start-steps b,
.quick-start-steps span {
  display: block;
}

.quick-start-steps span,
.tutorial-steps p {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 0.9rem;
}

.tutorial-steps {
  grid-template-columns: 1fr;
  counter-reset: tutorial-step;
}

.tutorial-steps li {
  position: relative;
  padding-left: 48px;
  counter-increment: tutorial-step;
}

.tutorial-steps li::before {
  content: counter(tutorial-step);
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 700;
}

main.glitch {
  animation: gl 0.32s steps(2) 1;
}

@keyframes gl {
  0% {
    transform: translateX(-6px);
    filter: hue-rotate(60deg);
  }
  50% {
    transform: translateX(5px) skewX(2deg);
  }
  100% {
    transform: none;
    filter: none;
  }
}

/* hero: the stage */
.stage {
  --bg: #07060b;
  --panel: #12101a;
  --line: #2a2338;
  --text: #ece9f5;
  --dim: #9a93ad;
  --red: #e0143c;
  --vio: #9b5cff;
  --blue: #3ab8ff;
  --pink: #ff4fb0;
  --accent: var(--accent-dark);
  --on-accent: var(--on-accent-dark);
  background: var(--bg);
  color: var(--text);
  border-radius: 0 0 14px 14px;
  position: relative;
  margin: 0 -20px;
  padding: 90px 20px 60px;
  min-height: 560px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.stage .beam {
  position: absolute;
  top: -10%;
  width: 34%;
  height: 120%;
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  filter: blur(2px);
  opacity: 0.55;
  animation: sway 7s ease-in-out infinite alternate;
}

.b1 {
  left: 8%;
  background: linear-gradient(var(--accent), transparent 85%);
}

.b2 {
  right: 8%;
  background: linear-gradient(var(--vio), transparent 85%);
  animation-delay: -3s !important;
}

@keyframes sway {
  to {
    transform: rotate(5deg);
  }
}

.city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(#0d0a16, #000);
  clip-path: polygon(
    0 100%,
    0 55%,
    5% 55%,
    5% 30%,
    10% 30%,
    10% 62%,
    15% 62%,
    15% 18%,
    21% 18%,
    21% 48%,
    27% 48%,
    27% 36%,
    33% 36%,
    33% 66%,
    39% 66%,
    39% 24%,
    45% 24%,
    45% 52%,
    52% 52%,
    52% 12%,
    58% 12%,
    58% 44%,
    64% 44%,
    64% 60%,
    70% 60%,
    70% 28%,
    77% 28%,
    77% 50%,
    83% 50%,
    83% 20%,
    89% 20%,
    89% 58%,
    95% 58%,
    95% 40%,
    100% 40%,
    100% 100%
  );
}

.figs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 150px;
  display: flex;
  justify-content: flex-end;
  padding-right: 6%;
  gap: 34px;
  align-items: flex-end;
  z-index: 1;
}

.fig {
  width: 26px;
  height: 88px;
  background: #000;
  border-radius: 13px 13px 3px 3px;
  position: relative;
}

.fig:before {
  content: "";
  position: absolute;
  top: -22px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000;
}

.fig.z {
  height: 74px;
  transform: rotate(-7deg);
  animation: shamble 5s ease-in-out infinite alternate;
}

.fig.z:before {
  box-shadow: inset 0 0 0 2px var(--red);
}

@keyframes shamble {
  to {
    transform: translateX(18px) rotate(5deg);
  }
}

.stage > *:not(.beam):not(.city):not(.figs):not(.status) {
  position: relative;
  z-index: 2;
}

.stage h1 {
  font-size: clamp(2.6rem, 9vw, 5.6rem);
  letter-spacing: 0.1em;
  text-shadow:
    2px 0 var(--red),
    -2px 0 var(--blue);
}

.tag {
  color: var(--dim);
  font-style: italic;
  margin: 10px 0 6px;
  max-width: 46ch;
}

.intro {
  max-width: 52ch;
  margin: 0 0 26px;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.status {
  position: absolute;
  z-index: 3;
  top: 26px;
  right: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  padding: 10px 14px;
  font:
    500 0.78rem/1.7 "Chakra Petch",
    monospace;
  border-radius: 3px;
}

.status i {
  font-style: normal;
  color: var(--blue);
}

.status .w {
  color: var(--red);
  animation: fl 2.4s steps(1) infinite;
}

@keyframes fl {
  50% {
    opacity: 0.35;
  }
}

.scen {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.scen button {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
  border-left: 3px solid var(--vio);
}

.scen button:hover {
  border-left-color: var(--accent);
}

.scen small {
  display: block;
  color: var(--dim);
}

h2.sec {
  font-size: 1.7rem;
  margin: 44px 0 6px;
}

/* archive */
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0;
}

input[type="search"] {
  flex: 1 1 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 4px;
  font: inherit;
}

.chip {
  border: 1px solid var(--line);
  background: none;
  border-radius: 99px;
  padding: 5px 13px;
  font-size: 0.88rem;
}

.chip[aria-pressed="true"] {
  background: var(--vio);
  border-color: var(--vio);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition:
    border-color 0.2s,
    transform 0.2s;
}

.card:hover {
  border-color: hsl(var(--h) 90% 60%);
  transform: translateY(-3px);
}

.por {
  height: 150px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 120%, hsl(var(--h) 90% 45%), transparent 70%),
    linear-gradient(160deg, #000, hsl(var(--h) 60% 14%));
}

.por span {
  font:
    700 3.4rem "Chakra Petch",
    sans-serif;
  color: hsl(var(--h) 100% 78%);
  text-shadow: 0 0 22px hsl(var(--h) 100% 55%);
}

.card .bd {
  padding: 14px 16px 16px;
}

.card h3 {
  font-size: 1.15rem;
}

.meta {
  color: var(--dim);
  font-size: 0.82rem;
  margin: 2px 0 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tags em {
  font-style: normal;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 8px;
  color: var(--dim);
}

.fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #000a;
  color: #fff;
  font-size: 1.1rem;
}

.fav[aria-pressed="true"] {
  color: var(--pink);
  border-color: var(--pink);
}

.empty {
  border: 1px dashed var(--line);
  padding: 40px;
  text-align: center;
  color: var(--dim);
  border-radius: 6px;
}

/* profile + chat */
.prof {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: 28px;
  margin-top: 30px;
}

.prof .por {
  height: 340px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.prof .por span {
  font-size: 7rem;
}

.prof h1 {
  font-size: 2.4rem;
}

.blk {
  margin: 18px 0;
}

.blk h3 {
  font-size: 1rem;
  color: var(--vio);
  margin-bottom: 4px;
}

.quote {
  border-left: 3px solid var(--accent);
  padding: 6px 14px;
  background: var(--panel);
  font-style: italic;
}

.chat {
  max-width: 720px;
  margin: 30px auto;
}

.chead {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.chead .por {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex: none;
}

.chead .por span {
  font-size: 1.8rem;
}

.sc {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 4px;
  margin: 16px 0;
  color: var(--dim);
  font-size: 0.92rem;
}

.rx {
  color: var(--blue);
  font:
    500 0.78rem "Chakra Petch",
    monospace;
  margin: 20px 0 6px;
}

.msg {
  background: var(--panel);
  border: 1px solid hsl(var(--h) 70% 40%);
  border-radius: 4px 14px 14px 14px;
  padding: 14px 16px;
  min-height: 60px;
}

.comp {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.comp input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px;
  border-radius: 4px;
  font: inherit;
}

.note {
  color: var(--dim);
  font-size: 0.85rem;
  margin-top: 8px;
}

#veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  display: none;
  place-items: center;
  font:
    700 clamp(1.6rem, 6vw, 3rem) "Chakra Petch",
    sans-serif;
  letter-spacing: 0.2em;
  color: var(--blue);
  text-shadow:
    3px 0 var(--red),
    -3px 0 var(--pink);
}

#veil.on {
  display: grid;
  animation: fl 0.5s steps(2) 2;
}

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--vio);
  border-radius: 6px;
  max-width: 480px;
  width: calc(100% - 32px);
  padding: 24px;
}

dialog::backdrop {
  background: #000b;
}

dialog h2 {
  margin-bottom: 10px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.sw {
  width: 46px;
  height: 26px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  padding: 0;
}

.sw:after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dim);
  transition: 0.2s;
}

.sw[aria-checked="true"] {
  border-color: var(--vio);
}

.sw[aria-checked="true"]:after {
  left: 23px;
  background: var(--vio);
}

:root[data-theme="light"] body.scan:after {
  opacity: 0.12;
}

@media (max-width: 760px) {
  nav {
    display: none;
  }
  .stage .status {
    position: relative;
    top: 0;
    right: 0;
    align-self: flex-start;
    margin-bottom: 20px;
  }
  .prof {
    grid-template-columns: 1fr;
  }
  .prof .por {
    height: 220px;
  }
  .mnav {
    display: flex !important;
  }
  .quick-start-steps {
    grid-template-columns: 1fr;
  }
}

.mnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
}

.mnav button {
  background: none;
  border: 0;
  padding: 10px 12px;
}

@media (prefers-reduced-motion: reduce) {
  body:not(.motion-full) *,
  body:not(.motion-full) *:before,
  body:not(.motion-full) *:after {
    animation: none !important;
    transition: none !important;
  }
}

body.motion-reduced *,
body.motion-reduced *:before,
body.motion-reduced *:after {
  animation: none !important;
  transition: none !important;
}

select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 4px;
  font: inherit;
  max-width: 100%;
}

.form {
  display: grid;
  gap: 14px;
  max-width: 680px;
}

.form label,
label.stack {
  display: grid;
  gap: 4px;
  color: var(--dim);
  font-size: 0.9rem;
}

.form input:not([type="checkbox"]):not([type="radio"]),
.form textarea,
label.stack textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 4px;
  font: inherit;
  width: 100%;
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}

legend {
  color: var(--vio);
  padding: 0 6px;
}

.form label.inl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  color: var(--text);
}

.srow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
  border-radius: 4px;
  margin-top: 10px;
}

/* ---------- chat conversation (Character.AI-style bubbles) ---------- */
:root {
  --act: #c3bbd9; /* action text: softer than dialogue, still easy to read */
  --who: 70% 72%;
}

:root[data-theme="light"] {
  --act: #4b4368;
  --who: 65% 34%;
}

.chat {
  max-width: 760px;
}

.chat .sc {
  border-radius: 14px;
}

.log {
  display: grid;
  gap: 20px;
  margin-top: 8px;
  max-height: min(64vh, 700px);
  overflow-y: auto;
  padding: 6px 4px 10px;
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.row.ai {
  justify-self: start;
  max-width: 96%;
}

.row.user {
  justify-self: end;
  max-width: 88%;
}

.mcol {
  min-width: 0;
  flex: 1 1 auto;
}

.av .por {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid hsl(var(--h) 60% 38%);
}

.av .por span {
  font-size: 1.15rem;
}

.who {
  margin: 0 0 5px 6px;
  font:
    500 0.76rem "Chakra Petch",
    sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--h) var(--who));
}

.m {
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 22px;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.m.ai {
  border-color: hsl(var(--h) 60% 38%);
  border-top-left-radius: 6px;
  background: color-mix(in srgb, hsl(var(--h) 60% 42%) 9%, var(--panel));
  box-shadow: 0 8px 26px -16px hsl(var(--h) 90% 50% / 0.8);
}

.m.user {
  border-color: color-mix(in srgb, var(--vio) 55%, var(--line));
  border-top-right-radius: 6px;
  background: color-mix(in srgb, var(--vio) 24%, var(--panel));
}

.m p {
  margin: 0;
}

.m p + p {
  margin-top: 0.8em;
}

/* the action or scene line on top */
.m p.act {
  font-style: italic;
  color: var(--act);
  font-size: 0.96rem;
  padding-left: 12px;
  border-left: 2px solid hsl(var(--h) 70% 52% / 0.7);
}

.m.user p.act {
  border-left-color: color-mix(in srgb, var(--vio) 80%, transparent);
}

/* the dialogue */
.m p.say {
  color: var(--text);
  font-size: 1.03rem;
}

.m em.act {
  font-style: italic;
  color: var(--act);
}

.m.err {
  border-color: var(--red);
  color: var(--red);
}

.dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 1.4em;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  animation: dotpulse 1.1s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dotpulse {
  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* buttons under each message */
.acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 13px 4px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--dim);
  font-size: 0.84rem;
  line-height: 1;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.act-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.act-btn:hover:not([disabled]) {
  color: var(--text);
  border-color: hsl(var(--h) 70% 55%);
  background: color-mix(in srgb, hsl(var(--h) 70% 50%) 14%, transparent);
}

.act-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.act-btn.done {
  color: var(--blue);
  border-color: var(--blue);
}

.act-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.act-btn.primary:hover:not([disabled]) {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.acts .hint {
  color: var(--dim);
  font-size: 0.78rem;
  margin-left: 4px;
}

@media (pointer: coarse) {
  .act-btn {
    min-height: 40px;
  }
}

/* editing a message */
.row.editing {
  width: 100%;
  max-width: 100%;
}

.m.editing {
  padding: 10px;
}

.edit-area {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid hsl(var(--h) 70% 52%);
  border-radius: 14px;
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

/* message box */
.comp {
  align-items: flex-end;
}

.chat .comp textarea {
  border-radius: 20px;
  padding: 12px 16px;
}

.comp .btn {
  border-radius: 99px;
  padding: 12px 24px;
}

@media (max-width: 560px) {
  .row.ai {
    max-width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    row-gap: 6px;
    align-items: center;
  }
  /* avatar and name sit on one line above the bubble, so the bubble and its
     buttons get the full width of the screen */
  .row.ai .mcol {
    display: contents;
  }
  .row.ai .av {
    grid-column: 1;
    grid-row: 1;
  }
  .row.ai .who {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }
  .row.ai .m,
  .row.ai .acts {
    grid-column: 1 / -1;
  }
  .row.ai .acts {
    margin-top: 2px;
  }
  .row.user {
    max-width: 94%;
  }
  .av .por {
    width: 30px;
    height: 30px;
  }
  .av .por span {
    font-size: 0.95rem;
  }
  .m {
    padding: 12px 15px;
  }
  .acts {
    gap: 4px;
  }
  .act-btn {
    gap: 4px;
    padding: 4px 9px 4px 7px;
  }
  .act-btn .lbl {
    font-size: 0.78rem;
  }
  .acts .hint {
    display: none;
  }
}

/* message styles (Settings > Message style) */
[data-bubble="script"] .log {
  gap: 18px;
}

[data-bubble="script"] .row,
[data-bubble="cards"] .row {
  justify-self: stretch;
  max-width: 100%;
}

[data-bubble="script"] .av,
[data-bubble="script"] .who {
  display: none;
}

[data-bubble="script"] .m,
[data-bubble="script"] .m.ai,
[data-bubble="script"] .m.user {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

[data-bubble="script"] .m.editing {
  padding: 0;
}

[data-bubble="script"] .m::before {
  content: attr(data-who);
  display: block;
  margin-bottom: 3px;
  font:
    500 0.75rem "Chakra Petch",
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

[data-bubble="script"] .m.ai::before {
  color: hsl(var(--h) var(--who));
}

[data-bubble="cards"] .m,
[data-bubble="cards"] .m.ai {
  border-radius: 10px;
}

[data-bubble="cards"] .m.user {
  background: var(--panel);
  border-radius: 0;
  border-left: 3px solid var(--accent);
}


.m.err {
  border-color: var(--red);
  color: var(--red);
}

.m.typing {
  opacity: 0.6;
}

.note.error {
  color: var(--red);
}

.comp textarea {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px;
  border-radius: 4px;
  font: inherit;
  resize: vertical;
  min-height: 46px;
}

.tools2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.tools2 label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 0.88rem;
}

.ghost[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.note.demo {
  color: var(--blue);
}

/* settings page */
.privacy-notice {
  width: min(1120px, calc(100% - 32px));
  margin: 10px auto 0;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: var(--panel);
  color: var(--dim);
  font-size: 0.86rem;
}

.privacy-notice a,
.site-footer a,
.legal-content a,
.set-card a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 34px auto 92px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.84rem;
}

.site-footer nav,
.legal-nav,
.privacy-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.site-footer nav {
  margin-top: 8px;
}

.legal-page {
  max-width: 920px;
  margin: 0 auto;
  padding-bottom: 32px;
}

.legal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.legal-heading .eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.legal-heading .sec {
  margin: 0;
}

.legal-draft {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid #b87b28;
  border-left: 3px solid #e4a949;
  border-radius: 5px;
  background: color-mix(in srgb, #b87b28 12%, var(--panel));
}

.legal-nav {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.legal-nav a {
  color: var(--dim);
  text-decoration: none;
}

.legal-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.legal-content {
  padding: 18px 24px 26px;
  line-height: 1.7;
}

.legal-content h3 {
  margin: 24px 0 6px;
  color: var(--vio);
}

.legal-content h3:first-child {
  margin-top: 12px;
}

.legal-summary {
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.legal-box {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  padding: 12px 14px;
  border-radius: 4px;
}

.legal-table-wrap {
  overflow-x: auto;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.legal-table th,
.legal-table td {
  border: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.legal-table th {
  background: var(--panel);
  color: var(--text);
}

.privacy-actions {
  margin: 14px 0;
}

.privacy-actions .btn {
  margin: 0;
}

.legal-content :focus-visible,
.legal-nav a:focus-visible,
.site-footer a:focus-visible,
.privacy-notice a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.set-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 6px 20px 8px;
  margin-top: 18px;
}

@media (max-width: 640px) {
  .legal-heading {
    flex-direction: column;
  }

  .legal-content {
    padding: 15px 16px 22px;
  }

  .site-footer {
    margin-bottom: 100px;
  }
}

.set-card > h3 {
  font-size: 1.05rem;
  color: var(--vio);
  padding: 14px 0 4px;
}

.opt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.set-card > h3 + .opt {
  border-top: 0;
}

.opt b {
  font-weight: 500;
}

.opt .meta {
  margin: 2px 0 0;
  max-width: 46ch;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.seg button {
  background: none;
  border: 0;
  padding: 8px 14px;
  border-right: 1px solid var(--line);
}

.seg button:last-child {
  border-right: 0;
}

.seg button[aria-checked="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.swatches {
  display: flex;
  gap: 10px;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--panel) inset;
  padding: 0;
}

.swatch[aria-checked="true"] {
  border-color: var(--text);
}

.set-card input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 4px;
  font: inherit;
  width: 220px;
  max-width: 100%;
}

.danger {
  border-color: var(--red);
  color: var(--red);
}

/* chat backgrounds: used on the page while a chat is open, and on the preview */
[data-chatbg="plain"] {
  background: var(--bg);
}

[data-chatbg="glow"] {
  background:
    radial-gradient(
      ellipse 80% 55% at 50% 0%,
      hsl(var(--ch) 85% 45% / 0.38),
      transparent 70%
    ),
    radial-gradient(
      ellipse 60% 40% at 50% 100%,
      hsl(var(--ch) 85% 45% / 0.18),
      transparent 70%
    ),
    var(--bg);
  background-attachment: fixed;
}

:root[data-theme="light"] [data-chatbg="glow"] {
  background:
    radial-gradient(
      ellipse 80% 55% at 50% 0%,
      hsl(var(--ch) 90% 72% / 0.5),
      transparent 70%
    ),
    radial-gradient(
      ellipse 60% 40% at 50% 100%,
      hsl(var(--ch) 90% 72% / 0.25),
      transparent 70%
    ),
    var(--bg);
  background-attachment: fixed;
}

[data-chatbg="grid"] {
  background-color: var(--bg);
  background-image:
    linear-gradient(
      color-mix(in srgb, var(--line) 70%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--line) 70%, transparent) 1px,
      transparent 1px
    );
  background-size: 32px 32px;
  background-attachment: fixed;
}

[data-chatbg="gradient"] {
  background: linear-gradient(
    160deg,
    var(--bg) 20%,
    color-mix(in srgb, var(--accent) 22%, var(--bg))
  );
  background-attachment: fixed;
}

[data-chatbg="image"] {
  background:
    linear-gradient(
      color-mix(in srgb, var(--bg) 62%, transparent),
      color-mix(in srgb, var(--bg) 62%, transparent)
    ),
    var(--chat-image) center / cover no-repeat,
    var(--bg);
  background-attachment: fixed;
}

.bgprev {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0 14px;
}

:root .bgprev[data-chatbg] {
  background-attachment: scroll;
}

/* agreement notice: text on the left, button on the right */
.privacy-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.privacy-notice[hidden] {
  display: none;
}

.privacy-notice .btn {
  padding: 8px 16px;
  font-size: 0.9rem;
}