@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300&family=Noto+Serif+KR:wght@300;400;500&family=Poppins:wght@300;400;700&display=swap');

:root {
  --primary: #BCA0CE;
  /* soft lilac */
  --primary-light: #D8BFD8;
  --primary-transparent: rgba(188, 160, 206, 0.15);
  --secondary: #E0A6C7;
  /* minimal warm blush */
  --bg-color: #FAF9F6;
  /* warm cream/sand */
  --surface: #FFFFFF;
  --text-dark: #2D2A2B;
  --text-muted: #858082;
  --border: #F0EBEF;
  --glass: rgba(255, 255, 255, 0.8);
  --pass-lilac: #C9A8E0;
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Home-screen(standalone) 실행에서는 콘텐츠가 상태바 아래로 깔린다.
   WebKit이 첫 페인트에 env()를 0으로 돌려주는 구간이 있어 그동안의
   바닥값을 깔아둔다. 실제 값이 잡히면 app.js의 primeSafeArea()가
   --safe-top을 측정값으로 덮어쓴다. 가로 모드는 상단 인셋이 없으므로 제외. */
@media (display-mode: standalone) and (orientation: portrait),
       (display-mode: fullscreen) and (orientation: portrait) {
  :root {
    --safe-top: max(env(safe-area-inset-top, 0px), 44px);
  }
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', 'Outfit', -apple-system, sans-serif;
  background-color: #E2DFDF;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh; min-height: 100dvh; min-height: var(--app-vh, 100dvh);
  color: var(--text-dark);
  /* NOT overflow:hidden — standalone iOS needs a real, user-reachable
     scroll for WebKit to recompute env(safe-area-inset-top) (see
     primeSafeArea() in app.js). #app-container below clips its own
     content, so this never causes visible scrolling. */
}

/* 실기기: 뷰포트를 그대로 채운다. 높이 상한(812px)을 두면 iOS Safari
   툴바가 접혔다 펼쳐질 때 dvh가 상한을 넘나들며 컨테이너가 상단 정렬 ↔
   중앙 정렬로 튀어, 스플래시가 붙었다 내려오는 것처럼 보인다.
   100dvh 자체도 standalone 콜드 런치 시 한 박자 늦게 안정되는 별도의
   WebKit 버그가 있어(env(safe-area-inset-top)과는 다른 메커니즘), CSS
   dvh 대신 app.js의 syncAppHeight()가 실측해 넣는 --app-vh를 우선한다.
   --app-vh가 아직 없으면(JS 실행 전 아주 짧은 순간, 또는 JS 비활성)
   dvh로 자연 폴백. */
#app-container {
  width: 100%;
  height: 100vh; height: 100dvh; height: var(--app-vh, 100dvh);
  background-color: var(--bg-color);
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* 데스크톱 프리뷰용 폰 목업 프레임. 실제 폰 폭(390~430px)에는 걸리지
   않도록 브레이크포인트를 넉넉히 잡는다. */
@media (min-width: 700px) {
  #app-container {
    max-width: 375px;
    max-height: 812px;
    border-radius: 40px;
    border: 8px solid #FFFFFF;
  }
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.45s ease;
  z-index: 1;
  /* Single source of truth for status-bar clearance — every screen
     goes through createScreen() and gets class="screen", so this
     can't be missed the way per-screen header classes were. */
  padding-top: var(--safe-top);
}

.screen.hidden-right {
  transform: translateX(100%);
  z-index: 2;
}

.screen.hidden-left {
  transform: translateX(-30%);
  opacity: 0.3;
  z-index: 0;
}

.screen.active {
  transform: translateX(0);
  z-index: 10;
  opacity: 1;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

h3 {
  font-size: 18px;
  font-weight: 500;
}

p {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
}

.content-padding {
  padding: 40px 24px;
}

.flex-spacer {
  flex: 1;
}

.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 100px;
  height: 100%;
  transition: padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-y.nav-hidden-content {
  padding-bottom: 16px;
}

.scroll-y::-webkit-scrollbar {
  display: none;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  color: #FFF;
  border: none;
  border-radius: 100px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  font-family: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary.disabled {
  background: #D3D1C7;
  box-shadow: none;
  cursor: default;
}

.btn-primary.disabled:active {
  transform: none;
}

/* Inputs */
.input-field {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 18px;
  font-family: inherit;
  color: var(--text-dark);
  transition: border-color 0.3s;
  margin-bottom: 24px;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
}

/* Terminal failure screen — see showFatalError() in app.js. Sits above every
   other layer, including modals (z-index 9999) and toasts. */
.fatal-error-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  box-sizing: border-box;
  background: var(--bg-color, #FAF9F6);
}

.fatal-error-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.fatal-error-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.fatal-error-text {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dark);
}

.fatal-error-btn {
  border: none;
  border-radius: 24px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: #E2FF74;
  color: #2D2A2B;
  cursor: pointer;
}

/* Confirms the invite code was picked out of a pasted message.
   See handleInviteCodePaste() in app.js. */
@keyframes inviteCodeAutofill {
  0% {
    background: rgba(226, 255, 116, 0.85);
    border-color: var(--primary);
  }
  100% {
    background: var(--surface);
    border-color: var(--border);
  }
}

.input-field.invite-code-autofilled {
  animation: inviteCodeAutofill 0.9s ease-out;
}

.input-field::placeholder {
  color: #C4C4C4;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 10px;
  background: var(--bg-color);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: #9B72CC;
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
}

.tab-watermark {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: #9B72CC;
  opacity: 0.18;
  display: flex;
  align-items: baseline;
  justify-content: center;
  line-height: 1;
  padding: 20px 0 12px;
  user-select: none;
}

/* ── Shared tab header layout ────────────────────────── */
.tab-header {
  padding: 10px 24px 0;
}

.tab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-height: 40px;
}

.tab-header-row h2 {
  margin: 0;
}

.tab-header-subtitle {
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.tab-header-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* For containers whose own top padding already matches .tab-header
   (10px) but that don't supply the 24px side padding themselves. */
.tab-header-pad-x {
  padding: 0 24px;
}



/* Nav Bar */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #FFFFFF;
  border-top: 1px solid #F0F0F0;
  border-radius: 20px 20px 0 0;
  z-index: 150;
  /* Ensure nav is above modals */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 24px;
}

.bottom-nav.nav-hidden {
  transform: translateY(calc(100% + 20px));
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 1;
}

.nav-icon {
  width: 24px;
  height: 24px;
  color: #B0B0AC;
  stroke-width: 1.75;
  transition: color 0.3s, stroke-width 0.3s;
}

.nav-item.active .nav-icon {
  color: #C89FDB;
  stroke-width: 2.25;
}

/* ── Splash Screen — Book Cover ────────────────────────── */
#splash {
  background: linear-gradient(to right, #E2FF74 0%, #C8B8D0 50%, #C89FDB 100%);
  overflow: hidden;
  position: relative;
  z-index: 100;
  /* Full-bleed cover — must extend under the status bar, not be pushed down. */
  padding-top: 0;
}

@keyframes spineIn {
  from {
    transform: translateX(-56px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes logoIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeUpIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Book Spine ── */
.splash-spine {
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 100%;
  background: #E2FF74;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(40px + var(--safe-top)) 0 calc(24px + env(safe-area-inset-bottom, 0px)) 0;
  z-index: 5;
  animation: spineIn 0.4s ease-out both;
}

/* All spine text: vertical-lr = reads top→bottom */
.splash-spine-logo,
.splash-spine-tagline,
.splash-spine-studio {
  writing-mode: vertical-lr;
  color: #C89FDB;
}

.splash-spine-logo {
  font-family: 'Poppins', 'Futura', sans-serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: normal;
  display: inline-flex;
  align-items: baseline;
}

.splash-spine-tagline {
  font-size: 11px;
  letter-spacing: 0.08em;
  font-family: 'Poppins', 'Pretendard', sans-serif;
  font-weight: 700;
}

.splash-spine-studio {
  font-size: 10px;
  letter-spacing: 0.06em;
  font-family: 'Poppins', 'Pretendard', sans-serif;
  font-weight: 700;
}


/* ── Book Cover (right of spine) ── */
.splash-cover {
  position: absolute;
  left: 56px;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* TOP zone */
.splash-tagline-top {
  padding-top: calc(48px + var(--safe-top));
  font-size: 15px;
  font-weight: 700;
  color: #E2FF74;
  letter-spacing: 0.05em;
  font-family: 'Poppins', 'Pretendard', sans-serif;
  opacity: 0;
  animation: fadeUpIn 0.45s ease-out 0.5s both;
}

/* CENTER zone */
.splash-logo-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 60px;
  color: #E2FF74;
  display: flex;
  align-items: baseline;
  justify-content: center;
  line-height: 1;
  animation: logoIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

/* BOTTOM zone */
.splash-studio {
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  font-size: 14px;
  font-weight: 700;
  color: #B36AE2;
  letter-spacing: 0.08em;
  line-height: 1.6;
  text-align: center;
  font-family: 'Poppins', 'Pretendard', sans-serif;
  opacity: 0;
  animation: fadeUpIn 0.45s ease-out 0.7s both;
}





/* Upload avatar placeholder */
.avatar-upload {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px dashed var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 32px;
  color: var(--primary);
  cursor: pointer;
}

/* Quiz Options */
.quiz-option {
  width: 100%;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 2px solid transparent;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  color: var(--text-dark);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-transparent);
}

.intent-option {
  width: 100%;
  padding: 24px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  align-items: center;
}

.intent-option.selected {
  background: #FAF7FF;
  border-color: var(--primary);
  border-left: 5px solid var(--primary);
}


/* Tag Pills */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  padding: 10px 16px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-pill.selected {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

.tag-pill.disabled {
  background: #F8F8F8;
  color: #BBB;
  border-color: #EEE;
  cursor: default;
}


.tag-category {
  margin-top: 24px;
}

.tag-category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  display: block;
}

.interest-counter {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: color 0.2s;
}

.interest-counter.ready {
  color: var(--primary);
}

/* Decade Slider (Onboarding Step 5) */
.decade-slider-container {
  margin: 48px 0;
  padding: 0 10px;
  position: relative;
}

.decade-slider-display {
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
}

.decade-track-box {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.decade-track-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: all 0.15s ease;
}

.decade-track-marker {
  position: absolute;
  top: -12px;
  width: 2px;
  height: 28px;
  background: var(--primary);
  z-index: 2;
}

.decade-snap-points {
  position: absolute;
  top: 12px;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.snap-point-label {
  font-size: 9px;
  color: var(--text-muted);
  transform: rotate(-45deg);
  transform-origin: top left;
  white-space: nowrap;
  margin-top: 8px;
}

.decade-handle {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  background: #FFF;
  border: 2px solid var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 5;
  transition: left 0.08s ease, transform 0.08s;
}

.decade-handle.snapping {
  transform: translate(-50%, -50%) scale(1.08);
}

.decade-handle:active {
  cursor: grabbing;
}

/* Role Choice Grid 2x2 */
.role-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

/* Teaser Card (Frosted/Gradient) */
.teaser-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  border: none;
  pointer-events: all !important;
}

.teaser-card * {
  pointer-events: none;
}

.teaser-card.gradient-lilac {
  background: linear-gradient(135deg, #F3E8FF 0%, #E9D5FF 100%);
}

.teaser-card.gradient-lavender {
  background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
}

.teaser-card.gradient-cream {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
}

.teaser-frosted-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(4px);
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.teaser-q-num {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #aaa;
  z-index: 2;
}

.teaser-q-num.on-dark {
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.teaser-q-text {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  line-height: 1.4;
  z-index: 2;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 28px 10px 10px 10px;
  text-align: left;
}

.teaser-q-text.on-dark {
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Notebook Paper Style — kept minimal: just white bg for grid cards */
.notebook-paper {
  background: #FFF !important;
}

/* Polaroid Style */
.polaroid-frame {
  background: #FFF;
  padding: 8px 8px 32px 8px;
  box-shadow: 2px 3px 12px rgba(0, 0, 0, 0.12);
  transform: rotate(-2deg);
  width: 150px;
  height: auto;
  margin: 16px auto;
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.polaroid-frame::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 40px;
  height: 16px;
  background: rgba(180, 160, 220, 0.2);
  transform: translateX(-50%) rotate(5deg);
}

.polaroid-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}




/* Range Slider (Onboarding Step 5) */
.range-slider-container {
  margin: 32px 0;
  padding: 0 10px;
}

.range-slider-display {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
}

.range-track-box {
  position: relative;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

.range-track-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.range-handle {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  background: #FFF;
  border: 2px solid var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 5;
}

.range-handle:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Multi-select Roles */
.role-pills-multi {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.role-pill-multi {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  background: #FFF;
  transition: all 0.2s;
}

.role-pill-multi.active {
  background: var(--primary);
  color: #FFF;
}

/* Bottom Sheet CTA */
.bottom-sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  /* Block clicks only when active */
}

.bottom-sheet-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #FFF;
  border-radius: 24px 24px 0 0;
  padding: 32px 24px 48px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 2001;
  pointer-events: all;
}

.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}

/* Modal Container Fixes */
#modal-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

#modal-container .modal {
  pointer-events: all;
}

.sheet-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.sheet-body {
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.6;
  margin-bottom: 32px;
}


/* Mixed Feed UI */
.mixed-feed-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.feed-card {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s;
}

.feed-card:active {
  transform: scale(0.98);
}

.feed-photo {
  width: 100%;
  height: 400px;
  background-size: cover;
  background-position: center;
}

.private-bg {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.private-badge {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  color: #FFF;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  position: absolute;
  top: 16px;
  left: 16px;
}

.private-initial {
  font-size: 64px;
  font-weight: 300;
  color: #FFF;
}

.feed-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 40px 20px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  color: #FFF;
}

.card-name {
  font-size: 26px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-age {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.9;
}

.card-tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.card-tag {
  background: white;
  border: 1px solid #E0D8F0;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: #5F5E5A;
}

/* Answer Card specific */
.type-answer {
  background: var(--surface);
  min-height: 180px;
}

.ans-text-only {
  padding: 32px 24px;
}

.ans-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.ans-content {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-dark);
}

.ans-label-over {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.ans-text-below {
  padding: 24px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
}

.feed-card-footer {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.feed-footer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-right: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #FFF;
  font-weight: 600;
  font-size: 14px;
}

.feed-like-btn {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  box-shadow: 0 4px 12px rgba(188, 160, 206, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 10;
}

.type-answer .feed-like-btn {
  bottom: 60px;
  /* shift up over the footer */
}

/* Modals */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  /* #modal-container (this element's positioned ancestor) sits at the
     screen's true top edge, outside .screen's own safe-area padding —
     absolute/fixed positioning always escapes an ancestor's padding.
     So .modal needs its own clearance. */
  padding-top: var(--safe-top);
}

.modal-fixed-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 110;
  cursor: pointer;
}

.modal-fixed-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px 24px 40px;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
  z-index: 110;
  display: none;
  /* Hidden by default, detail page uses its own bar */
}

.detail-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px;
  background: white;
  display: flex;
  gap: 12px;
  z-index: 120;
}

.detail-btn-pass {
  flex: 1;
  height: 52px;
  border-radius: 26px;
  background: #FFF;
  border: 1.5px solid #E0D8D0;
  color: #888;
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.detail-btn-like {
  flex: 1;
  height: 52px;
  border-radius: 26px;
  background: #9B72CC;
  color: white;
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

.paged-indicator {
  position: absolute;
  top: 50%;
  left: 52%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  color: #070708;
  opacity: 0.85;
  background: none;
  border: none;
  z-index: 5;
  pointer-events: none;
  box-shadow: none;
}

.paged-indicator-detail {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #9B72CC;
  opacity: 0.85;
  font-size: 24px;
  z-index: 105;
  pointer-events: none;
}

.prof-modal-photo {
  width: 100%;
  height: 480px;
  background-size: cover;
  background-position: center;
}

/* Answers Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 24px;
}

.grid-square {
  aspect-ratio: 1;
  /* Keep it square */
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px;
  pointer-events: all !important;
}

.grid-square * {
  pointer-events: none;
}

.grid-square.interactable {
  cursor: pointer;
}

.grid-square.interactable:active {
  transform: scale(0.96);
}

.answered-text {
  /* Dynamic BG defined inline */
  justify-content: center;
  align-items: center;
}

.answered-img {
  background-size: cover;
  background-position: center;
  justify-content: center;
  align-items: center;
}

.unanswered {
  border: 1px dashed #D3D1C7;
  background: #FFF;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.grid-q-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 500;
  color: #9E9A94;
}

.grid-ans-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.grid-ans-text-over {
  font-size: 11px;
  font-weight: 600;
  color: #FFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-unans-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  opacity: 0.7;
}

/* Meetup List & Detailed View UI */
.meetup-item {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  padding: 20px 20px 24px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-left 0.2s ease;
  border-left: 3px solid transparent;
  overflow: hidden;
}

.meetup-share-btn {
  position: absolute;
  top: 36px;
  right: 48px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9;
  color: #9B72CC;
}

.meetup-share-btn:active {
  transform: scale(0.9);
}

.meetup-bookmark-btn {
  position: absolute;
  top: 36px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9;
}

.meetup-bookmark-btn:active {
  transform: scale(0.9);
}

@keyframes meetupPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

.meetup-btn-pop {
  animation: meetupPop 0.15s ease-out;
}

.meetup-item:active {
  transform: scale(0.98);
}

.meetup-item-rsvpd {
  background: #FAF7FF;
  border-left: 3px solid var(--primary);
}

.meetup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.meetup-chip {
  background: var(--primary-transparent);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meetup-date {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}

.meetup-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meetup-location-preview {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.meetup-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meetup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.attendee-stack {
  display: flex;
}

.attendee-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -8px;
  background: #E0E0E0;
  background-size: cover;
  background-position: center;
}

.attendee-avatar:first-child {
  margin-left: 0;
}

.rsvp-btn {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.rsvp-btn.rsvpd {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

.rsvp-btn:disabled {
  border-color: #E0E0E0;
  color: #A0A0A0;
  background: #F5F5F5;
  cursor: not-allowed;
}

/* Filter Bar UI */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  white-space: nowrap;
  padding-bottom: 4px;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  background: #FFF;
  border: 1px solid #E0E0E0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.selected {
  background: var(--primary);
  color: #FFF;
  border: 1px solid var(--primary);
}

/* Detail Screen Address Secret Block */
.address-reveal-card {
  background: #F0EBF8;
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 32px;
}

.address-reveal-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.address-reveal-card-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: 6px;
}

.address-reveal-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* New Meetup Components */
.meetup-recommended-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #C9A8E0;
  color: #FFF;
  padding: 4px 10px;
  border-radius: 0 20px 0 12px;
  font-size: 11px;
  font-weight: 700;
  z-index: 10;
  white-space: nowrap;
}

.bookmark-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  cursor: pointer;
  z-index: 5;
}

.bookmark-btn svg {
  width: 24px;
  height: 24px;
  transition: 0.2s;
}

.meetup-ending-soon-badge {
  display: inline-flex;
  align-items: center;
  background: #FF8A80;
  color: #FFF;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  transform: translateY(-1px);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.fab-add {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFF;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 16px rgba(188, 160, 206, 0.4);
  cursor: pointer;
  z-index: 40;
  transition: transform 0.2s;
}

.fab-add:active {
  transform: scale(0.9);
}

.bottom-action-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px 24px 40px;
  background: linear-gradient(to top, var(--bg-color) 80%, transparent);
}

/* Messages UI */
.message-list {
  display: flex;
  flex-direction: column;
}

.message-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.message-item:active {
  background: rgba(0, 0, 0, 0.03);
}

.msg-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-right: 16px;
  flex-shrink: 0;
}

.msg-info {
  flex: 1;
  min-width: 0;
}

.msg-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.msg-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.msg-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}

.msg-preview {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-source {
  display: inline-block;
  font-size: 10px;
  background: var(--primary-transparent);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.2px;
}

/* Chat Room Spec */
.chat-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-color);
  z-index: 20;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  cursor: pointer;
  padding-right: 12px;
}

.chat-room-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-right: 12px;
}

.chat-room-name {
  font-size: 16px;
  font-weight: 600;
}

.chat-scroller {
  flex: 1;
  padding: 20px;
  padding-bottom: calc(130px + env(safe-area-inset-bottom));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - 160px); height: calc(100dvh - 160px - var(--safe-top));
}

.chat-scroller::-webkit-scrollbar {
  display: none;
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
}

.chat-bubble.received {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 16px 16px 16px;
}

.chat-bubble.sent {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-radius: 16px 0 16px 16px;
}

.chat-input-bar {
  position: fixed;
  bottom: calc(60px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-color);
  border-top: 1px solid var(--border);
  gap: 12px;
  z-index: 30;
}

.chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 15px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.card-bio {
  font-size: 15px;
  margin-top: 12px;
  line-height: 1.4;
  opacity: 0.95;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(188, 160, 206, 0.15);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.profile-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 16px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* Utilities */
.discover-empty {
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s;
}

.discover-empty.show {
  opacity: 1;
}

/* Modal Custom UI Components */

.modal-category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.calendar-wrapper {
  background: #FFF;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 15px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.calendar-day-header {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.calendar-day {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-dark);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-day:active {
  transform: scale(0.9);
}

.calendar-day.selected {
  background: var(--primary);
  color: #FFF;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(188, 160, 206, 0.4);
}

.calendar-day.empty {
  visibility: hidden;
}

.picker-wrapper {
  position: relative;
  height: 120px;
  background: #FFF;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
}

.picker-wheel-container {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.picker-wheel-container::-webkit-scrollbar {
  display: none;
}

.picker-spacer {
  height: 40px;
}

.picker-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-muted);
  scroll-snap-align: center;
  transition: all 0.1s ease;
}

.picker-item.active {
  color: var(--primary);
  font-weight: 700;
  font-size: 17px;
}

.picker-overlay-bar {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  height: 40px;
  border-top: 1px solid rgba(201, 168, 224, 0.3);
  border-bottom: 1px solid rgba(201, 168, 224, 0.3);
  background: rgba(201, 168, 224, 0.05);
  pointer-events: none;
  box-sizing: border-box;
}

/* Profile Redesign Custom Styles */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 0.5px solid #F0F0F0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .info-label {
  font-size: 13px;
  color: var(--text-muted);
}

.info-row .info-val {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
}

.info-card {
  background: #FFF;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  margin-bottom: 32px;
}

.chapter-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.chapter-label {
  font-size: 13px;
  font-weight: 600;
  width: 90px;
}

.chapter-track {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 12px;
}

.chapter-fill {
  height: 100%;
  background: var(--primary);
}

.chapter-pct {
  font-size: 12px;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
}

.chapter-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(188, 160, 206, 0.15);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 20px;
}

.grid-chapter-divider {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-dark);
}

/* Viewer lock — someone else's chapter stays behind frosted glass until the
   reader has started the same chapter. See renderAnswersGrid() in app.js. */
.chapter-viewer-lock {
  position: relative;
  border-radius: 12px;
  overflow: hidden; /* clips the blur bleeding past the card bounds */
}

.chapter-viewer-lock-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  filter: blur(8px);
  -webkit-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
}

.chapter-viewer-lock-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  box-sizing: border-box;
  text-align: center;
  background: rgba(250, 249, 246, 0.62);
}

.chapter-viewer-lock-icon {
  color: #9B72CC;
  opacity: 0.85;
}

.chapter-viewer-lock-text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-dark);
}

.chapter-viewer-lock-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.chapter-viewer-lock-btn {
  margin-top: 4px;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  background: #E2FF74;
  color: #2D2A2B;
  cursor: pointer;
}

.ans-text-only {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.ans-card-q-text {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}


/* --- Discover Redesign: Book Stack --- */
.discover-tab-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px); height: calc(100dvh - 140px - var(--safe-top));
  padding: 20px 24px 80px;
  /* Added bottom padding to avoid tab bar overlap */
  position: relative;
  overflow: hidden;
}

.stack-wrapper {
  flex: 1;
  position: relative;
  margin-top: 20px;
  /* Maintains card position relative to new header layout */
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.book-card {
  position: absolute;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 2 / 3;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.2),
    -2px 0 4px rgba(0, 0, 0, 0.12),
    3px 0 0 0 rgba(0, 0, 0, 0.1),
    6px 0 0 0 rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
  transform-origin: center bottom;
  cursor: grab;
  touch-action: none;
  display: flex;
  flex-direction: column;
  color: #FFF;
}

.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  z-index: 5;
  box-shadow: inset -3px 0 6px rgba(0, 0, 0, 0.15);
}

.book-bg-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(14px);
  transform: scale(1.18);
  z-index: 1;
}

.book-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.28) 0%,
      rgba(0, 0, 0, 0.08) 25%,
      rgba(0, 0, 0, 0.08) 75%,
      rgba(0, 0, 0, 0.42) 100%);
  z-index: 2;
}

.book-cover-content {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.book-meta-bar {
  display: flex;
  justify-content: space-between;
  padding: 16px 14px 0 24px;
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  letter-spacing: 0.05em;
}

.book-meta-no {
  font-size: 13px;
}

.book-meta-dist {
  font-size: 13px;
}

.book-meta-role {
  font-size: 13px;
}

.book-spacer-top {
  height: 22%;
  /* Align nickname to ~32% including meta bar */
}

.book-title {
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  font-size: 30px;
  text-align: center;
  padding: 0 14px 0 24px;
  line-height: 1.3;
}

.book-spacer-flex {
  flex: 1;
}

.book-quote {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 14px;
  line-height: 1.8;
  text-align: center;
  padding: 12px 24px 24px 32px;
  opacity: 0.9;
}

.book-card.dragging {
  transition: none;
  cursor: grabbing;
}

/* Card Stacking Levels: Clean Vertical Stack */
.book-card.level-0 {
  z-index: 10;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.book-card.level-1 {
  z-index: 9;
  transform: translateY(-20px) scale(0.97);
  opacity: 0.9;
  pointer-events: none;
}

.book-card.level-2 {
  z-index: 8;
  transform: translateY(-38px) scale(0.94);
  opacity: 0.75;
  pointer-events: none;
}

.book-card.level-3 {
  z-index: 7;
  transform: translateY(-54px) scale(0.91);
  opacity: 0.55;
  pointer-events: none;
}

/* Old card styles removed in favor of book cover layout */

/* Actions */
.stack-actions-row {
  display: none;
  /* Moved to detail page */
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}

.action-btn:active {
  transform: scale(0.92);
}

.btn-nope {
  width: 56px;
  height: 56px;
  background: #FFF;
  color: #8E8E8A;
  border: 1px solid #DDD;
}

.btn-like {
  width: 64px;
  height: 64px;
  background: #9B72CC;
  color: #FFF;
  box-shadow: 0 8px 24px rgba(155, 114, 204, 0.4);
}

.btn-undo {
  display: none;
}

.action-label {
  font-size: 10px;
  font-weight: 600;
  color: #8E8E8A;
}

/* Overlay */
.paged-heart-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px 30px;
  border-radius: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.paged-heart-overlay.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.paged-heart-text {
  font-size: 15px;
  font-weight: 700;
  color: #9B72CC;
}

.p-qurated-promo-card {
  margin-top: 24px;
  padding: 16px;
  background: #F4F0F9;
  border-radius: 12px;
  text-align: left;
  border-left: 3px solid #9B72CC;
  width: 100%;
}

/* Saved Box (보관함) Grid */
.saved-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 8px;
  row-gap: 20px;
  padding: 0 20px 40px;
}

.saved-book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  animation: fadeIn 0.3s ease-out forwards;
  color: #FFF;
}

.thumbnail-card-content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.thumbnail-nickname {
  position: absolute;
  top: 15%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  font-size: 16px;
  padding: 0 8px 0 16px;
}

.thumbnail-info {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 11px;
  opacity: 0.8;
}

.saved-book-cover .book-spine {
  width: 8px;
}

.saved-book-cover .book-bg-photo {
  filter: blur(3px);
  transform: scale(1.08);
}

/* Role Badge & Tooltip */
.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background-color: #C9A8E0;
  color: #FFF;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, background-color 0.2s;
  user-select: none;
  vertical-align: middle;
}

.role-badge:active {
  transform: scale(0.92);
  filter: brightness(0.9);
}

.role-tooltip {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 0.5px solid #C9A8E0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #888;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  white-space: nowrap;
  animation: fadeInTooltip 0.2s ease-out forwards;
  transform: translateX(-50%) translateY(0);
}

.role-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #C9A8E0;
}

@keyframes fadeInTooltip {
  from {
    opacity: 0;
    margin-top: 10px;
  }

  to {
    opacity: 1;
    margin-top: 5px;
  }
}

/* Onboarding Redesign */
.onboarding-progress-container {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.onboarding-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.onboarding-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.onboarding-step-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Choice Pill Styles for Modal */
.choice-pill:hover {
  border-color: var(--primary);
  background: rgba(188, 160, 206, 0.05);
}

.choice-pill.selected {
  border-color: var(--primary) !important;
  background: rgba(188, 160, 206, 0.1) !important;
  color: var(--primary) !important;
  font-weight: 700;
}

.choice-pill:active {
  transform: scale(0.98);
}

/* Q12/13 Answer Writing UI Rewrite */
.choice-section {
  margin-bottom: 24px;
}

.choice-label {
  font-size: 14px;
  color: #555;
  font-weight: 500;
  margin-bottom: 12px;
  display: block;
}

.sub-q-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #C89FDB;
  border-radius: 99px;
  background: white;
  color: #9B72CC;
  font-size: 14px;
  font-family: 'Pretendard', sans-serif;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.2s;
}

.choice-btn.selected {
  background: #C89FDB;
  color: white;
  border-color: #C89FDB !important;
}

/* Answer Card Thumbnail Typography Fixes */
.answer-card-thumb .q-num {
  font-size: 10px;
}

.answer-card-thumb .q-text {
  font-size: 11px;
  line-height: 1.4;
}

.answer-card-thumb .answer-preview {
  font-size: 11px;
  line-height: 1.4;
}

.grid-square.unanswered {
  pointer-events: all !important;
  cursor: pointer !important;
  position: relative;
  z-index: 2;
}

.grid-square.unanswered * {
  pointer-events: none;
}

.telecom-btn {
  width: 100%;
  height: 52px;
  background: #FFF;
  border: 1.5px solid var(--pass-lilac);
  border-radius: 12px;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.telecom-btn:active {
  background: #F8F4FC;
}

.date-selects {
  display: flex;
  gap: 8px;
  width: 100%;
  margin: 24px 0 32px;
}

.date-select-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.date-select-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.date-selects select {
  width: 100%;
  height: 52px;
  border: 1.5px solid #C9A8E0;
  border-radius: 12px;
  background: #FFF;
  color: #2C2C2A;
  font-size: 16px;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  padding: 0 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.date-selects select:focus {
  outline: none;
  border-color: #9B72CC;
  box-shadow: 0 0 0 3px rgba(155, 114, 204, 0.12);
}

/* ── Highlighter text effects ── */
.highlight-yellow {
  background: linear-gradient(transparent 60%, rgba(255, 236, 100, 0.7) 60%);
  padding: 0 2px;
}

.highlight-sage {
  background: linear-gradient(transparent 60%, rgba(180, 220, 180, 0.65) 60%);
  padding: 0 2px;
}

.highlight-lavender {
  background: linear-gradient(transparent 60%, rgba(200, 180, 240, 0.6) 60%);
  padding: 0 2px;
}

/* ── Book-page answer modal ── */
.book-page-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 210;
  background: transparent;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Noto Serif KR', Georgia, 'Times New Roman', serif;
}

.book-page-header {
  display: flex;
  align-items: center;
  padding: 20px 20px 8px;
  flex-shrink: 0;
}

.book-page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 32px 120px 40px;
}

.book-page-chapter {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  font-size: 11px;
  color: #bbb;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.book-page-question {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #888;
  line-height: 1.6;
  margin-bottom: 32px;
}

.book-page-answer {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  color: #2C2C2A;
  line-height: 2.0;
  white-space: pre-wrap;
  word-break: keep-all;
}

.book-qa-block {
  margin-bottom: 8px;
}

.book-divider {
  border: none;
  border-top: 1px solid #EEEBE6;
  margin: 28px 0 32px;
}

.role-pills {
  display: flex;
  gap: 8px;
  margin: 24px 0;
}

.role-pill {
  flex: 1;
  height: 48px;
  border-radius: 24px;
  border: 1.5px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  background: transparent;
  transition: all 0.2s;
}

.role-pill.active {
  background: var(--primary);
  color: #FFF;
}

.tooltip-container {
  position: relative;
  text-align: center;
  margin-top: 16px;
}

.tooltip-box {
  background: var(--surface);
  border: 0.5px solid var(--primary);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  animation: fadeIn 0.2s ease;
}

/* ── Chapter cover page ──────────────────────────────────────── */
.nb-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 48px 28px;
  background: transparent;
  min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px - var(--safe-top));
}

.nb-cover-chapter {
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  font-size: 20px;
  color: #2C2C2A;
  margin-bottom: 8px;
}

.nb-cover-title {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-weight: 400;
  font-size: 20px;
  color: #2C2C2A;
  margin-bottom: 0;
}

.nb-cover-ornament {
  width: 32px;
  height: 1.5px;
  margin-top: 14px;
}

/* ── Answer page ─────────────────────────────────────────────── */
.nb-answer-page {
  padding-top: 4px;
}

#like-btn {
  position: fixed;
  bottom: 48px;
  right: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 215;
  transition: transform 0.2s ease-out;
  pointer-events: all;
}

#like-btn svg {
  pointer-events: none;
}

#heart-path {
  fill: none;
  stroke: #ccc;
  stroke-width: 1.5;
  transition: fill 0.2s ease, stroke 0.2s ease;
}


#like-btn.liked #heart-path {
  stroke: none;
}


.card-liked-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 10px;
  color: #888;
  line-height: 1;
  z-index: 10;
  pointer-events: none;
}

.notif-list {
  padding: 4px 4px 0;
}

.notif-empty {
  padding: 80px 20px;
  font-size: 14px;
  color: #bbb;
  text-align: center;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #F8F6F2;
  border-left: 3px solid transparent;
}

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

.notif-item.unread {
  background: var(--primary-transparent);
  border-left-color: var(--primary);
}

.notif-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-body {
  flex: 1;
}

.notif-text {
  font-size: 14px;
  color: #2C2C2A;
  line-height: 1.5;
}

.notif-text strong {
  color: #9B72CC;
}

.notif-time {
  font-size: 12px;
  color: #bbb;
  margin-top: 4px;
}

/* Post-Onboarding Modal */
.post-onboarding-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: all;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

.post-onboarding-card {
  width: 85%;
  background: #FFF;
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(20px);
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
  }
}

.post-onboarding-title {
  font-size: 20px;
  font-weight: 700;
  color: #2C2C2A;
  margin-bottom: 8px;
}

.post-onboarding-sub {
  font-size: 15px;
  color: #858082;
  margin-bottom: 28px;
}

.post-onboarding-btn {
  background: #9B72CC;
  color: #FFF;
  border: none;
  border-radius: 12px;
  padding: 14px;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  pointer-events: auto;
  position: relative;
  z-index: 10000;
}

.post-onboarding-link {
  font-size: 14px;
  color: #aaa;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  pointer-events: auto;
  position: relative;
  z-index: 10000;
}

/* Profile Setup Flow */
.btn-setup-primary {
  background-color: #E2FF74;
  color: #2D2A2B;
  border: none;
  border-radius: 100px;
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 8px 20px rgba(226, 255, 116, 0.25);
}

.btn-setup-primary:active {
  transform: scale(0.98);
}

.setup-skip-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.profile-setup-progress-fill {
  height: 100%;
  background-color: #E2FF74;
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.setup-photo-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px dashed #D1D1D1;
  background: #F8F8F8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 60px auto;
  cursor: pointer;
}

.setup-photo-label {
  margin-top: 12px;
  font-size: 14px;
  color: #aaa;
  font-weight: 500;
}

.setup-textarea {
  width: 100%;
  height: 140px;
  background: #F8F8F8;
  border: 1px solid #EDEDED;
  border-radius: 16px;
  padding: 20px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  margin-top: 24px;
  color: var(--text-dark);
}

.setup-textarea::placeholder,
.setup-input::placeholder {
  color: #ccc;
}

.setup-input {
  width: 100%;
  background: #F8F8F8;
  border: 1px solid #EDEDED;
  border-radius: 16px;
  padding: 20px;
  font-size: 16px;
  font-family: inherit;
  margin-top: 24px;
  color: var(--text-dark);
}

.setup-hint {
  font-size: 13px;
  color: #aaa;
  margin-top: 10px;
  line-height: 1.4;
}

/* Profile Info Section */
.info-card {
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 0.5px solid #F0F0F0;
}

.info-label {
  font-size: 13px;
  color: #aaa;
  flex-shrink: 0;
}

.info-val {
  font-size: 13px;
  color: #2C2C2A;
  text-align: right;
  padding-left: 16px;
}

/* New Profile Sections */
.profile-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 48px;
  margin-bottom: 12px;
}

.qurated-card {
  background: #FFF;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  border-left: 4px solid #9B72CC;
  margin-bottom: 32px;
}

.qurated-info {
  flex: 1;
}

.qurated-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #2C2C2A;
  margin-bottom: 4px;
}

.qurated-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: keep-all;
}

.qurated-apply-btn {
  background: #F4F0F9;
  color: #9B72CC;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.invite-card {
  background: #FFF;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  margin-bottom: 32px;
}

.invite-card-header {
  margin-bottom: 20px;
}

.invite-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #2C2C2A;
  margin-bottom: 4px;
}

.invite-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.invite-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.invite-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.invite-dot.active {
  background: #9B72CC;
}

.invite-share-btn {
  width: 100%;
  background: #F7F4F0;
  color: #2C2C2A;
  border: 1px solid #ECEAE4;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.settings-card {
  background: #FFF;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  margin-bottom: 24px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #F7F4F0;
  font-size: 15px;
  color: #2C2C2A;
  cursor: pointer;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row i {
  color: #CCC;
  width: 18px;
  height: 18px;
}

.settings-row.no-chevron {
  cursor: default;
}

.version-text {
  font-size: 14px;
  color: var(--text-muted);
}

.settings-footer-links {
  padding: 0 20px 40px;
  display: flex;
  gap: 20px;
}

.footer-link {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.footer-link.danger {
  color: #E53935;
}

/* =========================================
   Messages Tab Redesign
   ========================================= */
.matches-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin: 16px 24px 8px;
}

.matches-scroll-container {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding: 0 24px 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.matches-scroll-container::-webkit-scrollbar {
  display: none;
}

.match-thumbnail-wrap {
  position: relative;
  width: 64px;
  height: 96px; /* 2:3 ratio */
  flex-shrink: 0;
  scroll-snap-align: start;
  cursor: pointer;
}

.match-thumbnail {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: relative;
}

.match-thumbnail-heart {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--bg-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.match-thumbnail-heart svg {
  width: 12px;
  height: 12px;
  fill: #9B72CC;
}

.match-new-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #C89FDB;
  border-radius: 50%;
  border: 2px solid var(--bg-color);
}

.msg-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 12px;
  margin-left: 6px;
}

.msg-badge-new {
  background: #E2FF74;
  color: #2D2A2B;
}

.msg-badge-unread {
  background: #C89FDB;
  color: #FFF;
}

.msg-avatar {
  border-radius: 50%; /* Circular avatar */
  background-size: cover;
  background-position: center;
}

/* =========================================
   Matching First Screen Modal
   ========================================= */
.match-intro-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #FAFAFA;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
  /* Appended straight to <body> (#answer-modal-container), outside
     #app-container/.screen entirely — needs its own safe-area clearance. */
  padding-top: var(--safe-top);
}

.match-intro-visual {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 20px;
  padding: 20px 0;
}

.match-intro-cover {
  width: 120px;
  height: 180px; /* 2:3 ratio */
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: floatBook 3s ease-in-out infinite alternate;
}

@keyframes floatBook {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.match-intro-heart {
  position: absolute;
  font-size: 48px;
  color: #C89FDB;
  animation: pulseHeart 2s infinite;
}

@keyframes pulseHeart {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

.match-intro-pm {
  padding: 24px;
  background: #FFF;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.05);
  padding-bottom: env(safe-area-inset-bottom, 24px);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.pm-message-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.pm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #C89FDB;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 0;
}

.pm-bubble {
  background: #F4F4F4;
  padding: 12px 16px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.match-intro-input-wrap {
  display: flex;
  gap: 8px;
}

.match-intro-input {
  flex: 1;
  border: 1px solid #EEE;
  border-radius: 24px;
  padding: 12px 16px;
  font-size: 14px;
  background: #FAFAFA;
  font-family: 'Pretendard', sans-serif;
  outline: none;
}

.match-intro-input:focus {
  border-color: #C89FDB;
}

.match-intro-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #9B72CC;
  color: #FFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* =========================================
   p.M Chat Interface
   ========================================= */
.pm-choice-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: #FFF;
  border: 1px solid #C89FDB;
  color: #C89FDB;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Pretendard', sans-serif;
}
.pm-choice-btn:active {
  background: #C89FDB;
  color: #FFF;
}

/* Regular Match Option Buttons */
.match-option-btn {
  display: block;
  width: calc(100% - 48px);
  margin: 6px auto;
  padding: 14px 20px;
  border-radius: 16px;
  border: 1.5px solid #C89FDB;
  background: white;
  color: #9B72CC;
  font-size: 15px;
  font-family: 'Pretendard', sans-serif;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.match-option-btn:active {
  background: rgba(200, 159, 219, 0.1);
}

/* ── Photo Grid (내 프로필 edit view) ── */
.my-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 16px 16px 8px;
}

.photo-slot {
  aspect-ratio: 1;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.photo-slot.filled {
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
}

.photo-slot.filled.editing {
  outline: 2px solid #9B7FD4;
  outline-offset: -2px;
}

.photo-slot.filled.dragging {
  opacity: 0.55;
}

.photo-slot.empty {
  background: #F4F3F0;
  border: 1.5px dashed #D0CEC8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-slot.empty:active {
  background: #EEEDE9;
}

.photo-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.62);
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  pointer-events: all;
  line-height: 1;
}

.photo-main-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0,0,0,0.48);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* Profile Detail FAB */
.prof-fab {
  position: absolute;
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #9B72CC;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(155, 114, 204, 0.45);
  z-index: 150;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.prof-fab:active {
  transform: scale(0.92);
}

@keyframes fabPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.prof-fab.pulsing {
  animation: fabPulse 0.35s ease-out forwards;
}

/* Library Screen */
.lib-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
  margin-top: 16px;
}

.lib-tab {
  flex: 1;
  padding: 13px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.lib-tab.active {
  color: var(--primary);
  font-weight: 700;
  border-bottom: 2.5px solid var(--primary);
}

.lib-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 12px;
  row-gap: 16px;
  padding: 0 20px 60px;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Full Screen Invite Page */
.invite-summary-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.invite-count-text {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.invite-count-text span {
  color: #9B72CC;
}
.invite-progress-bg {
  width: 100%;
  height: 4px;
  background: #EEE;
  border-radius: 2px;
  overflow: hidden;
}
.invite-progress-fill {
  height: 100%;
  background: #9B72CC;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.invite-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.invite-card-slot {
  aspect-ratio: 3/4;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Envelope flap shared */
.envelope-flap {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
}
.envelope-flap-top {
  top: 0;
  height: 44%;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}
.envelope-flap-bottom {
  bottom: 0;
  height: 44%;
  clip-path: polygon(0% 100%, 100% 100%, 50% 0%);
}
.envelope-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  padding: 12px;
}
.invite-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* State: Used */
.state-used {
  background: #D8D0E8;
  border: none;
  box-shadow: none;
}
.state-used .envelope-flap { background: #C8BFD8; }
.state-used .invite-circle { background: rgba(0,0,0,0.1); }

/* State: Active */
.state-active {
  background: #9B7FD4;
  padding: 14px;
  justify-content: space-between;
}
.invite-inner-card {
  background: white;
  border-radius: 12px;
  padding: 20px 20px 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.invite-inner-label {
  color: #9B7FD4;
  font-size: 10px;
  letter-spacing: 0.15em;
  font-weight: 600;
  text-align: center;
  width: 100%;
}
.invite-code {
  font-family: monospace;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 4px 0 2px;
  letter-spacing: 1px;
}
.invite-timer {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}
.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  flex-shrink: 0;
}
.invite-btn-copy {
  border: 1.5px solid rgba(155,127,212,0.45);
  background: rgba(155,127,212,0.08);
  color: #4A3060;
  border-radius: 100px;
  font-size: 13px;
  padding: 9px;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
}
.invite-btn-share {
  background: #4A3060;
  color: white;
  border-radius: 100px;
  font-size: 13px;
  padding: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
}

/* State: Unused */
.state-unused {
  background: #9B7FD4;
}
.state-unused .envelope-flap { background: #8A6FC4; }
.state-unused .invite-circle { background: white; }
.invite-number {
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 600;
}
.use-invite-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.use-invite-btn:active {
  background: rgba(255,255,255,0.3);
}

/* Notice */
.invite-notice-text {
  font-size: 12px;
  color: #999;
  line-height: 1.6;
}

/* p.Qurated Page */
.qurated-top-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}
.qurated-feature-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.qurated-plan-card {
  background: white;
  border: 1.5px solid #E0D0F0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: all 0.2s ease;
}
.qurated-plan-card.selected {
  border-width: 2px;
  background: #F8F0FC;
}
.qurated-plan-card.premium {
  border-color: #9B72CC;
  background: white;
}
.qurated-plan-card.premium.selected {
  background: rgba(155, 114, 204, 0.05);
}
.qurated-recommend-badge {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #9B72CC;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(155, 114, 204, 0.3);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* Tab watermark */
.tab-watermark {
  text-align: center;
  padding: 32px 0 12px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.15);
  letter-spacing: 1px;
  font-style: italic;
  font-family: 'Style Script', cursive;
  font-size: 16px;
  user-select: none;
  pointer-events: none;
}

/* Meetup search bar */
#meetup-search-input:focus {
  border-color: #9B72CC;
  box-shadow: 0 0 0 3px rgba(155, 114, 204, 0.12);
}
}