/* MOABAX 디자인 시스템 v4 — Warm & Friendly (Friendly / Casual 유지, 1안 확정)
 *  컬러: 웜 크림 #FFF8EF, 피치 코랄 #F28C70, 소프트 세이지 #A8C9A5,
 *        웜 브라운 #493F38, 밀크 베이지 #F4E7D8, 소프트 머스타드 #E9B96E
 *  방향: v3의 레이아웃·여백·버튼 구성·둥근 모서리 유지, 팔레트만 웜 계열로 교체.
 *  (파랑·민트 조합은 차갑고 일반 SaaS처럼 느껴져 웜 팔레트로 전환)
 *  대비: 코랄 위 흰 글자는 2.40:1로 부족해 버튼 글자는 짙은 웜 브라운 사용.
 *        코랄은 본문 글자색으로 쓰지 않고 버튼 배경·그래픽 강조에만 사용.
 *  1안 다듬기: 입력·칩 테두리 선명하게, 선택 칩에 ✓ 표시, 모바일 간격 정돈, 최종 금액·버튼 강조.
 *  원칙: 장식 최소, 강조는 계산하기 버튼 하나, 나머지는 여백과 위계로.
 *  모션: cubic-bezier(0.32, 0.72, 0, 1), reduced-motion 존중, CSS만 사용.
 */
:root {
  --bg: #fff8ef;
  --card: #f4e7d8;
  --input-bg: #fffbf5;
  --ink: #493f38;
  --btn-text: #33241d;
  --primary: #f28c70;
  --primary-dark: #de7a5c;
  --primary-soft: #fde9e1;
  --sage: #a8c9a5;
  --mustard: #e9b96e;
  --line: #e2cdb4;
  --input-line: #c9a876;
  --muted: #756557;
  --warn-bg: #fef1f1;
  --warn-text: #b91c1c;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: 3px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 18px 64px; }
.wrap--wide { max-width: 960px; }

/* 상단 — 워드마크 + 민트 도트 */
.brand { font-weight: 800; letter-spacing: 0.01em; font-size: 19px; }
.brand-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--sage); margin-left: 3px; vertical-align: baseline;
}
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.promise { font-size: 13px; font-weight: 600; margin: 14px 0 0; }
.breadcrumb { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.breadcrumb a { color: var(--muted); }
.promise .sep { color: var(--primary); padding: 0 6px; }
h1 { font-size: 30px; line-height: 1.35; margin: 28px 0 10px; }
.lead { color: var(--muted); margin: 0 0 28px; font-size: 16px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h2::before {
  content: ""; display: inline-block; width: 20px; height: 5px;
  background: var(--sage); border-radius: 999px; margin-right: 10px; vertical-align: middle;
}
h3 { font-size: 15px; margin: 0 0 8px; }

/* 카드 — 흰 바탕, 연한 선, 은은한 그림자 */
.card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 16px; margin: 14px 0;
  box-shadow: 0 1px 2px rgba(73, 63, 56, 0.05), 0 8px 24px rgba(242, 140, 112, 0.10);
}

/* 입력 */
label.lbl { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
input[type="text"], input[type="number"] {
  width: 100%; padding: 12px 12px; font-size: 16px;
  border: 1.5px solid var(--input-line); border-radius: 12px; background: var(--input-bg); color: var(--ink);
  transition: border-color 0.25s var(--ease);
}
input[type="text"]:focus, input[type="number"]:focus { outline: none; border-color: var(--primary); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row--tight { align-items: flex-end; }

/* 버튼 — 강조는 계산하기 버튼(블루) 하나 */
.btn {
  display: block; width: 100%; min-height: 52px; padding: 13px; font-size: 17px; font-weight: 700;
  color: var(--btn-text); background: var(--primary); border: 1.5px solid var(--primary); border-radius: 12px; cursor: pointer; margin: 14px 0;
  transition: background 0.25s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.98); }
.btn-ghost {
  display: inline-block; padding: 10px 16px; font-size: 14px; font-weight: 600;
  color: var(--ink); background: var(--card); border: 1.5px solid var(--input-line); border-radius: 999px; cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.15s var(--ease);
}
.btn-ghost:hover { background: var(--primary-soft); color: var(--ink); border-color: var(--primary); }
.btn-ghost:active { transform: scale(0.97); }
.btn-small { padding: 8px 13px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* 탭 — 활성 상태는 블루 채움 */
.tabs { display: flex; gap: 8px; margin: 20px 0 4px; }
.tab {
  flex: 1; min-height: 48px; padding: 11px; font-size: 15px; font-weight: 700; text-align: center;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--muted);
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--btn-text); }

/* 사람 행 */
.person-row { display: flex; gap: 8px; margin: 6px 0; align-items: center; }
.person-row input { flex: 1; min-width: 0; }

/* 메뉴 카드 */
.menu-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin: 14px 0;
  box-shadow: 0 1px 2px rgba(73, 63, 56, 0.05), 0 8px 24px rgba(242, 140, 112, 0.10);
}
.menu-card .menu-top { display: flex; gap: 8px; }
.menu-card .menu-top .name { flex: 1; min-width: 0; }
.menu-card .menu-top .amount { flex: 0 1 120px; min-width: 104px; }
.eaters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.chip span {
  display: inline-block; padding: 8px 14px; font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--input-line); border-radius: 999px; background: var(--input-bg); cursor: pointer; user-select: none;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.15s var(--ease);
}
.chip span:active { transform: scale(0.96); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip input:checked + span { background: var(--sage); border-color: var(--sage); color: var(--ink); font-weight: 800; }
.chip input:checked + span::before { content: "✓ "; }
.menu-actions { display: flex; gap: 6px; margin-top: 12px; }

/* 경고 / 결과 */
.warn { background: var(--warn-bg); color: var(--warn-text); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.warn:empty { display: none; }
.result-row { display: flex; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 16px; }
.result-row:last-child { border-bottom: 0; }
.result-row b { font-size: 17px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; padding: 14px 2px 4px; }
.total-line span:last-child { font-size: 22px; }
.ok-check { color: var(--ink); font-size: 14px; font-weight: 700; }
.ok-check::before { content: "✓ "; color: var(--primary); }
.muted { color: var(--muted); font-size: 13px; }
.foot { margin-top: 40px; padding-top: 18px; border-top: 1.5px solid var(--line); color: var(--muted); font-size: 13px; }

/* 사람별 상세 내역 카드 */
.detail-done { font-weight: 800; font-size: 18px; margin: 4px 0 2px; }
.detail-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin: 14px 0;
  box-shadow: 0 1px 2px rgba(73, 63, 56, 0.05), 0 8px 24px rgba(242, 140, 112, 0.10);
}
.detail-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 10px; border-bottom: 2px solid var(--primary); font-weight: 700; font-size: 16px;
}
.detail-final { font-size: 22px; font-weight: 800; color: var(--ink); }
.detail-row { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.detail-row:last-child { border-bottom: 0; }
.detail-total { font-weight: 800; padding-top: 12px; }

/* 결과 등장 — 단순한 페이드+상승, reduced-motion이면 없음 */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
#resultSection { animation: rise 0.4s var(--ease); }

/* 허브 도구 카드 — 호버 시 화살표가 미끄러짐 */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.tool-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 20px;
  display: block; color: var(--ink); text-decoration: none;
  transition: border-color 0.25s var(--ease);
  box-shadow: 0 1px 2px rgba(73, 63, 56, 0.05), 0 8px 24px rgba(242, 140, 112, 0.10);
}
.tool-card:hover { border-color: var(--primary); }
.tool-card h3 { font-size: 17px; margin-bottom: 4px; }
.tool-card p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.tool-card .go { font-weight: 700; color: var(--ink); display: inline-block; transition: transform 0.25s var(--ease); }
.tool-card:hover .go { transform: translateX(4px); }
.tool-card.disabled { opacity: 0.55; }
.tool-card.disabled:hover { border-color: var(--line); }
.soon { display: inline-block; font-size: 12px; font-weight: 700; background: var(--mustard); color: var(--ink); border: 1.5px solid var(--mustard); border-radius: 999px; padding: 3px 10px; }

/* 모바일 간격 정돈 (터치 영역 48px은 유지) */
@media (max-width: 480px) {
  .wrap { padding: 20px 14px 48px; }
  .card, .menu-card, .detail-card { padding: 14px; }
  h1 { font-size: 26px; }
  h2 { margin: 24px 0 10px; }
}

/* 운명 뽑기 — 카드 뒤집기 */
.step-btn { min-height: 48px; font-size: 18px; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.fate-card { perspective: 800px; margin: 10px 0; }
.fate-card-inner { position: relative; height: 76px; transform-style: preserve-3d; transition: transform 0.5s var(--ease); }
.fate-card-inner.flipped { transform: rotateY(180deg); }
.fate-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 16px; border: 1.5px solid var(--line); }
.fate-front { background: var(--card); font-size: 32px; font-weight: 800; color: var(--primary); }
.fate-back { background: var(--sage); transform: rotateY(180deg); }
.fate-badge { font-size: 12px; font-weight: 700; }
.fate-name { font-size: 20px; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
