:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-strong: #f7f4ff;
  --text: #17142a;
  --muted: #7a7789;
  --line: #ece8f7;
  --primary: #8f63ff;
  --primary-dark: #6546d6;
  --cyan: #29c9dd;
  --coral: #ff7b37;
  --pink: #ff74ba;
  --green: #48ce67;
  --yellow: #ffd35b;
  --shadow: 0 18px 50px rgba(80, 57, 133, 0.14);
  --card-shadow: 0 26px 60px rgba(113, 74, 208, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% -10%, rgba(141, 99, 255, 0.15), transparent 18rem),
    radial-gradient(circle at 96% 8%, rgba(255, 116, 186, 0.16), transparent 15rem),
    linear-gradient(180deg, #fbfbff 0%, #ffffff 42%, #fbfdff 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 16px 104px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(145deg, #9e7bff, #ff79bd);
  box-shadow: 0 12px 28px rgba(142, 99, 255, 0.24);
}

.brand-mark span {
  width: 18px;
  height: 18px;
  background: #fff;
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
}

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

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.usage-note {
  display: block;
  margin-top: 5px;
  color: #9a96aa;
  font-size: 11px;
  line-height: 1.35;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
  animation: view-in 0.32s ease both;
}

.hero-visual {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 211, 91, 0.55), transparent 5.2rem),
    radial-gradient(circle at 18% 18%, rgba(255, 116, 186, 0.38), transparent 6rem),
    radial-gradient(circle at 84% 14%, rgba(41, 201, 221, 0.35), transparent 6.5rem),
    linear-gradient(160deg, #21173f, #633bc0 48%, #19142d);
  box-shadow: var(--shadow);
}

.stage-lights {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(72deg, transparent 18%, rgba(255, 255, 255, 0.28) 48%, transparent 70%),
    linear-gradient(112deg, transparent 20%, rgba(255, 211, 91, 0.2) 52%, transparent 74%);
  opacity: 0.8;
}

.hero-card-fan {
  position: absolute;
  inset: 20px 34px 14px;
  display: grid;
  place-items: center;
}

.hero-mini-card {
  position: absolute;
  width: 86px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.16));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  transform: translateX(calc((var(--i) - 1) * 68px)) rotate(calc((var(--i) - 1) * 9deg));
}

.hero-mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-mini-card small {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  overflow: hidden;
  padding: 5px 6px;
  border-radius: 8px;
  background: rgba(20, 14, 42, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-panel {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border: 1px solid rgba(143, 99, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at 20% 0, rgba(41, 201, 221, 0.18), transparent 12rem);
  box-shadow: var(--shadow);
  text-align: center;
}

.upload-panel::after {
  position: absolute;
  right: -20px;
  bottom: -34px;
  width: 180px;
  height: 98px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(143, 99, 255, 0.12), rgba(255, 116, 186, 0.08)),
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255, 211, 91, 0.2) 15px 16px);
  border-radius: 999px 0 0 0;
  content: "";
  filter: blur(0.2px);
}

.spark-row {
  position: absolute;
  inset: 12px 18px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.spark-row span,
.section-heading h3::before,
.atlas-heading h2::before {
  width: 14px;
  height: 14px;
  background: var(--cyan);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
}

.spark-row span:nth-child(2) {
  width: 10px;
  height: 10px;
  margin-top: 18px;
  background: var(--pink);
}

.spark-row span:nth-child(3) {
  background: var(--yellow);
}

.action-icon svg,
.nav-item svg,
.douyin-button svg,
.modal-close svg,
.card-controls svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.upload-panel h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.22;
  letter-spacing: 0;
}

.upload-panel p {
  max-width: 290px;
  margin: 10px auto 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.upload-panel .upload-lead {
  max-width: 320px;
  margin-bottom: 14px;
  color: #5f5a70;
  font-weight: 650;
}

.upload-panel .upload-guide {
  position: relative;
  z-index: 1;
  max-width: 324px;
  margin: 12px auto 0;
  color: #918ca1;
  font-size: 12px;
  line-height: 1.55;
}

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

.camera-action,
.upload-action,
.small-button,
.ghost-button,
.text-button,
.douyin-button {
  border: 0;
  font-weight: 780;
}

.camera-action,
.upload-action {
  position: relative;
  z-index: 1;
  min-height: 86px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 9px;
  color: #fff;
  text-align: left;
  box-shadow: 0 14px 30px rgba(143, 99, 255, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.camera-action {
  background: linear-gradient(135deg, #ff8b2d, #ff6d3d);
}

.upload-action {
  background: linear-gradient(135deg, #10c6c4, #2cb4e8);
}

.camera-action:hover,
.upload-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(143, 99, 255, 0.22);
}

.camera-action strong,
.upload-action strong,
.camera-action small,
.upload-action small {
  display: block;
}

.camera-action small,
.upload-action small {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.88;
}

.camera-action input,
.upload-action input,
.upload-line input {
  display: none;
}

.action-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

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

.section-heading h2,
.section-heading h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.section-heading h3::before,
.atlas-heading h2::before {
  display: inline-block;
  content: "";
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.result-panel,
.recent-panel,
.preview-panel {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(143, 99, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(80, 57, 133, 0.1);
}

.preview-panel[hidden] {
  display: none;
}

.preview-panel > img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1fb;
}

.preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.preview-actions .primary-action {
  grid-column: 1 / -1;
}

.preview-actions input {
  display: none;
}

.result-panel.recognizing::after {
  position: absolute;
  inset: auto 18px 18px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  content: "";
  animation: loading-line 1s linear infinite;
}

.empty-result {
  display: grid;
  min-height: 220px;
  place-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px dashed rgba(143, 99, 255, 0.3);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbf9ff, #fff);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.mini-card-stack {
  position: relative;
  width: 116px;
  height: 156px;
}

.mini-card-stack span {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 1px solid rgba(143, 99, 255, 0.26);
  background: linear-gradient(145deg, #fff, #f2ecff);
  box-shadow: 0 16px 28px rgba(112, 76, 205, 0.14);
}

.mini-card-stack span:nth-child(1) {
  transform: rotate(-8deg) translateX(-16px);
}

.mini-card-stack span:nth-child(2) {
  transform: rotate(6deg) translateX(14px);
}

.mini-card-stack span:nth-child(3) {
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 116, 186, 0.35), transparent 22px),
    linear-gradient(145deg, #fff, #efe8ff);
}

.result-card-wrap {
  display: grid;
  place-items: center;
  padding: 4px 0 0;
}

.flip-card-shell {
  width: min(100%, 306px);
  perspective: 1100px;
  user-select: none;
}

.flip-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  transform: rotateY(var(--rotate-y));
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.15, 1);
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  backface-visibility: hidden;
  background: #fff;
  box-shadow: var(--card-shadow);
}

.flip-stage::after {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(115deg, transparent 8%, rgba(255, 255, 255, 0.26) 34%, transparent 58%);
  content: "";
  pointer-events: none;
  transform: translateZ(1px);
}

.card-face::before {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: inherit;
  background: linear-gradient(135deg, #a27aff, #ff77bd, #ffd05b, #23c6dd) border-box;
  content: "";
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.card-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-strong);
}

.card-sheen {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.28) 0 16%, transparent 36%),
    linear-gradient(180deg, rgba(23, 20, 42, 0.1), rgba(23, 20, 42, 0.68));
  mix-blend-mode: screen;
  pointer-events: none;
}

.card-front-content {
  position: absolute;
  top: 20%;
  right: 20px;
  left: 20px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: rgba(12, 10, 26, 0.28);
  color: #fff;
  text-align: center;
  backdrop-filter: blur(14px);
}

.card-avatar-square {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 16px 30px rgba(12, 10, 26, 0.24);
}

.card-front-content strong,
.card-front-content small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-front-content strong {
  font-size: 22px;
  line-height: 1.2;
}

.card-front-content small {
  font-size: 13px;
  opacity: 0.92;
}

.card-back {
  padding: 0;
  transform: rotateY(180deg);
}

.avatar-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border-radius: 999px;
  background: conic-gradient(from 90deg, #9d78ff, #ff78bd, #ffd35b, #29c9dd, #9d78ff);
  box-shadow: 0 14px 30px rgba(143, 99, 255, 0.22);
}

.avatar-ring img {
  width: 104px;
  height: 104px;
  border: 5px solid #fff;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface-strong);
}

.actor-meta h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.actor-meta h3 span {
  color: var(--yellow);
  font-size: 22px;
}

.actor-meta p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.douyin-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 230px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff70b9, #845fff);
  color: #fff;
  box-shadow: 0 14px 28px rgba(143, 99, 255, 0.24);
}

.card-douyin {
  position: absolute;
  right: 14px;
  bottom: 18px;
  left: 14px;
  width: auto;
  max-width: none;
}

.match-text {
  margin-top: 12px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(143, 99, 255, 0.24);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.recent-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.recent-row img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
}

.recent-row strong,
.recent-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-row strong {
  font-size: 15px;
}

.recent-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.recent-row em {
  color: var(--primary);
  font-style: normal;
  font-weight: 820;
}

.contact-panel {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(143, 99, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 244, 255, 0.96)),
    radial-gradient(circle at 100% 0, rgba(41, 201, 221, 0.18), transparent 8rem);
  box-shadow: 0 14px 32px rgba(80, 57, 133, 0.1);
}

.contact-panel img {
  width: 64px;
  height: 64px;
  border: 2px solid #fff;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-strong);
  box-shadow: 0 10px 22px rgba(80, 57, 133, 0.16);
}

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

.contact-copy h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.contact-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.douyin-contact-button {
  grid-column: 1 / -1;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #17142a, #8f63ff);
  color: #fff;
  font-size: 14px;
  font-weight: 820;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(80, 57, 133, 0.18);
}

.ghost-button,
.text-button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: #f5f0ff;
  color: var(--primary-dark);
  font-size: 12px;
}

.atlas-heading {
  margin-top: 2px;
}

.atlas-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(143, 99, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(80, 57, 133, 0.08);
}

.atlas-mode-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
}

.atlas-mode-switch button.active {
  background: linear-gradient(135deg, #ff8b2d, #8f63ff);
  color: #fff;
  box-shadow: 0 10px 22px rgba(143, 99, 255, 0.18);
}

.atlas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.atlas-loading {
  grid-column: 1 / -1;
  display: grid;
  min-height: 260px;
  place-items: center;
  gap: 8px;
  padding: 30px 16px;
  border: 1px solid rgba(143, 99, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbf9ff, #fff);
  color: var(--muted);
  text-align: center;
}

.atlas-loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(143, 99, 255, 0.16);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.82s linear infinite;
}

.atlas-loading strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.atlas-loading small {
  color: var(--muted);
  font-size: 12px;
}

.atlas-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px;
  border: 1px solid rgba(143, 99, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(143, 99, 255, 0.72), rgba(255, 116, 186, 0.6), rgba(41, 201, 221, 0.68)) border-box;
  box-shadow: 0 16px 38px rgba(80, 57, 133, 0.12);
  text-align: left;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.atlas-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 48px rgba(80, 57, 133, 0.18);
}

.atlas-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: var(--surface-strong);
}

.atlas-image::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(23, 20, 42, 0.52));
  content: "";
}

.atlas-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atlas-info {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 50px;
}

.atlas-card-mode .atlas-info {
  display: none;
}

.atlas-avatar-card {
  display: grid;
  width: 100%;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(143, 99, 255, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(80, 57, 133, 0.1);
  text-align: center;
}

.atlas-avatar-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-strong);
}

.atlas-avatar-card strong {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-avatar-card small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-empty {
  grid-column: 1 / -1;
  margin: 0;
}

.atlas-info img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.atlas-info strong,
.atlas-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-info strong {
  font-size: 15px;
}

.atlas-info small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

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

.modal.active {
  display: grid;
  animation: fade-in 0.2s ease both;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 13, 39, 0.48);
  backdrop-filter: blur(14px);
}

.modal-panel {
  position: relative;
  width: min(100%, 360px);
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 18px 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(18, 13, 39, 0.38);
}

.modal-panel h2 {
  margin: 0 44px 14px 0;
  font-size: 20px;
  line-height: 1.25;
}

.modal-hint,
.modal-disclaimer,
.page-disclaimer {
  margin: 0;
  color: #9a96aa;
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.modal-hint {
  margin: -8px 44px 12px 0;
  text-align: left;
}

.modal-disclaimer {
  margin-top: 12px;
}

.scan-failed {
  width: 94px;
  height: 130px;
  border: 1px dashed rgba(143, 99, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 45%, rgba(255, 116, 186, 0.2) 46%, transparent 48%),
    linear-gradient(145deg, #fff, #f4efff);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(143, 99, 255, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--primary-dark);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(143, 99, 255, 0.16);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 -18px 40px rgba(80, 57, 133, 0.08);
}

.nav-item {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #858195;
  font-size: 12px;
  font-weight: 780;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

.nav-item.active {
  background: linear-gradient(180deg, #f2ecff, #fff);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 94px;
  left: 18px;
  z-index: 30;
  display: none;
  max-width: 394px;
  margin: 0 auto;
  padding: 13px 14px;
  border-radius: 8px;
  background: #17142a;
  color: white;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.toast.active {
  display: block;
  animation: toast-in 0.2s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-line {
  from {
    transform: translateX(-70%);
  }
  to {
    transform: translateX(70%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.form-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
}

.form-panel h3 {
  margin: 0;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: 8px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 760;
}

.primary-action {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 28px rgba(143, 99, 255, 0.24);
}

.secondary-action {
  background: var(--surface-strong);
  color: var(--primary-dark);
  border: 1px solid rgba(143, 99, 255, 0.2);
}

.form-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-panel input,
.form-panel textarea,
.form-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  outline: none;
}

.form-panel input:focus,
.form-panel textarea:focus,
.form-panel select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 165, 148, 0.12);
}

.compact,
.small-button {
  width: 100%;
  border: 0;
}

.small-button {
  width: auto;
  min-height: 38px;
  padding: 0 12px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
}

.upload-line {
  min-height: 48px;
  place-items: center;
  border: 1px dashed #9edbd1;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--primary-dark) !important;
  font-weight: 760;
}

.admin-page {
  background: #f4f7f6;
}

.admin-login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 0, rgba(72, 206, 103, 0.16), transparent 16rem),
    radial-gradient(circle at 90% 10%, rgba(41, 201, 221, 0.16), transparent 14rem),
    #f4f7f6;
}

.admin-login-card {
  width: min(100%, 380px);
  padding: 24px;
  border: 1px solid rgba(19, 33, 30, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(19, 33, 30, 0.14);
}

.admin-login-card h1 {
  margin: 0;
  color: #13211e;
  font-size: 24px;
  line-height: 1.25;
}

.admin-login-card p {
  margin: 8px 0 18px;
  color: #68726f;
  font-size: 14px;
}

.admin-login-card form {
  display: grid;
  gap: 14px;
}

.admin-login-card label {
  display: grid;
  gap: 7px;
  color: #4d5855;
  font-size: 13px;
  font-weight: 760;
}

.admin-login-card input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  background: #fbfdfc;
  color: #13211e;
}

.admin-login-card a {
  display: inline-block;
  margin-top: 16px;
  color: #29675b;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  padding: 28px 24px;
  background: #13211e;
  color: #fff;
}

.admin-sidebar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.admin-sidebar p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.admin-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 760;
}

.admin-main {
  min-width: 0;
  padding: 28px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-toolbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.admin-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(520px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.desktop-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(31, 61, 55, 0.08);
}

.actor-table-panel {
  overflow: hidden;
}

.editor-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.editor-panel .panel-title {
  margin: -18px -18px 18px;
}

.panel-title h3 {
  margin: 0;
  font-size: 17px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.desktop-actor-list {
  display: grid;
}

.desktop-actor-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 13px 18px;
  text-align: left;
}

.desktop-actor-row:hover,
.desktop-actor-row.active {
  background: var(--surface-strong);
}

.desktop-actor-row img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8f5f1;
}

.desktop-actor-row strong,
.desktop-actor-row small {
  display: block;
}

.desktop-actor-row strong {
  font-size: 15px;
}

.desktop-actor-row small {
  margin-top: 4px;
  color: var(--muted);
}

.desktop-actor-row em {
  color: var(--primary-dark);
  font-style: normal;
  font-size: 13px;
  font-weight: 760;
}

.desktop-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.desktop-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.desktop-form label:nth-of-type(3),
.desktop-form label:nth-of-type(5),
.desktop-form label:nth-of-type(6),
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-actions button {
  flex: 1;
}

.media-box {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.media-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.avatar-preview {
  aspect-ratio: 1;
}

.background-preview {
  width: 92px;
  aspect-ratio: 9 / 16;
  justify-self: center;
}

.media-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-actions {
  display: grid;
  gap: 8px;
}

.media-actions h3,
.media-actions p {
  margin: 0;
}

.media-actions p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.desktop-form input,
.desktop-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  outline: none;
}

.desktop-form input:focus,
.desktop-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 165, 148, 0.12);
}

.danger-action {
  border: 0;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-weight: 780;
  cursor: pointer;
}

.danger-action:hover {
  background: #8f1d14;
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.training-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.training-box h3,
.training-box p {
  margin: 0;
}

.training-box p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.desktop-upload {
  width: 100%;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.photo-item {
  position: relative;
}

.photo-list a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.photo-list img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item button {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(23, 33, 31, 0.82);
  color: #fff;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 760;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.admin-page .toast {
  right: 28px;
  bottom: 28px;
  left: auto;
  width: min(360px, calc(100vw - 56px));
}

@media (min-width: 820px) {
  .app-shell {
    padding-top: 30px;
  }
}

@media (max-width: 400px) {
  .topbar h1 {
    font-size: 21px;
  }

  .camera-action,
  .upload-action {
    min-height: 84px;
  }

  .action-icon {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 600px) {
  .app-shell,
  .bottom-nav {
    margin-right: 0;
    margin-left: 0;
  }

  #actorCount {
    display: none;
  }

  .upload-panel h2,
  .upload-panel p {
    max-width: 320px;
    margin-right: auto;
    margin-left: auto;
  }
}

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

  .admin-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

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

@media (max-width: 720px) {
  .admin-main,
  .admin-sidebar {
    padding: 18px;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions,
  .desktop-form {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .toolbar-actions {
    display: grid;
  }

  .desktop-form label {
    grid-column: 1 / -1;
  }
}
