:root {
  --bg: #eef2e9;
  --card: #fbfcf8;
  --text: #1d2a21;
  --sub: #6d7a70;
  --faint: #a3ada5;
  --line: #e2e8dc;
  --btn: #eff3ea;
  --btn-line: #dbe3d3;
  --green: #2f7d4f;
  --green-2: #3f9a63;
  --green-soft: #e2f1e5;
  --green-dark: #1d3527;
  --num: #2b7a5b;
  --odds: #c4472b;
  --lose: #c4472b;
  --yellow: #f6c64a;
  --yellow-soft: #fff6d8;
  --gold: #e3a50d;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px; letter-spacing: -0.2px; }
body { max-width: 520px; margin: 0 auto; padding-bottom: 150px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }
main { padding: 0 14px; }
.page { display: none; }
.page.on { display: block; }

/* ───── 헤더 · 티커 ───── */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 14px 14px 0;
  border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; }
.logo { font-size: 23px; font-weight: 900; color: var(--green-dark); letter-spacing: -1px; }
.logo b { color: var(--green); font-weight: 900; }
.logo::before { content: "🦗"; font-size: 18px; margin-right: 3px; }
.page-name { color: var(--sub); font-size: 13.5px; font-weight: 600; }
.ticker { overflow: hidden; white-space: nowrap; padding: 9px 0 10px; font-size: 13px; font-weight: 700;
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-track { display: inline-block; animation: tick 30s linear infinite; padding-left: 4px; }
.ticker-track span { margin-right: 26px; color: var(--green); }
.ticker-track span:nth-child(3n+2) { color: var(--odds); }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.top:not(:has(.ticker:not([hidden]))) { padding-bottom: 12px; }

/* ───── 공통 카드 ───── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sec-head b { font-size: 16px; }
.sec-head small { color: var(--sub); font-size: 12px; }
.count-line { color: var(--sub); font-size: 13.5px; font-weight: 600; margin: 4px 2px 10px; }
.count-line b { color: var(--green); }
.empty { text-align: center; color: var(--sub); padding: 40px 0; }

.btn-dark { width: 100%; margin-top: 12px; background: var(--green-dark); color: #fff; font-weight: 800;
  padding: 14px; border-radius: 12px; }
.btn-primary { width: 100%; background: var(--green); color: #fff; font-weight: 800; padding: 15px;
  border-radius: 12px; font-size: 16px; }
.btn-primary:disabled { opacity: .5; }
.btn-soft { background: var(--btn); border: 1px solid var(--btn-line); border-radius: 12px; padding: 12px 6px; font-weight: 700; font-size: 14px; }
.btn-yellow { background: var(--yellow-soft); border: 1.5px solid var(--yellow); border-radius: 12px; padding: 12px 6px; font-weight: 700; font-size: 14px; }

.chips { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 20px; background: #e4eadf; font-weight: 700; font-size: 14px; color: #3a463d; }
.chip small { color: var(--faint); font-weight: 600; margin-left: 3px; }
.chip.on { background: var(--green-dark); color: #fff; }
.chip.on small { color: #9fc4ad; }
.chip.lg.on { background: var(--green); }
.chip.lg { background: var(--card); border: 1px solid var(--line); font-size: 13px; padding: 7px 12px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: #e2e8dc; padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.seg button { padding: 10px 0; border-radius: 9px; color: var(--sub); font-weight: 700; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 800; box-shadow: 0 1px 3px rgba(30,60,40,.1); }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #cfe9c7, #9fd3a8);
  color: var(--green-dark); display: grid; place-items: center; font-weight: 900; flex: none; font-size: 15px; }
.avatar.big { width: 56px; height: 56px; font-size: 28px; }
.chip-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  background: var(--green-soft); color: var(--green); vertical-align: 2px; }
.chip-badge:empty { display: none; }

/* ───── 내정보 ───── */
.pf-row { display: flex; align-items: center; gap: 12px; }
.pf-name b { font-size: 19px; }
.pf-sub { color: var(--sub); font-size: 13px; margin-top: 3px; }
.score-box { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0 10px; background: var(--green-dark);
  color: #fff; border-radius: 14px; padding: 14px 4px; text-align: center; }
.score-box span { display: block; font-size: 12px; color: #9fc4ad; margin-bottom: 4px; }
.score-box b { font-size: 19px; }
.score-box div:first-child b { color: #b6f0c6; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--btn); border-radius: 12px; text-align: center; padding: 14px 4px; }
.tile b { display: block; font-size: 20px; }
.tile span { color: var(--sub); font-size: 12.5px; }
.two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

.streak-banner { background: linear-gradient(90deg, #fde9b8, #fff3d4); color: #7a4b00; font-weight: 800; font-size: 14px;
  padding: 11px 14px; border-radius: 12px; margin-bottom: 8px; }
.pro { padding: 14px 0; border-top: 1px dashed var(--line); }
.pro:first-of-type { border-top: 0; }
.pro-row { display: flex; align-items: center; gap: 10px; }
.pro .medal { width: 28px; text-align: center; font-size: 20px; font-weight: 900; color: var(--sub); }
.pro .nm { flex: 1; min-width: 0; }
.pro .nm b { font-size: 16px; }
.pro .nm div { color: var(--sub); font-size: 12.5px; margin-top: 3px; }
.pro .sc { text-align: right; }
.pro .sc b { display: block; font-size: 19px; color: var(--green); font-weight: 900; }
.pro .sc small { color: var(--sub); font-size: 12px; }

/* ───── 배당판 ───── */
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 14px; margin-bottom: 10px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--sub); stroke-width: 2; flex: none; }
.search input { flex: 1; border: 0; background: none; font: inherit; padding: 13px 0; outline: none; color: var(--text); }

.game { padding: 14px; }
.game-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.game-head .lg { font-weight: 800; }
.game-head .tm { color: var(--sub); margin-left: 6px; font-weight: 500; }
.round { background: var(--yellow-soft); color: #8a5a00; border: 1px solid #f3dc92; font-size: 11.5px; font-weight: 800;
  padding: 3px 9px; border-radius: 10px; }
.game-title { text-align: center; font-weight: 800; font-size: 17px; margin: 12px 0 10px; }
.game-title .vs { color: var(--faint); font-weight: 500; font-size: 13px; margin: 0 7px; }
.mk { display: grid; grid-template-columns: 50px 1fr; gap: 8px; align-items: center; margin-top: 8px; }
.mk-name { font-size: 12px; line-height: 1.35; color: #3a463d; }
.mk-name b { color: var(--num); font-size: 13px; display: block; }
.opts { display: grid; gap: 6px; }
.opts.n2 { grid-template-columns: 1fr 1fr; }
.opts.n3 { grid-template-columns: 1fr 1fr 1fr; }
.opt { background: var(--btn); border: 1px solid var(--btn-line); border-radius: 12px; padding: 7px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; transition: background .12s, transform .08s; }
.opt:active { transform: scale(.97); }
.opt span { font-size: 12.5px; color: #4b574e; }
.opt b { font-size: 16px; font-weight: 700; }
.opt.sel { background: var(--green); border-color: var(--green); color: #fff; }
.opt.sel span { color: #d3f0db; }
.opt.mine { border: 1.5px solid var(--green); background: var(--green-soft); }
.opt:disabled { opacity: .35; cursor: default; }

/* ───── 픽 카드 (내 배팅 · 공유픽) ───── */
.member-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.member-head .nm { flex: 1; min-width: 0; }
.member-head .nm b { font-size: 16px; }
.member-head .nm div { color: var(--sub); font-size: 12.5px; margin-top: 2px; }
.member-head .best { text-align: right; font-size: 13px; color: var(--sub); }
.member-head .best b { color: var(--odds); }
.member-head .best div { font-size: 12px; margin-top: 2px; }
.member-body { margin-top: 12px; }
.pick { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; background: #fdfefb; }
.member-body .pick:first-child { margin-top: 0; }
.pick-head { display: flex; align-items: center; gap: 8px; }
.pick-head .t { font-weight: 800; }
.pick-head .f { color: var(--odds); font-weight: 800; font-size: 14px; }
.pick-head .st { margin-left: auto; }
.st { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 10px; }
.st-before { background: #e3edf8; color: #2f5d8a; }
.st-open { background: var(--green-soft); color: var(--green); }
.st-won { background: var(--green); color: #fff; }
.st-lost { background: #f8e3dc; color: var(--lose); }
.st-void { background: var(--btn); color: var(--sub); }
.leg { padding: 10px 0; border-top: 1px dashed var(--line); }
.pick-head + .leg, .cmt + .leg { border-top: 0; }
.leg .meta { font-size: 12.5px; color: var(--sub); }
.leg .meta b { color: var(--num); margin-right: 3px; }
.leg .teams { font-weight: 800; font-size: 15.5px; margin-top: 3px; }
.leg .pk { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-weight: 800; font-size: 16px; }
.leg .pk .o { color: var(--odds); font-size: 17px; }
.leg.win .pk span:first-child::after { content: " ✓"; color: var(--green); }
.leg.lose .pk { opacity: .45; text-decoration: line-through; }
.leg.void .pk { opacity: .55; }
.leg .res { font-size: 12px; color: var(--sub); margin-left: 4px; font-weight: 600; }
.cmt { background: var(--yellow-soft); border: 1px solid #f0d77e; border-left: 4px solid var(--yellow); border-radius: 10px;
  padding: 9px 12px; margin: 10px 0 2px; font-weight: 700; }
.cmt small { display: block; color: #9a7300; font-size: 11.5px; margin-bottom: 3px; font-weight: 700; }
.pick-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; font-size: 14px; }
.pick-foot b.win { color: var(--green); }
.copy { margin-top: 10px; width: 100%; padding: 10px; border-radius: 10px; background: var(--green-soft);
  color: var(--green); font-weight: 800; }

/* ───── 랭킹 ───── */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; margin-bottom: 12px; }
.pod { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; padding: 14px 6px 12px; }
.pod .medal { font-size: 28px; }
.pod .nm { font-weight: 800; margin-top: 4px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .sc { color: var(--green); font-weight: 900; font-size: 17px; margin-top: 4px; }
.pod .hr { color: var(--sub); font-size: 12px; margin-top: 2px; }
.pod.p1 { padding-top: 22px; border: 2px solid var(--gold); background: #fffbea; }
.list { padding: 4px 14px; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .rk { width: 26px; font-weight: 800; color: var(--sub); text-align: center; }
.row .nm { flex: 1; font-weight: 700; min-width: 0; }
.row .nm div { color: var(--sub); font-weight: 500; font-size: 12px; margin-top: 2px; }
.row .sc { font-weight: 900; text-align: right; }
.row .sc small { display: block; font-weight: 600; font-size: 11.5px; color: var(--sub); }
.row.me { background: var(--green-soft); margin: 0 -14px; padding: 12px 14px; }
.fame h3 { font-size: 15px; margin: 18px 2px 10px; }
.up { color: var(--green); }
.down { color: var(--lose); }

/* ───── 하단 탭 ───── */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); background: #fbfcf8; border-top: 1px solid var(--line);
  padding: 7px 0 calc(7px + env(safe-area-inset-bottom)); }
.bottom button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.bottom svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bottom button.on { color: var(--green-dark); font-weight: 800; }
.bottom button.on svg { stroke: var(--green); stroke-width: 2.1; }

/* ───── 슬립 · 시트 ───── */
.slipbar { position: fixed; left: 12px; right: 12px; bottom: 74px; max-width: 496px; margin: 0 auto;
  background: var(--green-dark); color: #fff; border-radius: 16px; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; box-shadow: 0 8px 24px rgba(20,50,30,.3); z-index: 20; }
.slip-clear { color: #9fc4ad; font-size: 16px; }
.slip-info { flex: 1; display: flex; flex-direction: column; font-size: 13px; color: #b9d3c1; }
.slip-info b { color: #fff; }
.slip-open { background: var(--green-2); color: #fff; font-weight: 800; padding: 11px 18px; border-radius: 12px; }

.sheet-bg { position: fixed; inset: 0; background: rgba(15,30,20,.45); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); z-index: 31; max-height: 86vh; overflow-y: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; margin-bottom: 6px; }
.sheet-head .x { font-size: 18px; color: var(--sub); }
.sheet .leg { display: flex; align-items: center; gap: 8px; }
.sheet .leg .body { flex: 1; min-width: 0; }
.sheet .leg .o { color: var(--odds); font-weight: 800; }
.sheet .leg .rm { color: var(--faint); padding: 4px; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border-radius: 12px; padding: 10px 6px; margin: 10px 0; text-align: center; }
.sum span { display: block; font-size: 12px; color: var(--sub); }
.sum b { font-size: 17px; }
.green { color: var(--green); }
.share { display: flex; gap: 8px; align-items: center; margin: 12px 2px 8px; font-weight: 700; }
.share input { width: 18px; height: 18px; accent-color: var(--green); }
.share small { color: var(--sub); font-weight: 500; }
.comment { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; font: inherit; }
.comment:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
.left { color: var(--sub); font-size: 12.5px; margin: 8px 2px; }
.how { padding-left: 20px; line-height: 1.6; }
.how li { margin-bottom: 8px; }
.note { background: var(--bg); border-radius: 10px; padding: 10px 12px; color: var(--sub); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); background: rgba(29,53,39,.95);
  color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: 90vw; text-align: center; }

/* ───── 관리자 버튼 · 공유픽 탭 · 유튜브 ───── */
.btn-admin { display: block; text-align: center; margin-top: 10px; padding: 11px; border-radius: 12px; border: 1px dashed var(--green);
  color: var(--green); font-weight: 800; text-decoration: none; font-size: 14px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.vrow { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.vrow:first-child { border-top: 0; }
.vrow img { width: 112px; height: 63px; object-fit: cover; border-radius: 10px; flex: none; background: var(--btn); }
.vrow .t { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vrow .t small { display: block; color: var(--sub); font-weight: 500; font-size: 12px; margin-top: 3px; }
a.btn-dark { display: block; text-align: center; text-decoration: none; }

/* ───── 연출: 꽃가루 · 적중 팝업 · 1위 반짝임 ───── */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
.win-pop { position: fixed; inset: 0; z-index: 55; background: rgba(15,30,20,.55); display: grid; place-items: center; padding: 24px;
  animation: fadeIn .2s ease-out; }
.win-card { background: var(--card); border-radius: 24px; padding: 26px 22px 18px; width: 100%; max-width: 320px; text-align: center;
  animation: popIn .45s cubic-bezier(.2, 1.6, .4, 1); }
.win-emoji { font-size: 58px; animation: wiggle 1s ease-in-out infinite; display: inline-block; }
.win-title { font-size: 26px; font-weight: 900; color: var(--green-dark); margin-top: 6px; }
.win-score { font-size: 34px; font-weight: 900; color: var(--green); margin: 6px 0 4px; }
.win-sub { color: var(--sub); font-size: 13.5px; margin-bottom: 16px; line-height: 1.5; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } }
@keyframes wiggle { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.12); } }

.pod.p1 { position: relative; overflow: hidden; }
.pod.p1::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent); animation: shine 2.8s ease-in-out infinite; }
.pod.p1 .medal { display: inline-block; animation: bounce 1.6s ease-in-out infinite; }
@keyframes shine { 0% { left: -60%; } 60%, 100% { left: 130%; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.st-won { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(47,125,79,.18); } }
@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; } }

.score-box small { display: block; font-size: 11.5px; margin-top: 2px; font-weight: 700; }
.score-box small.up { color: #8fdca7; }
.score-box small.down { color: #f2a48f; }
