/* ===== 골프 모임 핸디 현황 - 공용 스타일 (모바일 전용, 골프 그린 톤) ===== */
:root {
  --green-900: #0b3d2e;
  --green-800: #0f5132;
  --green-700: #146c43;
  --green-600: #188a55;
  --green-500: #1ea55f;
  --accent: #34d17a;
  --accent-soft: #d7f5e4;
  --cream: #eef3ec;
  --card: #ffffff;
  --ink: #14251c;
  --muted: #6b7f74;
  --line: #e4ebe4;
  --up: #e03131;    /* 핸디 상승(빨강) */
  --down: #1c7ed6;  /* 핸디 하락(파랑) */
  --same: #9aa7a0;  /* 변동없음 */
  --shadow: 0 6px 20px rgba(11, 61, 46, .10);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* iOS 사파리: 탭 지연·더블탭 확대 간섭 제거 (첫 탭 씹힘 완화) */
button, .member-card, .current-date, [role="button"] { touch-action: manipulation; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(52, 209, 122, .25), transparent 60%),
    linear-gradient(180deg, #f7faf6 0%, #eef3ec 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 모바일 컨테이너 ===== */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 전체화면 입력 폼(핸디/스코어) — 메인 위를 덮는 오버레이 */
#formView,
#memberView {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(52, 209, 122, .25), transparent 60%),
    linear-gradient(180deg, #f7faf6 0%, #eef3ec 100%);
}
#formView > .app-header,
#formView > .content,
#memberView > .app-header,
#memberView > .content { max-width: 480px; margin-left: auto; margin-right: auto; }

/* ===== 헤더 ===== */
.app-header {
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-900) 100%);
  color: #fff;
  padding: 22px 20px 26px;
  border-radius: 0 0 26px 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.app-header::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%);
  border-radius: 50%;
  pointer-events: none;   /* 장식일 뿐이므로 우측 상단 버튼의 클릭을 가로채지 않게 */
}
.app-header .top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-header .brand-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16);
  border-radius: 12px;
  flex: none;
}
.app-header h1 {
  font-size: 19px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.3px;
}
.app-header .subtitle {
  font-size: 12.5px;
  opacity: .85;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.back-btn {
  background: rgba(255,255,255,.16);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  cursor: pointer;
  flex: none;
}
.back-btn:active { background: rgba(255,255,255,.28); }

/* ===== 본문 ===== */
.content {
  padding: 18px 16px 32px;
  flex: 1;
}
/* 하단 고정 액션바(.action-bar)가 있는 화면은 마지막 항목이 가리지 않도록 여백을 더 준다 */
#formView .content,
#settleView .content { padding-bottom: 110px; }

/* ===== 멤버 카드 리스트 ===== */
.list-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 4px 12px;
}
.list-head .label {
  flex: 1; min-width: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden;
}
.list-head .date-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 5px;
  flex: none; white-space: nowrap;
}
/* 정렬 토글 — 날짜 배지와 같은 크기. 날짜(표시)와 구분되도록 눌리는 버튼 모양으로 */
.list-head .sort-btn {
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--green-800);
  font-family: inherit;
  cursor: pointer;
}
.list-head .sort-btn:active { background: #eef3ec; }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.member-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border: 1px solid var(--line);
}
/* 위 줄 : 순위 · 이름 · 변동 배지 · 핸디 */
.mc-top { display: flex; align-items: center; gap: 10px; }
/* 배지는 핸디 숫자와 같은 줄, 숫자 왼쪽에 둔다 */
.member-card .change { margin-top: 0; flex: none; font-size: 11px; padding: 3px 7px; }
.member-card .change svg { width: 12px; height: 12px; }
.member-card .member-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 아래 줄 : 최근순위 · 평균순위 · 스코어(n)
 * 네 값을 핸디 옆에 한 줄로 붙이면 360px 폭(갤럭시 S21 등)에서 이름과 라벨이
 * 잘리고 줄 높이도 틀어진다. 아래 줄로 내리면 세 칸이 넉넉하고,
 * 세 칸이 폭을 똑같이 나눠 가져 숫자가 카드끼리 위아래로 줄맞춰진다.
 * 모양은 화면 맨 위 요약 스트립(.stats-strip)과 같게 맞췄다. */
.card-metrics {
  display: flex;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.cm { flex: 1; text-align: center; position: relative; min-width: 0; }
.cm + .cm::before {
  content: ""; position: absolute; left: 0; top: 10%; height: 80%; width: 1px; background: var(--line);
}
.cm-val {
  font-size: 17px; font-weight: 800; line-height: 1;
  color: var(--green-700); font-variant-numeric: tabular-nums;
}
.cm-lab { font-size: 10.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
/* 최근 경기 1·2·3등 메달 아이콘 — 숫자가 여러 개라 색만으로는(특히 은색)
 * 눈에 띄지 않아 숫자 앞에 아이콘을 붙인다 */
.cm-val { display: flex; align-items: center; justify-content: center; gap: 3px; }
.cm-val .medal { display: block; flex: none; filter: drop-shadow(0 1px 2px rgba(11,61,46,.2)); }
.cm-n { font-size: 9.5px; }   /* 스코어(7) 의 경기 수 */
.rank {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}
.rank svg { display: block; filter: drop-shadow(0 2px 3px rgba(11,61,46,.22)); }
/* 4등 이하 순위 배지 — 1·2·3등 왕관과 달리 숫자뿐이라 이름과 뭉쳐 보였다.
 * 왕관과 같은 34px 라운드 네모에 앱의 연초록을 넣어 눈에 띄게 한다. */
.rank-num {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid #a7e0c1;
  color: var(--green-800);
  font-size: 15px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 4px rgba(11,61,46,.10);
}

.member-info { flex: 1; min-width: 0; }
.member-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.member-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex; align-items: center; gap: 4px;
}
/* 배지와 핸디 숫자를 한 줄에 두고(gap 22px), 오른쪽에 여백을 줘 안쪽으로 당긴다.
 *   평균스코어 숫자 바로 위 = 여백 (폭의 1/6 - 숫자 폭의 절반)
 *   여기서 다시 절반만 남기면 그 지점과 카드 오른쪽 끝의 가운데에 놓인다.
 * % 여백은 카드 안쪽 폭 기준이라 화면 폭이 달라져도 위치 비율이 유지된다. */
.handi-box {
  flex: none;
  display: flex; align-items: center; gap: 22px;
  padding-right: calc(8.333% - 7.5px);
}
/* min-width : 한 자리(1)와 두 자리(15)인 사람의 배지·숫자 위치가 어긋나지 않게 */
.handi-value {
  min-width: 30px; text-align: center;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--green-800);
  font-variant-numeric: tabular-nums;
}
.change {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}
.change.up   { color: var(--down); background: rgba(28,126,214,.10); }   /* 상승 = 파랑 */
.change.down { color: var(--up);   background: rgba(224,49,49,.10); }    /* 하락 = 빨강(좋음) */
.change.same { color: var(--same); background: rgba(154,167,160,.14); }

/* ===== 하단 고정 액션바 ===== */
.action-bar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(238,243,236,0), #eef3ec 32%);
  display: flex;
  gap: 10px;
}
.btn {
  flex: 1;
  border: none;
  border-radius: 15px;
  padding: 15px 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  letter-spacing: -.2px;
  transition: transform .06s ease, filter .1s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: linear-gradient(135deg, var(--green-600), var(--green-800)); color: #fff; box-shadow: var(--shadow); }
.btn-share   { background: #fff; color: var(--green-800); border: 1.5px solid var(--green-600); }
.btn-ghost   { background: #fff; color: var(--muted); border: 1.5px solid var(--line); }
.btn-danger  { background: #fff; color: var(--up); border: 1.5px solid var(--up); }
.btn-full { width: 100%; flex: none; }
.btn:disabled { opacity: .5; }

/* ===== 하단 탭 네비게이션 ===== */
/* ===== 상단 메뉴 (햄버거 + 드롭다운) ===== */
.navmenu { flex: none; margin-left: auto; }

.nav-btn {
  background: rgba(255,255,255,.16);
  border: none; color: #fff;
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn:active { background: rgba(255,255,255,.30); }

/* 히어로 위의 버튼은 배경이 밝아서 더 진하게 */
.hero .nav-btn {
  background: rgba(0,0,0,.30);
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}
.hero .nav-btn:active { background: rgba(0,0,0,.45); }
.hero-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* 바깥을 덮어 탭하면 닫히게 한다 */
.nav-backdrop {
  position: fixed; inset: 0;
  z-index: 55;
  display: none;
}
.nav-backdrop.show { display: block; }

/* 패널은 body 직속이라 헤더의 overflow:hidden 에 잘리지 않는다.
 * 여는 순간 JS 가 버튼 좌표를 재서 top/right 를 넣는다. */
.nav-sheet {
  position: fixed;
  z-index: 60;
  min-width: 168px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(11, 61, 46, .18);
  padding: 6px;
  display: none;
  transform-origin: top right;
  animation: navPop .14s ease-out;
}
.nav-sheet.show { display: block; }
@keyframes navPop {
  from { opacity: 0; transform: scale(.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: 11px;
  border: none; background: transparent;
  padding: 11px 12px;
  border-radius: 11px;
  color: var(--ink);
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { background: var(--cream); }
.nav-item .ni { display: flex; line-height: 0; color: var(--muted); }
.nav-item .ni svg { width: 20px; height: 20px; }
.nav-item.is-active { color: var(--green-700); background: var(--accent-soft); }
.nav-item.is-active .ni { color: var(--green-700); }
/* 공유는 이동이 아니라 동작이라 선으로 구분한다 */
.nav-item.has-sep { margin-top: 5px; border-top: 1px solid var(--line); padding-top: 13px; border-radius: 0 0 11px 11px; }

/* ===== 스코어 표 ===== */
.score-panel { margin-top: 6px; }
.score-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.score-table th, .score-table td { padding: 13px 6px; text-align: center; font-size: 14px; }
/* 헤더가 페이지 배경(#eef3ec)과 거의 같은 톤이라 구분이 안 됐다. 초록 계열로 확실히 분리한다 */
.score-table thead th {
  background: var(--accent-soft);
  color: var(--green-800);
  font-size: 12px; font-weight: 800; letter-spacing: -.2px;
  border-bottom: 1px solid #b9e4cd;
}
.score-table thead th.c-rk { width: 46px; }
.score-table tbody tr + tr td { border-top: 1px solid var(--line); }
.score-table .tl { text-align: left; }
.score-table td.tl { font-weight: 700; color: var(--ink); white-space: nowrap; padding-left: 10px; }
.score-table .s-name { vertical-align: middle; }
.score-table .num { font-weight: 700; }
.score-table .num.muted { color: var(--muted); font-weight: 600; }
.score-table .num.total { color: var(--green-700); font-weight: 800; font-size: 15px; }
.score-table td.rk { font-weight: 800; color: var(--muted); }
.score-table td.rk.rk-top { color: var(--green-700); }

/* 날짜 박스 탭 → 달력에서 날짜 선택 */
.current-date { position: relative; cursor: pointer; }
.current-date .d-caret { display: inline-flex; vertical-align: middle; margin-left: 5px; color: var(--green-600); }
/* 날짜 박스 전체를 덮는 투명 date 입력 (탭 가능).
 * - 사파리/모바일: input을 직접 탭하면 네이티브 달력이 열림
 * - 크롬/데스크톱: input의 click 에서 showPicker() 로 열림
 * 두 경로를 동시에 걸어 환경 감지 없이 양쪽 모두 동작한다. */
.hidden-date {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}

/* ===== 스코어 입력 폼 ===== */
.score-form-list { display: flex; flex-direction: column; gap: 10px; }
.score-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px;
}
.score-row .sr-name { flex: 1; font-weight: 700; font-size: 15px; }
.score-row .sr-handi { font-size: 13px; color: var(--muted); white-space: nowrap; }
.score-row .sr-handi b { color: var(--green-700); font-weight: 800; }
.score-row .score-input {
  width: 76px; flex: none;
  border: 1.5px solid var(--line); border-radius: 11px;
  padding: 10px 6px; font-size: 16px; font-weight: 800;
  text-align: center; font-family: inherit; color: var(--ink);
  background: #fbfdfb; -moz-appearance: textfield;
}
.score-row .score-input:focus { outline: none; border-color: var(--green-500); background: #fff; }
.score-row .score-input::-webkit-outer-spin-button,
.score-row .score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ===== 핸디 관리: 선택 날짜의 이름별 핸디 상태 ===== */
.handi-status { display: flex; flex-direction: column; gap: 8px; }
.status-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; padding: 9px 12px;
}
.status-row .st-rank {
  width: 20px; flex: none; text-align: center;
  font-weight: 800; font-size: 14px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status-row .st-name { flex: 1; font-weight: 700; font-size: 15px; color: var(--ink); }
.status-row .st-right { display: flex; align-items: center; gap: 8px; }
.status-row .st-handi {
  font-weight: 800; font-size: 18px; color: var(--green-800);
  font-variant-numeric: tabular-nums; min-width: 24px; text-align: right;
}
.status-row .change { margin-top: 0; min-width: 52px; justify-content: center; }
.status-empty, .status-note { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.status-note { margin-bottom: 8px; font-weight: 600; }

/* ===== 비용정산 ===== */
.cost-actions { display: flex; gap: 8px; margin: 2px 0 16px; }
.cost-actions .btn { flex: 1; padding: 13px 4px; font-size: 14px; border-radius: 13px; }

/* 사람별 지출 / 배분 행 */
.cost-person {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px;
  padding: 13px 15px; box-shadow: var(--shadow); margin-bottom: 9px;
}
.cost-person .cp-name { flex: 1; font-weight: 700; font-size: 15px; }
.cost-person .cp-name .cp-pct { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 3px; }
.cost-person .cp-amt { font-weight: 800; color: var(--green-700); font-size: 16px; font-variant-numeric: tabular-nums; }
.cost-person .cp-amt span { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 2px; }

/* 사용총금액 입력 */
.amount-field { display: flex; align-items: center; gap: 8px; }
.amount-input {
  /* 사파리(WebKit)는 flex 아이템의 min-width:auto 를 input 의 기본 size(20자)
   * 고유 너비로 계산해 줄어들지 않는다 → 가로 스크롤 발생. min-width:0 으로 해제. */
  flex: 1; min-width: 0;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 20px; font-weight: 800; text-align: right;
  font-family: inherit; color: var(--ink); background: #fbfdfb;
  font-variant-numeric: tabular-nums;
}
.amount-input:focus { outline: none; border-color: var(--green-500); background: #fff; }
.amount-won { font-size: 15px; font-weight: 800; color: var(--muted); }

/* 정산 방식 토글(세그먼트 재사용) */
#methodToggle { margin: 8px 0 0; }

/* 합계% 배지 경고색 */
.date-badge.warn { background: rgba(224,49,49,.10); color: var(--up); }

/* 참여자 행 */
.part-list { display: flex; flex-direction: column; gap: 9px; }
.part-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; padding: 9px 12px;
}
.part-row .pr-name { flex: 1; font-weight: 700; font-size: 15px; }
.part-row .pr-share { font-size: 13px; color: var(--muted); font-weight: 700; }
.pct-wrap { display: flex; align-items: center; gap: 3px; }
.pct-input {
  width: 58px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 6px; text-align: center; font-size: 15px; font-weight: 800;
  font-family: inherit; color: var(--ink); background: #fbfdfb;
}
.pct-input:focus { outline: none; border-color: var(--green-500); background: #fff; }
.pct-sign { font-weight: 800; color: var(--muted); }
.pr-del {
  width: 30px; height: 30px; flex: none; border: none; border-radius: 9px;
  background: rgba(224,49,49,.10); color: var(--up);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pr-del:active { background: rgba(224,49,49,.22); }

/* 일자별 : 총 비용 카드 */
.total-card {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--green-600), var(--green-800));
  color: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.total-card .tc-label { font-size: 14px; font-weight: 700; opacity: .9; }
.total-card .tc-amt { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; }
.total-card .tc-amt span { font-size: 14px; opacity: .85; margin-left: 3px; }

/* 작은 빈 상태 */
.empty.sm { padding: 22px 12px; }

/* 수정/삭제 버튼 나란히 */
.edit-actions { display: flex; gap: 10px; }

/* ===== 수정 페이지 : 세그먼트 탭 ===== */
.segment {
  display: flex;
  background: #e2e9e0;
  border-radius: 14px;
  padding: 4px;
  margin: 4px 4px 18px;
}
.segment button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 0;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.segment button.active {
  background: #fff;
  color: var(--green-800);
  box-shadow: 0 2px 8px rgba(11,61,46,.12);
}

/* ===== 날짜 선택 ===== */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px 16px;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 6px;
}
.date-input {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #fbfdfb;
}
.date-input:focus { outline: none; border-color: var(--green-500); }

.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-nav .nav-arrow {
  width: 46px; height: 52px;
  flex: none;
  border: 1.5px solid var(--line);
  background: #fbfdfb;
  border-radius: 13px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--green-700);
}
.date-nav .nav-arrow:active { background: var(--accent-soft); }
.date-nav .nav-arrow:disabled { opacity: .35; cursor: default; }
.date-nav .current-date {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: var(--accent-soft);
  border-radius: 13px;
}
.date-nav .current-date .d-main {
  font-size: 20px; font-weight: 800; color: var(--green-800);
  letter-spacing: -.3px;
}
.date-nav .current-date .d-sub {
  font-size: 11.5px; color: var(--green-700); margin-top: 2px;
}

/* ===== 사람별 입력 폼 ===== */
.form-list { display: flex; flex-direction: column; gap: 9px; }
.form-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(11,61,46,.05);
}
/* min-width:0 — 사파리에서 안쪽 input 의 고유 너비(기본 20자)만큼 셀이 버텨
 * 행이 화면 밖으로 넘치는 것을 방지 (.amount-input 과 동일한 이유) */
.form-row .name-cell { flex: 1; min-width: 0; }
.form-row .name-cell input {
  width: 100%;
  border: none;
  font-size: 15.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  padding: 4px 0;
}
.form-row .name-cell input:focus { outline: none; }
.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f0f4ef;
  border-radius: 11px;
  padding: 3px;
}
.stepper button {
  width: 32px; height: 32px;
  border: none; background: #fff;
  border-radius: 9px;
  font-size: 18px; font-weight: 800;
  color: var(--green-700);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stepper button:active { background: var(--accent-soft); }
.stepper input {
  width: 46px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  color: var(--green-800);
  font-variant-numeric: tabular-nums;
}
.stepper input:focus { outline: none; }
.del-btn {
  width: 34px; height: 34px;
  flex: none;
  border: none;
  background: rgba(224,49,49,.08);
  color: var(--up);
  border-radius: 10px;
  display: grid; place-items: center;
  cursor: pointer;
}
.del-btn:active { background: rgba(224,49,49,.18); }

.add-member-btn {
  margin-top: 4px;
  width: 100%;
  border: 1.5px dashed var(--green-500);
  background: rgba(52,209,122,.06);
  color: var(--green-700);
  border-radius: 14px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.add-member-btn:active { background: rgba(52,209,122,.14); }

.form-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 14px 4px 4px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

/* ===== 빈 상태 ===== */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty svg { opacity: .4; margin-bottom: 12px; }
.empty p { font-size: 14px; margin: 0; }

/* ===== 모달(비밀번호 / 알림) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,37,28,.5);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 22px;
  padding: 26px 22px 22px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .m-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--green-700);
  display: grid; place-items: center;
}
.modal h3 { text-align: center; margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.modal p { text-align: center; margin: 0 0 18px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.modal .pw-input {
  width: 100%;
  padding: 15px;
  font-size: 20px;
  text-align: center;
  letter-spacing: 8px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-family: inherit;
  background: #fbfdfb;
  margin-bottom: 8px;
}
.modal .pw-input:focus { outline: none; border-color: var(--green-500); }
.modal .pw-error {
  color: var(--up);
  font-size: 12.5px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 8px;
  font-weight: 600;
}
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ===== 토스트 ===== */
.toast {
  position: fixed;
  left: 50%; bottom: 96px;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 200;
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 멤버 관리 (score.html) ===== */
.member-add {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.member-input {
  flex: 1; min-width: 0;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; font-weight: 600;
  font-family: inherit; color: var(--ink); background: #fbfdfb;
}
.member-input:focus {
  outline: none; border-color: var(--accent);
  background: #fff;
}
.member-add .btn { flex: none; width: auto; padding: 12px 16px; }

.member-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px;
  margin-bottom: 8px;
}
.member-row:last-child { margin-bottom: 0; }
.member-row .mr-name {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-row .mr-edit { padding: 9px 11px; font-size: 15px; }

.btn-mini {
  flex: none;
  border: 1px solid var(--line); background: #f6f9f6;
  color: var(--muted); font-family: inherit;
  font-size: 13px; font-weight: 700;
  padding: 8px 11px; border-radius: 10px;
  cursor: pointer; touch-action: manipulation;
}
.btn-mini:active { transform: scale(.96); }
.btn-mini-primary {
  background: var(--green-700); border-color: var(--green-700); color: #fff;
}
.btn-mini-danger { color: var(--up); border-color: #f3d6d6; background: #fdf5f5; }

/* =========================================================================
 * 번개모임 (flash.html · flash-history.html)
 *   두 페이지의 body 에 .flash 가 붙는다. 다른 화면과 같이 쓰는 클래스를
 *   고칠 때는 .flash 로 범위를 좁혀 스코어·정산 화면에 번지지 않게 한다.
 * ========================================================================= */

/* 헤더 : 제목이 길어도 오른쪽 버튼을 밀어내지 않게 */
.flash .head-text { min-width: 0; }
.flash .app-header h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 헤더 오른쪽 '기록' 버튼 (메뉴 버튼 왼쪽) */
.head-link {
  flex: none; margin-left: auto;
  height: 38px; padding: 0 12px;
  border: none; border-radius: 11px;
  background: rgba(255,255,255,.16); color: #fff;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
}
.head-link svg { width: 17px; height: 17px; }
.head-link:active { background: rgba(255,255,255,.30); }
.head-link + .navmenu { margin-left: 0; }

/* 헤더 : 3단계 진행 표시 */
.steps { display: flex; gap: 6px; margin-top: 16px; position: relative; z-index: 1; }
.steps button {
  flex: 1; border: none; cursor: pointer;
  background: rgba(255,255,255,.14); color: rgba(255,255,255,.78);
  border-radius: 12px; padding: 9px 4px;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.steps button .no {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 800;
}
.steps button.active { background: #fff; color: var(--green-800); }
.steps button.active .no { background: var(--green-600); color: #fff; }
.steps button.done .no { background: var(--accent); color: var(--green-900); }

/* 게스트 추가 입력 줄 */
.guest-row { display: flex; gap: 8px; margin-top: 10px; }
.guest-row .date-input { flex: 1; min-width: 0; padding: 12px; font-size: 15px; }
.guest-row .btn { flex: none; padding: 0 16px; font-size: 14px; border-radius: 13px; }

/* 참가자 선택 칩 */
.chip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fbfdfb; color: var(--ink);
  border-radius: 13px; padding: 10px 2px; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.chip.is-on {
  background: linear-gradient(135deg, var(--green-600), var(--green-800));
  color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(20,108,67,.25);
}
.chip.is-on small { color: rgba(255,255,255,.8); }

.flash .form-row { padding-left: 16px; }
.flash .form-row .name-cell .nm { font-size: 15.5px; font-weight: 700; }
.ratio-head { margin-top: 22px; }

/* 비율 프리셋 버튼 */
.mini-seg { display: flex; gap: 8px; margin: 0 0 10px; }
.mini-seg button {
  flex: 1; border: 1.5px solid var(--line); background: #fff; color: var(--green-700);
  border-radius: 11px; padding: 9px 0; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
}
.mini-seg button:active { background: var(--accent-soft); }

.rank-badge {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: #f0f4ef; color: var(--muted);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.rank-badge.top { background: var(--accent-soft); color: var(--green-700); }

/* 단계 하단 버튼 줄 */
.step-actions { display: flex; gap: 10px; margin-top: 16px; }
.step-actions .btn { padding: 15px 6px; }
.step-actions .btn-ghost { flex: .7; }

/* 스코어 입력 행 / 순위 표 보강 */
.flash .score-row { padding-left: 16px; }
.flash .score-row .sr-name .sr-handi { margin-top: 2px; font-weight: 600; }
.flash .score-row .score-input { width: 88px; }
.flash .score-table td.rk small { display: block; font-size: 10px; font-weight: 700; color: var(--muted); }

/* 순위별 결과 행 (정산 · 기록 상세 공용) */
.cp-rank { width: 34px; flex: none; text-align: center; font-size: 24px; line-height: 1; }
.cp-rank.num { font-size: 14px; font-weight: 800; color: var(--muted); }
.cost-person .cp-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.cost-person .cp-tie {
  font-size: 11px; font-weight: 800; color: var(--green-700);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; margin-left: 6px;
}

/* 공유 미리보기 */
.share-panel { margin-top: 16px; }
.share-preview {
  margin: 0 0 12px; padding: 13px 14px;
  background: #f4f8f3; border: 1px dashed #cfdccf; border-radius: 13px;
  font-family: inherit; font-size: 13px; line-height: 1.65; color: var(--ink);
  white-space: pre-wrap; word-break: keep-all;
}

/* 기록 목록 카드 */
.round-card {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 9px; box-shadow: var(--shadow);
  font-family: inherit; color: var(--ink); cursor: pointer;
}
.round-card:active { background: #f7faf6; }
.rc-date {
  width: 44px; height: 46px; flex: none; border-radius: 12px;
  background: var(--accent-soft); color: var(--green-800);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.rc-date b { font-size: 18px; font-weight: 800; line-height: 1; }
.rc-date span { font-size: 11px; font-weight: 700; color: var(--green-700); margin-top: 3px; }
.rc-info { flex: 1; min-width: 0; }
.rc-names { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.rc-amt { flex: none; font-weight: 800; color: var(--green-700); font-size: 15.5px; font-variant-numeric: tabular-nums; }
.rc-amt span { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 2px; }

/* ===== 넓은 화면(PC) 대응 =====
 * 앱 폭이 480px 이라 그보다 조금만 넓어져도 여백이 생긴다. 그 여백과 컬럼이
 * 같은 톤이면 어디까지가 화면인지 구분되지 않는다.
 * 배경과 같은 톤이라 어디까지가 화면인지 구분되지 않는다.
 * 바깥을 한 톤 어둡게 하고 컬럼에 배경과 그림자를 줘서 경계를 만든다. */
@media (min-width: 520px) {
  body { background: #d5dfd7; }

  .app {
    background:
      radial-gradient(1200px 400px at 50% -120px, rgba(52, 209, 122, .25), transparent 60%),
      linear-gradient(180deg, #f7faf6 0%, #eef3ec 100%);
    box-shadow: 0 0 0 1px rgba(11, 61, 46, .07), 0 18px 55px rgba(11, 61, 46, .16);
  }

  /* 전체화면 오버레이도 같은 컬럼 모양을 유지한다 */
  #formView,
  #memberView { background: #d5dfd7; }

  #formView > .content,
  #memberView > .content {
    background: linear-gradient(180deg, #f7faf6 0%, #eef3ec 100%);
    box-shadow: 0 0 0 1px rgba(11, 61, 46, .07), 0 18px 55px rgba(11, 61, 46, .16);
    min-height: calc(100vh - 88px);   /* 헤더 높이를 뺀 만큼 채워 컬럼이 중간에서 끊기지 않게 */
  }

  /* 하단 고정 액션바도 컬럼 폭에 맞춰 배경을 준다 */
  .action-bar {
    background: linear-gradient(180deg, rgba(238,243,236,0), #eef3ec 32%);
    border-radius: 0;
  }
}
