/* 레이아웃: 초록 담요 위에 판. 로비는 게임 세 판을 나란히, 게임 화면은 위(상대) · 가운데(바닥) · 아래(나) */
:root {
  --felt: #14432f;
  --felt-deep: #0a281c;
  --ink: #f4ecd8;
  --muted: #a7bba8;
  --gold: #e6bb4c;
  --red: #c8352b;
  --panel: rgba(4, 20, 13, .5);
  --line: rgba(244, 236, 216, .13);
  --card: #f8f1e0;
  --paper: #f6eedb;
  --paper-ink: #231d14;
  --f-display: 'Black Han Sans', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --f-body: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% 38%, #1d5c41 0%, var(--felt) 45%, var(--felt-deep) 100%) fixed, var(--felt-deep);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, .card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn-primary {
  background: linear-gradient(#ecc761, #c9962c);
  color: #2a1d05;
  border: 0;
  border-radius: 10px;
  padding: .7em 1.3em;
  font-weight: 900;
  box-shadow: 0 3px 0 #8a6516;
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6516; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45em .85em;
  font-weight: 700;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--gold); }
.btn-ghost:disabled { opacity: .45; }
.btn-ghost.small { font-size: 13px; padding: .3em .7em; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  background: none; border: 0; padding: .35em .85em; border-radius: 999px;
  color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.seg button.on { background: var(--gold); color: #2a1d05; }

/* ---------- 화투 카드 ---------- */
.card {
  --cw: 52px;
  --mc: #555;
  position: relative;
  flex: none;
  width: var(--cw);
  height: calc(var(--cw) * 1.62);
  border-radius: calc(var(--cw) * .09);
  background: linear-gradient(180deg, var(--card) 0 60%, color-mix(in srgb, var(--mc) 24%, var(--card)) 100%);
  border: max(1px, calc(var(--cw) * .045)) solid #1b1712;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .22);
  color: #1d1a16;
  overflow: hidden;
  user-select: none;
  font-size: calc(var(--cw) * .2);
  line-height: 1;
}
.card .cm { position: absolute; top: 4%; left: 8%; font-weight: 900; color: var(--mc); }
.card .ci {
  position: absolute; left: 0; right: 0; top: 24%; text-align: center;
  font-size: calc(var(--cw) * .56);
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}
.card.t-P .ci { font-size: calc(var(--cw) * .42); top: 30%; opacity: .72; }
.card.t-T .ci { right: 28%; font-size: calc(var(--cw) * .44); top: 30%; }
.card .cn { position: absolute; bottom: 4%; left: 0; right: 0; text-align: center; font-size: .78em; font-weight: 700; color: #4a4035; }
.card .badge {
  position: absolute; top: 4%; right: 6%;
  min-width: 1.3em; height: 1.3em; padding: 0 .15em;
  border-radius: 50%; display: grid; place-items: center;
  font-size: .9em; font-weight: 900; color: #fff;
}
.card .gw { background: var(--red); }
.card .yb { background: #b7860f; }
.card .sp { background: #1d1a16; color: var(--card); border-radius: 3px; }
.card .rb {
  position: absolute; right: 9%; top: 14%; height: 64%; width: 22%;
  background: var(--rc); color: #fff;
  writing-mode: vertical-rl;
  display: flex; align-items: center; justify-content: center;
  font-size: .74em; font-weight: 900; letter-spacing: .08em;
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.card.img { background: #c8352b; border: 0; border-radius: calc(var(--cw) * .07); }
.card.img img { display: block; width: 100%; height: 100%; pointer-events: none; }
.card.img .sp { top: auto; bottom: 3%; right: 6%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.card.back {
  background: repeating-linear-gradient(45deg, #a8231c 0 4px, #ba2d24 4px 8px);
}
.card.back::after {
  content: ''; position: absolute; inset: 14%;
  border: 1px solid rgba(255, 220, 180, .4); border-radius: 3px;
}
.card.bombc { background: linear-gradient(#3a302a, #1d1a16); color: var(--gold); }
.card.bombc .ci { opacity: 1; }
.card.bombc .cn { color: var(--gold); }
.card.fresh { animation: pop .5s ease-out; box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(0, 0, 0, .3); }
@keyframes pop { from { transform: scale(1.25) translateY(-6px); } }

/* ---------- 로비 ---------- */
.lobby {
  max-width: 1100px; margin: 0 auto;
  padding-block: 24px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 22px;
}
.lb-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo, .radar b {
  width: 54px; height: 54px; border-radius: 12px;
  background: var(--red); color: #fff3d6;
  font-family: var(--f-display); font-size: 30px;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 3px #1b1712, 0 4px 0 #6e1913;
}
.brand h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 34px; letter-spacing: .02em; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .25em; }
.profile {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px;
}
.profile .av { font-size: 24px; }
.profile input {
  background: transparent; border: 0; border-bottom: 1px dashed var(--line);
  color: var(--ink); width: 7.5em; font: inherit; font-weight: 700; padding: 2px 0;
}
.money { font-variant-numeric: tabular-nums; font-weight: 900; color: var(--gold); }
.lb-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.stake-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lbl { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.game-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .22));
  border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.gc-art { display: flex; justify-content: center; align-items: flex-end; height: 112px; padding-top: 8px; }
.gc-art .card { --cw: 60px; margin: 0 -7px; transform-origin: 50% 100%; }
.gc-art .card:nth-child(1) { transform: rotate(-12deg); }
.gc-art .card:nth-child(2) { transform: translateY(-6px); z-index: 1; }
.gc-art .card:nth-child(3) { transform: rotate(12deg); }
.gc-text { display: flex; flex-direction: column; gap: 6px; }
.game-card h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 30px; }
.game-card .sub { color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.game-card ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: 14px; line-height: 1.75; }
.gc-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.rec { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.lb-foot { margin: 0; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.7; }
.lb-foot a { color: var(--ink); }
.lb-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 880px) { .games { grid-template-columns: 1fr; } }

/* ---------- 매칭 ---------- */
.match-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 14, 10, .84); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px;
}
.match {
  width: min(440px, 100%);
  background: linear-gradient(#18412f, #0d281e);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.match h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 24px; }
.radar { position: relative; width: 110px; height: 110px; display: grid; place-items: center; }
.radar span { position: absolute; inset: 0; border: 2px solid var(--gold); border-radius: 50%; opacity: 0; animation: ring 2.1s ease-out infinite; }
.radar span:nth-child(2) { animation-delay: .7s; }
.radar span:nth-child(3) { animation-delay: 1.4s; }
.match.done .radar span { animation: none; }
@keyframes ring { 0% { transform: scale(.45); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
.mtime { font-variant-numeric: tabular-nums; color: var(--muted); }
.mslots { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.mslot {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; min-height: 54px;
}
.mslot .av { font-size: 26px; width: 30px; text-align: center; }
.mslot.wait { color: var(--muted); }
.mslot.wait .av { animation: blink 1s infinite; }
.mslot.found { border-color: rgba(230, 187, 76, .5); animation: slotin .35s ease-out; }
.mslot .meta { margin-left: auto; font-size: 12px; color: var(--muted); }
.mnote { margin: 0; font-size: 12.5px; color: var(--muted); }
@keyframes blink { 50% { opacity: .3; } }
@keyframes slotin { from { transform: translateX(-10px); opacity: 0; } }

/* ---------- 공통 게임 화면 ---------- */
.gs, .sd {
  min-height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 1200px; margin: 0 auto;
}
.topbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.topbar .btn-ghost { white-space: nowrap; }
@media (max-width: 640px) { .tb-mult { min-width: 0; } .tb-title small { font-size: 11px; } }
.tb-title { font-family: var(--f-display); font-size: 22px; text-align: center; }
.tb-title small { display: block; font-family: var(--f-body); font-size: 12px; color: var(--muted); }
.tb-mult { color: var(--gold); font-weight: 900; min-width: 6em; text-align: right; }
.seat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.seat.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 26px rgba(230, 187, 76, .2); }
.pinfo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.av { font-size: 26px; line-height: 1; }
.pn { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn small { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 700; }
.lv { font-size: 11px; padding: 1px 6px; border-radius: 99px; font-weight: 700; vertical-align: 1px; color: #fff; }
.lv-초보 { background: #2f6b4f; }
.lv-중수 { background: #3b5a8a; }
.lv-고수 { background: #8a2f2a; }
.pscore { margin-left: auto; display: flex; align-items: baseline; gap: 2px; }
.pscore b { font-family: var(--f-display); font-weight: 400; font-size: 28px; color: var(--gold); font-variant-numeric: tabular-nums; }
.pscore small { color: var(--muted); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 900; background: var(--red); color: #fff; padding: 2px 6px; border-radius: 4px; }

/* ---------- 고스톱 ---------- */
.gs { --hcw: clamp(42px, 6vw, 66px); --fcw: clamp(36px, 4.6vw, 54px); --ccw: clamp(20px, 2.2vw, 28px); }
.opps { display: flex; gap: 10px; }
.opps .seat { flex: 1; }
.ohand { display: flex; padding-left: 4px; }
.ohand i {
  width: 12px; height: 19px; border-radius: 2px; margin-left: -5px;
  background: repeating-linear-gradient(45deg, #a8231c 0 3px, #ba2d24 3px 6px); border: 1px solid #1b1712;
}
.cap { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; min-height: calc(var(--ccw) * 1.62 + 18px); }
.cap .card { --cw: var(--ccw); }
.cap .card .cn { display: none; }
.cg { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cgl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.cgl b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cgc { display: flex; min-height: calc(var(--ccw) * 1.62); }
.cgc .card + .card { margin-left: calc(var(--cw) * -.48); }
.cg-P .cgc .card + .card { margin-left: calc(var(--cw) * -.64); }
.mid { flex: 1; min-height: calc(var(--fcw) * 3.6); display: flex; align-items: center; justify-content: center; gap: 22px; padding: 6px 0; }
.deckbox { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.deck { position: relative; width: var(--fcw); height: calc(var(--fcw) * 1.62); }
.deck .card { --cw: var(--fcw); position: absolute; top: 0; left: 0; }
.deck .card:nth-child(2) { top: -2px; left: -2px; }
.deck .card:nth-child(3) { top: -4px; left: -4px; }
.deckn { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.floor { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; align-content: center; max-width: 700px; }
.floor .card { --cw: var(--fcw); }
.fg { display: flex; position: relative; border-radius: 6px; transition: transform .15s; }
.fg .card + .card { margin-left: calc(var(--cw) * -.55); }
.fg.hit .card { box-shadow: 0 0 0 2px rgba(230, 187, 76, .55), 0 4px 10px rgba(0, 0, 0, .25); }
.fg.hover { transform: translateY(-5px); }
.fg.hover .card { box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .3); }
.fg.ppeok::after {
  content: '뻑'; position: absolute; top: -9px; right: -7px;
  background: var(--red); color: #fff; font-weight: 900; font-size: 11px;
  padding: 2px 6px; border-radius: 99px; box-shadow: 0 2px 0 #6e1913;
}
.msg { text-align: center; min-height: 1.5em; font-weight: 700; }
.hand { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 4px 0 6px; }
.hand .card { --cw: var(--hcw); transition: transform .15s, filter .15s; }
.hand:not(.active) .card { filter: brightness(.8) saturate(.8); }
.hand.active .card { cursor: pointer; }
.hand.active .card:hover, .hand.active .card:focus-visible { transform: translateY(-10px); }
.hand.active .card.can { box-shadow: 0 0 0 2px var(--gold), 0 4px 10px rgba(0, 0, 0, .3); }
.pick2 { display: flex; gap: 18px; justify-content: center; padding: 8px 0; }
.pick2 .card { --cw: 78px; cursor: pointer; transition: transform .15s; }
.pick2 .card:hover { transform: translateY(-6px); }

/* ---------- 섯다 ---------- */
.sd { --scw: clamp(46px, 6.5vw, 70px); }
.sd-opps { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sd-seat { flex: 1 1 150px; max-width: 250px; align-items: center; text-align: center; position: relative; }
.sd-seat .pinfo { justify-content: center; }
.sd-seat.me { max-width: 380px; margin: 0 auto; --scw: clamp(70px, 11vw, 96px); }
.sd-cards { display: flex; gap: 8px; justify-content: center; min-height: calc(var(--scw) * 1.62); }
.sd-cards .card { --cw: var(--scw); }
.hname { font-family: var(--f-display); color: var(--gold); font-size: 20px; min-height: 1.2em; }
.sd-seat.folded { opacity: .45; }
.sd-seat.folded .hname { color: var(--muted); }
.sd-seat.out { opacity: .3; }
.sd-seat.won { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 30px rgba(230, 187, 76, .3); }
.bubble {
  position: absolute; top: -10px; right: 8px; z-index: 1;
  background: var(--ink); color: var(--paper-ink); font-weight: 900; font-size: 12px;
  padding: 2px 9px; border-radius: 99px;
}
.bubble.die { background: #6b6b6b; color: #fff; }
.wonmark {
  position: absolute; top: -10px; left: 8px;
  background: var(--gold); color: #2a1d05; font-weight: 900; font-size: 12px; padding: 2px 9px; border-radius: 99px;
}
.sd-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 120px; }
.pot {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 24px;
}
.pot small { color: var(--muted); }
.pot b { font-family: var(--f-display); font-weight: 400; font-size: 36px; color: var(--gold); font-variant-numeric: tabular-nums; }
.sd-msg { text-align: center; font-weight: 700; min-height: 1.5em; max-width: 60ch; }
.sd-actions { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 780px; width: 100%; margin: 0 auto; }
.sd-actions.end { display: flex; justify-content: center; gap: 10px; }
.bet {
  border: 0; border-radius: 10px; padding: .5em .2em;
  background: #2c5141; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-weight: 900; box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.bet small { font-weight: 700; font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; }
.bet:not(:disabled):hover { filter: brightness(1.15); }
.bet:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.bet:disabled { opacity: .32; }
.b-die { background: #5c2a26; }
.b-half, .b-ddadang { background: #7a5a14; }

/* ---------- 모달 · 효과 ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 14, 10, .66);
  display: grid; place-items: center; padding: 16px;
  animation: fade .15s;
}
.modal {
  width: min(460px, 100%); max-height: 88dvh; overflow: auto;
  background: var(--paper); color: var(--paper-ink);
  border: 3px solid #1b1712; border-radius: 16px;
  padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal.wide { width: min(720px, 100%); }
.modal h3 { margin: 0 0 10px; font-family: var(--f-display); font-weight: 400; font-size: 26px; }
.modal h4 { margin: 18px 0 6px; font-size: 16px; color: #8a2a1f; }
.modal-body { line-height: 1.65; }
.modal-body p { margin: 6px 0; }
.modal-body ul, .modal-body ol { margin: 4px 0; padding-left: 1.3em; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal .btn-ghost { color: var(--paper-ink); border-color: rgba(0, 0, 0, .25); }
.modal .tag { vertical-align: 1px; }
.note { font-size: 13px; color: #6a5d4a; }
.rt { border-collapse: collapse; width: 100%; font-size: 14px; }
.rt th { text-align: left; padding: 6px 10px 6px 0; white-space: nowrap; vertical-align: top; color: #8a2a1f; }
.rt td { padding: 6px 0; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.rank { columns: 2; column-gap: 24px; }
.res-head { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 8px; }
.res-head .av { font-size: 34px; }
.res-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0; }
.res-t td { padding: 5px 0; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.res-t td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.res-t .sum td { font-weight: 900; border-bottom: 0; border-top: 2px solid rgba(0, 0, 0, .2); }
.res-m { color: #8a2a1f; font-weight: 700; }
.res-me { font-size: 17px; font-weight: 900; text-align: center; padding: 8px; border-radius: 10px; margin-top: 10px; }
.res-me.up { background: #e6f0d9; color: #2f5a1f; }
.res-me.down { background: #f6dcd6; color: #8a2a1f; }
.fx {
  position: fixed; left: 50%; top: 44%; z-index: 60; pointer-events: none;
  transform: translate(-50%, -50%);
  font-family: var(--f-display); font-size: clamp(52px, 10vw, 112px); white-space: nowrap;
  color: #fff3c4; -webkit-text-stroke: 2px #7a1d14;
  text-shadow: 0 6px 0 #7a1d14, 0 14px 30px rgba(0, 0, 0, .55);
  animation: fxin .45s cubic-bezier(.2, 1.5, .4, 1) both;
}
.fx.go { color: #ffe08a; }
.fx.with-cards { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: clamp(44px, 8vw, 88px); }
.fx-cards { display: flex; gap: 8px; -webkit-text-stroke: 0; text-shadow: none; }
.fx-cards .card { --cw: clamp(48px, 11vw, 84px); box-shadow: 0 0 0 2px var(--gold), 0 10px 24px rgba(0, 0, 0, .5); }
/* 규칙 창의 족보 카드 */
.jb { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 4px; padding: 0; list-style: none; }
.jb li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border-radius: 10px; background: rgba(0, 0, 0, .05); text-align: center; font-size: 13px; line-height: 1.35; }
.jb li b { font-size: 14px; color: #8a2a1f; }
.jb .jc { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.jb .card { --cw: 34px; }
.fx.out { opacity: 0; transition: opacity .2s; }
@keyframes fxin { from { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 20, 14, .94); border: 1px solid var(--gold);
  padding: 10px 18px; border-radius: 99px; font-weight: 700; max-width: calc(100% - 32px); text-align: center;
  animation: fade .2s;
}

/* ---------- 작은 화면 ---------- */
@media (max-width: 640px) {
  .gs { --hcw: clamp(40px, 14vw, 54px); --fcw: clamp(32px, 9vw, 44px); --ccw: 19px; }
  .opps { gap: 6px; }
  .seat { padding: 6px 8px; }
  .av { font-size: 22px; }
  .pscore b { font-size: 22px; }
  .cap { gap: 8px; }
  .mid { gap: 12px; }
  .hand { gap: 4px; }
  .sd-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sd-seat { flex-basis: 120px; }
  .rank { columns: 1; }
  .tb-title { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- 온라인: 로그인 ---------- */
.auth {
  min-height: 100dvh; display: grid; place-items: center;
  padding-block: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.auth-box {
  width: min(400px, 100%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 22px; display: flex; flex-direction: column; gap: 16px;
}
.auth-tabs { align-self: flex-start; }
#auth-form { display: flex; flex-direction: column; gap: 6px; }
#auth-form label { font-size: 13px; color: var(--muted); margin-top: 6px; }
#auth-form input, .auth-box input {
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font: inherit; padding: .65em .8em;
}
#auth-form input:focus { border-color: var(--gold); outline: none; }
#auth-form .btn-primary { margin-top: 8px; }
.auth-err { margin: 4px 0 0; min-height: 1.2em; color: #ff9b8f; font-size: 13.5px; font-weight: 700; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-note { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- 온라인: 로비 ---------- */
.lb-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.lb-status .sep { opacity: .5; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #b0453b; box-shadow: 0 0 0 3px rgba(176, 69, 59, .25); }
.dot.on { background: #5cc97b; box-shadow: 0 0 0 3px rgba(92, 201, 123, .25); }
.ranking { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.ranking h2 { margin: 0 0 10px; font-family: var(--f-display); font-weight: 400; font-size: 22px; }
.ranking ol { margin: 0; padding: 0; list-style: none; counter-reset: rk; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; }
.ranking li { counter-increment: rk; display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.ranking li::before { content: counter(rk); width: 1.6em; color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
.ranking li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .av { font-size: 20px; }
@media (max-width: 640px) { .ranking ol { grid-template-columns: 1fr; } }

/* ---------- 온라인: 게임 ---------- */
.lv-human { background: #8a6a1a; }
.seat.away { opacity: .7; }
.seat.away .pn small { color: var(--muted); }
.timer { position: relative; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; width: min(420px, 100%); margin: 0 auto; }
.timer i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 99px; transition: width .2s linear; }
.timer.low i { background: var(--red); }

/* ---------- 관리자 버튼 · 입력 창 (로비와 관리자 페이지 공용) ---------- */
.admin-btn { border-color: var(--gold) !important; color: var(--gold) !important; }
.btn-primary.small { font-size: 13px; padding: .4em .9em; }
.adm-form { display: flex; flex-direction: column; gap: 10px; }
.adm-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
.adm-form input {
  font: inherit; font-size: 15px; padding: 8px 10px; min-width: 0;
  border: 1.5px solid rgba(0, 0, 0, .25); border-radius: 8px; background: #fffdf6; color: var(--paper-ink);
}
.modal .auth-err { color: #b3261e; }
