:root {
  --ink: #111113;
  --ink-2: #2a2a2e;
  --red: #e4002b;
  --red-deep: #b30022;
  --red-soft: #ffe9ed;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --line: #ececf0;
  --muted: #8b8b94;
  --ok: #12a150;
  --shadow: 0 8px 24px rgba(17, 17, 19, 0.08);
  --shadow-red: 0 8px 18px rgba(228, 0, 43, 0.25);
  --kr: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --en: "Poppins", var(--kr);
  --tabbar: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-2); color: var(--ink); font: 15px/1.5 var(--kr); word-break: keep-all; overflow-wrap: anywhere; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 앱 껍데기: 모바일 폭 기둥 */
.shell { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--bg); position: relative; }
.top {
  position: sticky; top: 0; z-index: 10; height: 56px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px);
}
.logo { font-weight: 800; font-size: 19px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 7px; }
.logo i { width: 24px; height: 24px; border-radius: 7px; background: var(--red); display: grid; place-items: center; }
.logo svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-2); border: 0; }
#app { padding: 4px 20px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); display: grid; gap: 0; }
.loading, .empty-text { color: var(--muted); text-align: center; padding: 48px 0; }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 20;
  width: 100%; max-width: 480px; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center;
  background: #fff; border-top: 1px solid var(--line);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: #a3a3ab; padding: 6px 0; }
.tabbar a.on { color: var(--red); font-weight: 700; }
.tabbar .plus { width: 40px; height: 40px; border-radius: 13px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.tabbar a.on .plus { background: var(--red); }

/* 공통 요소 */
.h1 { font-size: 26px; font-weight: 800; line-height: 1.28; letter-spacing: -0.035em; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  height: 52px; border-radius: 12px; border: 0; font-weight: 700; font-size: 16px;
  background: var(--bg-2); color: var(--ink);
}
.btn.red { background: var(--red); color: #fff; box-shadow: var(--shadow-red); }
.btn.ink { background: var(--ink); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.field-in {
  width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid transparent; background: var(--bg-2);
  padding: 0 14px; outline: none; font-size: 16px; /* 16px 미만이면 아이폰이 입력할 때 화면을 확대함 */
}
.field-in:focus { border-color: var(--ink); background: #fff; }
.row { display: flex; gap: 8px; }
.row .field-in { flex: 1; min-width: 0; }
.sq-btn { width: 50px; height: 50px; flex: none; border-radius: 12px; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-red); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 12px; }
.sec-head b { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.sec-head span { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.hint.good { color: var(--ok); }
.hint.bad, .err { color: var(--red); }
.err:empty { display: none; }
.err { font-size: 14px; display: grid; gap: 2px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); }
.pill.red { background: var(--red-soft); color: var(--red-deep); }
.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--ink); color: #fff; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.notice svg { color: var(--red); margin-top: 1px; }

/* 포스터 카드 (사진 대신 타이포) */
.poster { position: relative; border-radius: 14px; background: var(--ink); color: #fff; overflow: hidden; isolation: isolate; }
.poster.red { background: var(--red); }
.poster .big {
  position: absolute; left: 9%; top: 22%; z-index: -1;
  font-family: var(--en); font-weight: 800; font-style: italic; line-height: 0.85; letter-spacing: -0.03em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.2);
}
.poster.red .big { -webkit-text-stroke-color: rgba(255, 255, 255, 0.42); }
.poster .stripe { position: absolute; left: -20%; right: -20%; top: 56%; height: 13%; background: var(--red); transform: rotate(-12deg); z-index: -1; }
.poster.red .stripe { background: var(--ink); }
.poster .pos { position: absolute; left: 9%; top: 8%; font: 600 11px var(--en); letter-spacing: 0.12em; color: var(--red); }
.poster.red .pos { color: #fff; }
.poster .kr { position: absolute; left: 9%; bottom: 8%; font-weight: 800; letter-spacing: -0.03em; font-size: 16px; }
.poster.mini { aspect-ratio: 3 / 4; }
.poster.mini .big { font-size: 23px; top: 26%; }
.poster.hc { width: 34%; aspect-ratio: 2 / 3; position: absolute; box-shadow: var(--shadow); }
.poster.hc .big { font-size: 58px; left: -4%; top: 6%; }
.poster.hc .pos { top: 7%; }
.poster.hc .kr { font-size: 19px; }

/* 홈 */
.hero { position: relative; aspect-ratio: 1.42; margin: 0 -4px 14px; }
.hero .poster:nth-child(1) { left: 2%; top: 12.5%; transform: rotate(-10deg); }
.hero .poster:nth-child(2) { left: 30.5%; top: 3%; transform: rotate(1deg); width: 39%; z-index: 2; }
.hero .poster:nth-child(3) { right: 2%; top: 14%; transform: rotate(9deg); }
.hero .poster:nth-child(3) .pos, .hero .poster:nth-child(3) .kr { left: auto; right: 9%; }
.home-copy { display: grid; gap: 6px; margin-bottom: 18px; }
.scope {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 8px; background: var(--red-soft); color: var(--red-deep); font-size: 13px; font-weight: 700; margin-bottom: 4px;
}
.scope::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.scope-b { color: var(--red); font-weight: 700; }
.home-actions { display: grid; gap: 10px; }
.lookup-cap { font-size: 13px; color: var(--muted); margin-top: 10px; }
.lookup-cap b { color: var(--ink); font-weight: 700; margin-right: 2px; }
.rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
.rail a { display: block; min-width: 0; }
.rail .cnt { font-size: 12px; color: var(--muted); margin-top: 6px; }
.rail .cnt b { color: var(--red); }
.foot { margin-top: 32px; font-size: 12px; color: #b1b1b8; line-height: 1.6; }

/* 등록 */
.form { display: grid; gap: 26px; margin-top: 18px; }
.form-head { display: grid; gap: 4px; margin: 6px 0 4px; }
.block { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.block-title { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; padding: 0; }
.block-title .tag { font-size: 12px; font-weight: 700; height: 22px; padding: 0 8px; border-radius: 6px; display: inline-flex; align-items: center; background: var(--ink); color: #fff; }
.block-title .tag.red { background: var(--red); }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick { position: relative; display: grid; gap: 6px; padding: 0; border: 0; background: none; text-align: left; }
.pick .poster { outline: 3px solid transparent; outline-offset: 2px; transition: outline-color 0.15s, transform 0.15s; }
.pick.on .poster { outline-color: var(--red); }
.pick:active .poster { transform: scale(0.97); }
.pick .badge { position: absolute; top: -6px; right: -6px; z-index: 3; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--red); color: #fff; font: 800 13px var(--en); display: none; place-items: center; border: 2px solid #fff; }
.pick.on .badge { display: grid; }
.pick-card { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 14px; }
.pick.off { cursor: not-allowed; }
.pick.off .poster { opacity: 0.22; }
.pick .off-label { position: absolute; inset: 0; display: none; place-items: center; z-index: 3; font-size: 13px; font-weight: 800; color: var(--ink); }
.pick.off .off-label { display: grid; }
.qty { display: flex; align-items: center; justify-content: space-between; height: 32px; border-radius: 9px; background: var(--bg-2); }
.qty button { width: 32px; height: 32px; border: 0; background: none; font-size: 18px; font-weight: 700; }
.qty button:disabled { opacity: 0.25; }
.qty output { font: 700 14px var(--en); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 38px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.preview { background: var(--bg-2); border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.preview .cap { font-size: 12px; color: var(--muted); }
.bub { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.4; }
.bub.in { background: #fff; box-shadow: var(--shadow); border-top-left-radius: 4px; justify-self: start; }
.bub.out { background: var(--red); color: #fff; border-top-right-radius: 4px; justify-self: end; }
.bub .ph { color: var(--muted); }
.bub.out .ph { color: rgba(255, 255, 255, 0.7); }

/* 매칭 */
.mhead { margin: 2px 0 14px; }
.mhead .who { font-size: 13px; color: var(--muted); }
.mhead b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.deck { position: relative; }
.match { height: 340px; box-shadow: var(--shadow); }
.match .big { font-size: 140px; left: -3%; top: 14%; -webkit-text-stroke-width: 2px; }
.match .stripe { top: 47%; height: 11%; }
.match .kr, .match > .pos { display: none; }
.match .tag { position: absolute; top: 14px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 700; display: flex; align-items: center; }
.match .tag.l { left: 14px; background: var(--red); color: #fff; }
.match.red .tag.l { background: var(--ink); }
.match .tag.r { right: 14px; background: rgba(255, 255, 255, 0.16); color: #fff; }
.match .ov { position: absolute; left: 20px; right: 20px; bottom: 20px; }
.match .ov .meta { font: 600 12px var(--en); letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.75); }
.match .ov .h { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 4px; }
.match .ov .swap { font-size: 15px; color: rgba(255, 255, 255, 0.85); }
.match .ov .swap b { color: #fff; }
.match .ov .swap .ar { color: var(--red); font-weight: 800; margin: 0 4px; }
.match.red .ov .swap .ar { color: var(--ink); }
.dots { display: flex; justify-content: center; gap: 5px; margin-top: 12px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width 0.2s; }
.dots i.on { width: 18px; background: var(--red); }
.actions { display: flex; justify-content: center; gap: 22px; margin: 14px 0 4px; }
.act { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 0; background: none; padding: 0; }
.act .sq { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; box-shadow: var(--shadow); background: #fff; color: var(--ink); }
.act .sq.red { background: var(--red); color: #fff; box-shadow: 0 10px 20px rgba(228, 0, 43, 0.3); }
.act .sq svg { width: 26px; height: 26px; }
.act .sq.red svg { fill: #fff; }
.act:disabled { opacity: 0.35; cursor: default; }
.cycles { margin-top: 22px; border-radius: 16px; background: var(--bg-2); }
.cycles summary { list-style: none; cursor: pointer; padding: 14px; display: flex; align-items: center; gap: 12px; }
.cycles summary::-webkit-details-marker { display: none; }
.cycles summary .txt { flex: 1; }
.cycles summary b { display: block; font-size: 15px; }
.cycles summary span { font-size: 12px; color: var(--muted); }
.cycles summary .chev { transition: transform 0.2s; color: var(--muted); }
.cycles[open] summary .chev { transform: rotate(180deg); }
.cycles .list { padding: 0 10px 10px; display: grid; gap: 8px; }
.trio { display: flex; flex: none; }
.trio i { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg-2); display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; }
.trio i + i { margin-left: -7px; }
.cy { background: #fff; border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.cy p { font-size: 15px; line-height: 1.5; }
.cy p b { font-weight: 800; }
.cy p .it { color: var(--red); font-weight: 800; }
.cy .sub { font-size: 13px; }
.cy .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cy .two a { height: 40px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mine { margin-top: 22px; display: grid; gap: 8px; }
.mine .cap { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.empty-card { border-radius: 16px; background: var(--bg-2); padding: 22px 18px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.empty-card .poster { width: 96px; opacity: 0.85; }
.close-box { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 10px; }
.close-box b { font-size: 15px; }
.close-box .sq-btn { width: auto; padding: 0 16px; background: var(--ink); box-shadow: none; font-weight: 700; font-size: 14px; }

/* 둘러보기 */
.ptabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; margin: 10px 0 14px; }
.ptabs a { height: 50px; border-radius: 12px; background: var(--bg-2); font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.2; }
.ptabs a small { font: 600 10px var(--en); letter-spacing: 0.08em; color: var(--muted); }
.ptabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.ptabs a[aria-current="page"] small { color: var(--red); }
.banner { height: 120px; margin-bottom: 14px; }
.banner .big { font-size: 96px; top: 10%; left: 32%; }
.banner .stripe { top: 50%; height: 22%; }
.banner .pos { top: 16%; left: 20px; }
.banner .kr { left: 20px; bottom: 16%; font-size: 26px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 8px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(17, 17, 19, 0.06); }
.rows { display: grid; }
.prow { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.av { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 800 15px var(--en); color: #fff; background: var(--ink); text-transform: uppercase; }
.prow .body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.prow .name { display: flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 15px; }
.prow .name span { font-weight: 500; font-size: 12px; color: var(--muted); }
.prow .line { font-size: 13px; color: var(--ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prow .line mark { background: none; color: var(--red); font-weight: 800; }
.hrt { color: var(--red); }
.prow .meth { font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prow .go { color: #c4c4cb; }

/* 내 매칭 찾기 */
.lookup { display: grid; gap: 14px; margin-top: 18px; }
.recent { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); }
.recent .av { width: 32px; height: 32px; font-size: 13px; }
.recent b { flex: 1; }
