/* 삼국지 마작 — 판 화면 (공통 core.css 뒤에 읽음) · 2026-12-04 */
html[data-game=mahjong] { --acc:#7a2e2a; --acc-hi:#9b4a3f; --acc-lo:#521d1a; }
#stage .hd { position:absolute; inset:0; display:flex; flex-direction:column; gap:5px; padding:4px 6px max(8px,env(safe-area-inset-bottom));
  max-width:620px; margin:0 auto; box-sizing:border-box; }
#stage .top h2 .bl { font-size:13px; color:var(--dim); font-weight:600; margin-left:4px; }

/* 패 — 실제 마작패 그림 (상아색 앞면 + 초록 등) */
.tl { position:relative; display:inline-block; flex:none; width:var(--w,30px); aspect-ratio:3/4; border-radius:calc(var(--w,30px) * .14);
  background:#f4efe2; box-shadow:0 calc(var(--w,30px) * .07) 0 #2f6b4f, 0 calc(var(--w,30px) * .09) 2px #0006; vertical-align:bottom; font-style:normal; }
.tl img { position:absolute; inset:0; width:100%; height:100%; display:block; border-radius:inherit; pointer-events:none; }
.tl.bk { background:linear-gradient(160deg,#3f8a66,#24573f); box-shadow:0 calc(var(--w,30px) * .07) 0 #e9e1cd, 0 calc(var(--w,30px) * .09) 2px #0006; }
.tl.sd { transform:rotate(-90deg); margin:0 calc(var(--w,30px) * .17); }
.tl.cl { opacity:.35; }
.tl.last { box-shadow:0 0 0 2px #f2c14e, 0 0 8px #f2c14e; }
.tl.last.sd { transform:rotate(-90deg); }

/* 탁자 */
#stage .tbl { position:relative; flex:1 1 auto; min-height:0; display:flex; align-items:center; justify-content:center;
  --tw:min(4.2vw, 2.15vh, 22px); padding-top:calc(var(--tw) * 3.6); }
#stage .x { position:relative; width:calc(var(--tw) * 17 + 8px); height:calc(var(--tw) * 17 + 8px); flex:none; margin:0 auto;
  border-radius:14px; background:radial-gradient(ellipse at 50% 45%, #2f7a5f, #1b4d3b 72%, #143b2d); border:3px solid #8d6a3b;
  box-shadow:inset 0 0 0 2px #0004, inset 0 6px 22px #0007, 0 2px 0 #fff8; }
#stage .pond { position:absolute; display:flex; flex-wrap:wrap; align-content:flex-start; gap:0; --w:var(--tw); width:calc(var(--tw) * 6.05); height:calc(var(--tw) * 5.4); }
#stage .pond .tl { margin-bottom:2px; }
#stage .pond .tl.sd { margin:0 calc(var(--tw) * .17) 2px; }
#stage .pond.p0 { left:calc(50% - var(--tw) * 3); top:calc(50% + var(--tw) * 3 + 3px); }
#stage .pond.p2 { left:calc(50% - var(--tw) * 3); top:calc(50% - var(--tw) * 8.4 - 3px); transform:rotate(180deg); }
#stage .pond.p1 { left:calc(50% + var(--tw) * 2.68 + 3px); top:calc(50% - var(--tw) * 2.7); transform:rotate(-90deg); }
#stage .pond.p3 { left:calc(50% - var(--tw) * 8.73 - 3px); top:calc(50% - var(--tw) * 2.7); transform:rotate(90deg); }
/* 가운데: 국 · 남은 패 · 도라 · 자리 바람 */
#stage .ctr { position:absolute; left:calc(50% - var(--tw) * 3); top:calc(50% - var(--tw) * 3); width:calc(var(--tw) * 6); height:calc(var(--tw) * 6);
  box-sizing:border-box; border-radius:6px; background:#0f2f23; border:1px solid #c9a96a66; color:#f1e7cf;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; text-align:center; }
#stage .ctr .rd { font-size:calc(var(--tw) * .85); font-weight:800; line-height:1.1; color:#ffe39a; }
#stage .ctr .lf { font-size:calc(var(--tw) * .55); line-height:1.2; } #stage .ctr .lf b { color:#fff; }
#stage .ctr .dr { display:flex; gap:1px; --w:calc(var(--tw) * .62); margin:2px 0; }
#stage .ctr .dr .tl { box-shadow:0 1px 0 #2f6b4f; }
#stage .ctr .hb { font-size:calc(var(--tw) * .5); color:#cfe6dc; min-height:calc(var(--tw) * .6); line-height:1.2; }
#stage .ctr .sw { position:absolute; font-size:calc(var(--tw) * .55); font-weight:800; color:#cfe6dc; width:calc(var(--tw) * .95); height:calc(var(--tw) * .95);
  line-height:calc(var(--tw) * .95); text-align:center; border-radius:3px; }
#stage .ctr .sw.dl { background:#a3261d; color:#fff; }
#stage .ctr .sw.on { box-shadow:0 0 0 2px #f2c14e; }
#stage .ctr .sw.rc::after { content:""; position:absolute; height:3px; width:calc(var(--tw) * 2.6); background:#fff; border-radius:2px; box-shadow:inset 0 0 0 1px #c33;
  background:radial-gradient(circle,#d22 0 2px,#fff 2.5px); }
#stage .ctr .sw.w0 { bottom:2px; left:50%; transform:translateX(-50%); } #stage .ctr .sw.w0.rc::after { left:calc(var(--tw) * 1.1); top:45%; }
#stage .ctr .sw.w2 { top:2px; left:50%; transform:translateX(-50%) rotate(180deg); } #stage .ctr .sw.w2.rc::after { left:calc(var(--tw) * 1.1); top:45%; }
#stage .ctr .sw.w1 { right:2px; top:50%; transform:translateY(-50%) rotate(-90deg); } #stage .ctr .sw.w1.rc::after { left:calc(var(--tw) * 1.1); top:45%; }
#stage .ctr .sw.w3 { left:2px; top:50%; transform:translateY(-50%) rotate(90deg); } #stage .ctr .sw.w3.rc::after { left:calc(var(--tw) * 1.1); top:45%; }

/* 장수 자리: 왼쪽 위(3) · 위(2) · 오른쪽 위(1) */
#stage .seat { position:absolute; display:flex; flex-direction:column; align-items:center; width:calc(var(--tw) * 5.4); z-index:3; cursor:pointer; transition:opacity .3s; }
#stage .seat.s3 { left:3px; top:3px; } #stage .seat.s1 { right:3px; top:3px; }
#stage .seat.s2 { left:50%; bottom:calc(100% + 1px); transform:translateX(-50%); width:auto; flex-direction:row; align-items:flex-end; gap:6px; }
#stage .seat.s2 .inf { display:flex; flex-direction:column; background:#143b2dd9; border:1px solid #8d6a3b; border-radius:4px; padding:2px 6px; }
#stage .seat .pt.sp { position:relative; height:calc(var(--tw) * 2.5); display:flex; align-items:flex-end; justify-content:center; }
#stage .seat .pt.sp .sprf { animation:bob 2.6s ease-in-out infinite; }
#stage .seat .pt.sp .sprf.act { animation:none; }
#stage .seat.turn .pt.sp .sprf { filter:drop-shadow(0 0 4px #f2c14e) drop-shadow(0 0 2px #f2c14e); }
#stage .seat.win .pt.sp .sprf { filter:drop-shadow(0 0 8px #f2c14e); }
@keyframes bob { 50% { transform:translateY(-2px); } }
#stage .seat .lordt, #modal .lordt { position:absolute; left:50%; bottom:-4px; transform:translateX(-50%); background:linear-gradient(#e9c46a,#b8862c); color:#3a2608;
  font-size:9px; font-weight:800; padding:0 4px; border-radius:2px; border:1px solid #7a5512; white-space:nowrap; z-index:2; }
#modal .lordt.in { position:static; transform:none; display:inline-block; vertical-align:2px; font-size:12px; }
#stage .seat .nm, #stage .myinfo .nm { display:flex; align-items:center; gap:3px; font-size:11.5px; white-space:nowrap; color:#f6eedb; line-height:1.2; }
#stage .seat .nm b, #stage .myinfo .nm b { font-size:12px; }
#stage .wd { display:inline-block; min-width:14px; height:14px; line-height:14px; text-align:center; font-size:10px; font-weight:800; border-radius:2px; background:#0f2f23; color:#cfe6dc; border:1px solid #c9a96a77; }
#stage .wd:empty { display:none; } #stage .wd.dl { background:#a3261d; color:#fff; border-color:#a3261d; }
#stage .seat .ch, #stage .myinfo .ch { font-size:11px; color:#cfe6dc; white-space:nowrap; } #stage .seat .ch b, #stage .myinfo .ch b { color:#fff; font-size:12px; }
#stage .ri { margin-left:3px; font-size:9.5px; font-weight:800; background:#c4302a; color:#fff; padding:0 3px; border-radius:2px; }
#stage .seat .ml { display:flex; flex-wrap:wrap; justify-content:center; gap:2px; --w:calc(var(--tw) * .62); margin-top:2px; max-width:calc(var(--tw) * 5.4); }
#stage .seat.s2 .ml { max-width:none; }
#stage .md { display:inline-flex; align-items:flex-end; gap:0; }
#stage .seat .say { position:absolute; left:50%; top:-14px; transform:translate(-50%,4px) scale(.9); opacity:0; pointer-events:none; z-index:8;
  background:#fffdf8; color:#2b2722; border:1px solid #b39a6c; border-radius:6px; padding:3px 7px; font-size:12px; font-weight:600; white-space:nowrap;
  box-shadow:0 3px 8px #0003; transition:opacity .2s, transform .2s; }
#stage .seat .say.on { opacity:1; transform:translate(-50%,0) scale(1); }
#stage .seat.s3 .say { left:0; transform:translate(0,4px) scale(.9); } #stage .seat.s3 .say.on { transform:translate(0,0) scale(1); }
#stage .seat.s1 .say { left:auto; right:0; transform:translate(0,4px) scale(.9); } #stage .seat.s1 .say.on { transform:translate(0,0) scale(1); }
#stage .seat.s2 .say { top:-6px; }
#stage .myinfo { position:absolute; left:4px; bottom:4px; display:flex; flex-direction:column; gap:1px; z-index:3; }
#stage .tre { position:absolute; right:4px; bottom:4px; max-width:calc(var(--tw) * 5.4); z-index:3; }
#stage .tre:empty { display:none; }
#stage .tre .trepot { display:flex; flex-direction:column; align-items:center; gap:1px; color:#ffe39a; font-size:10px; text-align:center; }
#stage .tre .trepot img { width:calc(var(--tw) * 2.2); height:calc(var(--tw) * 2.2); object-fit:contain; filter:drop-shadow(0 0 6px #f2c14e); }
/* 퐁!·치! 큰 글씨 */
#stage .shout { position:absolute; z-index:9; font:900 calc(var(--tw) * 1.7)/1 "Noto Serif KR",serif; color:#fff; text-shadow:0 0 6px #c4302a, 0 2px 0 #7a1f1a, 0 0 14px #000;
  pointer-events:none; animation:shout 1.2s ease-out forwards; }
#stage .shout.k-riichi, #stage .shout.k-ron, #stage .shout.k-tsumo { color:#ffe39a; font-size:calc(var(--tw) * 2.2); }
#stage .shout.sh0 { left:50%; top:62%; } #stage .shout.sh1 { left:78%; top:44%; } #stage .shout.sh2 { left:50%; top:22%; } #stage .shout.sh3 { left:22%; top:44%; }
@keyframes shout { 0% { transform:translate(-50%,-50%) scale(1.8); opacity:0; } 15% { transform:translate(-50%,-50%) scale(1); opacity:1; } 75% { opacity:1; } 100% { transform:translate(-50%,-70%) scale(1); opacity:0; } }

/* 국 결과 */
#stage .resv { position:absolute; left:0; right:0; bottom:0; top:0; display:none; align-items:center; justify-content:center; z-index:7; pointer-events:none; }
#stage .resv.on { display:flex; }
#stage .resv .rb { pointer-events:auto; width:min(94%, 520px); max-height:96%; overflow:auto; box-sizing:border-box; background:#fffdf7f2; border:1px solid #8d6a3b; border-radius:8px;
  box-shadow:0 8px 28px #0007; padding:10px 12px; color:var(--ink); text-align:center; animation:rin .35s ease-out; }
@keyframes rin { from { transform:translateY(14px) scale(.96); } }
#stage .resv h4 { margin:0 0 6px; font-size:17px; } #stage .resv h4 em { font-style:normal; color:#a3261d; font-size:20px; } #stage .resv h4 small { font-size:12px; color:var(--dim); font-weight:500; }
#stage .resv p { margin:4px 0; font-size:13.5px; }
#stage .resv .wh { display:flex; justify-content:center; align-items:flex-end; flex-wrap:wrap; gap:0; --w:min(6vw,26px); margin:4px 0 6px; }
#stage .resv .wh small { width:100%; font-size:11px; color:var(--dim); }
#stage .resv .wh .tl.wt { box-shadow:0 0 0 2px #c4302a, 0 2px 0 #2f6b4f; }
#stage .resv .gap { width:6px; } #stage .resv .mlds { display:inline-flex; gap:4px; margin-left:6px; --w:min(5vw,22px); }
#stage .resv .yk { display:flex; flex-wrap:wrap; justify-content:center; gap:3px 10px; font-size:13.5px; margin:4px 0; }
#stage .resv .yk b { color:#a3261d; }
#stage .resv .sc { font-size:14px; margin:4px 0; } #stage .resv .sc b { color:#7a2e2a; }
#stage .resv .ura { display:flex; justify-content:center; align-items:center; gap:2px; --w:18px; font-size:11px; color:var(--dim); margin:2px 0; }
#stage .resv .pays { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 12px; font-size:13px; margin-top:6px; padding-top:6px; border-top:1px solid var(--rule2,#0001); }
#stage .resv .pays .pl b { color:#1f6b3a; } #stage .resv .pays .mi b { color:#a3261d; }

/* 내 손패 */
#stage .mine { flex:none; display:flex; justify-content:center; padding-top:calc(var(--hw,30px) * .3); }
#stage .hand { display:flex; align-items:flex-end; justify-content:center; --w:var(--hw,30px); min-height:calc(var(--hw,30px) * 1.45); }
#stage .hand .tl { cursor:default; transition:transform .12s, filter .12s, opacity .12s; }
#stage .hand.act .tl { cursor:pointer; }
#stage .hand .tl.up { transform:translateY(calc(var(--hw,30px) * -.35)); box-shadow:0 0 0 2px #f2c14e, 0 calc(var(--hw,30px) * .07) 0 #2f6b4f; }
#stage .hand .tl.no { filter:brightness(.62); }
#stage .hand .tl.rk { box-shadow:0 0 0 2px #f2c14e, 0 calc(var(--hw,30px) * .07) 0 #2f6b4f; }
#stage .hand .tl.dw { animation:dw .35s ease-out; }
@keyframes dw { from { transform:translateY(calc(var(--hw,30px) * -.8)); } }
#stage .hand .gap { width:calc(var(--hw,30px) * .35); flex:none; }
#stage .hand .mlds .tl { cursor:default !important; filter:none !important; }
#stage .hand .mlds { display:inline-flex; gap:calc(var(--hw,30px) * .15); margin-left:calc(var(--hw,30px) * .3); --w:calc(var(--hw,30px) * .8); }
#stage .hand.wt .tl { filter:brightness(.92); }
#stage .msg { flex:none; padding:5px 8px; font-size:14px; line-height:1.45; min-height:22px; }
#stage .msg small { font-size:12px; color:var(--dim); }
/* 단추 */
#stage .acts { flex:none; display:flex; flex-direction:column; gap:5px; min-height:48px; }
#stage .acts .r1 { display:flex; gap:5px; }
#stage .acts .r1 .btn, #stage .acts > .btn { flex:1; min-height:48px; font-size:17px; font-weight:700; padding:4px 2px; }
#stage .acts .btn.big { flex:1.4; font-size:20px; }
html body #stage .acts .btn.go { background:linear-gradient(var(--acc-hi),var(--acc)); border:1px solid var(--acc-lo); color:#fff; text-shadow:0 1px 0 #0005; box-shadow:0 2px 0 var(--acc-lo); }
#stage .acts .wait { flex:1; display:flex; align-items:center; justify-content:center; color:var(--dim); font-size:14px; min-height:48px; }
#stage .tools { flex:none; display:flex; gap:5px; }
#stage .tools .btn { flex:1; font-size:13.5px; padding:6px 2px; min-height:38px; }
/* 창 */
#modal .wstat { display:grid; grid-template-columns:auto 1fr auto; gap:4px 8px; align-items:center; font-size:13px; margin:8px 0; text-align:left; }
#modal .wstat i { height:7px; background:#0001; border-radius:4px; overflow:hidden; } #modal .wstat u { display:block; height:100%; background:var(--acc,#7a2e2a); }
#modal .mini { display:inline-flex; gap:1px; --w:26px; align-items:flex-end; }
#modal .hintc { display:flex; justify-content:center; --w:46px; margin:6px 0; }
#modal .qopts .qo .mini { margin-bottom:4px; }
#modal .ranks.yl { text-align:left; max-height:54vh; overflow:auto; border-top:1px solid var(--rule2); }
#modal .ranks.yl .yg > b { display:block; margin:8px 0 2px; color:#7a2e2a; font-size:14px; }
#modal .ranks.yl .rr { display:flex; gap:8px; align-items:baseline; padding:3px 2px; border-bottom:1px solid var(--rule2); font-size:13.5px; }
#modal .ranks.yl .rr span { flex:none; width:96px; font-weight:700; } #modal .ranks.yl .rr small { color:var(--dim); font-size:12.5px; }
/* 가로로 넓은 창(PC): 탁자를 키우고 손패를 크게 */
@media (min-aspect-ratio:5/4) {
  #stage .hd { max-width:1000px !important; }
  #stage .tbl { --tw:min(3.4vw, 2.5vh, 26px); }
}
@media (max-height:640px) { #stage .msg { font-size:13px; padding:3px 6px; } #stage .tools .btn { min-height:32px; } }
