:root {
  color-scheme: dark;
  --paper: #fff3dc;
  --ink: #130d12;
  --black: #0c0810;
  --panel: #1a1118;
  --panel-2: #24131f;
  --cream: #ffe8b8;
  --muted: #c7a9a2;
  --line: #130d12;
  --red: #e23751;
  --red-dark: #9d1730;
  --pink: #ff7aa7;
  --gold: #ffc247;
  --teal: #18d6ca;
  --shadow: 9px 9px 0 #000;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 226, 151, 0.16) 2px, transparent 3px) 0 0 / 24px 24px,
    linear-gradient(135deg, #220817 0%, #0a0710 48%, #35100f 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: "Trebuchet MS", "Arial Black", system-ui, sans-serif;
}

body.identity-locked {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 6px 6px;
  mix-blend-mode: overlay;
}

h1, h2, h3, p {
  margin: 0;
}

button,
textarea,
input {
  font: inherit;
}

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy,
.spotlight,
.panel,
.catalog {
  border: 4px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-copy::after,
.spotlight::after,
.catalog::after,
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 1px, transparent 1.5px) 0 0 / 9px 9px;
  opacity: 0.18;
}

.hero-copy {
  min-height: 340px;
  padding: 28px;
  display: grid;
  align-content: center;
  gap: 16px;
  background:
    linear-gradient(115deg, rgba(19, 13, 18, 0.72), rgba(19, 13, 18, 0.18)),
    linear-gradient(135deg, #e23751 0%, #8c1630 42%, #151018 100%);
}

.hero-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.language-control {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
  color: var(--cream);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-control select {
  min-width: 120px;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 8px 28px 8px 9px;
  background: var(--cream);
  color: var(--black);
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-transform: none;
}

.paper-link {
  position: relative;
  z-index: 2;
  width: fit-content;
  color: var(--black);
  background: var(--teal);
  border: 3px solid #000;
  border-radius: 999px;
  padding: 9px 14px;
  box-shadow: 4px 4px 0 #000;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.paper-link.compact { align-self: center; }
.hero-actions, .paper-nav-actions { position: relative; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.buy-link {
  min-height: 46px;
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--gold) 0%, #fff06a 46%, var(--pink) 100%);
  border-width: 4px;
  box-shadow: 6px 6px 0 #000;
  font-size: 14px;
  transform: rotate(-1deg);
}
.buy-link::after { content: " ↗"; }
.buy-link:hover {
  transform: translate(-2px, -2px) rotate(-1deg);
  box-shadow: 9px 9px 0 #000;
}
.buy-link.compact {
  padding: 10px 16px;
}

.paper-page { max-width: 1280px; }
.paper-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.paper-cover {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
  padding: clamp(28px, 6vw, 72px); border: 4px solid #000; border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(125deg, rgba(12, 8, 16, .18), rgba(12, 8, 16, .9)), radial-gradient(circle at 80% 20%, #ff7aa7, transparent 28%), #b91f3d;
}
.paper-cover h1 { max-width: 900px; margin-top: 22px; font: 900 clamp(52px, 9vw, 112px)/.84 Impact, "Arial Black", sans-serif; text-transform: uppercase; text-shadow: 6px 6px 0 #000; }
.paper-lead { max-width: 800px; margin-top: 28px; font-size: clamp(17px, 2vw, 23px); line-height: 1.5; font-weight: 800; }
.token-seal { width: 190px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; color: #000; background: var(--gold); border: 5px solid #000; border-radius: 50%; box-shadow: 8px 8px 0 #000; transform: rotate(4deg); }
.token-seal span, .token-seal small { font-weight: 900; text-transform: uppercase; }
.token-seal strong { font: 70px/.9 Impact, sans-serif; }
.paper-status, .stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.paper-status > div, .stats-strip > div { min-width: 0; padding: 20px; border: 3px solid #000; border-radius: var(--radius); background: var(--cream); color: #000; box-shadow: 5px 5px 0 #000; }
.paper-status span, .stats-strip span { display: block; color: #6e2634; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.paper-status strong { display: block; margin-top: 6px; overflow-wrap: anywhere; }
.stats-strip { grid-template-columns: repeat(4, 1fr); }
.stats-strip > div:nth-child(even) { background: var(--pink); }
.stats-strip strong { display: block; font: 54px/1 Impact, sans-serif; margin-bottom: 10px; }
.paper-layout { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: start; }
.paper-toc { position: sticky; top: 20px; display: grid; border: 4px solid #000; box-shadow: 6px 6px 0 #000; }
.paper-toc a { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 13px; color: #000; background: var(--gold); border-bottom: 2px solid #000; font-weight: 900; text-decoration: none; }
.paper-toc a:last-child { border-bottom: 0; }
.paper-content { display: grid; gap: 20px; }
.paper-content section, .source-panel, .paper-warning { position: relative; overflow: hidden; padding: clamp(24px, 4vw, 48px); color: #000; background: var(--paper); border: 4px solid #000; border-radius: var(--radius); box-shadow: var(--shadow); }
.paper-content section:nth-child(even) { background: #ffc8d9; }
.section-number { color: var(--red); font: 52px/1 Impact, sans-serif; }
.paper-content h2, .source-panel h2 { margin: 8px 0 20px; font: 44px/.95 Impact, sans-serif; text-transform: uppercase; }
.paper-content section > p:not(.section-number) { margin-top: 15px; max-width: 850px; font: 700 17px/1.65 Georgia, serif; }
.source-panel { margin-top: 22px; background: var(--teal); }
.source-panel > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.source-panel a { color: #000; padding: 12px; border: 2px solid #000; background: #fff; font-weight: 900; }
.paper-warning { margin: 22px 0; background: var(--gold); font-weight: 900; line-height: 1.55; }

.eyebrow,
.spotlight-kicker,
.step-label {
  width: fit-content;
  padding: 6px 10px;
  border: 3px solid var(--line);
  background: var(--gold);
  color: var(--black);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-1deg);
}

.hero h1 {
  max-width: 760px;
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 66px;
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 5px 5px 0 #000;
}

.hero-text {
  max-width: 680px;
  color: #ffe9ef;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 800;
}

.notice {
  max-width: 760px;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fff0c8;
  color: var(--black);
  line-height: 1.45;
  box-shadow: 5px 5px 0 #000;
}

.spotlight {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background:
    linear-gradient(160deg, rgba(255, 194, 71, 0.24), transparent 42%),
    var(--panel);
}

.spotlight-media {
  min-height: 100%;
  border: 4px solid #000;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 6px 6px 0 #000;
}

.spotlight-media img,
.profile-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.32) contrast(1.18);
}

.spotlight-media img {
  min-height: 300px;
}

.spotlight-body {
  display: grid;
  align-content: center;
  gap: 12px;
  z-index: 1;
}

.spotlight-body h2 {
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 46px;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #000;
}

.spotlight-vibe {
  color: var(--gold);
  font-weight: 900;
}

.spotlight-desc {
  max-width: 420px;
  color: #ffe2e9;
  line-height: 1.5;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel,
.catalog {
  background: var(--panel);
  padding: 18px;
}

.profile-panel {
  position: sticky;
  top: 18px;
}

.experience-panel {
  display: grid;
  gap: 15px;
  background:
    linear-gradient(155deg, rgba(255, 194, 71, 0.18), transparent 45%),
    var(--panel);
}

.experience-panel h2 {
  position: relative;
  z-index: 1;
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 34px;
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000;
}

.experience-panel > p:not(.spotlight-kicker) {
  position: relative;
  z-index: 1;
  color: #ffe2e9;
  line-height: 1.5;
  font-weight: 700;
}

.experience-step {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 11px;
  align-items: center;
  padding: 11px;
  border: 3px solid #000;
  border-radius: 8px;
  background: #fff0c8;
  color: var(--black);
  box-shadow: 4px 4px 0 #000;
  font-weight: 800;
}

.experience-step strong {
  color: var(--red);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 27px;
}

.experience-note {
  padding-top: 13px;
  border-top: 2px dashed rgba(255, 255, 255, 0.3);
  color: var(--muted) !important;
  font-size: 12px;
}

.panel-head,
.section-head {
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.panel-head h2,
.section-head h2 {
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 31px;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000;
}

.panel-head p,
.section-head p,
.meta {
  color: var(--muted);
  line-height: 1.45;
}

.panel-head p,
.section-head p {
  margin-top: 7px;
}

.wizard,
.wizard-actions,
.wizard-progress,
.profile-summary,
.field,
.custom-companion,
.composer,
.messages,
.grid {
  position: relative;
  z-index: 1;
}

.custom-companion {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px;
  border: 3px solid #000;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 240, 200, 0.96), rgba(255, 95, 77, 0.88));
  color: var(--black);
  box-shadow: 6px 6px 0 #000;
}

.custom-preview {
  border: 3px solid #000;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
}

.custom-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.custom-fields {
  display: grid;
  gap: 10px;
}

.custom-fields h3 {
  color: var(--black);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
}

.custom-fields label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.custom-fields input,
.custom-fields textarea {
  width: 100%;
  border: 3px solid #000;
  border-radius: 8px;
  background: #fffaf0;
  color: var(--black);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  text-transform: none;
  box-shadow: 3px 3px 0 #000;
}

.custom-fields textarea {
  resize: vertical;
}

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

.step-dot {
  height: 9px;
  border: 2px solid #000;
  background: #473240;
}

.step-dot.active {
  background: var(--gold);
}

.wizard-step {
  display: none;
  min-height: 240px;
}

.wizard-step.active {
  display: grid;
  align-content: start;
  gap: 13px;
}

.wizard-step h3 {
  color: #fff;
  font-size: 20px;
  text-transform: uppercase;
}

.choice-grid {
  display: grid;
  gap: 9px;
}

.choice-grid button,
.ghost-btn,
.primary-btn {
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.choice-grid button {
  min-height: 42px;
  padding: 10px 12px;
  background: #fff0c8;
  color: var(--black);
  text-align: left;
}

.choice-grid button.active {
  background: var(--pink);
  color: #fff;
}

.choice-grid button:hover,
.primary-btn:hover,
.ghost-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #000;
}

.field {
  display: grid;
  gap: 8px;
}

.field.compact textarea {
  min-height: 150px;
}

textarea,
input {
  width: 100%;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff6df;
  color: var(--black);
  box-shadow: 4px 4px 0 #000;
}

textarea {
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: 3px solid var(--gold);
}

.wizard-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
}

.primary-btn,
.ghost-btn,
.enter-btn {
  min-height: 44px;
  padding: 10px 14px;
}

.primary-btn {
  background: var(--red);
  color: #fff;
}

.ghost-btn {
  background: var(--cream);
  color: var(--black);
}

.enter-btn {
  width: 100%;
  border: 3px solid #000;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font-weight: 900;
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#saveProfile {
  width: 100%;
  margin-bottom: 14px;
}

.profile-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.profile-summary div {
  border: 3px solid #000;
  border-radius: 8px;
  background: #2c1827;
  padding: 10px;
}

.profile-summary span {
  display: block;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.profile-summary strong {
  display: block;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
}

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

.profile-card {
  border: 4px solid #000;
  border-radius: 8px;
  overflow: hidden;
  background: #fff0c8;
  color: var(--black);
  box-shadow: 7px 7px 0 #000;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.profile-card:hover,
.profile-card.active {
  transform: translate(-2px, -2px) rotate(-0.5deg);
  box-shadow: 10px 10px 0 #000;
}

.profile-card.active {
  outline: 5px solid var(--red);
}

.photo-frame {
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border-bottom: 4px solid #000;
  overflow: hidden;
}

.profile-info {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.profile-info h3 {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 28px;
  line-height: 0.95;
  text-transform: uppercase;
}

.profile-info p {
  line-height: 1.42;
  font-weight: 700;
}

.tag-row,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 2px solid #000;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--teal);
  color: #001716;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 760px;
}

.chat-page {
  max-width: 1420px;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.chat-language-control {
  align-self: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 14px;
  border: 3px solid #000;
  border-radius: 8px;
  background: var(--cream);
  color: var(--black);
  box-shadow: 4px 4px 0 #000;
  font-weight: 900;
  text-decoration: none;
}

.chat-notice {
  flex: 1 1 420px;
  max-width: none;
}

.character-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: 0;
}

.character-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: visible;
}

.character-photo-frame {
  position: sticky;
  top: 12px;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  border: 4px solid #000;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 6px 6px 0 #000;
  cursor: zoom-in;
}

.character-photo-frame:hover,
.character-photo-frame:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 8px 8px 0 #000;
}

.character-photo-frame:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.character-photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 4.45;
  max-height: min(430px, 46vh);
  object-fit: cover;
  filter: saturate(1.32) contrast(1.18);
}

.character-profile {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
}

.character-profile h1 {
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 46px;
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow: 5px 5px 0 #000;
}

.data-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.data-grid div {
  border: 3px solid #000;
  border-radius: 8px;
  background: #fff0c8;
  color: var(--black);
  padding: 8px 10px;
  box-shadow: 4px 4px 0 #000;
}

.data-grid span {
  display: block;
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.data-grid strong {
  display: block;
  line-height: 1.25;
}

.model-photo-btn,
.photo-rule {
  position: relative;
  z-index: 1;
}

.model-photo-btn {
  width: 100%;
}

.photo-rule {
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.gift-shop {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 3px dashed rgba(255, 232, 184, 0.35);
}

.gift-shop-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.gift-shop-head > div {
  display: grid;
  gap: 8px;
}

.gift-shop h2 {
  color: #fff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000;
}

.wallet-btn {
  min-height: 38px;
  padding: 8px 10px;
  border: 3px solid #000;
  border-radius: 8px;
  background: var(--teal);
  color: #001716;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.wallet-btn.connected {
  background: var(--gold);
}

.gift-token-info,
.gift-disclaimer,
.gift-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.gift-buy-link {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 4px solid #000;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold) 0%, #fff06a 50%, var(--pink) 100%);
  color: var(--black);
  box-shadow: 7px 7px 0 #000;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.gift-buy-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 #000;
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.gift-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 2px 9px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border: 3px solid #000;
  border-radius: 8px;
  background: #fff0c8;
  color: var(--black);
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.gift-card:hover:not(:disabled) {
  transform: translate(-1px, -1px) rotate(-0.6deg);
  box-shadow: 6px 6px 0 #000;
}

.gift-card:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.5;
}

.gift-card strong,
.gift-card > span:last-child {
  grid-column: 2;
}

.gift-card strong {
  align-self: end;
  font-size: 12px;
}

.gift-card > span:last-child {
  align-self: start;
  color: var(--red-dark);
  font-size: 10px;
  font-weight: 900;
}

.gift-art {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  border: 3px solid #000;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 2px 2px 0 #000;
}

.gift-card.rose .gift-art {
  background: radial-gradient(circle at 35% 35%, #fff 0 8%, #ff7aa7 10% 31%, #e23751 33% 58%, #7d1028 60%);
}

.gift-card.coffee .gift-art {
  border-radius: 7px 7px 14px 14px;
  background: linear-gradient(#fff0c8 0 22%, #6c392b 24% 48%, #ffc247 50%);
}

.gift-card.vinyl .gift-art {
  background: radial-gradient(circle, var(--gold) 0 9%, #e23751 11% 20%, #0c0810 22% 48%, #473240 50% 54%, #0c0810 56%);
}

.gift-card.starlight .gift-art {
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 30%, #fff 0 3%, transparent 5%),
    radial-gradient(circle at 70% 65%, #ffc247 0 4%, transparent 6%),
    linear-gradient(135deg, #15285c, #8c1630);
}

.gift-status:not(:empty) {
  padding: 8px 10px;
  border: 2px solid #000;
  border-radius: 6px;
  background: #fff0c8;
  color: var(--black);
  font-weight: 800;
}

.gift-status[data-tone="success"] {
  background: var(--teal);
}

.gift-status[data-tone="error"] {
  background: #ff9fc0;
}

.gift-event {
  display: grid;
  gap: 2px;
  text-align: center;
}

.gift-event a {
  margin-top: 4px;
  color: var(--red-dark);
  font-size: 11px;
}

.gift-photo {
  display: grid;
  gap: 8px;
  padding: 6px;
  max-width: min(340px, 82%);
}

.gift-photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gift-photo-open:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

.gift-photo img {
  display: block;
  width: 100%;
  max-height: 460px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 3px solid #000;
  border-radius: 6px;
}

.nft-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nft-claim-btn {
  min-height: 34px;
  padding: 7px 10px;
  border: 2px solid #000;
  border-radius: 6px;
  background: var(--gold);
  color: var(--black);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
}

.nft-claim-btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 #000;
}

.nft-claim-btn:disabled {
  cursor: default;
  opacity: 0.72;
}

.nft-actions a {
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 900;
}

.nft-page {
  min-height: 100vh;
}

.nft-layout {
  display: grid;
  gap: 18px;
}

.nft-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 4px solid #000;
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 6px 6px 0 #000;
}

.nft-head h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.95;
}

.nft-head p:last-child {
  max-width: 680px;
  margin: 8px 0 0;
  font-weight: 800;
}

.nft-status:not(:empty) {
  justify-self: start;
}

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

.nft-card,
.nft-empty {
  border: 4px solid #000;
  border-radius: 8px;
  background: #fff;
  box-shadow: 5px 5px 0 #000;
}

.nft-card {
  overflow: hidden;
}

.nft-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-bottom: 4px solid #000;
}

.nft-card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.nft-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
}

.nft-card p {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  color: rgba(18, 15, 16, 0.72);
}

.nft-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nft-card-actions a {
  padding: 7px 9px;
  border: 2px solid #000;
  border-radius: 6px;
  background: var(--yellow);
  color: var(--black);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.nft-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  min-height: 180px;
  place-content: center;
  padding: 24px;
  text-align: center;
}

.nft-empty strong {
  font-size: 22px;
}

.nft-empty span {
  font-weight: 800;
}

.viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  grid-template-rows: auto 1fr;
  background: rgba(8, 3, 8, 0.92);
  padding: 16px;
}

.image-viewer.active {
  display: grid;
}

.image-viewer-toolbar {
  display: flex;
  justify-content: end;
  gap: 8px;
  padding-bottom: 12px;
}

.image-viewer-toolbar button {
  min-width: 44px;
  height: 44px;
  border: 3px solid #000;
  border-radius: 6px;
  background: var(--cream);
  color: var(--black);
  box-shadow: 3px 3px 0 #000;
  font-weight: 900;
}

.image-viewer-toolbar button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.image-viewer-canvas {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  cursor: zoom-out;
}

.image-viewer-canvas img {
  display: block;
  max-width: 96vw;
  max-height: 82vh;
  object-fit: contain;
  border: 4px solid #000;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #000;
  transform-origin: center center;
}

.burn-animation {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(8, 3, 8, 0);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.burn-animation.active {
  background: rgba(8, 3, 8, 0.72);
  opacity: 1;
}

.burn-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: min(360px, calc(100vw - 40px));
  padding: 28px;
  border: 4px solid #000;
  border-radius: 10px;
  background: linear-gradient(145deg, #ffcf58, #e23751 58%, #5d1026);
  color: #fff;
  box-shadow: 10px 10px 0 #000;
  text-align: center;
  transform: scale(0.7) rotate(-4deg);
}

.burn-animation.active .burn-card {
  animation: burnCardIn 2.8s both cubic-bezier(0.22, 1, 0.36, 1);
}

.burn-coin {
  position: relative;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 5px solid #000;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 48px;
  box-shadow: 6px 6px 0 #000;
}

.burn-animation.active .burn-coin {
  animation: coinBurn 2.4s 0.2s both ease-in;
}

.burn-card strong {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 34px;
  letter-spacing: 0.03em;
  text-shadow: 3px 3px 0 #000;
}

.burn-card span {
  font-size: 13px;
  font-weight: 900;
}

.burn-particles,
.burn-particles::before,
.burn-particles::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
  opacity: 0;
}

.burn-animation.active .burn-particles,
.burn-animation.active .burn-particles::before,
.burn-animation.active .burn-particles::after {
  animation: burnParticles 1.7s 0.7s both ease-out;
}

.burn-particles::before {
  transform: rotate(120deg);
}

.burn-particles::after {
  transform: rotate(240deg);
}

@keyframes burnCardIn {
  0% { transform: scale(0.7) rotate(-4deg); }
  18%, 78% { transform: scale(1) rotate(0); }
  100% { transform: scale(0.88) rotate(2deg); }
}

@keyframes coinBurn {
  0%, 24% { filter: brightness(1); transform: rotateY(0) scale(1); opacity: 1; }
  55% { filter: brightness(1.7) saturate(1.7); transform: rotateY(540deg) scale(1.12); opacity: 1; }
  100% { filter: brightness(2.4); transform: rotateY(900deg) scale(0.05); opacity: 0; }
}

@keyframes burnParticles {
  0% { box-shadow: 0 0 var(--gold), 0 0 var(--pink), 0 0 #fff; opacity: 1; transform: translate(0, 0) scale(1); }
  100% { box-shadow: 90px -100px var(--gold), -110px -60px var(--pink), 45px 110px #fff; opacity: 0; transform: translate(0, -30px) scale(0.2); }
}

@media (prefers-reduced-motion: reduce) {
  .burn-animation.active .burn-card,
  .burn-animation.active .burn-coin,
  .burn-animation.active .burn-particles,
  .burn-animation.active .burn-particles::before,
  .burn-animation.active .burn-particles::after {
    animation-duration: 0.01ms;
  }
}

.private-chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: calc(100vh - 205px);
  min-height: 500px;
}

.private-messages {
  min-height: 0;
}

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

.chat-head-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  flex-wrap: wrap;
  gap: 10px;
}

.clear-chat-btn {
  border: 3px solid #000;
  border-radius: 999px;
  background: #fff0c8;
  color: var(--black);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
}

.clear-chat-btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #000;
}

.clear-chat-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-chip {
  border: 3px solid #000;
  border-radius: 999px;
  background: var(--gold);
  color: var(--black);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 4px 4px 0 #000;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 12px;
  border: 3px solid #000;
  border-radius: 8px;
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.2) 1px, transparent 1.7px) 0 0 / 10px 10px,
    #fff0c8;
}

.bubble {
  max-width: 86%;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--black);
  line-height: 1.45;
  font-weight: 800;
  box-shadow: 4px 4px 0 #000;
}

.bubble.user {
  align-self: end;
  background: #fff8e7;
}

.bubble.assistant {
  align-self: start;
  background: #ff9fc0;
}

.bubble.system {
  align-self: center;
  max-width: 100%;
  background: var(--gold);
  font-size: 13px;
}

.status-bubble,
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: fit-content;
}

.status-bubble {
  align-self: end;
}

.typing-bubble {
  align-self: start;
}

.typing-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  animation: typingPulse 0.9s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.photo-message {
  display: grid;
  gap: 8px;
  max-width: min(360px, 88%);
  padding: 8px;
}

.photo-message img {
  display: block;
  width: 100%;
  border: 3px solid #000;
  border-radius: 6px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.photo-message span {
  padding: 0 4px 4px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding-top: 14px;
}

.identity-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(12, 8, 16, 0.78);
}

.identity-modal.active {
  display: grid;
}

.identity-dialog {
  width: min(460px, 100%);
  border: 4px solid #000;
  border-radius: 8px;
  padding: 22px;
  background: var(--paper);
  color: var(--black);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.identity-dialog h2 {
  font-size: 28px;
  line-height: 1.05;
}

.identity-copy {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.identity-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.identity-fieldset legend,
.identity-name-field span {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.identity-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px;
  background: #fff8e7;
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
}

.identity-fieldset input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.identity-name-field {
  display: grid;
  gap: 6px;
}

.identity-name-field input {
  width: 100%;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 12px;
  background: #fff8e7;
  color: var(--black);
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
}

.identity-error {
  min-height: 18px;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 1250px) {
  .hero,
  .workspace,
  .chat-topbar {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    position: static;
  }

  .chat-panel {
    min-height: 650px;
  }

  .private-chat-panel {
    height: calc(100vh - 250px);
    min-height: 480px;
  }
}

@media (max-width: 980px) {
  .character-layout {
    grid-template-columns: 1fr;
  }

  .character-photo-frame {
    position: relative;
    top: auto;
  }

  .character-photo-frame img {
    max-height: 420px;
  }

  .data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page {
    padding: 14px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .hero-tools,
  .gift-shop-head {
    align-items: start;
    flex-direction: column;
  }

  .language-control select {
    width: 100%;
  }

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

  .custom-companion {
    grid-template-columns: 1fr;
  }

  .custom-preview {
    max-width: 190px;
  }

  .chat-head {
    flex-direction: column;
  }

  .chat-head-actions {
    justify-content: start;
  }

  .grid,
  .composer {
    grid-template-columns: 1fr;
  }

  .private-chat-panel {
    height: auto;
    min-height: 0;
  }

  .private-messages {
    min-height: 420px;
    max-height: 58vh;
  }

  .character-photo-frame img {
    max-height: 340px;
  }

  .character-profile h1 {
    font-size: 40px;
  }

  .data-grid,
  .gift-grid {
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 100%;
  }

  .paper-cover, .paper-layout { grid-template-columns: 1fr; }
  .token-seal { width: 145px; }
  .paper-status, .stats-strip, .source-panel > div { grid-template-columns: 1fr; }
  .paper-toc { position: static; }
  .paper-cover h1 { font-size: 52px; }
}
