:root {
  --bg: #07060c;
  --panel: #14121c;
  --card: #1b1824;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1f8;
  --muted: rgba(244, 241, 248, 0.58);
  --accent: #cc80f2;
  --accent-2: #7d5cff;
  --good: #3ddc97;
  --danger: #ff6b7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); color-scheme: dark; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: transparent; }
img { max-width: 100%; }

.app {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(125, 92, 255, 0.28), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(61, 220, 151, 0.12), transparent 55%),
    var(--bg);
}

.gate, .welcome {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px 40px;
}

.panel {
  width: min(460px, 100%);
  background: rgba(20, 18, 28, 0.92);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.kicker {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 8px;
}

h1 { font-size: 34px; line-height: 1.05; margin: 0 0 10px; }
h2 { margin: 0; font-size: 22px; }
.sub { color: var(--muted); line-height: 1.45; margin: 0 0 18px; }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }

.btn, .ghost, .danger {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 700;
}
.btn {
  background: linear-gradient(90deg, #7a3cff, #c86bff 55%, #3ddc97);
  color: white;
}
.btn.block, .ghost.block, .danger.block { width: 100%; }
.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.danger { background: rgba(255, 107, 122, 0.14); color: #ffd0d5; }
.btn:disabled, .ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.small { padding: 8px 12px; border-radius: 12px; font-size: 13px; }

.field, textarea, select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0e0d14;
  padding: 12px 14px;
}
textarea { min-height: 90px; resize: vertical; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 14px; }
.check input { margin-top: 3px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 8px;
}
.brand { font-weight: 800; font-size: 18px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.account-banner { border-color: rgba(204, 128, 242, 0.5); }
.ghost.on { border-color: var(--accent); background: rgba(204, 128, 242, 0.16); }
.usage {
  font-size: 12px;
  font-weight: 700;
  color: #f4f1f8;
  background: #1b1824;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 10px;
}

.tabs {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(7, 6, 12, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.tabs button {
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: 14px;
  padding: 8px 4px 6px;
  font-size: 12px;
  font-weight: 700;
}
.tabs button.on { color: white; background: rgba(204, 128, 242, 0.16); }
.tabs span { display: block; font-size: 16px; margin-bottom: 2px; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.screen { width: min(980px, 100%); margin: 0 auto; padding: 8px 16px 96px; flex: 1 0 auto; }
.screen-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin: 8px 0 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  text-align: left;
  width: 100%;
}
.card:hover { border-color: rgba(204, 128, 242, 0.45); }
.girl-card { cursor: pointer; }
.brand { display: flex; align-items: center; gap: 8px; }
.shot {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  display: block;
  margin-bottom: 10px;
  background: #111;
}
.shot.round {
  width: 44px;
  height: 44px;
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.brand .shot.round { width: 28px; height: 28px; }
.pair .shot.round { width: 84px; height: 84px; }
.shot.hero {
  width: min(280px, 78%);
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center center;
  margin: 0 auto 12px;
  border-radius: 22px;
  background: #1a1522;
}
.pic-loading {
  width: 42px;
  height: 42px;
  margin: 8px auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: #d28bff;
  animation: picSpin 0.8s linear infinite;
}
@keyframes picSpin { to { transform: rotate(360deg); } }
.portrait-wait {
  width: min(240px, 78%);
  aspect-ratio: 1;
  margin: 0 auto 12px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: #241c30;
  color: #c9bdd6;
  padding: 16px;
  text-align: center;
  line-height: 1.4;
}
.shot.wide { aspect-ratio: 16 / 7; border-radius: 20px; margin-bottom: 14px; }
.shot.pack { aspect-ratio: 3 / 4; }
.pack-card { cursor: pointer; }
.pair { display: flex; justify-content: center; margin-bottom: 8px; }
.pair .shot.round { margin: 0 -8px; }
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  margin-bottom: 10px;
  border: 2px solid rgba(255, 255, 255, 0.18);
}
.meta { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
}
.chip.on { background: rgba(204, 128, 242, 0.2); border-color: var(--accent); }
.chip-card.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(204, 128, 242, 0.7);
  background: #2a2238;
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: min(820px, 100%);
  margin: 0 auto;
}
.thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: min(78%, 520px);
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.bubble.user { align-self: flex-end; background: #5b3dff; }
.bubble.assistant { align-self: flex-start; background: rgba(255, 255, 255, 0.08); }
.voice-memo { padding: 10px 12px; }
.voice-player { display: flex; align-items: center; gap: 12px; width: min(260px, 70vw); }
.voice-play {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #b861fa;
  cursor: pointer;
  position: relative;
  flex: none;
}
.voice-play::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent white;
}
.voice-play.is-playing::before {
  left: 12px;
  top: 10px;
  width: 4px;
  height: 16px;
  border: 0;
  background: white;
  box-shadow: 8px 0 0 white;
}
.voice-bar {
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.voice-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.16);
}
.voice-track i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 99px;
  background: #b861fa;
}
.voice-track i::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
}
.voice-player.is-loading .voice-play { opacity: 0.55; }
.voice-player.is-loading .voice-time::after { content: "…"; }
.play-voice { align-self: flex-start; font-weight: 700; }
.bubble img { display: block; width: min(100%, 280px); height: auto; border-radius: 12px; margin-top: 8px; }
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(7, 6, 12, 0.94);
}
.composer textarea { min-height: 48px; max-height: 140px; }
.tools { display: flex; gap: 8px; padding: 0 12px 8px; align-items: center; flex-wrap: wrap; }
.pic-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #1c1a26;
  color: inherit;
  cursor: pointer;
}
.pic-option strong, .pic-option .meta { display: block; }
.voice-mark {
  width: 72px;
  height: 72px;
  margin: 4px auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #cc80f2, #8538eb);
}
.voice-mark span {
  width: 4px;
  border-radius: 2px;
  background: white;
}
.voice-mark span:nth-child(1) { height: 10px; }
.voice-mark span:nth-child(2) { height: 18px; }
.voice-mark span:nth-child(3) { height: 28px; }
.voice-mark span:nth-child(4) { height: 16px; }
.voice-mark span:nth-child(5) { height: 22px; }
.pic-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: none;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 5;
}
.modal {
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: #16141e;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 18px;
}
.price { font-size: 28px; font-weight: 800; }
.note { font-size: 13px; color: var(--muted); }
.test-banner {
  margin: 0;
  padding: 8px 16px;
  background: #3a2a12;
  color: #ffd89a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.notice {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 92px;
  z-index: 8;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: #241c33;
  border: 1px solid rgba(204, 128, 242, 0.45);
  box-shadow: var(--shadow);
}
.notice button { flex: none; }
.checkout-wait {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: rgba(7, 6, 12, 0.72);
  font-weight: 800;
}

.rip-stage {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px 32px;
  text-align: center;
  background:
    radial-gradient(420px 280px at 50% 42%, rgba(168, 84, 247, 0.28), transparent 70%),
    #0a0612;
}
.rip-stage h2 { font-size: 28px; }
.foil-wrap {
  width: min(268px, 72vw);
  height: 400px;
  margin: 8px 0 4px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.foil {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 24px 60px rgba(120, 40, 200, 0.45);
  animation: foilFloat 2.8s ease-in-out infinite;
}
.foil img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.foil-wrap.is-ripping .foil { animation: foilRip 1.15s ease forwards; }
@keyframes foilFloat {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-10px) rotate(2deg); }
}
@keyframes foilRip {
  0% { transform: rotate(-2deg) scale(1); filter: brightness(1); }
  35% { transform: rotate(-10deg) scale(1.05); filter: brightness(1.6); }
  100% { transform: translate(40px, -80px) rotate(-22deg) scale(0.15); opacity: 0; filter: brightness(2); }
}
.countries { display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; overflow: auto; }
.countries span {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
}
.countries span.got { color: var(--good); }

.empty {
  border: 1px dashed var(--line);
  border-radius: 22px;
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}
.err { color: #ffb4bc; font-size: 13px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i { height: 4px; flex: 1; border-radius: 99px; background: rgba(255,255,255,0.12); }
.steps i.on { background: var(--accent); }
.range { width: 100%; }
.section { margin: 18px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
