:root {
  color-scheme: dark;
  font-family: "Inter", "Noto Color Emoji", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101012;
  color: #fff5f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #101012;
}

body:has(.chat-shell) {
  height: 100vh;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.8rem;
  background: #f04f96;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 0.9rem 1.25rem;
  box-shadow: 0 0.65rem 1.4rem rgba(240, 79, 150, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 0.85rem 1.8rem rgba(240, 79, 150, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

code {
  color: #ff8fbd;
  overflow-wrap: anywhere;
}

p {
  margin: 0;
}

.site-logo {
  position: fixed;
  left: clamp(1rem, 4vw, 2rem);
  top: clamp(1rem, 4vw, 2rem);
  color: #fff5f9;
  font-family: "Inter", "Noto Color Emoji", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-decoration: none;
  z-index: 2;
}

.topbar {
  align-items: center;
  background: rgba(16, 16, 18, 0.88);
  border-bottom: 1px solid #242428;
  backdrop-filter: blur(16px);
  display: flex;
  gap: 1rem;
  inset: 0 0 auto;
  justify-content: space-between;
  padding: clamp(1rem, 4vw, 2rem);
  position: fixed;
  z-index: 5;
}

.topbar .site-logo {
  flex: 0 0 auto;
  position: static;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 0.6rem;
}

.header-search {
  background: transparent;
  border: 1px solid #2b2b31;
  border-radius: 0.65rem;
  color: #fff5f9;
  min-width: 0;
  padding: 0.58rem 0.75rem;
  width: 14rem;
}

.header-search::placeholder {
  color: #777780;
}

.create-action {
  align-items: center;
  background: #1b1b1f;
  border: 1px solid #2b2b31;
  border-radius: 0.65rem;
  color: #fff5f9;
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 800;
  gap: 0.45rem;
  padding: 0.58rem 0.75rem;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.create-action span {
  color: #ff7fb3;
  font-size: 1.05rem;
  line-height: 1;
}

.create-action:hover {
  background: #24242a;
  border-color: #3a3a42;
  transform: translateY(-1px);
}

.site-footer {
  border-top: 1px solid #242428;
  color: #8f8f98;
  font-size: 0.88rem;
  margin-inline: auto;
  max-width: 54rem;
  padding: 1.25rem clamp(1rem, 4vw, 2rem) 2rem;
}

.site-footer a {
  color: #ffc1da;
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff5f9;
}

.button-link {
  align-items: center;
  background: #f04f96;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.8rem;
  box-shadow: 0 0.65rem 1.4rem rgba(240, 79, 150, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  padding: 0.9rem 1.25rem;
  text-decoration: none;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.button-link:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.compact-link {
  padding: 0.65rem 1rem;
}

.plain-link {
  color: #ffc1da;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.plain-link:hover {
  color: #fff5f9;
}

.brand-name {
  display: inline-block;
  text-transform: none;
}

.shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 3rem);
  place-items: center;
}

.home-shell {
  align-content: start;
  display: grid;
  gap: 1.25rem;
  margin-inline: auto;
  max-width: 54rem;
  min-height: 100vh;
  padding: 7rem clamp(1rem, 4vw, 2rem) 3rem;
}

.character-section {
  align-content: start;
  display: grid;
  gap: 1rem;
}

.section-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  justify-content: space-between;
}

.section-heading h1 {
  font-size: 1.25rem;
  line-height: 1.1;
  margin: 0;
}

.section-heading p {
  color: #777780;
  font-size: 0.88rem;
}

.character-grid {
  align-content: start;
  align-items: start;
  display: grid;
  gap: 0.15rem;
  grid-template-columns: 1fr;
}

.character-tile {
  align-items: center;
  align-self: start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  cursor: pointer;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: auto 1fr auto;
  height: auto;
  padding: 0.45rem 0.55rem;
  transition: border-color 140ms ease, background 140ms ease;
}

.storage-error {
  background: transparent;
  border: 0;
  border-left: 2px solid #f04f96;
  border-radius: 0;
  display: grid;
  gap: 0.35rem;
  grid-column: 1 / -1;
  justify-self: start;
  max-width: 32rem;
  padding: 0.25rem 0 0.25rem 0.9rem;
}

.empty-state {
  border: 1px dashed #303038;
  border-radius: 0.85rem;
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
}

.empty-state h3 {
  font-size: 0.98rem;
  margin: 0;
}

.empty-state p {
  color: #8f8f98;
  font-size: 0.9rem;
}

.storage-error h3 {
  font-size: 0.98rem;
  margin: 0;
}

.storage-error p {
  color: #8f8f98;
  font-size: 0.9rem;
  line-height: 1.45;
}

.character-tile:hover {
  background: #1a1a1e;
  border-color: #2a2a30;
}

.character-avatar {
  align-items: center;
  background: #24242a;
  border: 1px solid #303038;
  border-radius: 0.7rem;
  color: #ffc1da;
  display: grid;
  font-size: 1.4rem;
  font-weight: 900;
  height: 3rem;
  overflow: hidden;
  place-items: center;
  width: 3rem;
}

.character-text {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.character-tile h3 {
  font-size: 1rem;
  margin: 0;
}

.character-tile p {
  color: #9a9aa3;
  display: -webkit-box;
  font-size: 0.9rem;
  line-height: 1.35;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.delete-character-button {
  background: #24242a;
  border-color: #33333a;
  border-radius: 0.65rem;
  box-shadow: none;
  color: #ff8fbd;
  font-size: 0.78rem;
  padding: 0.55rem 0.7rem;
}

.delete-character-button:hover {
  background: #2d2229;
  border-color: #f04f96;
  box-shadow: none;
  transform: translateY(-1px);
}

.creator-shell {
  place-items: center stretch;
}

.create-page {
  background: #101012;
}

.create-shell {
  display: grid;
  margin-inline: auto;
  max-width: 42rem;
  min-height: 100vh;
  padding: 7rem clamp(1rem, 4vw, 2rem) 3rem;
}


.create-panel {
  align-content: start;
  display: grid;
  gap: 1rem;
}

.create-panel .creator-copy {
  align-self: auto;
  border-bottom: 1px solid #242428;
  display: grid;
  gap: 0.45rem;
  padding: 0 0 1rem;
}

.create-panel .creator-copy::before,
.create-panel .form-card::before {
  display: none;
}

.create-panel .eyebrow {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #8f8f98;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin: 0;
  padding: 0;
}

.create-panel h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.create-panel .lede {
  color: #9a9aa3;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 32rem;
}

.create-form {
  background: #18181b;
  border: 1px solid #2a2a30;
  border-radius: 0.85rem;
  box-shadow: none;
  padding: 0.75rem;
}

.avatar-upload {
  align-items: center;
  background: #202024;
  border: 1px solid #313136;
  border-radius: 0.8rem;
  cursor: pointer;
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.avatar-upload:hover,
.avatar-upload:focus-within {
  background: #242428;
  border-color: #f04f96;
  transform: translateY(-1px);
}

.avatar-upload input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.avatar-preview {
  align-items: center;
  background: #2b2b31;
  border: 1px solid #3a3a42;
  border-radius: 0.7rem;
  color: #ffc1da;
  display: grid;
  flex: 0 0 auto;
  font-size: 1.35rem;
  font-weight: 900;
  height: 4rem;
  overflow: hidden;
  place-items: center;
  width: 4rem;
}

.avatar-preview img,
.character-avatar img,
.chat-avatar img,
.profile-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.avatar-upload-copy {
  display: grid;
  gap: 0.15rem;
}

.avatar-upload-copy small {
  color: #8f8f98;
  font-size: 0.78rem;
  font-weight: 600;
}

.create-panel .field {
  background: #202024;
  border-color: #313136;
  box-shadow: none;
  padding: 0.75rem;
}

.create-panel .field:focus-within {
  background: #222226;
  border-color: #f04f96;
}

.create-panel .field-label {
  color: #f4f4f5;
}

.create-panel .field small {
  color: #85858f;
}

.create-panel input,
.create-panel textarea {
  background: #17171a;
  border-color: #2f2f36;
  padding: 0.85rem;
}

.create-panel textarea {
  resize: vertical;
}

.create-panel .visibility-field {
  grid-template-columns: 1fr 1fr;
}

.create-panel .visibility-field legend,
.create-panel .visibility-field small {
  grid-column: 1 / -1;
}

.create-panel .radio-option {
  background: #17171a;
  border: 1px solid #303038;
  border-radius: 0.7rem;
  padding: 0.75rem;
}

.create-panel .form-actions {
  gap: 0.65rem;
}

.create-panel .form-actions button {
  border-radius: 0.8rem;
}

.create-panel .route-preview {
  background: transparent;
  border-color: #2a2a30;
  grid-column: auto;
  margin-top: 0;
}

.chat-shell {
  background: #171719;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 17rem;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 0;
  place-items: stretch;
}

.chat-card {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #202024;
  box-shadow: none;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(15rem, 0.9fr) minmax(20rem, 1.1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  margin-inline: auto;
  width: min(100%, 68rem);
  padding: clamp(1rem, 4vw, 2rem) 0;
}

.creator-copy {
  align-self: center;
  padding: clamp(0rem, 2vw, 1rem) 0 clamp(2rem, 10vw, 7rem);
  position: relative;
}

.creator-copy::before {
  background: #f04f96;
  border-radius: 0.25rem;
  content: "";
  display: block;
  height: 0.35rem;
  margin-bottom: 1.4rem;
  width: 4rem;
}

.eyebrow {
  color: #ff7fb3;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  margin: 0 0 0.8rem;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.15rem, 6vw, 4.8rem);
  line-height: 1;
  margin: 0;
}

.lede,
.description {
  color: #b9b9c0;
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 44rem;
}

.form-card {
  display: grid;
  gap: 1rem;
  margin-top: 0;
  position: relative;
}

.form-card::before {
  background: #2b2b31;
  border-radius: 1rem;
  content: "";
  inset: 1.25rem -1rem -1rem 1.25rem;
  position: absolute;
  z-index: -1;
}

.form-actions,
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.form-actions {
  align-items: stretch;
  display: grid;
  grid-template-columns: 1fr auto;
}

.chat-actions {
  align-items: center;
  justify-content: space-between;
}

.secondary-button {
  border: 1px solid #3b3b42;
  background: #2b2b31;
  color: #ffc1da;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0.45rem 1rem rgba(0, 0, 0, 0.18);
}

.secondary-button:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0.65rem 1.3rem rgba(0, 0, 0, 0.22);
}

.compact-button {
  padding: 0.65rem 1rem;
}

label {
  display: grid;
  gap: 0.5rem;
}

fieldset {
  margin: 0;
}

.field {
  border: 1px solid #313136;
  border-radius: 0.95rem;
  background: #242428;
  padding: 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0.8rem 1.6rem rgba(0, 0, 0, 0.14);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.field:focus-within {
  border-color: #f04f96;
  background: #27272c;
  transform: translateY(-1px);
}

.field-label {
  color: #ffe5ef;
  display: flex;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.field small {
  color: #8f8f98;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: -0.35rem;
}

.visibility-field {
  display: grid;
  gap: 0.7rem;
}

.visibility-field legend {
  margin-bottom: 0.5rem;
}

.radio-option {
  align-items: center;
  color: #fff5f9;
  display: flex;
  font-weight: 800;
  gap: 0.55rem;
}

.radio-option input {
  accent-color: #f04f96;
  box-shadow: none;
  width: auto;
}

input,
textarea {
  width: 100%;
  border: 1px solid #38383f;
  border-radius: 0.7rem;
  background: #17171a;
  color: #fff5f9;
  outline: none;
  padding: 1rem;
  box-shadow: inset 0 0.15rem 0.6rem rgba(0, 0, 0, 0.28);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
textarea:focus {
  border-color: #f04f96;
  background: #151518;
  box-shadow: inset 0 0.15rem 0.6rem rgba(0, 0, 0, 0.2), 0 0 0 0.18rem rgba(240, 79, 150, 0.2);
}

.route-preview {
  display: grid;
  grid-column: 2;
  gap: 0.4rem;
  margin-top: -0.25rem;
  border-radius: 0.8rem;
  background: #18181b;
  border: 1px solid #313136;
  padding: 1rem;
}

.route-preview span {
  color: #a7a7af;
  font-size: 0.85rem;
  font-weight: 800;
}

.route-preview p {
  color: #b9b9c0;
  line-height: 1.5;
}

.chat-card {
  display: grid;
  grid-template-rows: auto minmax(18rem, 1fr) auto auto;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.chat-sidebar,
.character-panel {
  background: #121214;
  border-color: #27272b;
  border-style: solid;
  color: #f4f4f5;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 1rem;
}

.chat-sidebar {
  border-width: 0 1px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sidebar-brand {
  color: #fff5f9;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  text-decoration: none;
}

.sidebar-action {
  background: #1d1d20;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  color: #d6d6dc;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 0.72rem 0.8rem;
  text-decoration: none;
}

.sidebar-action:hover {
  background: #25252a;
  border-color: #33333a;
}

.chat-header {
  background: rgba(32, 32, 36, 0.92);
  border-bottom: 1px solid #313136;
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem clamp(1rem, 3vw, 1.35rem);
}

.chat-header h1 {
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  letter-spacing: -0.04em;
  margin-bottom: 0.12rem;
}

.chat-title-row {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  min-width: 0;
}

.chat-avatar,
.profile-avatar {
  align-items: center;
  background: linear-gradient(135deg, #f04f96, #7757ff);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #fff;
  display: grid;
  flex: 0 0 auto;
  font-weight: 900;
  overflow: hidden;
  place-items: center;
}

.chat-avatar {
  font-size: 1rem;
  height: 2.6rem;
  width: 2.6rem;
}

.chat-header .eyebrow {
  color: #8f8f98;
  font-size: 0.68rem;
  margin-bottom: 0.25rem;
}

.chat-header .description {
  color: #9f9fa8;
  display: -webkit-box;
  font-size: 0.86rem;
  line-height: 1.35;
  max-width: 42rem;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.back-link {
  color: #c9c9d0;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.messages {
  background: #202024;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.5rem) max(clamp(1rem, 8vw, 8rem), 1rem);
  scroll-behavior: smooth;
}

.message {
  border-radius: 0.95rem;
  font-size: 0.96rem;
  line-height: 1.55;
  max-width: min(72%, 42rem);
  padding: 0.78rem 0.95rem;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #303035;
  color: #fff;
}

.message.assistant {
  align-self: flex-start;
  background: #2b2b31;
  border: 1px solid #36363d;
  color: #fff5f9;
}

.message em {
  color: #c9c9d0;
  font-style: italic;
}

.message strong {
  color: #fff;
  font-weight: 900;
}

.message code {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.35rem;
  color: #ffc1da;
  font-size: 0.9em;
  padding: 0.1rem 0.28rem;
}

.message pre {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.7rem;
  margin: 0.45rem 0 0;
  overflow-x: auto;
  padding: 0.75rem;
}

.message pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.chat-form {
  background: #202024;
  border-top: 1px solid #313136;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  padding: 0.9rem max(clamp(1rem, 8vw, 8rem), 1rem) 1rem;
}

.chat-form input {
  background: #17171a;
  border-color: #34343a;
  border-radius: 999px;
  min-height: 3rem;
  padding-inline: 1.1rem;
}

.chat-form button {
  border-radius: 999px;
  min-width: 4.7rem;
  padding: 0 1rem;
}

.slow-mode {
  border-radius: 0;
  background: #2b2b31;
  color: #ffc1da;
  padding: 0.8rem 1rem;
}

.character-panel {
  border-width: 0 0 0 1px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-avatar {
  font-size: 1.35rem;
  height: 4rem;
  width: 4rem;
}

.character-panel h2 {
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  margin: 0;
}

.character-panel p {
  color: #9f9fa8;
  font-size: 0.9rem;
  line-height: 1.5;
}

.profile-links {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.copy-toast {
  background: #f4f4f5;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.35);
  color: #121214;
  font-size: 0.92rem;
  font-weight: 900;
  left: 50%;
  opacity: 0;
  padding: 0.7rem 1.05rem;
  pointer-events: none;
  position: fixed;
  top: 1rem;
  transform: translate(-50%, -0.45rem);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

.copy-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  background: rgba(8, 4, 7, 0.74);
  backdrop-filter: blur(12px);
  padding: clamp(1rem, 4vw, 2rem);
  place-items: center;
  z-index: 30;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 28rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.35rem;
  background: #202024;
  box-shadow: 0 2.5rem 7rem rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(240, 79, 150, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  padding: clamp(1.25rem, 5vw, 1.7rem);
  position: relative;
}

.modal-card::before {
  content: "🐢";
  display: block;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 2.35rem;
  line-height: 1;
  font-weight: 900;
  margin-bottom: 1rem;
}

.modal-card h2 {
  font-size: clamp(1.6rem, 5vw, 2rem);
  letter-spacing: -0.05em;
  margin: 0 0 0.55rem;
}

.modal-card p {
  color: #c9c9d0;
  font-size: 0.98rem;
  line-height: 1.6;
}

.modal-card button {
  border-radius: 999px;
  margin-top: 1.25rem;
  width: 100%;
}

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

  .chat-sidebar,
  .character-panel {
    display: none;
  }

  .messages,
  .chat-form {
    padding-inline: clamp(1rem, 4vw, 1.25rem);
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .creator-copy {
    padding-bottom: 0;
  }

  .route-preview {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  body:not(:has(.topbar)) .site-logo {
    position: absolute;
  }

  .shell {
    padding-top: 4.5rem;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .header-search {
    width: 100%;
  }

  .home-shell {
    padding-top: 10.75rem;
  }

  .home-shell:has(aside) {
    grid-template-columns: 1fr !important;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .create-panel .visibility-field {
    grid-template-columns: 1fr;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr auto;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .message {
    max-width: 92%;
  }
}

.age-gate-card::before {
  content: "🔞";
  display: block;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 2.35rem;
  line-height: 1;
  font-weight: 900;
  margin-bottom: 1rem;
}

.age-gate-card h2 {
  margin-bottom: 0.25rem;
}

.age-gate-card input[type="number"] {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.85rem;
}

.age-gate-card .age-error {
  color: #f04f96;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.flag-badge {
  align-items: center;
  background: rgba(240, 79, 150, 0.12);
  border: 1px solid rgba(240, 79, 150, 0.3);
  border-radius: 0.5rem;
  cursor: help;
  display: flex;
  font-size: 0.85rem;
  height: 1.8rem;
  justify-content: center;
  width: 1.8rem;
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-nav a {
  color: #ffc1da;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: #fff5f9;
}
