/* 삼국지 윷놀이 — 판 화면 (core.css 뒤에 읽음) · 각진 4px · 가는 선 · 샴페인 바탕 */
html[data-game=yut] { --acc:#33366e; --acc-hi:#4d508a; --acc-lo:#22244c; }
#stage { --me:#bf3f24; --op:#24325e; --ink2:#3b2f22; }
#stage .yw { position:absolute; inset:0; display:grid; gap:6px; padding:6px 6px max(8px,env(safe-area-inset-bottom)); box-sizing:border-box;
  grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto auto; grid-template-areas:"op" "board" "me" "ctl"; justify-items:center; align-content:center; }
#stage .yw.land { grid-template-columns:auto minmax(270px,380px); grid-template-rows:1fr auto 1fr; grid-template-areas:"board op" "board ctl" "board me";
  align-content:center; justify-content:center; column-gap:14px; padding:8px 14px; }
#stage .yw .side.op { grid-area:op; } #stage .yw .side.me { grid-area:me; } #stage .yw .bdw { grid-area:board; align-self:center; }
#stage .yw .ctlw { grid-area:ctl; width:100%; max-width:640px; display:flex; flex-direction:column; gap:6px; }
#stage .yw.land .ctlw { justify-content:center; }
#stage .yw.land .side.op { align-self:end; } #stage .yw.land .side.me { align-self:start; }

/* 양쪽 줄: 장수 · 대기 말 · 난 말 */
#stage .side { width:100%; max-width:640px; display:flex; align-items:center; gap:8px; padding:5px 8px; box-sizing:border-box;
  background:var(--panel); border:1px solid var(--rule2); border-left:4px solid var(--rule2); border-radius:4px; min-height:48px; }
#stage .side.on { border-left-color:var(--acc); box-shadow:inset 0 0 0 1px #33366e22; }
#stage .side.me.on { border-left-color:var(--me); } #stage .side.op.on { border-left-color:var(--op); }
#stage .side .who { display:flex; align-items:center; gap:7px; min-width:0; flex:0 1 auto; }
#stage .side .who img { width:36px; height:36px; object-fit:cover; object-position:50% 18%; border-radius:3px; border:1px solid var(--rule); background:#fff; flex:none; }
#stage .side.me .who img { border-color:var(--me); } #stage .side.op .who img { border-color:var(--op); }
#stage .side .who span { display:flex; flex-direction:column; min-width:0; line-height:1.15; }
#stage .side .who b { font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#stage .side .who small { font-size:11.5px; color:var(--dim); white-space:nowrap; }
#stage .side .tray { flex:1; min-width:0; display:flex; align-items:center; gap:3px; padding:3px 6px; min-height:38px; background:transparent;
  border:1px dashed var(--rule2); border-radius:3px; color:var(--ink); font-size:12px; cursor:default; }
#stage .side .tray:disabled { opacity:1; }
#stage .side .tray.can { border:1px solid var(--me); background:#bf3f240d; cursor:pointer; }
#stage .side .tray.sel { background:#bf3f2422; box-shadow:inset 0 0 0 1px var(--me); }
#stage .side .tray.hint { box-shadow:inset 0 0 0 2px #c99a2e; animation:yhint 1s ease-in-out infinite alternate; }
#stage .side .tl { font-size:11px; color:var(--dim); margin-right:3px; white-space:nowrap; }
#stage .side .none { font-size:11.5px; color:var(--dim); }
#stage .side .outs { flex:none; font-size:12px; color:var(--dim); white-space:nowrap; } #stage .side .outs b { font-size:17px; color:var(--ink); margin-left:2px; }
#stage .mt { display:inline-block; width:26px; height:26px; border-radius:50%; overflow:hidden; border:2px solid; background:#fff; flex:none; }
#stage .mt.me { border-color:var(--me); } #stage .mt.op { border-color:var(--op); }
#stage .mt img { width:100%; height:100%; object-fit:cover; object-position:50% 18%; display:block; }

/* 말판 */
#stage .bdw { position:relative; }
#stage .bd { position:relative; user-select:none; -webkit-user-select:none; box-shadow:0 1px 0 #fff8 inset, 0 3px 10px #3b2a1430; }
#stage .ysv { position:absolute; inset:0; width:100%; height:100%; display:block; }
#stage .ysv .paper { fill:#f1e6cc; stroke:#8a6a3c; stroke-width:.6; }
#stage .ysv .frame { fill:none; stroke:#8a6a3c; stroke-width:.25; }
#stage .ysv .ln { stroke:#4a3420; stroke-width:.38; fill:none; stroke-linecap:round; }
#stage .ysv .ex { stroke:#4a3420; stroke-width:.35; stroke-dasharray:1 1; }
#stage .ysv .ns { fill:#f7f0de; stroke:#4a3420; stroke-width:.32; }
#stage .ysv .nb { fill:#f7f0de; stroke:#4a3420; stroke-width:.36; }
#stage .ysv .ni { fill:none; stroke:#4a3420; stroke-width:.24; }
#stage .ysv .lb { font-size:2.5px; fill:#6a5236; text-anchor:middle; font-family:"Gowun Batang","Batang",serif; letter-spacing:.05em; }
#stage .ysv .lb.s { font-size:2.2px; text-anchor:end; }
#stage .tkl, #stage .mkl { position:absolute; inset:0; pointer-events:none; }
/* 말 (장수 얼굴 토큰) */
#stage .tk { position:absolute; width:10.6%; aspect-ratio:1; transform:translate(-50%,-50%); border-radius:50%; background:#fff; border:2px solid; box-sizing:border-box;
  box-shadow:0 2px 3px #2a1a0a55; transition:left .14s ease-out, top .14s ease-out; pointer-events:auto; cursor:default; }
#stage .tk.me { border-color:var(--me); } #stage .tk.op { border-color:var(--op); }
#stage .tk img { width:100%; height:100%; border-radius:50%; object-fit:cover; object-position:50% 18%; display:block; pointer-events:none; }
#stage .tk b { position:absolute; right:-8%; bottom:-8%; min-width:44%; padding:0 2px; font-size:11px; line-height:15px; text-align:center; color:#fff; border-radius:2px; }
#stage .tk.me b { background:var(--me); } #stage .tk.op b { background:var(--op); }
#stage .tk b:empty { display:none; }
#stage .tk.off { display:none; }
#stage .tk.can { cursor:pointer; box-shadow:0 0 0 2px #fff, 0 0 0 3px var(--me), 0 2px 4px #2a1a0a66; }
#stage .tk.sel { box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--me), 0 3px 8px #2a1a0a88; transform:translate(-50%,-58%); }
#stage .tk.hint { animation:yhint 1s ease-in-out infinite alternate; }
#stage .tk.pick { box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--op); transform:translate(-50%,-58%); }
#stage .tk.last::after { content:""; position:absolute; left:50%; top:-14%; width:14%; height:14%; transform:translateX(-50%) rotate(45deg); background:currentColor; }
#stage .tk.me.last { color:var(--me); } #stage .tk.op.last { color:var(--op); }
@keyframes yhint { from { box-shadow:0 0 0 2px #fff, 0 0 0 3px #c99a2e; } to { box-shadow:0 0 0 2px #fff, 0 0 0 5px #e2b84a, 0 0 10px #e2b84a; } }
/* 갈 수 있는 칸 */
#stage .mk { position:absolute; transform:translate(-50%,-50%); pointer-events:auto; z-index:40; min-width:11%; min-height:7.6%; padding:1px 5px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1.05;
  background:var(--me); color:#fff; border:1px solid #fff; border-radius:3px; font:inherit; font-size:clamp(12px,2.6vmin,16px); font-weight:700;
  box-shadow:0 0 0 1px var(--me), 0 2px 6px #2a1a0a66; animation:ymk .9s ease-in-out infinite alternate; }
#stage .mk small { font-size:10px; font-weight:500; opacity:.9; }
#stage .mk.cap { background:#8e1f12; box-shadow:0 0 0 1px #8e1f12, 0 2px 6px #2a1a0a66; }
#stage .mk.outm { background:var(--ink2); box-shadow:0 0 0 1px var(--ink2), 0 2px 6px #2a1a0a66; }
#stage .mk.hint { background:#b8871f; box-shadow:0 0 0 2px #f4d58a, 0 2px 8px #2a1a0a88; }
@keyframes ymk { to { transform:translate(-50%,-50%) scale(1.07); } }

/* 안내 · 윷 · 결과 · 단추 */
#stage .yw .msg { font-size:14.5px; line-height:1.4; text-align:center; min-height:2.9em; padding:5px 8px; display:flex; align-items:center; justify-content:center;
  background:var(--panel); border:1px solid var(--rule2); border-radius:4px; }
#stage .yw .msg b { color:#8a2f1a; }
#stage .yard { position:relative; display:flex; align-items:center; gap:10px; padding:6px 10px; min-height:66px;
  background:linear-gradient(#efe7d6,#e6dcc6); border:1px solid var(--rule2); border-radius:4px; }
#stage .sticks { display:flex; gap:7px; align-items:center; flex:none; perspective:300px; }
#stage .yt { position:relative; display:block; width:13px; height:54px; border-radius:7px / 12px; box-sizing:border-box; transform:rotate(var(--rz)); }
#stage .yt.flat { background:linear-gradient(90deg,#e9d2a2,#f6e7c4 45%,#e2c58e); border:1px solid #a9844c; }
#stage .yt.flat::after { content:""; position:absolute; left:50%; top:10%; bottom:10%; width:1px; background:#b8935a88; }
#stage .yt.round { background:linear-gradient(90deg,#6e4320,#a87542 40%,#7a4b23); border:1px solid #4e2f14; }
#stage .yt.round::before { content:"×\A×\A×"; white-space:pre; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center;
  font-size:9px; line-height:13px; color:#e8c48f; }
#stage .yt em { position:absolute; left:0; right:0; top:50%; transform:translateY(-50%); font-style:normal; font-size:9px; font-weight:700; color:#b0301c; text-align:center; z-index:1; }
#stage .yt.spin { animation:yspin .17s linear infinite alternate; animation-delay:var(--d); }
@keyframes yspin { from { transform:translateY(0) rotate(var(--rz)) scaleY(1); } to { transform:translateY(-14px) rotate(calc(var(--rz) * -1)) scaleY(.35); } }
#stage .res { flex:1; min-width:0; display:flex; flex-wrap:wrap; gap:5px; align-items:center; }
#stage .res .chip { display:inline-block; min-width:34px; padding:4px 8px; text-align:center; font-weight:700; font-size:15px; background:#fbf8f1; border:1px solid var(--rule); border-radius:3px; color:var(--ink); }
#stage .res .chip.hi { border-color:var(--acc); color:var(--acc); }
#stage .res .chip.bk { border-color:#a8321e; color:#a8321e; }
#stage .res .none { font-size:12px; color:var(--dim); }
#stage .big { position:absolute; right:12px; top:50%; transform:translateY(-50%) scale(.6); opacity:0; pointer-events:none; transition:opacity .2s, transform .2s;
  font-family:"Gowun Batang","Batang",serif; font-size:34px; font-weight:900; color:var(--ink2); letter-spacing:.05em; }
#stage .big.on { opacity:1; transform:translateY(-50%) scale(1); }
#stage .big.hi { color:var(--acc); } #stage .big.bk { color:#a8321e; } #stage .big.cap { color:#8e1f12; }
#stage .yw .ctl { display:flex; gap:6px; }
#stage .yw .ctl .btn { min-height:46px; padding:6px 8px; font-size:14.5px; font-weight:700; flex:1; }
#stage .yw .ctl .btn.throw { flex:1.6; font-size:17px; }
#stage .yw .ctl .btn.throw.go { background:linear-gradient(var(--acc-hi),var(--acc)); color:#fff8ec; border-color:var(--acc-lo); text-shadow:none; box-shadow:0 2px 0 var(--acc-lo); }
#stage .yw .ctl .btn small { display:block; font-size:10.5px; font-weight:500; opacity:.75; }
#stage .yw .ctl .btn b { margin-left:2px; }
#stage .yw.land .ctl { flex-wrap:wrap; } #stage .yw.land .ctl .btn.throw { flex:1 1 100%; min-height:54px; font-size:19px; }
#stage .top h2 small { font-size:13px; color:var(--dim); }
/* 튜토리얼 말풍선 */
#stage .bubble { position:absolute; left:50%; top:10px; transform:translateX(-50%); z-index:60; width:min(94%,470px); background:var(--panel); color:var(--ink);
  border:1px solid var(--rule); border-top:3px solid var(--acc); border-radius:4px; padding:12px 14px; font-size:15px; line-height:1.6; box-shadow:0 8px 24px #2a1a0a40; text-align:center; }
#stage .bubble .btn { margin-top:8px; min-width:120px; }
/* 작은 화면 */
@media (max-height:640px) { #stage .yw .msg { min-height:2.4em; font-size:13.5px; } #stage .yard { min-height:56px; } #stage .yt { height:44px; } #stage .side { min-height:42px; } #stage .side .who img { width:30px; height:30px; } }
@media (max-width:380px) { #stage .side .who small { display:none; } #stage .mt { width:22px; height:22px; } }
