@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #0b0b10;
  --surface: #15151d;
  --surface-2: #1d1d28;
  --surface-3: #262634;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f3f6;
  --muted: #9b9bad;
  --accent: #ff4f8b;
  --accent-2: #a855f7;
  --accent-text: #ff7aa8;
  --accent-soft: rgba(255, 79, 139, 0.14);
  --grad: linear-gradient(135deg, #ff4f8b 0%, #a855f7 100%);
  --adult: #ff4d5e;
  --adult-soft: rgba(255, 77, 94, 0.14);
  --gold: #ffcf5a;
  --ok: #4ade80;
  --danger: #ff6b6b;
  --radius: 16px;
  --radius-sm: 12px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
::selection { background: rgba(255, 79, 139, 0.35); }

/* ---------- 상단바 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  background: rgba(11, 11, 16, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
#login-link { background: var(--grad); color: #fff; font-weight: 700; }
#login-link:hover { color: #fff; filter: brightness(1.08); }
.coin-badge {
  margin-left: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 207, 90, 0.12);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.container { max-width: 1120px; margin: 0 auto; padding: 20px; }

/* ---------- 홈 배너 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin: 4px 0 20px;
  padding: 28px 24px;
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(168, 85, 247, 0.55) 0%, transparent 55%),
    radial-gradient(120% 140% at 0% 100%, rgba(255, 79, 139, 0.55) 0%, transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
}
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 6px; }
.hero p { color: rgba(255, 255, 255, 0.78); margin: 0; font-size: 14px; }
.hero strong { color: #fff; }

/* ---------- 슬라이드 배너 ---------- */
.banner { position: relative; margin: 4px 0 20px; }
.banner-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  border-radius: 20px; scrollbar-width: none;
}
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide {
  position: relative; flex: 0 0 100%; scroll-snap-align: start;
  height: 240px; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: space-between;
  background: var(--surface); color: #fff;
}
.banner-bg {
  position: absolute; inset: -20px;
  background-size: cover; background-position: center 20%;
  filter: blur(22px) brightness(0.5) saturate(1.3);
}
.banner-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11, 11, 16, 0.85) 0%, rgba(11, 11, 16, 0.3) 60%, transparent 100%);
}
.banner-text { position: relative; z-index: 1; padding: 24px; max-width: 60%; }
.banner-label {
  display: inline-block; padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
  background: var(--grad); font-size: 12px; font-weight: 700;
}
.banner-text h2 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.banner-text p {
  margin: 0 0 14px; font-size: 14px; color: rgba(255, 255, 255, 0.8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.banner-cta { font-size: 13px; font-weight: 700; color: var(--accent-text); }
.banner-img {
  position: relative; z-index: 1; height: 100%; aspect-ratio: 3 / 4;
  object-fit: cover; object-position: center top;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 25%);
  mask-image: linear-gradient(to right, transparent 0%, #000 25%);
}
.banner-dots {
  position: absolute; left: 24px; bottom: 12px; z-index: 2; display: flex; gap: 6px;
}
.banner-dots button {
  width: 7px; height: 7px; padding: 0; border: none; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.35); transition: width .2s, background .2s;
}
.banner-dots button.active { width: 20px; background: #fff; }

/* ---------- 인기 순위 / 정렬 ---------- */
.section-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.rank-section { margin-bottom: 24px; }
.rank-row {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity; padding-bottom: 2px;
}
.rank-row::-webkit-scrollbar { display: none; }
.rank-card { flex: 0 0 138px; scroll-snap-align: start; }
.rank-card .char-card .card-info { padding: 40px 10px 10px; }
.rank-card .char-card h3 { font-size: 14px; }
.rank-card .fav-btn { width: 30px; height: 30px; font-size: 15px; }
.rank-num {
  position: absolute; top: 4px; left: 10px; z-index: 1;
  font-size: 38px; font-weight: 900; font-style: italic; line-height: 1;
  color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-head .section-title { margin: 0 0 12px; }
.sort-toggle { display: flex; gap: 4px; margin-bottom: 12px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.sort-toggle button {
  padding: 6px 12px; border: none; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 700;
}
.sort-toggle button.active { background: var(--surface-3); color: var(--text); }
.card-stats { display: flex; gap: 10px; margin: 0 0 6px; font-size: 11px; color: rgba(255, 255, 255, 0.7); }

/* ---------- 공용 카드/그리드 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 79, 139, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin-bottom: 12px;
  border: 2px solid var(--line-strong);
}
.card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.card .tagline { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
}
.tag-adult { background: var(--adult) !important; color: #fff !important; }

/* ---------- 검색 / 탭 / 태그 ---------- */
.search-bar { margin: 0 0 14px; }
.search-bar input {
  width: 100%;
  padding: 13px 18px 13px 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%239b9bad' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center;
  color: var(--text);
  font-size: 15px;
  transition: border-color .15s;
}
.search-bar input::placeholder { color: var(--muted); }
.search-bar input:focus { outline: none; border-color: rgba(255, 79, 139, 0.55); }

.filter-tabs {
  display: flex;
  gap: 22px;
  margin: 8px 0 14px;
  border-bottom: 1px solid var(--line);
}
.filter-tab {
  position: relative;
  padding: 10px 2px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { color: var(--text); }
.filter-tab.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 3px; border-radius: 3px;
  background: var(--grad);
}
.filter-tab[data-filter="adult"].active { color: var(--adult); }
.filter-tab[data-filter="adult"].active::after { background: var(--adult); }

.tag-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tag-bar::-webkit-scrollbar { display: none; }
.tag-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.tag-chip:hover { color: var(--text); border-color: var(--line-strong); }
.tag-chip.active { background: var(--text); border-color: var(--text); color: #111; }

/* ---------- 캐릭터 카드 (세로 포스터형) ---------- */
.char-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.char-card-wrap { position: relative; }
.char-card {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.char-card .card-portrait {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  display: block;
  background: var(--surface-2);
  transition: transform .35s ease;
}
.char-card:hover .card-portrait { transform: scale(1.04); }
.char-card .card-portrait-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 54px; font-weight: 800; color: rgba(255, 255, 255, 0.9);
}
.char-card .card-info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 44px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.65) 55%, transparent 100%);
}
.char-card h3 {
  margin: 0 0 2px;
  font-size: 16px;
  display: flex; align-items: center; gap: 6px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.char-card .tagline {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.char-card .tags { gap: 4px; max-height: 22px; overflow: hidden; }
.char-card .tag { background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(4px); }
.char-card .tag-adult { font-size: 10px; padding: 2px 6px; }
.adult-card:hover { border-color: rgba(255, 77, 94, 0.55); }

.fav-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  color: #fff; font-size: 17px;
  cursor: pointer; line-height: 1;
  transition: transform .15s;
}
.fav-btn:hover { transform: scale(1.1); }
.fav-btn.is-on { color: var(--accent); background: rgba(0, 0, 0, 0.6); }

/* ---------- 출석 ---------- */
.attendance-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 14px; padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.attendance-desc { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.attendance-box button {
  padding: 10px 18px; border: none; border-radius: 999px;
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.attendance-box button:disabled { opacity: 0.45; cursor: default; }
.daily-status { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.daily-hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- 채팅방 ---------- */
.chat-layout {
  max-width: 680px; margin: 0 auto; padding: 12px 16px 16px;
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}
.profile-box {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 16px 12px;
  background: rgba(21, 21, 29, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-shrink: 0;
}
.profile-img {
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--accent); object-fit: cover; object-position: center top;
  background: var(--surface-2);
}
.profile-name { font-size: 18px; font-weight: 800; margin-top: 8px; }
.back-link {
  position: absolute; left: 12px; top: 12px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.06);
}
.back-link:hover { color: var(--text); }
.reset-btn, .report-btn {
  position: absolute; right: 12px;
  padding: 5px 10px; border: none; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
  cursor: pointer; font-size: 12px;
}
.reset-btn { top: 12px; }
.report-btn { top: 44px; }
.reset-btn:hover, .report-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }

.chat-head {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 8px 10px; margin-bottom: 8px;
  background: rgba(21, 21, 29, 0.75); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.head-back { font-size: 28px; line-height: 1; padding: 0 6px 2px; color: var(--muted); }
.head-back:hover { color: var(--text); }
.head-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.head-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; object-position: center top;
  border: 2px solid var(--char-accent, var(--accent)); background: var(--surface-2);
}
.head-avatar-empty { display: flex; align-items: center; justify-content: center; font-weight: 800; }
.head-text { display: flex; flex-direction: column; min-width: 0; }
.head-name { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-text .daily-hint { margin: 0; }
.chip-btn {
  flex-shrink: 0; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.chip-btn:hover { border-color: rgba(255, 79, 139, 0.5); }
.menu-wrap { position: relative; flex-shrink: 0; }
.head-menu-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); color: var(--text); font-size: 18px; line-height: 1;
}
.dropdown {
  position: absolute; right: 0; top: 42px; z-index: 30; min-width: 190px;
  padding: 6px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.dropdown button {
  display: block; width: 100%; padding: 10px 12px; border: none; border-radius: 10px;
  background: none; color: var(--text); text-align: left; font-size: 14px; cursor: pointer;
}
.dropdown button:hover { background: var(--surface-3); }
.room-bar { display: flex; gap: 8px; margin-bottom: 8px; flex-shrink: 0; }
.room-bar select {
  flex: 1; min-width: 0; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13px;
}

.msg { display: flex; flex-direction: column; max-width: 82%; gap: 4px; }
.msg.from-user { align-self: flex-end; align-items: flex-end; }
.msg.from-ai { align-self: flex-start; align-items: flex-start; }
.msg .user, .msg .ai { max-width: 100%; cursor: pointer; }
.msg-tools { display: none; gap: 4px; }
.msg.open .msg-tools, .msg.is-last .msg-tools { display: flex; }
.msg.is-last:not(.open) .msg-tools [data-act="edit"],
.msg.is-last:not(.open) .msg-tools [data-act="delete"] { display: none; }
.msg-tools button {
  padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(21, 21, 29, 0.8); color: var(--muted); font-size: 12px;
}
.msg-tools button:hover { color: var(--text); border-color: var(--line-strong); }
.edited { font-size: 11px; opacity: 0.6; }

.modal-label { display: block; margin: 12px 0 0; font-size: 13px; font-weight: 700; }
.modal-actions .btn-main { background: var(--grad); }
.model-list { display: flex; flex-direction: column; gap: 8px; }
.model-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left;
  padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.model-item.active { border-color: var(--accent); background: var(--accent-soft); }
.model-name { font-weight: 800; font-size: 15px; }
.model-cost { font-size: 12px; color: var(--accent-text); font-weight: 700; align-self: center; }
.model-desc { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

#chat {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background: rgba(11, 11, 16, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  line-height: 1.65;
  font-size: 15px;
  display: flex; flex-direction: column; gap: 10px;
}
.user, .ai {
  width: fit-content;
  max-width: 82%;
  padding: 10px 14px;
  word-break: break-word;
}
.user {
  align-self: flex-end;
  background: var(--grad);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}
.user strong { display: none; }
.ai {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 4px;
}
.ai strong {
  display: block;
  font-size: 12px;
  color: var(--char-accent, var(--accent-text));
  margin-bottom: 2px;
}
.ai .rp-action, .user .rp-action {
  font-style: italic;
  display: inline;
}
.ai .rp-action { color: rgba(255, 255, 255, 0.55); }
.user .rp-action { color: rgba(255, 255, 255, 0.8); }

.input-row {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 6px 6px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  flex-shrink: 0;
}
.input-row:focus-within { border-color: rgba(255, 79, 139, 0.5); }
.input-row input {
  flex: 1; min-width: 0; padding: 10px 0;
  border: none; background: transparent; color: var(--text);
  font-size: 15px;
}
.input-row input:focus { outline: none; }
.input-row input::placeholder { color: var(--muted); }
.input-row button {
  padding: 10px 18px; border: none; border-radius: 999px;
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}

.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; flex-shrink: 0; }
.quick-btn {
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: rgba(255, 255, 255, 0.85); font-size: 12px;
  cursor: pointer; max-width: 100%; text-align: left;
}
.quick-btn:hover { border-color: rgba(255, 79, 139, 0.5); color: #fff; }

.scene-bg {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg);
  transition: background 0.6s ease;
}
body.chat-room::after {
  content: ""; position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(to bottom, rgba(11, 11, 16, 0.55), rgba(11, 11, 16, 0.85));
  pointer-events: none;
}
body.chat-page .topbar,
body.chat-page .chat-layout { position: relative; z-index: 1; }
body.chat-room .profile-img { border-color: var(--char-accent, var(--accent)); }

/* ---------- 폼 ---------- */
.form-box {
  max-width: 460px; margin: 12px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 24px;
}
.form-box h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.form-box label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.form-box input, .form-box textarea, .form-box select {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 15px;
  transition: border-color .15s, background .15s;
}
.form-box input::placeholder, .form-box textarea::placeholder { color: #6f6f82; }
.form-box input:focus, .form-box textarea:focus, .form-box select:focus {
  outline: none; border-color: rgba(255, 79, 139, 0.6); background: var(--surface-3);
}
.form-box textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.form-box button {
  margin-top: 18px; width: 100%; padding: 14px;
  border: none; border-radius: var(--radius-sm);
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer; font-size: 15px;
  transition: filter .15s, transform .1s;
}
.form-box button:hover { filter: brightness(1.08); }
.form-box button:active { transform: scale(0.99); }
.form-box button:disabled { opacity: 0.5; cursor: default; filter: none; }
.form-box a { color: var(--accent-text); }
.form-hint { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 8px; line-height: 1.6; }
.form-msg { margin-top: 12px; font-size: 14px; text-align: center; line-height: 1.6; }
.form-msg a { color: var(--accent-text); text-decoration: underline; }
#phone-signup { margin-bottom: 8px; }
#phone-signup button { margin-top: 0; background: var(--surface-3); border: 1px solid var(--line-strong); }
#phone-signup button:hover { border-color: rgba(255, 79, 139, 0.6); }

.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 0; font-size: 14px; line-height: 1.45; cursor: pointer;
}
.check-row input { margin-top: 3px; accent-color: var(--accent); }
.form-box .check-row { display: flex; font-weight: 400; }
.form-box .check-row input { width: auto; }

.agree-box {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.agree-box .check-row { margin: 8px 0; font-size: 14px; }
.agree-box a { color: var(--accent-text); text-decoration: underline; }
.agree-all { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.form-box .agree-box input[type="checkbox"] { width: auto; }

.rules-box {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(255, 207, 90, 0.06); border: 1px solid rgba(255, 207, 90, 0.22);
  font-size: 13px;
}
.rules-box ul { margin: 6px 0; padding-left: 18px; line-height: 1.7; color: rgba(255, 255, 255, 0.85); }
.rules-box a { color: var(--accent-text); text-decoration: underline; }
.rules-title { margin: 0; font-weight: 700; color: var(--gold); }
.rules-note { margin: 4px 0 0; color: var(--muted); }

/* ---------- 19+ ---------- */
.nav-adult { color: var(--adult) !important; font-weight: 700; }
.adult-badge {
  font-size: 12px; padding: 2px 8px; margin-left: 6px;
  border-radius: 999px; background: var(--adult-soft); color: var(--adult);
  vertical-align: middle;
}
.adult-hero h1 { color: var(--adult); }
.gate-box {
  max-width: 420px; margin: 0 auto 32px;
  background: var(--surface);
  border: 1px solid rgba(255, 77, 94, 0.3);
  border-radius: 20px; padding: 26px 24px;
}
.gate-box h2 { margin-top: 0; color: var(--adult); font-size: 20px; }
.gate-note { color: var(--muted); font-size: 14px; line-height: 1.5; }
.gate-box label { display: block; margin: 12px 0 6px; font-size: 13px; }
.gate-box input[type="number"] {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  margin-bottom: 8px; font-size: 15px;
}
.gate-box button {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
  background: var(--adult); color: #fff; font-weight: 700; cursor: pointer; font-size: 15px;
}
.gate-box button:disabled { opacity: 0.5; }
.gate-err { color: var(--danger); font-size: 14px; margin-top: 10px; }

/* ---------- 모달 ---------- */
.modal {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal.is-open { display: flex; }
.modal-close {
  margin-top: 10px; width: 100%; padding: 12px;
  border: 1px solid var(--line-strong) !important; border-radius: var(--radius-sm);
  background: transparent !important; color: var(--muted) !important; cursor: pointer;
}
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; margin: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px;
}
.modal-box.gate-box { border-color: rgba(255, 77, 94, 0.3); padding: 26px 24px; }
.modal-box h3 { margin: 0 0 4px; }
.modal-desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.radio-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; cursor: pointer; }
.radio-row input { accent-color: var(--accent); }
.modal-box textarea {
  width: 100%; min-height: 70px; margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); resize: vertical;
}
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions button {
  flex: 1; padding: 12px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700;
  background: var(--adult); color: #fff;
}
.modal-actions .btn-sub { background: var(--surface-3); color: var(--text); }

/* ---------- 하단 탭바 ---------- */
body.has-bottom-nav { padding-bottom: 76px; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(11, 11, 16, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
}
.bottom-nav-item {
  flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; font-size: 11px; font-weight: 600; color: var(--muted);
  transition: color .15s;
}
.bottom-nav-item .bn-icon { font-size: 21px; line-height: 1; filter: grayscale(1) opacity(0.65); transition: filter .15s; }
.bottom-nav-item:hover { color: var(--text); }
.bottom-nav-item.active { color: var(--text); }
.bottom-nav-item.active .bn-icon { filter: none; }

/* ---------- 채팅 목록 ---------- */
.chat-list { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.chat-list-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); transition: border-color .15s, background .15s;
}
.chat-list-item:hover { border-color: rgba(255, 79, 139, 0.4); background: var(--surface-2); }
.chat-list-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; object-position: center top; flex-shrink: 0;
  background: var(--surface-3);
}
.chat-list-emoji { display: flex; align-items: center; justify-content: center; font-size: 22px; }
.chat-list-body { flex: 1; min-width: 0; }
.chat-list-body h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.chat-preview {
  margin: 0; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-time { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ---------- 마이 ---------- */
.profile-card {
  max-width: 560px; margin: 0 auto 16px; padding: 22px;
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(168, 85, 247, 0.25) 0%, transparent 60%),
    var(--surface);
  border-radius: 20px;
  border: 1px solid var(--line);
}
.profile-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
}
.profile-card h2 { margin: 0 0 2px; font-size: 19px; font-weight: 800; }
.profile-email { margin: 0; font-size: 13px; color: var(--muted); }
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px;
}
.profile-stats > div { padding: 12px 6px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); }
.profile-stats strong { display: block; font-size: 19px; font-weight: 800; color: var(--text); }
.profile-stats span { font-size: 12px; color: var(--muted); }

.menu-list {
  max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
}
.menu-item {
  display: block; padding: 16px 18px;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  font-size: 15px; cursor: pointer; text-align: left; width: 100%;
  color: inherit; font-family: inherit;
  transition: background .15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-btn { color: var(--danger); }
.menu-btn.menu-verify { color: var(--accent-text); }
.menu-btn.menu-verify:disabled { color: var(--ok); cursor: default; background: transparent; }
.menu-danger { color: var(--muted); font-size: 13px; }

.empty-msg, .guest-msg { text-align: center; color: var(--muted); padding: 40px 24px; grid-column: 1 / -1; }
.guest-msg a { color: var(--accent-text); text-decoration: underline; }

/* ---------- 푸터 ---------- */
.site-footer {
  max-width: 1120px; margin: 48px auto 0; padding: 24px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: #6f6f82; line-height: 1.75;
}
.footer-links { display: flex; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-biz p { margin: 0; }

/* ---------- 약관 / 고객센터 ---------- */
.policy { max-width: 760px; line-height: 1.8; font-size: 15px; }
.policy h1 { margin-bottom: 4px; font-weight: 800; letter-spacing: -0.03em; }
.policy h2 { font-size: 17px; margin: 30px 0 8px; color: var(--accent-text); }
.policy p, .policy li { color: rgba(255, 255, 255, 0.85); }
.policy a { color: var(--accent-text); text-decoration: underline; }
.policy-date { color: var(--muted) !important; font-size: 13px; }
.policy-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.policy-table th, .policy-table td {
  border: 1px solid var(--line-strong); padding: 9px 11px; text-align: left; vertical-align: top;
}
.policy-table th { background: var(--surface-2); }

.contact-card {
  margin: 16px 0 8px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid rgba(255, 79, 139, 0.3);
}
.contact-card p { margin: 4px 0; }
.contact-title { font-weight: 800; color: var(--accent-text); font-size: 16px; }
.contact-note { font-size: 13px; color: var(--muted) !important; }
.faq-group { margin: 22px 0 8px; font-weight: 800; font-size: 14px; color: var(--accent-text) !important; }
.faq {
  margin: 6px 0; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.faq[open] { border-color: var(--line-strong); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 10px 0 0; font-size: 14px; }

/* ---------- 코인 / 결제 ---------- */
.pay-notice {
  max-width: 640px; margin: 0 auto 20px; padding: 12px 16px; border-radius: var(--radius-sm); text-align: center;
  background: rgba(255, 207, 90, 0.08); border: 1px solid rgba(255, 207, 90, 0.3); color: var(--gold); font-size: 14px;
}
.pkg-card { text-align: center; cursor: default; }
.pkg-coins { font-size: 26px; font-weight: 800; color: var(--gold); margin: 8px 0; }
.pkg-price { color: var(--muted); margin: 0 0 14px; }
.pkg-btn {
  width: 100%; padding: 12px; border: none; border-radius: var(--radius-sm);
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer; font-size: 15px;
}
.pkg-btn:disabled { opacity: 0.45; cursor: default; }
.pay-info { margin-top: 24px; font-size: 13px; color: var(--muted); line-height: 1.65; }
.pay-info p { margin: 4px 0; }
.pay-info a { color: var(--accent-text); text-decoration: underline; }
.pay-history { margin-top: 24px; }
.history-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px;
  padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}

/* ---------- 픽챗 플러스 ---------- */
.plus-card {
  max-width: 560px; margin: 0 auto; padding: 24px 22px;
  border-radius: 20px; border: 1px solid rgba(255, 207, 90, 0.35);
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(255, 207, 90, 0.14) 0%, transparent 60%),
    var(--surface);
}
.plus-price { margin: 0 0 14px; font-size: 15px; color: var(--muted); }
.plus-price strong { font-size: 32px; font-weight: 800; color: var(--gold); letter-spacing: -0.03em; }
.plus-benefits { list-style: none; padding: 0; margin: 0 0 18px; }
.plus-benefits li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.plus-benefits li:last-child { border-bottom: none; }
.plus-sub { color: var(--muted); font-size: 12px; }
.plus-status {
  margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px;
}
.plus-status p { margin: 3px 0; }
.plus-agree { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; font-size: 13px; color: rgba(255, 255, 255, 0.85); line-height: 1.55; cursor: pointer; }
.plus-agree input { margin-top: 3px; flex-shrink: 0; }
.plus-link-btn {
  display: block; width: 100%; margin-top: 10px; padding: 10px;
  background: transparent; border: none; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer;
}
.plus-promo {
  display: block; max-width: 640px; margin: 0 auto 20px; padding: 13px 16px; border-radius: var(--radius-sm);
  background: rgba(255, 207, 90, 0.08); border: 1px solid rgba(255, 207, 90, 0.35); font-size: 14px; color: var(--text);
}
.plus-promo b { color: var(--gold); }
.plus-promo span { float: right; color: var(--muted); }
.plus-badge {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  font-size: 11px; font-weight: 700; color: #1a1300; background: var(--gold);
}

.result-box { text-align: center; margin-top: 40px; }
.result-btn {
  display: block; margin-top: 12px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--grad); color: #fff; font-weight: 700;
}
.result-btn-sub { background: transparent; border: 1px solid var(--line-strong); color: var(--text); }

/* ---------- 신고 / 관리자 ---------- */
.admin-list { max-width: 760px; margin: 0 auto; }
.admin-card {
  margin-bottom: 12px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-head h3 { margin: 0; }
.admin-status { font-size: 13px; color: var(--gold); }
.admin-meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); word-break: break-all; }
.admin-system { margin-top: 8px; font-size: 13px; }
.admin-system p { white-space: pre-wrap; color: rgba(255, 255, 255, 0.8); }
.admin-reports { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.admin-date { color: var(--muted); font-size: 12px; }
.admin-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.admin-actions button {
  padding: 8px 14px; border: none; border-radius: 10px; cursor: pointer; font-weight: 700;
  background: var(--grad); color: #fff;
}
.admin-actions .btn-danger { background: var(--danger); color: #fff; }
.admin-actions .btn-sub { background: var(--surface-3); color: var(--text); }
.admin-input {
  flex: 1; min-width: 200px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}

/* ---------- 시작 상황 ---------- */
.situation {
  align-self: stretch;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--line-strong);
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

/* ---------- 캐릭터 제작 ---------- */
.create-title { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.create-back { font-size: 26px; line-height: 1; color: var(--muted); padding: 0 4px; }
.create-back:hover { color: var(--text); }
.ghost-btn {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600;
}
.ghost-btn:hover { border-color: rgba(255, 79, 139, 0.5); }

.create-layout {
  max-width: 1180px; margin: 0 auto; padding: 16px 20px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start;
}
.create-tabs {
  display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.create-tabs::-webkit-scrollbar { display: none; }
.create-tabs button {
  position: relative; flex-shrink: 0; padding: 10px 2px;
  border: none; background: none; color: var(--muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.create-tabs button:hover { color: var(--text); }
.create-tabs button.active { color: var(--text); }
.create-tabs button.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px;
  background: var(--grad);
}

#create-form label, .create-main .field-title {
  display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.9);
}
.create-main .field-title:first-child { margin-top: 0; }
#create-form input[type="text"], #create-form input:not([type]), #create-form textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 14px; line-height: 1.6; resize: vertical;
  transition: border-color .15s, background .15s;
}
#create-form input::placeholder, #create-form textarea::placeholder { color: #6f6f82; }
#create-form input:focus, #create-form textarea:focus { outline: none; border-color: rgba(255, 79, 139, 0.6); background: var(--surface-3); }
.req { color: var(--accent); }
.muted { color: var(--muted); font-weight: 500; }
.counter { text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.label-row label { margin: 0 !important; }
.panel-hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.panel-hint strong { color: var(--text); }

.field-card, .sub-card {
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  margin-top: 14px;
}
.field-card > label:first-child, .field-card > .label-row:first-child { margin-top: 0; }
.sub-card { background: var(--surface-2); }

.image-row { display: flex; gap: 16px; align-items: flex-start; }
.image-preview {
  width: 120px; aspect-ratio: 3 / 4; flex-shrink: 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--muted);
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.image-side { flex: 1; min-width: 0; }
.seg { display: inline-flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  padding: 8px 16px; border: none; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--text); font-weight: 700; font-size: 13px;
}
.seg button:hover { background: var(--surface-3); }
.seg button:disabled { opacity: 0.5; }
.seg-small { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.seg-small label {
  display: flex !important; align-items: center; gap: 6px; margin: 0 !important;
  padding: 7px 12px; border-radius: 9px; cursor: pointer; font-weight: 600 !important;
}
.seg-small input { accent-color: var(--accent); }
.image-tips { margin: 10px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.link-btn { margin-top: 6px; padding: 0; border: none; background: none; color: var(--danger); font-size: 12px; cursor: pointer; }
#ai-image-go, .add-btn {
  width: 100%; margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 700; font-size: 14px;
}
#ai-image-go { border: none; background: var(--grad); color: #fff; }
#ai-image-go:disabled { opacity: 0.5; }
.add-btn { border: 1px dashed var(--line-strong); background: transparent; color: var(--text); }
.add-btn:hover { border-color: rgba(255, 79, 139, 0.6); }
.assist-btn {
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 79, 139, 0.4); background: var(--accent-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.assist-btn:disabled { opacity: 0.6; cursor: default; }

.dyn-list { display: flex; flex-direction: column; gap: 10px; }
.dyn-item {
  position: relative; padding: 12px 14px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.dyn-item label { margin: 6px 0 4px !important; font-size: 12px !important; color: var(--muted) !important; }
.dyn-item input, .dyn-item textarea { background: var(--bg) !important; }
.dyn-remove {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.06); color: var(--muted); cursor: pointer;
}
.dyn-remove:hover { color: var(--danger); }

.form-error { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: rgba(255, 107, 107, 0.1); color: var(--danger); font-size: 14px; }
.create-actions { display: flex; gap: 8px; margin-top: 16px; }
.create-actions button {
  flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm);
  background: var(--grad); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
}
.create-actions .btn-sub { flex: 0 0 110px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.create-actions button:disabled { opacity: 0.5; }

.test-panel {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 120px); min-height: 460px;
  padding: 14px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line);
}
.test-head { display: flex; justify-content: space-between; align-items: center; }
.test-count { font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.test-desc { margin: 4px 0 10px; font-size: 12px; color: var(--muted); }
.test-chat {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; margin-bottom: 10px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); font-size: 14px; line-height: 1.6;
}
.test-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface-3) !important; color: var(--text); font-size: 16px; padding: 0 !important;
}

/* ---------- 캐릭터 소개 / 제작자 ---------- */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 999px; cursor: pointer;
  font-size: 15px; font-weight: 700; white-space: nowrap;
}
.btn-primary { border: none; background: var(--grad); color: #fff; }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); }
.btn-ghost.is-on, .btn-primary.is-on { background: var(--surface-2); border: 1px solid var(--accent); color: var(--accent-text); }
.detail-page { max-width: 860px; }
.detail-hero { display: flex; gap: 24px; align-items: flex-end; margin: 8px 0 20px; }
.detail-portrait { width: 240px; flex-shrink: 0; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; background: var(--surface-2); }
.detail-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.detail-portrait .card-portrait-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 64px; font-weight: 800; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { margin: 0 0 4px; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; }
.detail-tagline { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 6px; font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.detail-creator { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.detail-creator a { color: var(--accent-text); font-weight: 700; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions .btn-primary { flex: 1; min-width: 160px; }
.detail-card {
  margin-bottom: 14px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.detail-card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.detail-card > p { margin: 0; line-height: 1.7; color: rgba(255, 255, 255, 0.85); }
.detail-preview { display: flex; flex-direction: column; gap: 8px; line-height: 1.6; }
.comment-form { display: flex; gap: 8px; margin-bottom: 14px; }
.comment-form textarea {
  flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); resize: vertical;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 14px;
}
.comment-form button { padding: 0 18px; border: none; border-radius: var(--radius-sm); background: var(--grad); color: #fff; font-weight: 700; cursor: pointer; }
.comment-list { display: flex; flex-direction: column; }
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head .link-btn { margin: 0 0 0 auto; }
.comment p { margin: 4px 0 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comment-empty { margin: 4px 0; font-size: 13px; }
.creator-head {
  display: flex; align-items: center; gap: 16px; margin: 8px 0 22px; padding: 20px;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
}
.creator-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad); font-size: 26px; font-weight: 800;
}
.creator-info { flex: 1; min-width: 0; }
.creator-info h1 { margin: 0; font-size: 22px; }
.creator-info .detail-stats { margin: 6px 0 0; }
.status-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, 0.6); color: #fff;
}
.status-public { background: rgba(80, 200, 120, 0.85); }
.status-hidden { background: var(--danger); }
.mychar-actions { display: flex; gap: 6px; margin-top: 8px; }
.mychar-actions .chip-btn { flex: 1; text-align: center; }
.chip-danger { color: var(--danger); }

/* ---------- 반응형 ---------- */
@media (max-width: 960px) {
  .create-layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 24px; }
  .test-panel { position: static; height: 520px; }
}
@media (max-width: 640px) {
  .container { padding: 14px; }
  .detail-hero { flex-direction: column; align-items: stretch; gap: 16px; }
  .detail-portrait { width: 62%; max-width: 260px; margin: 0 auto; }
  .detail-info h1 { font-size: 24px; justify-content: center; }
  .detail-info { text-align: center; }
  .detail-stats, .detail-actions, .detail-info .tags { justify-content: center; }
  .creator-head { flex-wrap: wrap; }
  .creator-head .btn-primary, .creator-head .btn-ghost { width: 100%; }
  .chat-head .chip-btn { padding: 6px 9px; }
  .banner-slide { height: 200px; }
  .banner-text { padding: 18px; max-width: 62%; }
  .banner-text h2 { font-size: 21px; }
  .banner-text p { font-size: 13px; }
  .banner-dots { left: 18px; }
  .rank-card { flex-basis: 118px; }
  .rank-num { font-size: 32px; }
  .topbar { padding: 0 14px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .hero { padding: 22px 18px; border-radius: 18px; }
  .hero h1 { font-size: 21px; }
  .char-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .char-card h3 { font-size: 15px; }
  .form-box { padding: 22px 18px; }
  .chat-layout { padding: 8px 10px 10px; }
  .user, .ai { max-width: 88%; }
  .history-row { grid-template-columns: 1.5fr 1fr 1fr 1fr; font-size: 12px; }
}
@media (min-width: 1000px) {
  .char-grid { grid-template-columns: repeat(5, 1fr); }
}
