/* 토끼지마 — DESIGN.md 토큰 구현. 모바일 웹 앱 + 데스크톱 웹 */
:root {
  --brand-500: #ff7fa8;
  --brand-600: #f2648f;
  --brand-050: #fff0f5;

  --him-500: #4a90d9;
  --him-050: #e6f0fb;
  --her-500: #ff7fa8;
  --her-050: #ffe9f0;
  --judge-500: #3b4266;
  --judge-050: #eceef6;

  --ink: #2b2b30;
  --ink-muted: #6e6e73;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --line: #e5e5ea;
  --danger: #ff3b30;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-050: #3a2430;
    --him-050: #1e3a5f;
    --her-050: #5c2437;
    --judge-050: #2f3550;
    --ink: #f5f5f7;
    --ink-muted: #98989d;
    --bg: #1c1c1e;
    --surface: #2c2c2e;
    --line: #3a3a3c;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.view { display: none; max-width: 720px; margin: 0 auto; min-height: 100dvh; padding: 16px; }
.view.active { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* 마스코트: 다크모드에서도 캐릭터 정체성 유지 위해 밝은 원형 배경 */
.mascot { display: block; }
.hero-mascot, .overlay-mascot { display: flex; justify-content: center; }
.hero-mascot .mascot, .overlay-mascot .mascot {
  background: #fff; border-radius: 50%; padding: 6px;
}
.mini-mascot { display: inline-block; vertical-align: middle; }
.mini-mascot .mascot { background: #fff; border-radius: 50%; }

/* 홈 */
.hero { text-align: center; padding: 7vh 8px 28px; }
/* keep-all: 한국어 단어 중간에서 줄이 끊기지 않게 한다 */
h1 { font-size: 27px; font-weight: 800; line-height: 1.35; margin-top: 14px; word-break: keep-all; }
@media (min-width: 420px) { h1 { font-size: 32px; } }
.accent { color: var(--brand-500); }
.subtitle { color: var(--ink-muted); margin-top: 12px; font-size: 15px; line-height: 1.6; word-break: keep-all; }
.verdict-headline, .overlay-card h2 { word-break: keep-all; }

.home-cta { display: flex; flex-direction: column; gap: 14px; }
.primary-btn.big { padding: 19px; font-size: 18px; min-height: 56px; border-radius: 14px; }
.hint.center { text-align: center; }

.disclaimer {
  margin-top: 24px; padding: 14px 16px; border-radius: 12px;
  background: var(--brand-050); color: var(--ink-muted);
  font-size: 12.5px; line-height: 1.65; text-align: center;
}
.disclaimer.small { margin-top: 8px; font-size: 12px; }

/* 상단바 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 14px; gap: 8px; }
.topbar h2 { font-size: 17px; font-weight: 700; }
.back-btn, .stop-btn {
  background: none; border: none; color: var(--brand-500);
  font-size: 15px; cursor: pointer; padding: 10px 4px; min-height: 44px;
}
.stop-btn { color: var(--danger); }
.topbar-spacer { width: 48px; }

/* 폼 */
.form { display: flex; flex-direction: column; gap: 14px; padding-bottom: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.card h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-muted); }
input[type="text"], textarea, select {
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; min-height: 44px;
}
textarea { resize: vertical; }
.req { color: var(--brand-500); font-size: 11px; font-weight: 700; }
.hint { color: var(--ink-muted); font-size: 12.5px; line-height: 1.6; }

/* 세그먼트 (관계 선택) */
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; padding: 12px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-muted);
  border-radius: 10px; font: inherit; font-size: 15px;
}
.seg-btn.active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); font-weight: 700; }

/* 성격 프리셋 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-muted);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; min-height: 32px;
}
.chip:hover { border-color: var(--brand-500); color: var(--brand-500); }

/* 버튼 */
.primary-btn {
  background: var(--brand-500); color: #fff; border: none;
  border-radius: 12px; padding: 15px; font-size: 16px; font-weight: 700;
  cursor: pointer; min-height: 48px;
}
.primary-btn:active { background: var(--brand-600); }
.primary-btn:disabled { opacity: 0.5; cursor: default; }
.secondary-btn {
  background: var(--surface); color: var(--brand-500);
  border: 1px solid var(--brand-500); border-radius: 12px;
  padding: 13px; font-size: 15px; cursor: pointer; min-height: 44px;
}


/* 재판 채팅 */
.chat { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 32px; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; }
.bubble-row.a { justify-content: flex-start; }
.bubble-row.b { justify-content: flex-end; flex-direction: row-reverse; }
.bubble-row .avatar { flex: 0 0 auto; background: #fff; border-radius: 50%; }
.bubble { max-width: 78%; border-radius: 16px; padding: 12px 14px; font-size: 15px; line-height: 1.55; }
.bubble .speaker { display: block; font-size: 12px; font-weight: 700; color: var(--ink-muted); margin-bottom: 4px; }
.bubble-row.a .bubble { background: var(--him-050); border-bottom-left-radius: 4px; }
.bubble-row.b .bubble { background: var(--her-050); border-bottom-right-radius: 4px; }
.bubble.silent { opacity: 0.6; font-style: italic; }
.sources { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.sources a { font-size: 11.5px; color: var(--brand-500); text-decoration: none; word-break: break-all; }

.judge-note {
  align-self: center; background: var(--judge-050); color: var(--ink);
  border-radius: 12px; padding: 11px 14px; font-size: 13.5px; max-width: 92%;
  display: flex; align-items: center; gap: 8px; line-height: 1.55;
}
.typing { color: var(--ink-muted); font-size: 13px; align-self: center; display: flex; align-items: center; gap: 8px; }
.typing .mascot { animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .typing .mascot { animation: none; } }

.error-note {
  align-self: center; color: var(--danger); background: var(--surface);
  border: 1px solid var(--danger); border-radius: 12px; padding: 11px 14px;
  font-size: 13px; max-width: 92%;
}

/* 판결 */
.verdict-card {
  background: var(--surface); border: 2px solid var(--judge-500); border-radius: 16px;
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.verdict-head { display: flex; align-items: center; gap: 10px; }
.verdict-head .mascot { background: #fff; border-radius: 50%; flex: 0 0 auto; }
.verdict-headline { font-size: 18px; font-weight: 800; line-height: 1.4; }
.verdict-label { font-size: 11.5px; color: var(--ink-muted); font-weight: 700; letter-spacing: 0.04em; }

.ratio { display: flex; flex-direction: column; gap: 6px; }
.ratio-title { font-size: 13px; font-weight: 800; color: var(--ink); }
.ratio-title small { font-size: 11px; font-weight: 600; color: var(--ink-muted); margin-left: 4px; }
.ratio-verdict {
  margin-top: 4px; padding: 10px 12px; border-radius: 10px;
  background: var(--brand-050); color: var(--brand-600);
  font-size: 13.5px; font-weight: 800; text-align: center;
}
.ratio-bar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; }
.ratio-a, .ratio-b {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 44px;
}
.ratio-a { background: var(--him-500); }
.ratio-b { background: var(--her-500); }
.ratio-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-muted); }

.verdict-body { font-size: 14.5px; line-height: 1.65; }
.verdict-points { display: grid; gap: 8px; }
@media (min-width: 520px) { .verdict-points { grid-template-columns: 1fr 1fr; } }
.point { background: var(--bg); border-radius: 10px; padding: 12px; font-size: 13.5px; line-height: 1.55; }
.point b { display: block; margin-bottom: 4px; font-size: 12px; color: var(--ink-muted); }

.missions { display: grid; gap: 8px; }
.mission {
  background: var(--brand-050); border-radius: 10px; padding: 12px;
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
}
.mission b { display: block; font-size: 12px; color: var(--ink-muted); margin-bottom: 3px; }

/* 유료 구간 — 제목과 과실 비율까지만 무료, 그 아래는 블라인드 */
.locked { position: relative; }
.locked > .locked-content {
  display: flex; flex-direction: column; gap: 14px;
  filter: blur(7px); opacity: 0.55; pointer-events: none;
  max-height: 260px; overflow: hidden;
  /* 텍스트를 읽을 수 없게 하되 분량감은 보이도록 */
  user-select: none;
}
.locked.unlocked > .locked-content {
  filter: none; opacity: 1; pointer-events: auto; max-height: none; user-select: auto;
}
.locked.unlocked > .paywall { display: none; }

.paywall {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, var(--surface) 55%);
  border-radius: 12px;
}
@media (prefers-color-scheme: dark) {
  .paywall { background: linear-gradient(180deg, rgba(44,44,46,0.55) 0%, var(--surface) 55%); }
}
.paywall-lock { font-size: 28px; }
.paywall-title { font-size: 16px; font-weight: 800; word-break: keep-all; }
.paywall-desc { font-size: 12.5px; color: var(--ink-muted); line-height: 1.55; word-break: keep-all; }
.paywall .primary-btn { margin-top: 6px; padding: 12px 22px; font-size: 15px; min-height: 44px; }

.verdict-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.verdict-actions > * { flex: 1 1 140px; }
.one-sided {
  font-size: 11.5px; color: var(--ink-muted); text-align: center;
  background: var(--bg); border-radius: 8px; padding: 8px;
}


/* 안전 오버레이 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.overlay-card {
  background: var(--surface); border-radius: 20px; padding: 26px 22px;
  max-width: 420px; width: 100%; text-align: center;
  display: flex; flex-direction: column; gap: 14px; max-height: 90dvh; overflow-y: auto;
}
.overlay-card h2 { font-size: 20px; font-weight: 800; }
.overlay-card > p { font-size: 14.5px; line-height: 1.65; color: var(--ink); }
.hotlines { display: flex; flex-direction: column; gap: 8px; }
.hotline {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--brand-050); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--ink);
}
.hotline-name { font-size: 13.5px; font-weight: 700; text-align: left; }
.hotline-note { font-size: 11.5px; color: var(--ink-muted); display: block; font-weight: 400; margin-top: 2px; }
.hotline-num { font-size: 19px; font-weight: 800; color: var(--brand-500); font-variant-numeric: tabular-nums; }
