:root {
  /* ── 라이트 모던 미니멀 토큰 (무채색 + 인디고 포인트 1개) ── */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --line: #ececf0;
  --line-strong: #e0e0e6;

  --text: #16161a;
  --text2: #6e6e78;   /* 보조 텍스트 */
  --text3: #a0a0aa;   /* 약한/플레이스홀더 */

  --brand: #2d3a5e;        /* 포인트색 (잉크 네이비) */
  --brand-soft: #eef0f5;   /* 네이비 연한 배경 */
  --brand-line: #d4d9e6;   /* 네이비 연한 테두리 */
  --ok: #2d3a5e;           /* 완료 = 포인트와 한 색(절제) */
  --ok-soft: #eef0f5;
  --danger: #c0524d;
  --fire-warm: #df8a32;
  --fire-hot: #dc4f3f;
  --fire-blaze: #b92f36;

  --r: 16px;               /* 기본 라운드 */
  --r-sm: 12px;
  --shadow: 0 1px 3px rgba(20,20,40,.05), 0 1px 2px rgba(20,20,40,.03);
  --shadow-btn: 0 4px 12px rgba(45,58,94,.25);

  /* 아바타 grayscale 강도(60% — 색 살짝만) */
  --av-gray: grayscale(0.6);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text); min-height: 100vh;
  width: 100%; overflow-x: hidden;   /* 가로 넘침 차단(반응형) */
}
.app { width: 100%; max-width: 400px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 24px; }
.screen { display: none; padding: 26px 18px 16px; animation: fade .2s; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Lucide 아이콘 기본 */
[data-lucide] { width: 1em; height: 1em; stroke-width: 2; vertical-align: -.12em; }

/* ── DiceBear 아바타 ── */
.av { border-radius: 50%; background: #eef0f4; object-fit: cover; flex-shrink: 0; filter: var(--av-gray); display: inline-block; }
.av-lg { width: 44px; height: 44px; }
.av-md { width: 38px; height: 38px; }
.av-sm { width: 30px; height: 30px; }
.av-xs { width: 22px; height: 22px; }
.av-xl { width: 64px; height: 64px; }

h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.sub { color: var(--text2); font-size: 13px; margin-top: 8px; line-height: 1.5; }
.section-title { font-size: 12px; color: var(--text3); font-weight: 700; letter-spacing: .3px; text-transform: uppercase; margin: 28px 4px 12px; }
.back { background: none; border: none; color: var(--text2); font-size: 14px; cursor: pointer; margin-bottom: 8px; padding: 4px 0; display: inline-flex; align-items: center; gap: 4px; }

/* 입장 */
.enter-hero { text-align: center; margin: 44px 0 24px; }
.enter-hero .logo { font-size: 48px; }
.enter-hero h1 { margin-top: 14px; }
.enter-foot { text-align: center; font-size: 12px; color: var(--text3); margin-top: 16px; line-height: 1.5; }
.reset-btn { display: block; margin: 16px auto 0; background: none; border: 1px dashed var(--line-strong);
  color: var(--text3); border-radius: 9px; padding: 8px 14px; font-size: 11px; cursor: pointer; font-family: inherit; }
.pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px;
  transition: border-color .15s, transform .1s; box-shadow: var(--shadow);
}
.pick:active { transform: scale(.99); }
.pick:hover { border-color: var(--line-strong); }
.pick .info { flex: 1; }
.pick .nm { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.pick .rl { font-size: 12.5px; color: var(--text2); margin-top: 3px; }
.pick .arrow { color: var(--text3); display: inline-flex; }
.team-head { font-size: 12px; color: var(--brand); font-weight: 700; margin: 18px 4px 8px; display: flex; align-items: center; gap: 5px; }

/* 핀 */
.pin-card { text-align: center; margin-top: 24px; }
.pin-ava { display: inline-flex; }
.pin-ava .av { width: 64px; height: 64px; }
.pin-name { font-size: 20px; font-weight: 800; margin-top: 12px; letter-spacing: -.3px; }
.pin-role { font-size: 13px; color: var(--text2); margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.pin-prompt { font-size: 14px; color: var(--text2); margin-top: 22px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.pin-dots .dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong);
  transition: all .15s;
}
.pin-dots .dot.on { background: var(--brand); border-color: var(--brand); }
.pin-err { color: var(--danger); font-size: 13px; height: 18px; margin-top: 4px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 280px; margin: 12px auto 0; }
.pin-key {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 0; font-size: 22px; font-weight: 700; color: var(--text); cursor: pointer;
  font-family: inherit; transition: background .1s; box-shadow: var(--shadow);
}
.pin-key:active { background: var(--bg); }
.pin-key.empty { background: none; border: none; box-shadow: none; cursor: default; }

/* 오늘 */
.me-bar {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; box-shadow: var(--shadow);
}
.me-ava { display: inline-flex; }
.me-bar .nm { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.me-bar .rl { font-size: 12.5px; color: var(--text2); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.me-bar .rl [data-lucide] { font-size: 14px; }
.logout { margin-left: auto; background: var(--bg); border: 1px solid var(--line); color: var(--text2);
  border-radius: 10px; padding: 8px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px; }
.logout [data-lucide] { font-size: 15px; }

/* D-day 큰 타이포 (작은 뱃지 → 위계 강화) */
.day-hero { margin: 24px 4px 4px; }
.day-hero .big { font-size: 28px; font-weight: 800; letter-spacing: -.8px; }
.day-hero .big b { color: var(--brand); }
.day-hero .date { font-size: 13px; color: var(--text3); margin-top: 2px; }

.mission {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); transition: border-color .15s, background .15s;
}
.mission.done { border-color: var(--brand-line); background: var(--ok-soft); }
.mission .top { display: flex; align-items: flex-start; gap: 14px; }
.check {
  width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--line-strong);
  flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: transparent; transition: all .15s; margin-top: 1px;
}
.check [data-lucide] { font-size: 17px; }
.mission.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.mission .body { flex: 1; }
.mission .mtitle { font-weight: 700; font-size: 15.5px; letter-spacing: -.2px; }
.mission .done-tag { font-size: 11px; font-weight: 700; color: var(--ok); margin-left: 6px;
  background: var(--ok-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mission .mdesc { font-size: 13px; color: var(--text2); margin-top: 5px; line-height: 1.5; }
.mission .mteam { font-size: 12px; color: var(--text3); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.mission .mteam [data-lucide] { font-size: 13px; }
.mission .memo {
  margin-top: 12px; width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; color: var(--text); font-size: 14px; resize: none;
  font-family: inherit; display: none;
}
.mission.done .memo { display: block; }
.mission .memo::placeholder { color: var(--text3); }
.finish-btn {
  width: 100%; margin-top: 8px; padding: 16px; border: none; border-radius: 14px;
  font-size: 15.5px; font-weight: 700; cursor: pointer; font-family: inherit;
  background: var(--brand); color: #fff; transition: transform .12s, opacity .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow-btn); opacity: .55;
}
.finish-btn [data-lucide] { font-size: 18px; }
.finish-btn:active { transform: scale(.98); }
.finish-btn.ready { opacity: 1; }

/* 오늘 화면 - 6명은 3×2, 7명은 4+3. 스크롤 없이 파티 전체를 한눈에 본다. */
.party-strip {
  display: grid; gap: 10px; overflow: visible; padding: 9px 4px 6px;
}
.party-strip.cols-1 { grid-template-columns: 1fr; }
.party-strip.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.party-strip.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.party-strip.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pchip {
  min-width: 0; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 6px 9px; position: relative; transition: all .3s; box-shadow: var(--shadow);
}
.pchip .pava { line-height: 1; transition: all .35s; display: inline-flex; }
.pchip .pava .av { width: 38px; height: 38px; opacity: .4; }
.pchip .pnm {
  font-size: 11px; color: var(--text3); margin: 7px auto 0; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  text-align: center;
}
.pchip .pbadge {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 800;
  display: none; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.pchip .pbadge [data-lucide] { font-size: 12px; }
/* 서포터즈(팀 리더) 왕관 */
.pchip .pcrown {
  position: absolute; top: 3px; left: 5px; color: #d6a93a;
}
.pchip .pcrown [data-lucide] { font-size: 14px; }
/* 완료(점등) 상태 */
.pchip.on { border-color: var(--brand); background: var(--brand-soft); }
.pchip.on .pava .av { opacity: 1; transform: scale(1.05); }
.pchip.on .pnm { color: var(--brand); font-weight: 700; }
.pchip.on .pbadge { display: flex; }
.pchip.me.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.pchip.me .pnm { color: var(--brand); }
.party-strip.stage-warm .pchip.on { border-color: #efc58f; background: #fff8ef; }
.party-strip.stage-warm .pchip.on .pbadge { background: var(--fire-warm); }
.party-strip.stage-hot .pchip.on { border-color: #e9a49b; background: #fff3f1; }
.party-strip.stage-hot .pchip.on .pbadge { background: var(--fire-hot); }
.party-strip.stage-blaze .pchip.on {
  border-color: var(--fire-blaze); background: #fff0f0;
  box-shadow: 0 0 0 1px rgba(185,47,54,.14), 0 5px 16px rgba(185,47,54,.12);
}
.party-strip.stage-blaze .pchip.on .pbadge { background: var(--fire-blaze); }
/* 방금 켜진 칩 펄스 */
@keyframes lightUp { 0% { transform: scale(.85); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
.pchip.just-on .pava { animation: lightUp .5s; }

.party-msg { text-align: center; font-size: 13px; color: var(--text2); margin: 8px 4px 0; line-height: 1.5; }
.party-msg b { color: var(--brand); }
.party-msg.stage-warm b { color: var(--fire-warm); }
.party-msg.stage-hot b { color: var(--fire-hot); }
.party-msg.stage-blaze b { color: var(--fire-blaze); }

/* 팀 보드 */
.board-head { display: flex; align-items: baseline; justify-content: space-between; }
.board-head .day { font-size: 13px; color: var(--brand); font-weight: 700; }
.summary {
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: var(--r); padding: 16px; text-align: center; margin: 14px 0 4px;
}
.summary .big { font-size: 15px; font-weight: 700; line-height: 1.5; }
.summary .big b { color: var(--brand); }
.mate {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.mate.me { border-color: var(--brand); }
.mate .info { flex: 1; min-width: 0; }
.mate .nm { font-weight: 700; font-size: 14px; }
.mate .rl { font-size: 11px; color: var(--text2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mate .right { text-align: right; }
.mate .today { font-size: 12px; font-weight: 700; }
.mate .today.on { color: var(--ok); }
.mate .today.off { color: var(--text3); }
.mate .days { font-size: 11px; color: var(--text3); margin-top: 3px; }

.grid-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 14px; box-shadow: var(--shadow); max-width: 100%; overflow: hidden; }
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; }
th, td { text-align: center; }
.row-label {
  font-size: 12px; color: var(--text); white-space: nowrap; padding-right: 10px;
  text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--surface);
  display: flex; align-items: center; gap: 6px;
}
.col-day { font-size: 9px; color: var(--text3); padding-bottom: 8px; min-width: 18px; }
.col-day.today { color: var(--brand); font-weight: 800; }
.cell { width: 18px; height: 20px; padding: 1px 0; }
.cell [data-lucide] { font-size: 13px; }
.cell.done { color: var(--ok); }
.cell.stage-warm { color: var(--fire-warm); }
.cell.stage-hot { color: var(--fire-hot); }
.cell.stage-blaze { color: var(--fire-blaze); }
.cell.stage-blaze [data-lucide] {
  filter: drop-shadow(0 1px 2px rgba(185,47,54,.3));
}
.cell.miss .miss-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.cell.today { box-shadow: 0 0 0 1.5px var(--brand) inset; border-radius: 5px; }

/* 탭 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab { flex: 1; text-align: center; padding: 10px 0 12px; cursor: pointer; color: var(--text3);
  font-size: 11px; border: none; background: none; font-family: inherit; }
.tab .ico { font-size: 20px; display: block; margin-bottom: 3px; }
.tab.active { color: var(--brand); }
.tabbar.hidden { display: none; }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; font-weight: 700; padding: 10px 20px;
  border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 5;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#confetti {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 50; display: none;
}
#confetti.on { display: block; }

/* ── PWA 설치 버튼(안드로이드) ── */
.pwa-install {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; box-shadow: 0 6px 20px rgba(45,58,94,.35); z-index: 40;
  display: inline-flex; align-items: center; gap: 7px;
}
.pwa-install [data-lucide] { font-size: 17px; }

/* ── PWA 안내 배너(아이폰) ── */
.pwa-guide { position: fixed; inset: 0; background: rgba(20,20,40,.4); z-index: 60;
  display: flex; align-items: flex-end; }
.pwa-guide-card {
  background: var(--surface); width: 100%; max-width: 480px; margin: 0 auto;
  border-radius: 20px 20px 0 0; padding: 24px 22px 30px; position: relative; text-align: center;
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
}
.pwa-guide-x { position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--text3); cursor: pointer; }
.pwa-guide-x [data-lucide] { font-size: 20px; }
.pwa-guide-ttl { font-size: 17px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 6px; }
.pwa-guide-ttl [data-lucide] { color: var(--brand); }
.pwa-guide-body { font-size: 14px; color: var(--text2); margin-top: 12px; line-height: 1.7; }
.pwa-guide-body b { color: var(--text); }
.pwa-guide-body [data-lucide] { font-size: 15px; vertical-align: -.15em; }
.save-notice { margin: 12px 0; padding: 12px; border-radius: 12px; background: #fff1dc; color: #704414; font-size: 14px; line-height: 1.6; }
.save-notice button { display: block; margin-top: 8px; padding: 7px 10px; border: 1px solid #c58b43; border-radius: 8px; background: white; color: inherit; cursor: pointer; }
