/* ─── Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:           #0A0E17;
  --desktop-bg:   #050810;
  --surface:      #131927;
  --border:       #1E2A3A;
  --accent:       #5B8FB9;
  --accent-dim:   #3d6a8a;
  --text:         #E2E8F0;
  --text-muted:   #A8B5C8;
  --text-dim:     #4A5568;
  --msg-user:     #1A2744;
  --radius-card:  12px;
  --radius-btn:   8px;
  --font: 'Pretendard', 'Inter', -apple-system, sans-serif;
}

/* ─── Splash Screen ─────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  background: #0A0E17;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 9999;
  pointer-events: none;
}
#splash.splash-out {
  animation: splashFadeOut 0.4s ease forwards;
}
@keyframes splashFadeOut {
  to { opacity: 0; }
}

.splash-logo {
  font-size: 42px;
  font-weight: 800;
  color: #E2E8F0;
  font-family: 'Pretendard', 'Inter', -apple-system, sans-serif;
  letter-spacing: -0.02em;
  animation: splashLogoIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1);    }
}

.splash-copy {
  font-size: 13px;
  color: #4A5568;
  font-family: 'Pretendard', 'Inter', -apple-system, sans-serif;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: splashCopyIn 0.5s ease 0.3s forwards;
}
@keyframes splashCopyIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  height: 100%;
  min-height: 100vh;
  background: var(--desktop-bg);
  display: flex;
  align-items: stretch;
  justify-content: center;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ─── App Shell ─────────────────────────────────────────── */
#app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Desktop: floating phone */
@media (min-width: 500px) {
  body { align-items: center; padding: 24px 0; }
  #app {
    min-height: calc(100vh - 48px);
    max-height: calc(100vh - 48px);
    border-radius: 24px;
    box-shadow: 0 0 0 1px #0d1520, 0 32px 80px rgba(0,0,0,0.7);
    overflow: hidden;
  }
}

/* ─── Screens ───────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.screen.active { display: flex; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ══════════════════════════════════════════════════════════
   SCREEN 1 — LANDING (Character Select)
══════════════════════════════════════════════════════════ */
#screen-landing {
  padding: 0;
}


.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px 0;
  flex-shrink: 0;
}

/* ── 탐색 화면 ───────────────────────────────────────────── */
/* ── 탭 페이지 공통 헤더 컴포넌트 ──────────────────────── */
.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px 0;
  flex-shrink: 0;
}
.tab-header-with-subtitle {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: 4px;
}
.tab-header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.tab-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tab-body {
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* ── 탐색 전용 검색/태그 ──────────────────────────────── */
.explore-search-wrap {
  padding: 20px 20px 0;
  flex-shrink: 0;
}
.explore-tag-bar {
  display: flex;
  gap: 7px;
  padding: 14px 20px 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.explore-tag-bar::-webkit-scrollbar { display: none; }
.explore-tag-chip {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.explore-tag-chip:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}
.explore-tag-chip.active {
  color: #5B8FB9;
  background: rgba(91, 143, 185, 0.12);
  border-color: rgba(91, 143, 185, 0.4);
}
.explore-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 40px 0;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input, 10px);
  padding: 0 12px;
  height: 42px;
  transition: border-color 0.15s;
}
.search-input-row:focus-within {
  border-color: var(--accent-dim);
}
.search-icon-inline {
  color: var(--text-dim);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
}
.search-input::placeholder { color: var(--text-dim); }
.search-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.search-close-btn:hover { color: var(--text); }
.search-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 32px 0;
}

.landing-header-left {
  display: flex;
  align-items: center;
  margin-left: 4px;
}

.landing-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.btn-icon:hover {
  background: var(--surface);
  color: var(--text);
}

.landing-logo {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
  color: #E2E8F0;
  font-family: 'Pretendard', var(--font);
}

.logo-o-wrap {
  position: relative;
  display: inline-block;
}

.logo-dots {
  position: absolute;
  top: -10px;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  align-items: center;
}

.logo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.logo-dot-1 { background: #5B8FB9; }
.logo-dot-2 { background: #8BA8DC; }

.landing-subtitle {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  color: #4A5568;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.landing-footer {
  padding: 16px 20px 12px;
  flex-shrink: 0;
}

/* ── Bottom navigation bar ───────────────────────────────── */
.bottom-nav {
  width: 100%;
  background: #0D1117;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav.hidden { display: none; }

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0 12px;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.nav-tab:hover { opacity: 0.8; }

.nav-tab-icon {
  font-size: 18px;
  color: #64748B;
  line-height: 1;
}

.nav-tab-label {
  font-size: 10px;
  letter-spacing: 0.03em;
  color: #64748B;
  font-family: var(--font);
}

.nav-tab.active .nav-tab-icon,
.nav-tab.active .nav-tab-label {
  color: #5B8FB9;
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(30, 42, 58, 0.95);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9998;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Character grid — 2-col image cards ──────────────────── */
.char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.char-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
  background: var(--surface);
}
.char-card:not(.char-card-disabled):hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

.char-card-disabled {
  cursor: default;
}

.char-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.char-card-img-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  font-size: 28px;
  color: var(--text-dim);
}

.char-card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--accent);
  font-size: 36px;
  font-weight: 700;
}

/* Gradient overlay */
.char-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 14px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
}

.char-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.char-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}
.char-card-tag {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(2px);
}

.char-card-role {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 4px;
}

/* Coming Soon overlay */
.char-card-coming-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}

.char-card-soon-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 4px 10px;
  backdrop-filter: blur(4px);
}

/* ── 태그 시스템 ─────────────────────────────────────────── */

/* 인트로 화면 태그 */
.intro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.intro-tag-chip {
  font-size: 11px;
  font-weight: 500;
  color: #5B8FB9;
  background: rgba(91, 143, 185, 0.13);
  border: 1px solid rgba(91, 143, 185, 0.28);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: 0.02em;
}

/* 빌더 편집 태그 입력 */
.label-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  cursor: text;
}
.tag-input-wrap:focus-within {
  border-color: var(--accent-dim);
}
.tag-chips {
  display: contents;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #5B8FB9;
  background: rgba(91, 143, 185, 0.15);
  border: 1px solid rgba(91, 143, 185, 0.3);
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  white-space: nowrap;
}
.tag-chip-x {
  background: none;
  border: none;
  color: rgba(91, 143, 185, 0.7);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
}
.tag-chip-x:hover { color: #e05c5c; }
.tag-text-input {
  flex: 1;
  min-width: 80px;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  padding: 0;
}
.tag-text-input::placeholder { color: var(--text-dim); }

/* 추천 태그 */
.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.tag-suggest-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-right: 2px;
}
.tag-suggest-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-raised, var(--surface));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tag-suggest-btn:hover {
  color: #5B8FB9;
  border-color: rgba(91, 143, 185, 0.4);
}

/* ── 준비중 카드 오버레이 ────────────────────────────────── */
.char-card-pending-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-card-pending-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 5px 14px;
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.25);
}

/* ── 공지 캐러셀 ─────────────────────────────────────────── */
.notice-carousel-wrap {
  position: relative;
  overflow: hidden;
  margin-left: -20px;
  margin-right: -20px;
}
.notice-carousel {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.notice-carousel::-webkit-scrollbar { display: none; }

.notice-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  height: 140px;
  background: #000;
}
.notice-pagination {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   SAFETY SEGMENT CONTROL
══════════════════════════════════════════════════════════ */
.safety-segment-wrap {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            8px;
}

.safety-segment {
  display:         inline-flex;
  background:      var(--surface);
  border:          1px solid var(--border);
  border-radius:   10px;
  padding:         3px;
  gap:             2px;
  position:        relative;
}

.safety-seg-btn {
  position:      relative;
  z-index:       1;
  padding:       8px 22px;
  border:        none;
  border-radius: 7px;
  background:    transparent;
  color:         var(--text-dim);
  font-size:     13px;
  font-weight:   500;
  font-family:   var(--font);
  cursor:        pointer;
  transition:    color 0.25s ease;
  white-space:   nowrap;
  letter-spacing: 0.01em;
}

/* On active: text color */
.safety-segment[data-safety="on"]  .safety-seg-btn#safety-btn-on  { color: #fff; }
.safety-segment[data-safety="off"] .safety-seg-btn#safety-btn-off { color: #fff; }

/* Sliding background pill */
.safety-segment::before {
  content:       '';
  position:      absolute;
  top:           3px;
  bottom:        3px;
  border-radius: 7px;
  transition:    left 0.28s ease, width 0.28s ease, background 0.28s ease;
  z-index:       0;
}

/* Position & color per state — approximated widths; JS adjusts via inline style if needed */
.safety-segment[data-safety="on"]::before {
  left:       3px;
  width:      calc(50% - 3px);
  background: var(--accent);     /* #5B8FB9 */
}
.safety-segment[data-safety="off"]::before {
  left:       calc(50% + 1px);
  width:      calc(50% - 4px);
  background: #C0434A;
}

/* Disabled */
.safety-segment-disabled .safety-seg-btn { cursor: not-allowed; opacity: 0.55; }

.safety-segment-hint {
  font-size:   11px;
  color:       #C0434A;
  letter-spacing: 0.02em;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   SCREEN 2 — CHARACTER INTRO
══════════════════════════════════════════════════════════ */
.page-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 0 40px;
}

.page-nav {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  flex: 1;
}

.btn-bookmark { color: var(--text-dim); }
.btn-bookmark.active { color: var(--accent); }

.page-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 4px;
}

/* ── Content Header component (section title + subtitle) ─── */
.content-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.content-header-title {
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
}
.content-header-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Profile table */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.pt-row {
  display: flex;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pt-row:last-child { border-bottom: none; }

.pt-key {
  width: 68px;
  flex-shrink: 0;
  padding: 11px 14px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.pt-val {
  padding: 11px 14px 11px 0;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

/* Note block */
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
}

.note-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.note-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 10px;
}
.note-card p:last-child { margin-bottom: 0; }

/* Worldbuilding accordion */
.wb-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.wb-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  color: var(--text);
}

.wb-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.wb-caret {
  font-size: 16px;
  color: var(--text-dim);
  transition: transform 0.2s;
  line-height: 1;
}

.wb-toggle[aria-expanded="true"] .wb-caret {
  transform: rotate(90deg);
}

.wb-body {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.wb-content {
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
}

.wb-content p {
  margin-bottom: 10px;
}
.wb-content p:last-child { margin-bottom: 0; }

.wb-content strong {
  color: var(--text);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════
   SCREEN 3 — PERSONA SETUP
══════════════════════════════════════════════════════════ */
.recommend-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  align-self: flex-start;
  transition: border-color 0.15s, background 0.15s;
}
.recommend-btn:hover {
  border-color: var(--accent-dim);
  background: rgba(91,143,185,0.06);
}

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

.form-group label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.required { color: var(--accent); margin-left: 2px; }

.form-group input,
.form-group textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

.gender-btn-group {
  display: flex;
  gap: 8px;
}

.gender-btn {
  flex: 1;
  padding: 9px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.gender-btn:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}
.gender-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

/* ══════════════════════════════════════════════════════════
   SCREEN 4 — CHAT
══════════════════════════════════════════════════════════ */
#screen-chat {
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 10;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.chat-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}

.chat-status {
  font-size: 11px;
  color: var(--text-dim);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Messages */
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.user  { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }

.msg-sender {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
  padding: 0 4px;
}

.msg-bubble {
  padding: 12px 15px;
  border-radius: var(--radius-card);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: keep-all;
}

.msg.user .msg-bubble {
  background: var(--msg-user);
  color: var(--text);
  border: 1px solid rgba(91,143,185,0.15);
  border-bottom-right-radius: 3px;
}

.msg.assistant .msg-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-bottom-left-radius: 3px;
  line-height: 1.8;
}

/* Typing */
.typing-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-card);
  border-bottom-left-radius: 3px;
}

.dot {
  width: 5px; height: 5px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: blink 1.3s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Input area */
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.15s;
  line-height: 1.5;
}

.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-dim); }

/* Model bar */
.model-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px 6px;
  background: var(--bg);
  flex-shrink: 0;
}

.btn-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #5b8fb9;
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  color: #5b8fb9;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(91, 143, 185, 0.2);
}
.btn-model:hover {
  border-color: #6ffff7;
  color: #6ffff7;
  box-shadow: 0 0 14px rgba(91, 143, 185, 0.4);
}

.model-caret {
  font-size: 10px;
  opacity: 0.8;
  line-height: 1;
}

/* Model picker popover (position:fixed, outside #app) */
.model-picker {
  position: fixed;
  background: #0f1623;
  border: 1px solid #5b8fb9;
  border-radius: var(--radius-card);
  min-width: 240px;
  display: none;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 -8px 40px rgba(91, 143, 185, 0.18), 0 -2px 16px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: fadeUp 0.12s ease;
}
.model-picker.open { display: flex; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(91, 143, 185, 0.15);
  gap: 12px;
}
.model-option:last-child { border-bottom: none; }
.model-option:hover { background: rgba(91, 143, 185, 0.07); }
.model-option.active { background: rgba(91, 143, 185, 0.12); }

.model-option-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.model-option-name {
  font-size: 13px;
  font-weight: 600;
  color: #e8f0f8;
  letter-spacing: 0.02em;
}
.model-option-desc {
  font-size: 11px;
  color: #8aa0b8;
}
.model-option-check {
  font-size: 14px;
  color: #5b8fb9;
  flex-shrink: 0;
  opacity: 0;
  text-shadow: 0 0 8px rgba(91, 143, 185, 0.8);
}
.model-option.active .model-option-check { opacity: 1; }
.model-option.active .model-option-name  { color: #5b8fb9; }

.model-divider {
  height:     1px;
  background: rgba(91, 143, 185, 0.15);
  margin:     4px 0;
}

.model-provider-badge {
  display:       inline-block;
  font-size:     9px;
  font-weight:   500;
  letter-spacing: 0.06em;
  padding:       1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left:   6px;
  line-height:   1.6;
}

.model-provider-claude {
  background: rgba(91, 143, 185, 0.15);
  color:      #5b8fb9;
  border:     1px solid rgba(91, 143, 185, 0.25);
}

.model-provider-gemini {
  background: rgba(66, 133, 244, 0.12);
  color:      #7baaf7;
  border:     1px solid rgba(66, 133, 244, 0.25);
}

/* ══════════════════════════════════════════════════════════
   SHARED COMPONENTS
══════════════════════════════════════════════════════════ */

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, opacity 0.15s;
  text-align: center;
}
.btn-primary:hover { background: #4a7ea8; }

.btn-ghost {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px 4px 0;
  flex-shrink: 0;
  transition: color 0.15s;
  font-family: var(--font);
}
.btn-back:hover { color: var(--text); }

.btn-send {
  width: 42px;
  height: 42px;
  align-self: flex-end;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.btn-send:hover { background: #4a7ea8; }
.btn-send:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

/* ── Session List ─────────────────────────────────────────── */
.session-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  overflow: hidden;
}
.session-card:hover { border-color: var(--accent-dim); }

/* Avatar */
.session-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  margin-right: 12px;
  align-self: center;
}
.session-card.select-mode .session-avatar-wrap {
  margin-right: 10px;
}

.session-safety-pennant {
  position: absolute;
  top: 0;
  left: 16px;
  width: 16px;
  height: 36px;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
  line-height: 16px;
  padding-top: 4px;
  z-index: 1;
  pointer-events: none;
}
.session-safety-pennant.all-ages { background: var(--accent); }
.session-safety-pennant.adult    { background: #e05c5c; }

.session-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
}
.session-avatar.session-avatar-img {
  background-size: cover;
  background-position: top center;
  font-size: 0;
}
.session-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-char-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.session-date {
  font-size: 11px;
  color: var(--text-dim);
}

.session-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  display: box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  box-orient: vertical;
}

.session-persona-tag {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  display: block;
}

/* ── History Subheader ───────────────────────────────────── */
.history-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 0;
  flex-shrink: 0;
}
.history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.history-action-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s;
}
.history-action-btn:hover { color: var(--text); }

/* 선택삭제 모드의 "삭제" 버튼 */
.history-action-btn--delete {
  color: #e05c5c;
}
.history-action-btn--delete:hover { color: #f07070; }
.history-action-btn--delete:disabled {
  color: var(--text-dim);
  cursor: default;
  opacity: 0.45;
}

.session-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

/* Checkbox: hidden by default, slides in from left */
.session-checkbox {
  flex-shrink: 0;
  width: 0;
  height: 18px;
  margin-right: 0;
  border-radius: 4px;
  border: 1.5px solid transparent;
  background: var(--surface);
  cursor: pointer;
  transition: width 0.2s ease, margin-right 0.2s ease, border-color 0.15s, background 0.15s;
  position: relative;
  display: inline-block;
  overflow: hidden;
}

/* Slide in */
.session-card.select-mode .session-checkbox {
  width: 18px;
  margin-right: 12px;
  border-color: var(--text-muted);
  border-width: 2px;
}

/* Checked state */
.session-card.select-mode .session-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.session-card.select-mode .session-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: #fff;
  line-height: 1;
}

/* Selected card highlight */
.session-card.selected {
  border-color: var(--accent-dim);
  background: rgba(91, 143, 185, 0.06);
}

/* ── Delete Confirm Modal ─────────────────────────────────── */
.delete-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.delete-modal-overlay.open {
  display: flex;
}
.delete-modal {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.delete-modal-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.delete-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.delete-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.delete-modal-actions .btn-ghost {
  flex: 1;
}
.btn-delete-confirm {
  flex: 1;
  background: #e05c5c;
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-delete-confirm:hover { background: #c94f4f; }

/* ── Regenerate Pagination ───────────────────────────────── */
.msg-pagination {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.btn-pg {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 11px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font);
}
.btn-pg:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--accent); }
.btn-pg:disabled { opacity: 0.25; cursor: default; }

.pg-counter {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 28px;
  text-align: center;
}

/* ── Regenerate Button ──────────────────────────────────── */
.btn-regenerate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  align-self: flex-start;
}
.btn-regenerate:hover  { border-color: var(--accent-dim); color: var(--accent); }
.btn-regenerate:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════
   NOVEL MODE
══════════════════════════════════════════════════════════ */
.chat-messages.novel-mode {
  padding: 28px 22px;
  gap: 0;
}

/* Ihwa — full-width prose block */
.novel-mode .msg.assistant {
  max-width: 100%;
  align-self: stretch;
  align-items: flex-start;
  margin-bottom: 20px;
}

.novel-mode .msg.assistant .msg-sender { display: none; }

.novel-mode .msg.assistant .msg-bubble {
  background:    transparent;
  border:        none;
  border-left:   none;
  border-radius: 0;
  padding:       0;
  font-size:     15px;
  line-height:   1.9;
  color:         var(--text);
  width:         100%;
}

/* Dialogue highlight: "..." */
.novel-mode .dialogue {
  color:            var(--text);
  background:       rgba(91, 143, 185, 0.10);
  border-radius:    3px;
  padding:          1px 3px;
  font-style:       normal;
}

/* User — right-aligned, muted */
.novel-mode .msg.user {
  max-width: 100%;
  align-self: stretch;
  align-items: flex-end;
  margin-bottom: 20px;
}

.novel-mode .msg.user .msg-sender { display: none; }

.novel-mode .msg.user .msg-bubble {
  background:    transparent;
  border:        none;
  border-radius: 0;
  padding:       0;
  font-size:     13px;
  line-height:   1.7;
  color:         var(--text-muted);
  text-align:    right;
  font-style:    italic;
}

/* Typing in novel mode */
.novel-mode .typing-bubble {
  background:  transparent;
  border:      none;
  border-left: none;
  padding:     4px 0;
}

/* Mode toggle button */
.btn-mode-toggle {
  margin-left: auto;
  padding:     6px 10px;
  background:  transparent;
  border:      1px solid var(--border);
  border-radius: 6px;
  color:       var(--text-muted);
  font-size:   12px;
  font-family: var(--font);
  cursor:      pointer;
  white-space: nowrap;
  transition:  border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-mode-toggle:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ── Note Button ────────────────────────────────────────── */
.btn-note {
  position:      relative;
  padding:       6px 8px;
  background:    transparent;
  border:        1px solid var(--border);
  border-radius: 6px;
  color:         var(--text-muted);
  font-size:     14px;
  cursor:        pointer;
  flex-shrink:   0;
  transition:    border-color 0.15s, color 0.15s;
}
.btn-note:hover { border-color: var(--accent-dim); color: var(--accent); }

.note-dot {
  position:      absolute;
  top:           4px;
  right:         4px;
  width:         6px;
  height:        6px;
  background:    var(--accent);
  border-radius: 50%;
}

/* ── Chat Header Profile Button ─────────────────────────── */
.chat-header-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  text-align: left;
  transition: background 0.15s;
}
.chat-header-profile-btn:hover { background: rgba(255,255,255,0.05); }

/* ── Character Profile Modal ─────────────────────────────── */
.char-profile-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.char-profile-overlay.open { display: flex; }

.char-profile-panel {
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}
.char-profile-panel.closing {
  animation: slideDown 0.22s ease forwards;
}
@keyframes slideDown {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(100%); opacity: 0; }
}

.char-profile-header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px 0;
}

.char-profile-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.char-profile-close:hover { color: var(--text); }

.char-profile-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 20px 32px;
}

.char-profile-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid var(--border);
  align-self: center;
  margin-top: 4px;
}

.char-profile-names {
  text-align: center;
}

.char-profile-fullname {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.char-profile-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* ── Note Modal ─────────────────────────────────────────── */
.note-overlay {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(5, 8, 16, 0.7);
  z-index:         100;
  align-items:     flex-end;
  justify-content: center;
}
.note-overlay.open { display: flex; }

.note-panel {
  width:            100%;
  max-width:        430px;
  background:       var(--surface);
  border-top:       1px solid var(--border);
  border-radius:    16px 16px 0 0;
  padding:          20px 20px 32px;
  display:          flex;
  flex-direction:   column;
  gap:              12px;
  animation:        slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.note-panel-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
}

.note-panel-title {
  font-size:   15px;
  font-weight: 500;
  color:       var(--text);
}

.note-close {
  background:    none;
  border:        none;
  color:         var(--text-dim);
  font-size:     16px;
  cursor:        pointer;
  padding:       2px 4px;
  transition:    color 0.15s;
}
.note-close:hover { color: var(--text); }

.note-panel-desc {
  font-size:   12px;
  color:       var(--text-dim);
  line-height: 1.6;
}

.note-textarea {
  width:        100%;
  min-height:   140px;
  background:   var(--bg);
  border:       1px solid var(--border);
  border-radius: var(--radius-btn);
  padding:      12px 14px;
  color:        var(--text);
  font-size:    14px;
  font-family:  var(--font);
  line-height:  1.65;
  resize:       vertical;
  outline:      none;
  transition:   border-color 0.15s;
}
.note-textarea:focus   { border-color: var(--accent); }
.note-textarea::placeholder { color: var(--text-dim); }

.note-footer {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
}

.note-count {
  font-size: 11px;
  color:     var(--text-dim);
}

.note-save-btn {
  width:   auto;
  padding: 10px 24px;
}

/* ══════════════════════════════════════════════════════════
   CHARACTER IMAGE
══════════════════════════════════════════════════════════ */

/* Landing — tall image with bottom fade */
.landing-img-wrap {
  position:      relative;
  width:         200px;
  height:        200px;
  margin:        0 auto 24px;
  border-radius: 50%;
  overflow:      hidden;
  border:        1px solid var(--border);
}

.landing-img {
  width:       100%;
  height:      100%;
  object-fit:  cover;
  object-position: top center;
  display:     block;
}

.landing-img-fade {
  position:   absolute;
  bottom:     0;
  left:       0;
  right:      0;
  height:     50%;
  background: linear-gradient(to bottom, transparent, var(--bg));
}

/* Intro page — rectangular card image */
.intro-img-wrap {
  width:         100%;
  height:        500px;
  border-radius: var(--radius-card);
  overflow:      hidden;
  border:        1px solid var(--border);
}

.intro-img {
  width:           100%;
  height:          100%;
  object-fit:      cover;
  object-position: top center;
  display:         block;
}

/* Chat — small circular avatar beside message */
.msg-avatar {
  width:         36px;
  height:        36px;
  border-radius: 50%;
  object-fit:    cover;
  object-position: top center;
  border:        1px solid var(--border);
  flex-shrink:   0;
  align-self:    flex-start;
  margin-bottom: 2px;
}

/* Layout: avatar + (sender + bubble) side by side */
.msg.assistant {
  flex-direction: row;
  align-items:    flex-start;
  gap:            8px;
}

.msg.assistant .msg-inner {
  display:        flex;
  flex-direction: column;
  align-items:    flex-start;
  min-width:      0;
}

/* Novel mode — hide avatar */
.novel-mode .msg-avatar { display: none; }
.novel-mode .msg.assistant { flex-direction: column; }

/* ══════════════════════════════════════════════════════════
   USER MESSAGE — corrections
══════════════════════════════════════════════════════════ */

/* Chat mode: same font size as Ihwa, no italic */
.msg.user .msg-bubble {
  font-size:   14px;
  font-style:  normal;
}

/* Novel mode: left-align, no italic, same size */
.novel-mode .msg.user {
  align-self:  flex-start;
  align-items: flex-start;
}
.novel-mode .msg.user .msg-bubble {
  text-align:  left;
  font-style:  normal;
  font-size:   15px;
  color:       var(--text-muted);
}

/* ── User avatar in chat ─────────────────────────────────── */
.msg.user {
  flex-direction: row-reverse;
  gap:            8px;
}

.msg-user-avatar {
  width:           36px;
  height:          36px;
  border-radius:   50%;
  object-fit:      cover;
  object-position: center;
  border:          1px solid var(--border);
  flex-shrink:     0;
  align-self:      flex-start;
}

.msg.user .msg-inner-user {
  display:        flex;
  flex-direction: column;
  align-items:    flex-end;
  min-width:      0;
}

/* Novel mode: hide user avatar */
.novel-mode .msg-user-avatar { display: none; }
.novel-mode .msg.user        { flex-direction: column; }
.novel-mode .msg.user .msg-inner-user { align-items: flex-start; }

/* ── Profile image upload button ─────────────────────────── */
.upload-avatar-wrap { display: flex; align-items: center; gap: 12px; }

.upload-avatar {
  width:           72px;
  height:          72px;
  border-radius:   50%;
  border:          1.5px dashed var(--border);
  background:      var(--surface);
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  position:        relative;
  overflow:        hidden;
  transition:      border-color 0.15s;
  flex-shrink:     0;
}
.upload-avatar:hover { border-color: var(--accent-dim); }

.upload-avatar-plus {
  font-size:  24px;
  color:      var(--text-dim);
  line-height: 1;
  user-select: none;
}

.upload-avatar-img {
  position:    absolute;
  inset:       0;
  width:       100%;
  height:      100%;
  object-fit:  cover;
  object-position: center;
}

.upload-avatar-hint {
  font-size:   12px;
  color:       var(--text-dim);
  line-height: 1.6;
}

.upload-remove {
  display:       none;
  font-size:     11px;
  color:         var(--text-dim);
  background:    none;
  border:        none;
  cursor:        pointer;
  padding:       0;
  font-family:   var(--font);
  text-decoration: underline;
}
.upload-remove:hover { color: var(--danger, #c25f5f); }

/* ══════════════════════════════════════════════════════════
   BUILDER SCREENS (6, 7, 8)
══════════════════════════════════════════════════════════ */

/* ── Screen 6: Builder Chat ─────────────────────────────── */
#screen-builder-chat { overflow: hidden; }

/* Header avatar — ✦ symbol circle */
/* ── Builder 방식 선택 ───────────────────────────────────── */
/* ── 공통 선택 카드 컴포넌트 ─────────────────────────────── */
.select-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.select-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.select-card:hover {
  border-color: var(--accent-dim);
  background: rgba(91,143,185,0.05);
}
.select-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(91,143,185,0.1);
  border: 1px solid rgba(91,143,185,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}
.select-card-body {
  flex: 1;
  min-width: 0;
}
.select-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.select-card-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.select-card-arrow {
  font-size: 20px;
  color: var(--text-dim);
  flex-shrink: 0;
  line-height: 1;
}

/* ── Builder 헤더 아바타 ─────────────────────────────────── */
.builder-header-avatar {
  width:           34px;
  height:          34px;
  border-radius:   50%;
  background:      rgba(91,143,185,0.12);
  border:          1px solid rgba(91,143,185,0.3);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       15px;
  color:           var(--accent);
  flex-shrink:     0;
}

/* Message avatar for builder agent */
.builder-avatar {
  width:           36px;
  height:          36px;
  border-radius:   50%;
  background:      rgba(91,143,185,0.10);
  border:          1px solid rgba(91,143,185,0.25);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       14px;
  color:           var(--accent);
  flex-shrink:     0;
  align-self:      flex-start;
  margin-bottom:   2px;
}

/* "캐릭터 생성하기" CTA button inside builder message */
.btn-builder-generate {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  margin-top:    12px;
  padding:       10px 18px;
  background:    var(--accent);
  color:         #fff;
  border:        none;
  border-radius: var(--radius-btn);
  font-size:     13px;
  font-weight:   600;
  font-family:   var(--font);
  cursor:        pointer;
  letter-spacing: 0.02em;
  transition:    background 0.15s;
  align-self:    flex-start;
}
.btn-builder-generate:hover { background: #4a7ea8; }

/* ── Screen 7: Builder Loading ──────────────────────────── */
#screen-builder-loading {
  align-items:     center;
  justify-content: center;
}

.builder-loading-wrap {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            16px;
  padding:        40px 30px;
  text-align:     center;
}

.builder-loading-icon {
  font-size:   52px;
  color:       var(--accent);
  animation:   builderPulse 1.8s ease-in-out infinite;
  line-height: 1;
}

@keyframes builderPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.92); }
  50%       { opacity: 1;   transform: scale(1.06); }
}

.builder-loading-title {
  font-size:   18px;
  font-weight: 500;
  color:       var(--text);
}

.builder-loading-desc {
  font-size:   13px;
  color:       var(--text-dim);
  line-height: 1.6;
}

.builder-progress {
  width:         200px;
  height:        2px;
  background:    var(--border);
  border-radius: 2px;
  overflow:      hidden;
  margin-top:    4px;
}

.builder-progress-bar {
  height:        100%;
  background:    var(--accent);
  border-radius: 2px;
  width:         0%;
  transition:    width 0.4s ease;
}

/* ── Screen 8: Builder Edit — toggle switch ─────────────── */
.builder-toggle-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         14px 0;
  border-top:      1px solid var(--border);
  border-bottom:   1px solid var(--border);
  gap:             12px;
}

.builder-toggle-label {
  font-size:   14px;
  font-weight: 500;
  color:       var(--text);
}

.builder-toggle-desc {
  font-size:   12px;
  color:       var(--text-dim);
  margin-top:  3px;
  line-height: 1.5;
}

.toggle-switch {
  position:    relative;
  width:       44px;
  height:      26px;
  flex-shrink: 0;
  cursor:      pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-thumb {
  position:      absolute;
  inset:         0;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 26px;
  transition:    background 0.2s, border-color 0.2s;
}

.toggle-thumb::before {
  content:       '';
  position:      absolute;
  left:          4px;
  top:           50%;
  transform:     translateY(-50%);
  width:         16px;
  height:        16px;
  background:    var(--text-dim);
  border-radius: 50%;
  transition:    transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-thumb {
  background:   rgba(91,143,185,0.18);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-thumb::before {
  transform:  translateY(-50%) translateX(18px);
  background: var(--accent);
}

/* ══════════════════════════════════════════════════════════
   AUTH — Login / Register
══════════════════════════════════════════════════════════ */
.field-error {
  font-size: 12px;
  color: #e06c75;
  min-height: 16px;
  margin-top: 4px;
}

.auth-switch {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-text-link.danger { color: #e06c75; }
.btn-text-link:hover { opacity: 0.8; }

/* ── Auth Gate Modal ──────────────────────────────────────*/
.auth-gate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.auth-gate-overlay.open { display: flex; }

.auth-gate-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 430px;
}
.auth-gate-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.auth-gate-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.auth-gate-actions {
  display: flex;
  gap: 10px;
}
.auth-gate-actions .btn-ghost { flex: 1; }
.auth-gate-btn { flex: 2; }

/* ── Mypage modal overlay (reuse delete-modal-overlay) ──── */
#mypage-modal-overlay.open { display: flex; }
#mypage-modal-overlay .delete-modal { padding: 24px; width: 100%; }

/* ══════════════════════════════════════════════════════════
   SCREEN 10 — MYPAGE
══════════════════════════════════════════════════════════ */
.mypage-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 4px;
}

.mypage-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.mypage-nickname {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.mypage-email {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 3px;
}

.mypage-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.mypage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
}
.mypage-row:last-child { border-bottom: none; }
.mypage-row:hover { background: rgba(255,255,255,0.03); }
.mypage-row-arrow { color: var(--text-dim); font-size: 18px; }
.mypage-row-toggle { cursor: default; }
.mypage-row-toggle:hover { background: none; }
.mypage-row-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.mypage-empty {
  font-size: 13px;
  color: var(--text-dim);
  padding: 16px;
  text-align: center;
}

.mypage-persona-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.mypage-persona-card:last-child { border-bottom: none; }
.mypage-persona-card.is-default { background: rgba(91,143,185,0.06); }

.mypage-persona-info { display: flex; flex-direction: column; gap: 2px; }
.mypage-persona-name { font-size: 14px; color: var(--text); }
.mypage-persona-meta { font-size: 12px; color: var(--text-dim); }

.default-badge {
  display: inline-block;
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

.mypage-persona-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.mypage-char-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.mypage-char-row:last-child { border-bottom: none; }

.mypage-char-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}

.mypage-char-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mypage-char-thumb-empty {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Avatar upload ───────────────────────────────────────── */
.mypage-avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.mypage-avatar-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}
.mypage-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  pointer-events: none;
}

/* ── Char actions ────────────────────────────────────────── */
.mypage-char-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.mypage-char-link:hover { opacity: 0.8; }

.mypage-char-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.mypage-char-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-dim);
  padding: 0;
  text-decoration: underline;
}
.mypage-char-action-btn.danger { color: #e06c75; }
.mypage-char-action-btn:hover { opacity: 0.7; }

/* ── Mypage underline tabs ───────────────────────────────── */
.mypage-tab-bar {
  position: relative;
  display: flex;
  border-bottom: 1px solid var(--border);
}

.mypage-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font);
  padding: 11px 0 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.mypage-tab.active {
  color: var(--text);
  font-weight: 600;
}

.mypage-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 33.333%;
  height: 2px;
  background: var(--accent);
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tab panels ──────────────────────────────────────────── */
.mypage-tab-panel {
  display: none;
  padding-top: 16px;
}
.mypage-tab-panel.active {
  display: block;
  animation: mpFadeIn 0.18s ease;
}
@keyframes mpFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Tab panel topbar ────────────────────────────────────── */
.mypage-panel-topbar {
  display: flex;
  justify-content: flex-end;
  min-height: 20px;
  margin-bottom: 10px;
}

/* ── Shared card grid (persona + char) ───────────────────── */
.mypage-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mypage-card-grid > p {
  grid-column: 1 / -1;
  text-align: center;
}

/* ── Persona card ────────────────────────────────────────── */
.mypage-p-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #1c2135 0%, #252b40 100%);
  border: 1px solid var(--border);
  cursor: pointer;
}
.mypage-p-card.is-default {
  border-color: var(--accent);
}
/* 이미지 있는 카드 */
.mypage-p-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 이미지 없는 카드 — 중앙 아이콘 영역 */
.mypage-p-no-img {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mypage-p-add-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.35);
}
.mypage-p-initial {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 56px;
  font-weight: 700;
  color: rgba(255,255,255,0.07);
  letter-spacing: -2px;
  pointer-events: none;
  user-select: none;
}
.mypage-p-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 12px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0) 100%);
}
/* 이미지 없는 카드는 오버레이 더 연하게 */
.mypage-p-card:not(.has-image) .mypage-p-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.1) 55%, rgba(0,0,0,0) 100%);
}
.mypage-p-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.mypage-p-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.mypage-p-actions {
  display: flex;
  gap: 8px;
}

/* ── Char card wrapper ───────────────────────────────────── */
.mypage-char-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mypage-char-card-wrap .char-card {
  cursor: pointer;
}
.mypage-char-card-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Shared card action buttons ──────────────────────────── */
.mypage-card-action-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-family: var(--font);
  color: rgba(255,255,255,0.45);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mypage-card-action-btn.danger { color: rgba(224,108,117,0.7); }
.mypage-card-action-btn:hover { opacity: 0.8; }

/* ── Persona form/choice wrappers ───────────────────────── */
#persona-form-wrap,
#persona-choice-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#persona-choice-wrap { display: none; } /* JS로 제어, 기본 숨김 */

/* ── Persona choice cards ────────────────────────────────── */
/* persona-choice → select-card 컴포넌트로 통합 */

/* ── Persona detail screen ───────────────────────────────── */
.pd-card-wrap {
  padding: 4px 0 0;
}
.pd-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: linear-gradient(160deg, #1c2135 0%, #252b40 100%);
  border: 1px solid var(--border);
  cursor: pointer;
}
/* 이미지 업로드 호버 힌트 */
.pd-card::after {
  content: '사진 변경';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.2s;
}
.pd-card:hover::after { opacity: 1; }
/* 이미지 있는 경우 */
.pd-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 이미지 없는 경우 — 중앙 아이콘 */
.pd-card-no-img {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pd-card-no-img-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
}
/* 하단 오버레이 — 이름/나이/성별 */
.pd-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 14px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
}
.pd-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}
.pd-card-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}
.pd-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  width: 100%;
}
.pd-default-label {
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  padding: 10px 0;
}
.pd-delete-link {
  background: none;
  border: none;
  font-size: 12px;
  font-family: var(--font);
  color: #e05555;
  cursor: pointer;
  padding: 4px 0;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.pd-delete-link:hover { opacity: 1; }

/* ── Add button ──────────────────────────────────────────── */
.mypage-add-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-btn);
  color: var(--accent);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.mypage-add-btn:hover { background: rgba(255,255,255,0.03); }

/* ── Logout / delete text buttons ───────────────────────── */
.mypage-text-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
  margin-bottom: 8px;
}
.mypage-text-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
}
.mypage-text-btn.danger { color: rgba(224,108,117,0.7); }
.mypage-text-btn:hover { color: var(--text-muted); }
.mypage-text-btn.danger:hover { color: #e06c75; }
.mypage-text-divider {
  color: var(--text-dim);
  font-size: 12px;
  pointer-events: none;
}

/* ── Adult content toggle (main landing) ─────────────────── */
.adult-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  margin-bottom: 4px;
}
.adult-toggle-label {
  font-size: 13px;
  color: var(--text-muted);
}
.adult-segment {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.adult-seg-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-family: var(--font);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.adult-seg-btn.active {
  background: var(--accent);
  color: #fff;
}
.adult-seg-btn:last-child.active {
  background: #c94f4f;
  color: #fff;
}

/* ── Adult verify modal check row ────────────────────────── */
.adult-verify-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.adult-verify-check-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ── Builder rating select ────────────────────────────────── */
.rating-select-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rating-select-btn {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}
.rating-select-btn.active {
  border-color: var(--accent);
  color: var(--text);
}
.rating-select-btn[data-value="adult_only"].active {
  border-color: #c94f4f;
}
