:root {
  --ink: #17285c;
  --soft-line: #d6ebe8;
  --lava-deep: #4b0b25;
  --lava-wine: #741335;
  --lava-rose: #a84062;
  --lava-light: #dfa0b0;
}

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

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

body {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  overflow-x: hidden;
  color: #ffffff;
  background: var(--lava-deep);
  font-family: Arial, Helvetica, sans-serif;
}

body.is-sessions-menu-open {
  overflow: hidden;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: -18%;
  content: "";
  background:
    radial-gradient(
      ellipse at 12% 14%,
      var(--lava-light) 0 9%,
      transparent 38%
    ),
    radial-gradient(
      ellipse at 86% 84%,
      var(--lava-rose) 0 11%,
      transparent 40%
    ),
    radial-gradient(
      ellipse at 48% 45%,
      var(--lava-wine) 0 20%,
      transparent 58%
    ),
    linear-gradient(125deg, var(--lava-light), var(--lava-wine) 48%, var(--lava-deep));
  background-size: 155% 155%, 145% 145%, 135% 135%, 100% 100%;
  background-position: 0% 0%, 100% 100%, 50% 50%, 50% 50%;
  filter: blur(32px);
  transform: scale(1.08);
  animation: profile-lava-lamp 28s ease-in-out infinite alternate;
}

.profile-page {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: start center;
  align-content: start;
  padding: 18px 24px 40px;
}

.profile-page h1 {
  margin: 4px 0 0;
  font-size: clamp(20px, 3.4vw, 31px);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.profile-card {
  display: flex;
  width: min(100%, 620px);
  min-height: 112px;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  margin-top: 10px;
  padding: 18px 30px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 24px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 18px 50px rgb(35 0 16 / 18%);
  color: #4b0b25;
}

.account-management {
  display: grid;
  width: min(100%, 900px);
  gap: 16px;
  margin-top: 36px;
}

.account-management h2 {
  margin: 0 0 2px;
  color: #ffffff;
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}

.memory-settings {
  display: grid;
  width: min(100%, 900px);
  gap: 16px;
  margin-top: 28px;
}

.memory-settings h2 {
  margin: 0 0 2px;
  color: #ffffff;
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}

.account-management-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 120px;
  padding: 18px 24px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 28px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 18px 50px rgb(35 0 16 / 16%);
  color: #171717;
}

.memory-toggle {
  display: inline-flex;
  min-width: 104px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 0 8px 8px;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}

.memory-toggle-track {
  display: flex;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: #b8b8b8;
  transition: background-color 160ms ease;
}

.memory-toggle-thumb {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
  transition: transform 160ms ease;
}

.memory-toggle[aria-checked="true"] .memory-toggle-track {
  background: var(--lava-wine);
}

.memory-toggle[aria-checked="true"] .memory-toggle-thumb {
  transform: translateX(20px);
}

.memory-toggle:focus-visible {
  border-radius: 8px;
  outline: 3px solid var(--lava-wine);
  outline-offset: 3px;
}

.management-icon {
  display: block;
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  color: #2d2d2d;
}

.management-copy {
  min-width: 0;
}

.management-copy h3 {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 600;
  line-height: 1.25;
}

.management-copy p {
  max-width: 34ch;
  margin: 6px 0 0;
  color: #777777;
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.4;
}

.management-action {
  justify-self: end;
  min-width: 116px;
  min-height: 52px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  color: #171717;
  background: #e8e8e8;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
}

.management-action-danger {
  color: #ed2644;
  background: transparent;
}

.management-action:focus-visible {
  outline: 3px solid #741335;
  outline-offset: 3px;
}

.management-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

.profile-status {
  width: min(100%, 900px);
  margin: 12px 0 0;
  color: #ffffff;
  font-size: 14px;
}

.profile-card-content {
  min-width: 0;
}

.profile-card-label,
.profile-card-account {
  margin: 0;
}

.profile-card-label {
  color: rgb(75 11 37 / 60%);
  font-size: 14px;
}

.profile-card-account {
  margin-top: 8px;
  overflow: hidden;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar {
  display: block;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  color: #333333;
  opacity: 0.78;
}

.profile-back-button {
  position: fixed;
  top: max(24px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  text-decoration: none;
}

.profile-back-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.profile-back-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.sessions-page {
  display: block;
  width: min(100%, 960px);
  margin-inline: auto;
  padding: 18px 24px 40px;
}

.sessions-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 44px;
}

.sessions-header h1 {
  margin: 0;
  font-size: clamp(20px, 3.4vw, 31px);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.sessions-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 32px);
}

.sessions-title-decoration {
  display: block;
  width: 62px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  mix-blend-mode: screen;
  opacity: 0.55;
}

.sessions-title-decoration-plus {
  object-position: center;
}

.sessions-title-decoration-star {
  width: 56px;
}

.sessions-back-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  text-decoration: none;
}

.sessions-back-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sessions-back-button:focus-visible,
.sessions-filter-option:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.sessions-header-spacer {
  width: 44px;
  height: 44px;
}

.sessions-filter {
  position: sticky;
  z-index: 10;
  top: max(12px, env(safe-area-inset-top));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-height: 42px;
  gap: 4px;
  margin-top: 20px;
  margin-inline: auto;
  padding: 4px;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 999px;
  background: rgb(55 7 27 / 30%);
  box-shadow: 0 8px 24px rgb(35 0 16 / 16%);
  backdrop-filter: blur(14px);
}

.sessions-filter-option {
  min-width: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.sessions-filter-option.is-active {
  color: #4b0b25;
  background: #ffffff;
}

.sessions-list {
  display: grid;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  padding-bottom: 96px;
}

.sessions-list-status,
.sessions-empty {
  margin: 0;
  padding: 14px 4px;
  color: rgb(255 255 255 / 84%);
  font-size: 15px;
  line-height: 1.5;
}

.sessions-list-status.is-error {
  color: #ffffff;
}

.sessions-chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 8px 5px 16px;
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(41 37 42 / 7%);
}

.sessions-chat-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--lava-deep);
  background: #dfa0b0;
}

.sessions-chat-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.sessions-chat-icon.is-favorite {
  color: var(--lava-wine);
}

.sessions-chat-icon.is-favorite svg {
  fill: var(--lava-wine);
}

.sessions-chat-link {
  display: block;
  min-width: 0;
  flex: 1;
  min-height: 50px;
  padding: 12px 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.5;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sessions-chat-time {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.sessions-chat-menu-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.sessions-chat-menu-button svg {
  width: 22px;
  height: 22px;
}

.sessions-chat-menu-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.sessions-new-chat-button {
  position: fixed;
  z-index: 20;
  right: max(24px, calc((100vw - 960px) / 2 + 24px));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--lava-wine);
  box-shadow: 0 10px 26px rgb(35 0 16 / 30%);
  cursor: pointer;
}

.sessions-new-chat-button:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.sessions-new-chat-button svg {
  width: 28px;
  height: 28px;
  stroke-width: 2;
}

.sessions-action-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(25 0 14 / 48%);
}

.sessions-action-backdrop[hidden] {
  display: none;
}

.sessions-action-sheet {
  width: min(100%, 960px);
  min-height: 33dvh;
  padding: 12px 24px max(24px, env(safe-area-inset-bottom));
  border: 1px solid rgb(255 255 255 / 45%);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: #ffffff;
  box-shadow: 0 -14px 38px rgb(35 0 16 / 24%);
  color: var(--lava-deep);
}

.sessions-action-sheet-handle {
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto 22px;
  border-radius: 999px;
  background: rgb(75 11 37 / 24%);
}

.sessions-action {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  gap: 16px;
  padding: 10px 4px;
  border: 0;
  border-radius: 14px;
  color: var(--lava-deep);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  text-align: left;
}

.sessions-action:hover,
.sessions-action:focus-visible {
  background: #f3e8dc;
}

.sessions-action svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  stroke-width: 2;
}

.sessions-action-divider {
  height: 1px;
  margin: 10px 0;
  background: #dce5f2;
}

.sessions-action-danger {
  color: #ed2644;
}

.sessions-chat-link:focus-visible {
  border-radius: 8px;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.sessions-divider {
  height: 1px;
  background: rgb(255 255 255 / 44%);
}

.session-page {
  position: fixed;
  inset: var(--session-viewport-offset-top, 0px) 0 auto;
  display: flex;
  width: min(100%, 1000px);
  height: var(--session-viewport-height, 100dvh);
  flex-direction: column;
  margin-inline: auto;
  overflow: hidden;
  padding: 12px 24px max(18px, env(safe-area-inset-bottom));
}

.session-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 56px;
}

.session-back-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  text-decoration: none;
}

.session-back-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.session-back-button:focus-visible,
.session-send-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.session-logo {
  display: block;
  width: clamp(130px, 20vw, 200px);
  max-height: 48px;
  justify-self: center;
  object-fit: contain;
}

.session-messages {
  display: flex;
  width: min(100%, 820px);
  flex: 1;
  flex-direction: column;
  align-self: center;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 30px 8px 20px;
  overscroll-behavior-y: contain;
  scroll-padding-block: 20px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000000 56px,
    #000000 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000000 56px,
    #000000 100%
  );
}

.session-loading {
  margin: auto;
  color: rgb(255 255 255 / 82%);
  text-align: center;
}

.session-message {
  width: fit-content;
  max-width: min(82%, 680px);
  padding: 14px 18px;
  border-radius: 20px;
  color: #24121a;
  background: #ffffff;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.session-message-user {
  align-self: flex-end;
  border-end-end-radius: 6px;
}

.session-assistant-item {
  display: flex;
  width: fit-content;
  max-width: min(82%, 680px);
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
}

.session-message-assistant {
  align-self: flex-start;
  max-width: 100%;
  border-end-start-radius: 6px;
  white-space: normal;
}

.session-assistant-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0 0 4px;
}

.session-assistant-action {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  cursor: default;
}

.session-assistant-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.session-assistant-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.session-assistant-action.is-copied,
.session-code-copy.is-copied {
  color: #21834a;
}

.session-message-assistant > :first-child {
  margin-top: 0;
}

.session-message-assistant > :last-child {
  margin-bottom: 0;
}

.session-message-assistant p {
  margin: 0.65em 0;
  white-space: normal;
}

.session-message-assistant h1,
.session-message-assistant h2,
.session-message-assistant h3,
.session-message-assistant h4,
.session-message-assistant h5,
.session-message-assistant h6 {
  margin: 0.9em 0 0.4em;
  color: var(--accent);
  line-height: 1.25;
}

.session-message-assistant h1 {
  font-size: 1.35em;
}

.session-message-assistant h2 {
  font-size: 1.2em;
}

.session-message-assistant h3,
.session-message-assistant h4,
.session-message-assistant h5,
.session-message-assistant h6 {
  font-size: 1.08em;
}

.session-message-assistant ul,
.session-message-assistant ol {
  margin: 0.55em 0;
  padding-inline-start: 1.5em;
}

.session-message-assistant li + li {
  margin-top: 0.25em;
}

.session-message-assistant blockquote {
  margin: 0.7em 0;
  padding: 0.15em 0 0.15em 0.8em;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
}

.session-message-assistant hr {
  margin: 0.9em 0;
  border: 0;
  border-top: 1px solid var(--grid);
}

.session-message-assistant a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.session-message-assistant code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: rgb(112 27 61 / 8%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.session-message-assistant pre {
  position: relative;
  max-width: 100%;
  margin: 0.7em 0;
  padding: 38px 14px 12px;
  overflow-x: auto;
  border: 1px solid var(--grid);
  border-radius: 10px;
  background: #f6f4f6;
  line-height: 1.45;
  white-space: pre;
}

.session-code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.session-code-copy:hover,
.session-code-copy:focus-visible {
  color: var(--accent);
  background: rgb(112 27 61 / 8%);
}

.session-code-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.session-code-copy svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.session-message-assistant pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  overflow-wrap: normal;
}

.session-message-assistant table {
  display: block;
  max-width: 100%;
  margin: 0.7em 0;
  overflow-x: auto;
  border-collapse: collapse;
  white-space: normal;
  font-size: 0.92em;
}

.session-message-assistant th,
.session-message-assistant td {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid var(--grid);
  text-align: left;
  vertical-align: top;
}

.session-message-assistant th {
  background: rgb(112 27 61 / 7%);
  font-weight: 700;
}

.session-status {
  width: min(100%, 820px);
  min-height: 0;
  align-self: center;
  margin: 0 auto;
  color: #ffffff;
  font-size: 13px;
  text-align: center;
}

.session-status:empty {
  display: none;
}

.session-copy-feedback {
  position: fixed;
  z-index: 20;
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  left: 50%;
  display: none;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 9px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--grid);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(41 37 42 / 14%);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}

.session-copy-feedback.is-visible {
  display: block;
}

.session-leave-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
}

.session-leave-modal.is-open {
  display: grid;
}

.session-leave-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(30 18 25 / 38%);
  backdrop-filter: blur(6px);
}

.session-leave-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 30px 24px 22px;
  border: 1px solid var(--grid);
  border-radius: 24px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 20px 60px rgb(41 37 42 / 22%);
  text-align: center;
}

.session-leave-card h2 {
  margin: 0;
  color: var(--accent);
  font-size: 22px;
}

.session-leave-card p {
  margin: 12px 0 22px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.45;
}

.session-leave-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  background: transparent;
  font-size: 25px;
  cursor: pointer;
}

.session-leave-save,
.session-leave-discard {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  cursor: pointer;
}

.session-leave-save {
  color: #ffffff;
  background: var(--accent);
  font-weight: 600;
}

.session-leave-discard {
  margin-top: 8px;
  color: var(--text-secondary);
  background: transparent;
}

.session-leave-save:focus-visible,
.session-leave-discard:focus-visible,
.session-leave-close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.session-composer {
  display: grid;
  width: 100%;
  gap: 6px;
  align-self: center;
  margin: 12px auto 0;
  padding: 10px 8px;
  border: 2px solid var(--soft-line);
  border-radius: 28px;
  background: #ffffff;
}

.session-composer-main,
.session-composer-footer {
  display: flex;
  align-items: center;
}

.session-composer-main {
  align-items: flex-end;
  gap: 0;
}

.session-icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4f4f4f;
  background: transparent;
  cursor: pointer;
}

.session-icon-button svg,
.session-model-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.session-composer textarea {
  flex: 1;
  min-width: 0;
  margin-inline-start: -4px;
  min-height: 38px;
  max-height: 180px;
  padding: 5px 0;
  resize: vertical;
  border: 0;
  outline: none;
  color: #1b1b1b;
  background: transparent;
  font: inherit;
  font-size: clamp(16px, 2.4vw, 26px);
  line-height: 1.3;
  overflow-x: hidden;
  overflow-y: hidden;
}

.session-composer textarea:focus-visible {
  outline: none;
}

.session-composer:focus-within {
  border-color: #741335;
  box-shadow: 0 0 0 2px rgb(116 19 53 / 24%);
}

.session-composer-footer {
  justify-content: space-between;
  gap: 10px;
}

.session-model-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  color: #171717;
  background: #f2f2f2;
  cursor: pointer;
}

.session-model-button svg {
  width: 14px;
  height: 14px;
  color: #777777;
}

.session-model-icon {
  color: #151515;
  font-size: 14px;
}

.session-send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
}

.session-icon-button:focus-visible,
.session-model-button:focus-visible {
  outline: 3px solid #741335;
  outline-offset: 3px;
}

.session-send-button:focus-visible {
  outline: 3px solid #6374c8;
  outline-offset: 3px;
}

.session-send-button:active {
  scale: 0.96;
}

.session-send-button svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.session-send-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.session-composer[hidden] {
  display: none;
}

.session-disclaimer {
  width: 70%;
  margin: 10px auto 0;
  color: rgb(255 255 255 / 68%);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

@keyframes profile-lava-lamp {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%, 50% 50%;
    transform: scale(1.08) translate3d(-2%, -1%, 0);
  }

  50% {
    background-position: 34% 24%, 64% 76%, 38% 58%, 50% 50%;
    transform: scale(1.1) translate3d(1%, 2%, 0);
  }

  100% {
    background-position: 72% 54%, 18% 28%, 62% 40%, 50% 50%;
    transform: scale(1.08) translate3d(-1%, 1%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

@media (max-width: 600px) {
  .profile-page {
    padding: max(12px, env(safe-area-inset-top)) 16px 24px;
  }

  .profile-page h1 {
    margin-top: 2px;
    font-size: 24px;
  }

  .profile-card {
    min-height: 95px;
    gap: 16px;
    margin-top: 8px;
    padding: 12px 18px;
    border-radius: 20px;
  }

  .profile-card-label {
    font-size: 12px;
  }

  .profile-card-account {
    margin-top: 6px;
    font-size: 17px;
  }

  .profile-avatar {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .account-management {
    gap: 12px;
    margin-top: 28px;
  }

  .memory-settings {
    gap: 12px;
    margin-top: 22px;
  }

  .memory-settings h2 {
    font-size: 21px;
  }

  .account-management h2 {
    font-size: 21px;
  }

  .account-management-card {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 0;
    padding: 14px 12px;
    border-radius: 22px;
  }

  .management-icon {
    width: 30px;
    height: 30px;
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .management-copy {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .management-copy h3 {
    font-size: 17px;
  }

  .management-copy p {
    font-size: 14px;
  }

  .memory-toggle {
    min-width: 84px;
    gap: 7px;
    font-size: 14px;
  }

  .memory-toggle-track {
    width: 42px;
    height: 25px;
    flex-basis: 42px;
  }

  .memory-toggle-thumb {
    width: 19px;
    height: 19px;
  }

  .memory-toggle[aria-checked="true"] .memory-toggle-thumb {
    transform: translateX(17px);
  }

  .management-action {
    grid-column: 3;
    grid-row: 1 / span 2;
    justify-self: end;
    min-width: 72px;
    min-height: 40px;
    margin: 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  .profile-back-button {
    top: max(12px, env(safe-area-inset-top));
    left: 16px;
  }

  .sessions-page {
    padding: max(12px, env(safe-area-inset-top)) 16px 24px;
  }

  .sessions-header {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    min-height: 40px;
  }

  .sessions-header h1 {
    font-size: 24px;
  }

  .sessions-title {
    gap: 16px;
  }

  .sessions-title-decoration {
    width: 48px;
    height: 43px;
    border-radius: 6px;
  }

  .sessions-title-decoration-star {
    width: 43px;
  }

  .sessions-back-button,
  .sessions-header-spacer {
    width: 40px;
    height: 40px;
  }

  .sessions-filter {
    width: 100%;
    min-height: 38px;
    margin-top: 16px;
  }

  .sessions-filter-option {
    padding: 5px 10px;
    font-size: 13px;
  }

  .sessions-new-chat-button {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
  }

  .sessions-action-sheet {
    min-height: 34dvh;
    padding-inline: 18px;
  }

  .session-page {
    height: var(--session-viewport-height, 100dvh);
    min-height: 0;
    padding: max(8px, env(safe-area-inset-top)) 16px
      max(12px, env(safe-area-inset-bottom));
  }

  .session-header {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    min-height: 48px;
  }

  .session-back-button {
    width: 40px;
    height: 40px;
  }

  .session-logo {
    width: 150px;
    max-height: 40px;
  }

  .session-messages {
    min-height: 0;
    gap: 12px;
    padding: 18px 2px 150px;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000000 44px,
      #000000 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000000 44px,
      #000000 100%
    );
  }

  .session-message {
    max-width: 90%;
    padding: 12px 14px;
    font-size: 15px;
  }

  .session-assistant-item {
    max-width: 90%;
  }

  .session-composer {
    position: fixed;
    z-index: 5;
    left: 50%;
    bottom: calc(
      var(--session-viewport-bottom-inset, 0px) +
      max(12px, env(safe-area-inset-bottom)) +
      30px
    );
    width: min(calc(100% - 32px), 968px);
    gap: 5px;
    margin: 0;
    padding: 9px 6px;
    border-radius: 23px;
    transform: translateX(-50%);
    transition: bottom 120ms ease-out;
  }

  .session-composer-main {
    gap: 0;
  }

  .session-icon-button {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .session-composer textarea {
    min-height: 38px;
    font-size: 17px;
  }

  .session-model-button {
    min-height: 32px;
    gap: 5px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .session-send-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .session-disclaimer {
    position: fixed;
    z-index: 4;
    right: 16px;
    bottom: calc(
      var(--session-viewport-bottom-inset, 0px) +
      max(12px, env(safe-area-inset-bottom))
    );
    left: 16px;
    width: auto;
    margin: 0 auto;
    font-size: 10px;
  }

  .session-keyboard-open .session-disclaimer {
    display: none;
  }

  .session-keyboard-open .session-composer {
    bottom: calc(
      var(--session-viewport-bottom-inset, 0px) +
      max(12px, env(safe-area-inset-bottom))
    );
  }
}

/* Paper notebook theme */
:root {
  --paper: #f2f5fa;
  --grid: #dce5f2;
  --accent: #701b3d;
  --text: #29252a;
  --surface: #ffffff;
  --text-secondary: #99949a;
  --soft-line: #dce5f2;
  --ink: #701b3d;
}

body {
  color: var(--text);
  background: var(--paper);
}

body::before {
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(to right, rgb(220 229 242 / 58%) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(220 229 242 / 58%) 1px, transparent 1px),
    radial-gradient(circle, rgb(112 27 61 / 4%) 0.6px, transparent 0.8px);
  background-size: 28px 28px, 28px 28px, 7px 7px;
  filter: none;
  opacity: 0.9;
  transform: none;
  animation: none;
}

.profile-page h1,
.account-management h2,
.memory-settings h2 {
  color: var(--accent);
}

.profile-back-button,
.sessions-back-button,
.session-back-button {
  color: var(--accent);
}

.profile-card,
.account-management-card,
.session-message,
.session-composer {
  border-color: var(--grid);
  background: var(--surface);
  box-shadow: 0 10px 28px rgb(41 37 42 / 9%);
}

.profile-card {
  color: var(--text);
}

.profile-card-label,
.management-copy p {
  color: var(--text-secondary);
}

.profile-card-account,
.management-copy h3 {
  color: var(--text);
}

.account-management h2 {
  color: var(--accent);
}

.session-status,
.session-disclaimer {
  color: var(--text-secondary);
}

.session-message {
  color: var(--text);
}

.session-loading {
  color: var(--text-secondary);
}

.session-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(112 27 61 / 16%), 0 10px 28px rgb(41 37 42 / 9%);
}

.sessions-filter {
  border-color: var(--grid);
  background: rgb(255 255 255 / 78%);
}

.sessions-filter-option {
  color: var(--accent);
}

.sessions-filter-option.is-active {
  color: #ffffff;
  background: var(--accent);
}

.sessions-chat-link {
  color: var(--text);
}

.sessions-divider {
  background: var(--grid);
}
