/* 이리와서 이리해와 파티방 — '괴렘콘' 이미지팩 기반 테마
 * 방향: 손그림 스티커 느낌(굵은 잉크 외곽선 + 살짝 띄운 단색 그림자), 크림/살구빛 털색,
 *       빨간 리본·노란 별 포인트, 볼터치 핑크. 이미지가 흰 배경이라 밝은 크림 테마로 구성한다.
 */
:root {
  --bg: #fff6e8;          /* 크림 배경 */
  --bg2: #fdebd2;         /* 살구 연한 */
  --card: #ffffff;
  --card2: #fffaf2;
  --ink: #2b211c;         /* 캐릭터 외곽선 */
  --line: #2b211c;
  --line-soft: #ecd8bd;
  --text: #2b211c;
  --muted: #8a7462;
  --apricot: #f4b45c;     /* 털 주색 */
  --apricot-deep: #e0923a;
  --apricot-soft: #fde4bf;
  --ribbon: #d93a40;      /* 리본 빨강 */
  --ribbon-deep: #b5272e;
  --ribbon-soft: #fde1df;
  --star: #f7c843;        /* 리본 매듭 별 */
  --star-soft: #fff2c6;
  --blush: #f7b9bf;       /* 볼터치 */
  --blush-soft: #fde9ea;
  --leaf: #6fa35a;        /* 대나무(이미지 일부) — 모집 중 표시 */
  --leaf-soft: #e6f2dc;
  --sky-soft: #e2edf9;
  --lilac-soft: #efe7f8;
  --green: var(--leaf);
  --red: var(--ribbon);
  --amber: var(--apricot-deep);
  --radius: 18px;
  --shadow: 0 3px 0 var(--ink);
  --shadow-sm: 0 2px 0 var(--ink);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  min-height: 100vh;
  padding-bottom: calc(92px + var(--safe-b));
  /* 은은한 점무늬(이미지 없이 CSS 로) */
  background-image: radial-gradient(rgba(224, 146, 58, .13) 1.6px, transparent 1.7px);
  background-size: 22px 22px;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
img { max-width: 100%; }
.pic { display: block; mix-blend-mode: multiply; user-select: none; -webkit-user-drag: none; } /* 흰 배경을 바탕색에 녹임 */

/* ---------- 상단 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 246, 232, .94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 720px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; color: inherit; }
.brand-pic {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: #fff;
  border: 2px solid var(--ink); box-shadow: var(--shadow-sm); overflow: hidden;
}
.brand-pic img { width: 100%; height: 100%; }
h1 { margin: 0; line-height: 1.1; min-width: 0; }
h1 .b1 { display: block; font-size: 12px; font-weight: 700; color: var(--apricot-deep); letter-spacing: -.2px; white-space: nowrap; }
h1 .b2 { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.6px; white-space: nowrap; }
h1 .b2::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--ribbon); vertical-align: 3px; }
.top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn i { width: 9px; height: 9px; border-radius: 50%; background: var(--star); border: 1.5px solid var(--ink); }
.conn.ok i { background: var(--leaf); }
.conn.ok span { display: none; }
.conn.bad i { background: var(--ribbon); }
.conn.bad span { color: var(--ribbon); font-weight: 700; }
.user-chip {
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow-sm);
  padding: 4px 10px; font-size: 13px; font-weight: 700; max-width: 128px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.tag { color: var(--muted); font-size: .85em; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px auto 0; max-width: 720px; }
.stat { background: var(--card); border: 1.5px solid var(--line-soft); border-radius: 12px; padding: 5px 4px; text-align: center; }
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.rec b { color: var(--leaf); }
.stat.full b { color: var(--apricot-deep); }

.filters { display: flex; gap: 6px; margin: 10px auto 0; max-width: 720px; overflow-x: auto; scrollbar-width: none; padding-bottom: 3px; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto; background: var(--card); border: 2px solid var(--line-soft); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.filters button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters button .cnt { font-weight: 500; opacity: .75; margin-left: 3px; font-size: 12px; }

/* ---------- 본문 */
main { padding: 14px 16px; max-width: 720px; margin: 0 auto; }
.party-list { display: grid; gap: 12px; }
@media (min-width: 640px) { .party-list { grid-template-columns: 1fr 1fr; } }

/* 일반파티 자동 배정 */
.auto-join {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  background: var(--apricot-soft); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 12px;
}
.auto-join .pic { width: 72px; height: 72px; flex: 0 0 auto; }
.auto-join .aj-body { flex: 1; min-width: 0; }
.auto-join h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.auto-join p { margin: 2px 0 8px; font-size: 12.5px; color: #6f5643; }
.auto-join .btn { width: 100%; }

.card {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px 12px; cursor: pointer; position: relative;
  transition: transform .08s, box-shadow .08s; min-width: 0;
}
.card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.card.full { background: var(--card2); }
.card.mine { background: var(--star-soft); }
.card.mine::after {
  content: "내 파티"; position: absolute; top: -11px; right: 14px; background: var(--ribbon); color: #fff;
  font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; border: 2px solid var(--ink);
}
.card.flash { animation: flash 1.1s ease-out; }
@keyframes flash { from { box-shadow: 0 3px 0 var(--ink), 0 0 0 5px var(--star); } to { box-shadow: var(--shadow); } }

.card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pno { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; flex: 0 0 auto; }
.ptitle {
  margin: 7px 0 9px; font-size: 20px; font-weight: 800; letter-spacing: -.5px; line-height: 1.28;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ptitle.placeholder { color: #5f4a3b; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1.5px solid var(--ink); }
.cat-rank { background: var(--ribbon-soft); }
.cat-normal { background: var(--apricot-soft); }
.cat-scrim { background: var(--leaf-soft); }
.cat-cobalt { background: var(--sky-soft); }
.cat-event { background: var(--star-soft); }
.cat-other { background: var(--lilac-soft); }
.st { font-size: 12px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); }
.st.recruiting { color: #3f7a2e; }
.st.recruiting::before { background: var(--leaf); }
.st.full { color: var(--apricot-deep); }
.st.full::before { background: var(--apricot); }
.st.closed { color: var(--muted); }
.st.closed::before { background: #ccc; }

.slots { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.slots li {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0;
  font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 10px;
  background: var(--card2); border: 1.5px solid var(--ink);
}
.slots li.open { border-style: dashed; border-color: #c9ad8f; color: var(--muted); background: transparent; font-weight: 500; }
.slots .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.slots .tag { display: none; }
.crown { font-size: 12px; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meta { font-size: 12px; color: var(--muted); line-height: 1.35; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1.5px solid var(--ink); background: var(--card); }
.badge.me { background: var(--star-soft); }
.badge.auto { background: var(--apricot-soft); }
.badge.full { background: var(--blush-soft); }

/* ---------- 버튼 */
.btn {
  border: 2px solid var(--ink); background: var(--card); color: var(--text); box-shadow: var(--shadow-sm);
  border-radius: 12px; padding: 10px 14px; font-weight: 800; cursor: pointer; white-space: nowrap;
  transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.primary { background: var(--apricot); }
.btn.ribbon, .btn.green { background: var(--ribbon); color: #fff; }
.btn.ribbon:disabled { background: var(--card2); color: var(--muted); border-color: var(--line-soft); opacity: 1; }
.btn.danger { color: var(--ribbon-deep); background: var(--ribbon-soft); }
.btn.danger.armed { background: var(--ribbon); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line-soft); }
.btn.big { padding: 13px 14px; font-size: 16px; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 10px; justify-content: center;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 72%, rgba(255, 246, 232, 0));
}
.bottombar .btn { flex: 1; max-width: 340px; padding: 13px 10px; font-size: 15px; }

/* ---------- 로그인 */
.login { display: flex; justify-content: center; padding-top: 2vh; }
.login-card {
  width: 100%; max-width: 420px; background: var(--card); border: 2px solid var(--ink);
  border-radius: 22px; box-shadow: 0 4px 0 var(--ink); padding: 18px 18px 20px; position: relative;
}
.login-hero { display: flex; align-items: center; gap: 10px; margin: -4px 0 6px; }
.login-hero .pic { width: 104px; height: 104px; flex: 0 0 auto; }
.login-card h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.5px; }
.login-card p { margin: 0; }
label { display: block; font-size: 13px; font-weight: 700; color: #6f5643; margin: 12px 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; font-size: 16px; /* iOS 확대 방지 */
  color: var(--text); background: var(--card2); border: 2px solid var(--line-soft); border-radius: 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--apricot-deep); background: #fff; }
.recover { margin-top: 18px; border-top: 2px dashed var(--line-soft); padding-top: 12px; }
.recover summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 700; }
.dev-box { margin-top: 18px; padding: 10px 12px; border: 2px dashed var(--apricot-deep); border-radius: 12px; background: var(--star-soft); }
.dev-box p { margin: 0; color: #8a5a12; }

.empty { text-align: center; padding: 26px 0 40px; }
.empty .pic { width: 150px; height: 150px; margin: 0 auto 4px; }
.empty p { margin: 6px 0; font-weight: 700; }
.empty p.small { font-weight: 400; }

/* ---------- 카카오 인증 */
.btn.kakao { background: #fee500; color: #191600; }  /* 카카오 공식 노란색 버튼 */
.kakao-box { margin-top: 6px; }
.invite-box { margin-top: 16px; border-top: 2px dashed var(--line-soft); padding-top: 12px; }
.invite-box summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 700; }
.kakao-flow { margin-top: 12px; display: grid; gap: 10px; }
.kflow-state { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 2px solid var(--ink);
  border-radius: 14px; padding: 10px 12px; }
.kflow-state .pic { width: 64px; height: 64px; flex: 0 0 auto; }
.kflow-state b { display: block; font-size: 16px; }
.kflow-state.ok { background: var(--leaf-soft); }
.kflow-state.err { background: var(--ribbon-soft); }
.kflow-code { font-size: 22px; font-weight: 800; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line-soft); border-top-color: var(--apricot-deep);
  display: inline-block; vertical-align: -4px; margin-right: 6px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- 바텀 시트 */
.backdrop { position: fixed; inset: 0; background: rgba(43, 33, 28, .45); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border: 2px solid var(--ink); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + var(--safe-b));
  max-width: 720px; margin: 0 auto; animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line-soft); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 21px; font-weight: 800; letter-spacing: -.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.sheet h4 { font-size: 14px; margin: 16px 0 6px; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.sheet-pic { width: 120px; height: 120px; margin: 0 auto 6px; }
.detail-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1.5px dashed var(--line-soft); min-width: 0; }
.member-row .n { width: 18px; text-align: right; font-size: 12px; }
.member-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.member-row .name.muted { font-weight: 500; }
.member-row .acts { display: flex; gap: 6px; flex: 0 0 auto; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.actions .full { grid-column: 1 / -1; }
.notice { background: var(--apricot-soft); border: 1.5px solid var(--ink); border-radius: 12px; padding: 9px 11px; font-size: 13px; }
.events { margin-top: 16px; font-size: 12px; color: var(--muted); }
.events h4 { margin: 0 0 4px; font-size: 13px; color: var(--text); }
.events ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.cat-grid button {
  padding: 10px 4px; border-radius: 12px; border: 2px solid var(--line-soft); background: var(--card);
  cursor: pointer; font-weight: 800; font-size: 14px; color: var(--text); line-height: 1.2;
}
.cat-grid button small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.cat-grid button.on { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.stepper { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.stepper .btn { width: 46px; padding: 8px 0; font-size: 18px; }
.stepper output { min-width: 54px; text-align: center; font-size: 20px; font-weight: 800; color: var(--text); }
.fixed-cap { margin-top: 6px; font-size: 15px; font-weight: 800; color: var(--text); }
.fixed-cap span { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 6px; }
.copy-area { width: 100%; height: 240px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); z-index: 40;
  background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: 14px;
  padding: 10px 14px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.toast.err { background: var(--ribbon-deep); }

.mt8 { margin-top: 8px; }
.mt14 { margin-top: 14px; }
.mt16 { margin-top: 16px; }
.linkbtn { display: block; text-align: center; text-decoration: none; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .card.flash { animation: none; }
  .btn, .card { transition: none; }
}
