@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #090813;
  --bg-soft: #121126;
  --panel: rgba(18, 17, 38, 0.88);
  --panel-strong: rgba(22, 20, 44, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f7efff;
  --text-soft: rgba(239, 229, 255, 0.72);
  --accent: #ef5bd8;
  --accent-2: #866bff;
  --accent-3: #61d5ff;
  --success: #7cf8b9;
  --danger: #ff8ba3;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(134, 107, 255, 0.2), transparent 35%),
    radial-gradient(circle at bottom right, rgba(97, 213, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #08070f 0%, #0b0a17 38%, #0d0c1b 100%);
  color: var(--text);
  font-family: "Outfit", "Noto Sans SC", "PingFang SC", sans-serif;
}

body {
  display: flex;
  justify-content: center;
  padding: 20px;
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
}

.bg-orb {
  position: fixed;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  filter: blur(58px);
  opacity: 0.45;
  pointer-events: none;
  animation: drift 10s ease-in-out infinite alternate;
}

.bg-orb-a {
  top: 30px;
  right: 0;
  background: rgba(239, 91, 216, 0.4);
}

.bg-orb-b {
  bottom: 80px;
  left: -50px;
  background: rgba(97, 213, 255, 0.22);
  animation-duration: 13s;
}

.phone-frame {
  position: relative;
  min-height: calc(100vh - 40px);
  padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(11, 10, 25, 0.92), rgba(7, 7, 18, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 100px;
}

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

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo,
.profile-avatar {
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(239, 91, 216, 0.9), rgba(134, 107, 255, 0.9)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent);
  box-shadow: 0 14px 24px rgba(239, 91, 216, 0.2);
}

.brand-logo {
  width: 54px;
  height: 54px;
  font-size: 1.25rem;
  font-weight: 700;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  font-size: 1.4rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: #d697ff;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  font-size: 1.65rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  color: var(--text-soft);
  line-height: 1.55;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.user-chip small {
  display: block;
  color: var(--text-soft);
}

.user-chip__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(134, 107, 255, 0.6), rgba(97, 213, 255, 0.4));
  font-weight: 700;
}

.hero-card,
.panel,
.script-card,
.loading-card,
.banner,
.bottom-nav,
.composer,
.messages,
.chat-topbar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at right top, rgba(97, 213, 255, 0.18), transparent 38%),
    radial-gradient(circle at left bottom, rgba(239, 91, 216, 0.28), transparent 40%),
    linear-gradient(135deg, rgba(26, 22, 53, 0.98), rgba(14, 12, 32, 0.95));
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(239, 91, 216, 0.5), transparent 65%);
  filter: blur(24px);
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.hero-copy h2 {
  font-size: 1.6rem;
}

.hero-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}

.hero-badge,
.status-pill,
.tag,
.chip,
.nav-btn,
.ghost-btn,
.primary-btn,
.model-select select {
  border-radius: 999px;
}

.hero-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.hero-stat {
  align-self: stretch;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  text-align: right;
}

.hero-stat strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 2rem;
}

.panel,
.script-card,
.loading-card,
.banner,
.messages,
.composer,
.chat-topbar {
  border-radius: var(--radius-lg);
}

.panel,
.loading-card,
.banner,
.messages,
.composer,
.chat-topbar {
  padding: 18px;
}

.model-panel,
.setting-item,
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-row,
.tag-row,
.quick-replies,
.bottom-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar,
.tag-row::-webkit-scrollbar,
.quick-replies::-webkit-scrollbar,
.bottom-nav::-webkit-scrollbar {
  display: none;
}

.chip,
.tag,
.ghost-btn,
.nav-btn {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.chip-active,
.primary-btn,
.nav-btn-active {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 14px 28px rgba(183, 92, 255, 0.25);
}

.primary-btn,
.ghost-btn {
  padding: 13px 18px;
  cursor: pointer;
}

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

.block-btn,
.send-btn {
  width: 100%;
}

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

.scripts-grid {
  display: grid;
  gap: 16px;
}

.script-card {
  overflow: hidden;
}

.script-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(134, 107, 255, 0.35), rgba(97, 213, 255, 0.2));
}

.script-card__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.script-meta {
  display: flex;
  gap: 10px;
}

.tag-role {
  background: rgba(239, 91, 216, 0.16);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(239, 91, 216, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(20, 17, 41, 0.98), rgba(13, 12, 29, 0.96));
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.setting-item:last-child {
  border-bottom: none;
}

.chat-topbar {
  align-items: start;
}

.model-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.model-select select {
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 46vh;
  overflow-y: auto;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-label {
  color: #c8abff;
  font-size: 0.84rem;
}

.message-bubble {
  max-width: 88%;
  padding: 13px 16px;
  border-radius: 18px;
  line-height: 1.6;
}

.message-assistant .message-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-top-left-radius: 6px;
}

.message-user {
  align-items: flex-end;
}

.message-user .message-label {
  color: #8fe0ff;
}

.message-user .message-bubble {
  background: linear-gradient(135deg, rgba(97, 213, 255, 0.14), rgba(134, 107, 255, 0.24));
  border-top-right-radius: 6px;
}

.message-streaming .message-bubble::after {
  content: "▋";
  display: inline-block;
  margin-left: 3px;
  color: #f28bdf;
  animation: caret-blink 0.9s step-end infinite;
}

.composer {
  display: grid;
  gap: 12px;
}

.composer textarea {
  width: 100%;
  min-height: 92px;
  padding: 14px 16px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 36px), 424px);
  padding: 10px;
  justify-content: space-between;
  backdrop-filter: blur(18px);
}

.nav-btn {
  flex: 1;
  text-align: center;
}

.loading-card,
.empty-state,
.banner {
  text-align: center;
}

.banner.error {
  color: #fff;
  background: rgba(255, 107, 140, 0.16);
  border-color: rgba(255, 107, 140, 0.3);
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(20px, -18px, 0) scale(1.08);
  }
}

@keyframes caret-blink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0;
  }

  .app-shell {
    width: 100%;
  }

  .phone-frame {
    min-height: 100vh;
    border-radius: 0;
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

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

  .topbar,
  .chat-topbar,
  .model-panel,
  .setting-item {
    flex-direction: column;
    align-items: stretch;
  }

  .user-chip {
    justify-content: flex-start;
  }

  .message-bubble {
    max-width: 100%;
  }

  .bottom-nav {
    width: calc(100% - 24px);
  }
}
