/* JPN — all artwork is generated images in /img; CSS only lays them out and animates them. */
*{box-sizing:border-box;margin:0}
:root{--sakura:#ff9ec4;--gold:#f4d27a;--ink:#f6efe0;--muted:#b9b2a3}
html,body{height:100%}
body{font:14px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);background:#06080f url(img/bg.webp) center/cover fixed;overflow-x:hidden}
.muted{color:var(--muted)}
[hidden]{display:none!important}

/* ---------- header ---------- */
.top{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 14px;background:linear-gradient(#000c,#0000)}
.brand{display:block;width:120px;height:52px;background:url(img/logo.webp) center/contain no-repeat;font-size:0;animation:logoIn .9s cubic-bezier(.2,1.4,.4,1)}
.me{display:flex;align-items:center;gap:8px;padding:4px 14px 4px 8px;background:url(img/plate.webp) center/100% 100% no-repeat;min-height:40px}
.me-name{font-weight:700;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chips{display:flex;align-items:center;gap:4px;color:var(--gold);font-weight:800}
.chip-ico{display:inline-block;width:18px;height:18px;background:url(img/chip.webp) center/contain no-repeat;flex:none}

/* ---------- buttons (image skins) ---------- */
.btn{border:0;cursor:pointer;color:#fff;font:800 14px system-ui,sans-serif;text-shadow:0 1px 2px #000a;min-width:96px;height:44px;padding:0 22px;
 background:url(img/btn-dark.webp) center/100% 100% no-repeat;transition:transform .12s,filter .15s}
.btn:hover{filter:brightness(1.15)}
.btn:active{transform:scale(.95)}
.btn:disabled{filter:grayscale(1) brightness(.6);cursor:default}
.btn.gold{background-image:url(img/btn-gold.webp);color:#3a2400;text-shadow:0 1px 0 #fff6}
.btn.danger{background-image:url(img/btn-red.webp)}
.btn.green{background-image:url(img/btn-green.webp)}
.btn.small{height:34px;min-width:70px;padding:0 14px;font-size:12px}
.btn.tiny{height:28px;min-width:56px;padding:0 10px;font-size:11px}

/* ---------- login ---------- */
.screen{animation:fadeUp .45s ease}
#login{display:grid;place-items:center;min-height:calc(100vh - 70px);padding:16px}
.login-card{width:min(440px,100%);aspect-ratio:3/2;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;text-align:center;
 padding:30px 40px;background:url(img/panel.webp) center/100% 100% no-repeat}
.login-card h1{font-size:26px;color:var(--gold);line-height:1.15}
.login-card h1 span{font-size:16px;color:var(--ink);font-weight:600}
#loginForm{display:flex;flex-direction:column;gap:10px;width:100%;max-width:260px}
input{font:inherit;color:var(--ink);background:#0009;border:1px solid #f4d27a66;border-radius:10px;padding:9px 12px;outline:0}
input:focus{border-color:var(--gold)}

/* ---------- lobby ---------- */
#lobby{padding:8px 16px 30px;max-width:1100px;margin:auto}
.lobby-head h2{color:var(--gold);margin:6px 0 14px}
.tables{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:16px}
.table-card{position:relative;border:0;cursor:pointer;color:var(--ink);text-align:left;font:inherit;padding:18px 18px 16px;min-height:170px;
 background:url(img/table.webp) center 62%/118% auto no-repeat,url(img/panel.webp) center/100% 100% no-repeat;transition:transform .2s,filter .2s;animation:fadeUp .5s ease both}
.table-card:nth-child(2){animation-delay:.07s}.table-card:nth-child(3){animation-delay:.14s}.table-card:nth-child(4){animation-delay:.21s}
.table-card:hover{transform:translateY(-4px) scale(1.02);filter:brightness(1.12)}
.tc-top{display:flex;justify-content:space-between;font-size:16px}
.tc-top b{color:var(--gold);text-shadow:0 2px 4px #000}
.seats{font-weight:800;text-shadow:0 1px 3px #000}
.tc-blinds,.tc-buy{text-shadow:0 1px 3px #000;margin-top:2px}
.tc-dots{position:absolute;left:18px;bottom:14px;display:flex;gap:4px}
.tc-dots i{width:14px;height:14px;background:url(img/chip.webp) center/contain no-repeat;filter:grayscale(1) brightness(.4)}
.tc-dots i.on{filter:none}

/* ---------- table screen ---------- */
#table{padding:0 10px 10px;max-width:1280px;margin:auto}
.table-bar{display:flex;align-items:center;gap:10px;padding:4px 0 6px}
.table-title{flex:1;min-width:0}
.table-title b{color:var(--gold);font-size:16px}
.table-tools{display:flex;gap:6px}
.arena{display:grid;grid-template-columns:1fr 260px;gap:10px}
.felt-wrap{position:relative}
.felt{position:relative;width:100%;aspect-ratio:3/2;background:url(img/table.webp) center/contain no-repeat}
.center{position:absolute;left:50%;top:47%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:8px;width:60%}
.pot{min-height:26px;display:flex;align-items:center;gap:6px;padding:2px 14px 2px 34px;font-weight:700;background:url(img/chip-stack.webp) 4px center/26px no-repeat,#0008;border-radius:20px}
.pot:empty{visibility:hidden}
.pot b{color:var(--gold)}
.board{display:flex;gap:6px;min-height:76px}
.result{min-height:20px;font-weight:800;color:var(--gold);text-align:center;text-shadow:0 2px 4px #000}

/* cards */
.card{position:relative;width:54px;height:76px;flex:none;background:url(img/card-face.webp) center/100% 100% no-repeat;filter:drop-shadow(0 3px 4px #0008)}
.card .r{position:absolute;left:6px;top:2px;font:900 20px/1 Georgia,serif;letter-spacing:-1px}
.card .s{position:absolute;right:5px;bottom:6px;width:58%;height:48%;background:center/contain no-repeat}
.card .s.mini{left:6px;top:23px;right:auto;bottom:auto;width:14px;height:14px}
.card.red .r{color:#c4141c}.card.black .r{color:#121212}
.card .s.s{background-image:url(img/suit-spade.webp)}.card .s.h{background-image:url(img/suit-heart.webp)}
.card .s.d{background-image:url(img/suit-diamond.webp)}.card .s.c{background-image:url(img/suit-club.webp)}
.card.back{background-image:url(img/card-back.webp)}
.card.sm{width:38px;height:54px}
.card.sm .r{font-size:14px;left:4px}.card.sm .s.mini{display:none}
.card.hi{animation:glowPulse 1s ease-in-out infinite alternate;z-index:2}
.card.deal{animation:dealIn .5s cubic-bezier(.2,.9,.3,1.1) both}
.card.flip{animation:flipIn .55s ease both}

/* seats */
.seat{position:absolute;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;width:128px;z-index:3;transition:opacity .3s,filter .3s}
.seat.empty .sit{animation:breathe 2.2s ease-in-out infinite}
.seat.folded{opacity:.5;filter:grayscale(.7)}
.seat.away{opacity:.6}
.hole{display:flex;gap:2px;height:56px;margin-bottom:-12px;z-index:1}
.seat.hero .hole{height:78px;margin-bottom:-14px}
.plate{position:relative;display:flex;align-items:center;gap:6px;width:128px;height:46px;padding:0 10px 0 6px;background:url(img/plate.webp) center/100% 100% no-repeat;z-index:2}
.avatar{width:36px;height:36px;flex:none;border-radius:50%;background:#222 center/cover no-repeat;box-shadow:0 0 0 2px var(--gold)}
.info{min-width:0}
.nm{font-size:11px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st{font-size:12px;font-weight:900;color:var(--gold)}
.seat.turn .avatar{animation:turnRing 1s ease-in-out infinite}
.seat.turn .plate{filter:brightness(1.25)}
.timer{position:absolute;left:10px;right:10px;bottom:3px;height:3px;border-radius:2px;background:linear-gradient(90deg,var(--gold) var(--p,100%),#0000 0)}
.timer.low{background:linear-gradient(90deg,#ff4d4d var(--p,100%),#0000 0)}
.last{margin-top:3px;padding:1px 8px;font-size:11px;font-weight:700;background:#000b;border-radius:10px;animation:pop .3s ease}
.seat.win::before{content:"";position:absolute;left:50%;top:40%;width:220px;height:220px;transform:translate(-50%,-50%);background:url(img/win-burst.webp) center/contain no-repeat;z-index:0;animation:burst 1.6s ease-out both,spin 6s linear infinite}
.seat.win .plate{animation:bounce .6s ease 2}
.bet{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;gap:3px;padding:1px 7px 1px 2px;font-size:11px;font-weight:800;background:#000a;border-radius:12px;z-index:2;animation:chipSlide .4s ease both}
.bet .chip-ico{width:16px;height:16px}
.dealer{position:absolute;width:26px;height:26px;transform:translate(-50%,-50%);background:url(img/dealer.webp) center/contain no-repeat;font-size:0;z-index:2;transition:left .6s,top .6s}

/* chat + actions */
.chat{display:flex;flex-direction:column;min-height:0;max-height:min(66vw,560px);padding:14px;background:url(img/panel.webp) center/100% 100% no-repeat}
.chat-log{flex:1;overflow:auto;font-size:12px;padding:4px;min-height:120px}
.chat-log p{margin:2px 0;word-break:break-word}
.chat-log p.sys{color:var(--muted);font-style:italic}
.chat-log b{color:var(--gold)}
#chatForm{display:flex;gap:6px;margin-top:6px}
#chatForm input{flex:1;min-width:0}
.actions{position:sticky;bottom:0;margin-top:8px;padding:10px 14px;background:url(img/panel.webp) center/100% 100% no-repeat;animation:slideUp .3s ease;z-index:10}
.raise-row{display:flex;align-items:center;gap:6px;margin-bottom:8px}
.raise-row input[type=range]{flex:1;accent-color:var(--gold)}
.raise-row input[type=number]{width:96px}
.act-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
.act-row .btn{width:100%;height:48px}

/* dialog + toast */
dialog{border:0;padding:0;background:transparent;color:var(--ink);margin:auto}
dialog::backdrop{background:#000a;backdrop-filter:blur(3px)}
dialog[open]{animation:zoomIn .3s cubic-bezier(.2,1.3,.4,1)}
.dlg{width:min(380px,92vw);aspect-ratio:3/2;display:flex;flex-direction:column;justify-content:center;gap:8px;padding:28px 34px;background:url(img/panel.webp) center/100% 100% no-repeat}
.dlg h3{color:var(--gold)}
.dlg input[type=range]{accent-color:var(--gold)}
.buy-amount input{width:100%;text-align:center;font-weight:800;font-size:16px}
.dlg-btns{display:flex;justify-content:flex-end;gap:8px}
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,40px);opacity:0;padding:10px 18px;background:#000d;border:1px solid #f4d27a88;border-radius:12px;transition:.3s;z-index:50;pointer-events:none}
.toast.on{opacity:1;transform:translate(-50%,0)}

/* ---------- animations ---------- */
@keyframes fadeUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes logoIn{from{opacity:0;transform:scale(.6) rotate(-6deg)}to{opacity:1;transform:none}}
@keyframes dealIn{from{opacity:0;transform:translate(var(--dx,0),var(--dy,-120px)) rotate(-25deg) scale(.6)}to{opacity:1;transform:none}}
@keyframes flipIn{0%{transform:rotateY(90deg) scale(.9);opacity:.3}100%{transform:none;opacity:1}}
@keyframes glowPulse{from{filter:drop-shadow(0 0 3px #ffd76a)}to{filter:drop-shadow(0 0 12px #ffd76a) brightness(1.08);transform:translateY(-4px)}}
@keyframes turnRing{0%,100%{box-shadow:0 0 0 2px var(--gold),0 0 4px var(--gold)}50%{box-shadow:0 0 0 3px #fff,0 0 16px var(--gold)}}
@keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.07)}}
@keyframes pop{from{transform:scale(.4);opacity:0}to{transform:none;opacity:1}}
@keyframes burst{from{opacity:0;transform:translate(-50%,-50%) scale(.3)}30%{opacity:1}to{opacity:.85;transform:translate(-50%,-50%) scale(1)}}
@keyframes spin{to{rotate:360deg}}
@keyframes bounce{0%,100%{transform:none}40%{transform:translateY(-8px) scale(1.05)}}
@keyframes chipSlide{from{opacity:0;transform:translate(-50%,-50%) scale(.3)}to{opacity:1;transform:translate(-50%,-50%)}}
@keyframes slideUp{from{transform:translateY(30px);opacity:0}to{transform:none;opacity:1}}
@keyframes zoomIn{from{transform:scale(.7);opacity:0}to{transform:none;opacity:1}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* ---------- mobile ---------- */
@media (max-width:860px){
 .arena{grid-template-columns:1fr}
 .chat{max-height:200px}
 .felt{aspect-ratio:4/5;background-size:auto 100%;background-image:url(img/table-v.webp)}
 .seat{width:92px}.plate{width:92px;height:38px;padding:0 6px 0 4px}.avatar{width:26px;height:26px}
 .nm{font-size:10px}.st{font-size:11px}
 .card{width:42px;height:60px}.card .r{font-size:16px}.card .s.mini{top:19px;width:11px;height:11px}
 .card.sm{width:28px;height:40px}.card.sm .r{font-size:11px;left:3px}
 .hole{height:42px}.seat.hero .hole{height:62px}
 .board{min-height:60px;gap:4px}.center{width:80%}
 .brand{width:90px;height:40px}
 .table-tools .btn{min-width:56px;padding:0 8px}
}

/* ---------- sakura accents ---------- */
.sakura{position:fixed;inset:0;pointer-events:none;z-index:0;overflow:hidden}
body>header,body>main{position:relative;z-index:1}
.branch{position:absolute;top:-10px;width:min(42vw,520px);aspect-ratio:3/2;background:url(img/sakura-branch.webp) left top/contain no-repeat;opacity:.9;animation:sway 7s ease-in-out infinite alternate;transform-origin:0 0}
.branch.l{left:-30px}
.branch.r{right:-30px;transform:scaleX(-1);transform-origin:100% 0;animation-name:swayR}
.petals i{position:absolute;top:-30px;background:url(img/sakura-petal.webp) center/contain no-repeat;opacity:.85;animation-name:petalFall,petalSpin;animation-timing-function:linear,ease-in-out;animation-iteration-count:infinite,infinite;animation-direction:normal,alternate}
@keyframes petalFall{to{transform:translate(var(--drift),110vh)}}
@keyframes petalSpin{from{rotate:-40deg}to{rotate:60deg}}
@keyframes sway{from{rotate:0deg}to{rotate:2.5deg}}
@keyframes swayR{from{transform:scaleX(-1) rotate(0deg)}to{transform:scaleX(-1) rotate(2.5deg)}}
.login-card h1 span,.lobby-head h2{color:var(--sakura)}
.lobby-head h2{text-shadow:0 0 12px #ff9ec455}
.seat.turn .avatar{box-shadow:0 0 0 2px var(--sakura)}
input:focus{border-color:var(--sakura)}
@media (max-width:860px){.branch{width:52vw;opacity:.6}}

/* ---------- layout tuning ---------- */
#lobby{padding-top:36px}
.lobby-head h2{text-align:center;font-size:24px;letter-spacing:.5px;text-shadow:0 2px 6px #000,0 0 18px #000,0 0 30px #ff9ec455}
.tables{grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:20px}
.table-card{min-height:200px;padding:42px 46px 30px;background:url(img/table.webp) center/100% 100% no-repeat;filter:drop-shadow(0 8px 16px #000c)}
.table-card:hover{filter:drop-shadow(0 8px 22px #ff9ec466) brightness(1.1)}
.tc-dots{left:46px;bottom:34px}
.table-title b,.table-title span{text-shadow:0 1px 4px #000,0 0 10px #000}
.felt{width:min(100%,calc((100vh - 250px)*1.6));aspect-ratio:16/10;margin:0 auto}
.seat.empty{width:auto}
.seat.empty .muted{display:block;padding:10px 22px;font-size:11px;color:#d9d2c3;background:url(img/plate.webp) center/100% 100% no-repeat;opacity:.45}
@media (max-width:860px){
 .felt{width:100%;aspect-ratio:3/4;background:url(img/table-v.webp) center/100% 100% no-repeat}
 .raise-row{gap:4px}.raise-row .btn.tiny{min-width:42px;padding:0 6px}
 .raise-row input[type=number]{width:66px;padding:6px}
 .table-card{padding:38px 40px 28px}
 .seat.empty .muted{padding:7px 12px;font-size:10px}
}
.login-card h1 span{display:block;width:170px;height:80px;margin:8px auto 0;background:url(img/logo.webp) center/contain no-repeat;font-size:0}

/* ---------- buttons: 3-slice image skin (round caps never stretch) ---------- */
.btn{background:none!important;border-style:solid;border-color:transparent;border-width:0 22px;border-image:url(img/btn-dark.webp) 0 79 fill/0 22px stretch;padding:0 6px;border-radius:0;letter-spacing:.3px;
 transition:transform .12s,filter .15s,box-shadow .15s}
.btn.gold{border-image-source:url(img/btn-gold.webp)}
.btn.danger{border-image-source:url(img/btn-red.webp)}
.btn.green{border-image-source:url(img/btn-green.webp)}
.btn.small{border-width:0 17px;border-image-width:0 17px;padding:0 4px;height:34px;min-width:0}
.btn.tiny{border-width:0 14px;border-image-width:0 14px;padding:0 3px;height:28px;min-width:0}
.act-row .btn{border-width:0 24px;border-image-width:0 24px;height:48px;font-size:15px}
.btn:hover{filter:brightness(1.12) drop-shadow(0 0 6px #f4d27a66)}
.btn:focus-visible{outline:2px solid var(--sakura);outline-offset:3px}
@media (min-width:861px){
 .actions{max-width:760px;margin:8px auto 0;padding:12px 28px}
 .act-row{grid-template-columns:repeat(3,minmax(0,190px));justify-content:center;gap:14px}
 .raise-row{max-width:620px;margin:0 auto 10px}
 #loginForm .btn{height:46px}
}
.btn{white-space:nowrap}
@media (max-width:860px){
 .btn.small{border-width:0 13px;border-image-width:0 13px;font-size:11px;height:32px}
 .btn.tiny{border-width:0 10px;border-image-width:0 10px;font-size:10px;height:26px}
 .act-row .btn{border-width:0 18px;border-image-width:0 18px;font-size:14px;height:46px}
 .table-bar{gap:6px}
 .table-title{display:flex;flex-direction:column;line-height:1.15;overflow:hidden}
 .table-title b{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .table-title span{font-size:11px;white-space:nowrap}
 .actions{padding:10px}
 .raise-row input[type=number]{width:58px}
}

/* ---------- action bar: fixed while seated, dimmed off-turn, lit on turn ---------- */
.actions{animation:none;transition:box-shadow .25s}
.actions .btn:disabled{filter:grayscale(.85) brightness(.5);cursor:default}
.actions.turn{box-shadow:0 0 0 1px #f4d27a55,0 0 24px #f4d27a33}
.actions.turn .act-row .btn:not(:disabled){animation:btnGlow 1.1s ease-in-out infinite alternate}
.raise-row input:disabled{opacity:.45}
@keyframes btnGlow{from{filter:brightness(1) drop-shadow(0 0 2px #f4d27a55)}to{filter:brightness(1.18) drop-shadow(0 0 10px #f4d27aaa)}}
.table-title span{margin-left:8px}
@media (max-width:860px){
 .table-title span{margin-left:0}
 .raise-row .btn.tiny{border-width:0 9px;border-image-width:0 9px;padding:0 1px;letter-spacing:0;min-width:0}
 .act-row .btn{font-size:13px;letter-spacing:0;padding:0 2px}
 .raise-row input[type=number]{width:54px;padding:5px}
}

/* lobby: JPN logo centred */
body[data-screen=lobby] .brand{position:absolute;left:50%;top:6px;transform:translateX(-50%);width:230px;height:100px;animation:logoIn .9s cubic-bezier(.2,1.4,.4,1)}
body[data-screen=lobby] #lobby{padding-top:70px}
@keyframes logoIn{from{opacity:0;transform:translateX(-50%) scale(.6)}to{opacity:1;transform:translateX(-50%)}}
body:not([data-screen=lobby]) .brand{animation:none}
@media (max-width:860px){
 body[data-screen=lobby] .top{flex-direction:column;gap:6px}
 body[data-screen=lobby] .brand{position:static;transform:none;width:170px;height:76px;animation:none}
 body[data-screen=lobby] #lobby{padding-top:8px}
}
body[data-screen=lobby] .me{margin-left:auto}
#lobby{max-width:1280px}
.tables{grid-template-columns:repeat(auto-fit,minmax(260px,285px));justify-content:center}
@media (max-width:860px){body[data-screen=lobby] .me{margin-left:0}.tables{grid-template-columns:1fr}}

/* Japanese titles: smooth rounded font; no plate behind name/chips */
body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}
[lang=ja]{font-family:"Zen Maru Gothic",system-ui,sans-serif;font-weight:700;letter-spacing:.06em}
.login-card h1[lang=ja]{font-size:24px}
.me{background:none;padding:4px 0;text-shadow:0 1px 4px #000,0 0 10px #000}
@media (max-width:860px){.login-card h1[lang=ja]{font-size:19px}}
body[data-screen=login] .brand,body:not([data-screen]) .brand{visibility:hidden}

/* ---------- image buttons (artwork includes the word; generated by ChatGPT image) ---------- */
.ib{position:relative;display:inline-block;flex:none;height:40px;width:auto;padding:0;border:0;cursor:pointer;color:transparent;font-size:0;
 background:center/contain no-repeat;transition:transform .12s,filter .2s}
.ib:hover:not(:disabled){filter:brightness(1.12) drop-shadow(0 0 8px #f4d27a77)}
.ib:active:not(:disabled){transform:scale(.96)}
.ib:disabled{filter:grayscale(.85) brightness(.5);cursor:default}
.ib:focus-visible{outline:2px solid var(--sakura);outline-offset:3px}
.ib .amt{position:absolute;left:50%;top:-17px;transform:translateX(-50%);font:800 12px/1 system-ui,sans-serif;color:var(--gold);white-space:nowrap;text-shadow:0 1px 3px #000,0 0 6px #000}
.ib .amt:empty{display:none}
.me .ib,.table-tools .ib,#toLobby{height:34px}
#chatForm .ib{height:38px}
.raise-row .ib{height:30px}
.act-row{display:flex;justify-content:center;gap:14px;padding-top:14px}
.act-row .ib{height:56px}
.actions.turn .act-row .ib:not(:disabled){animation:btnGlow 1.1s ease-in-out infinite alternate}
#loginForm .ib{height:58px;align-self:center}
.dlg-btns .ib{height:42px}
.seat.empty .ib-sit{height:32px;animation:breathe 2.2s ease-in-out infinite}
/* inputs framed with the reference input artwork */
#nick,#chatText,#raiseValue,#buyValue{border:0;border-radius:0;background:url(img/input-frame.webp) center/100% 100% no-repeat;padding:10px 22px;color:var(--ink)}
#raiseValue{padding:6px 14px;text-align:center}
#nick{height:52px}
@media (max-width:860px){
 .me .ib,.table-tools .ib,#toLobby{height:28px}
 .raise-row .ib{height:24px}
 .act-row{gap:6px}.act-row .ib{height:auto;width:31%}
 #loginForm .ib{height:50px}
}
