
*{box-sizing:border-box}html,body{margin:0;height:100%;font-family:Arial,Helvetica,sans-serif;background:#10291f;color:#fff}
#app{height:100%;display:flex;flex-direction:column}
header{height:58px;display:flex;align-items:center;gap:24px;padding:0 18px;background:#17241f;border-bottom:1px solid #51655c;z-index:5}
.brand{font-weight:800;letter-spacing:1.5px}.brand,#score{white-space:nowrap}#score{margin-left:auto;font-size:16px}
button{background:#e9e2c8;color:#171717;border:0;border-radius:8px;padding:9px 14px;font-weight:700;cursor:pointer}
#table{position:relative;flex:1;overflow:hidden;background:radial-gradient(circle at 50% 55%,#14715d 0,#075441 48%,#063c31 100%);min-height:600px}
.player{position:absolute;display:flex;align-items:center;gap:8px;font-weight:700;text-shadow:0 1px 2px #000}
.player.top{top:18px;left:50%;transform:translateX(-50%);flex-direction:column}
.player.left{left:18px;top:42%;flex-direction:column}.player.right{right:18px;top:42%;flex-direction:column}
.mood{display:inline-block;min-width:48px;font-size:48px;line-height:1;text-align:center}.backs{display:flex;gap:3px}.backs.vertical{flex-direction:column}
.back{width:16px;height:31px;border:2px solid #262626;border-radius:4px;background:linear-gradient(135deg,#f7f1da,#cfc7ad);box-shadow:inset 0 0 0 2px #fff9e6,1px 2px 2px #001c15}
.vertical .back{width:31px;height:16px}
#boardWrap{position:absolute;left:9%;right:9%;top:42%;height:150px;display:flex;align-items:center;justify-content:center;gap:8px}
#chain{display:flex;align-items:center;justify-content:center;min-width:60px;max-width:82%;flex-wrap:nowrap}
.target{width:80px;height:110px;border-radius:14px;transition:.15s}.target.active{border:3px dashed rgba(255,255,255,.75);background:rgba(255,255,255,.08);cursor:pointer}
.tile{position:relative;width:44px;height:86px;background:linear-gradient(145deg,#fffdf3 0,#eee8d2 70%,#d2cbb4 100%);border:3px solid #252525;border-radius:8px;box-shadow:inset 0 0 0 2px #fff,inset 0 0 0 4px #c8c0a7,2px 4px 5px rgba(0,0,0,.45);display:flex;flex-direction:column;flex:0 0 auto;user-select:none}
.tile.horizontal{width:86px;height:44px;flex-direction:row}.tile.horizontal .half{width:50%;height:100%}.tile.horizontal .half:first-child{border-right:2px solid #222;border-bottom:0}
.half{position:relative;width:100%;height:50%}.half:first-child{border-bottom:2px solid #222}
.pip{position:absolute;width:8px;height:8px;border-radius:50%;background:#171717;transform:translate(-50%,-50%);box-shadow:inset 1px 1px 1px rgba(255,255,255,.25)}
#human{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:8px}
.human-name{font-weight:800;display:flex;align-items:center;gap:6px}
#hand{display:flex;gap:8px;min-height:106px;align-items:flex-end}
#hand .tile{cursor:pointer;transition:transform .12s,filter .12s}
#hand .tile:hover{filter:brightness(1.05)}#hand .tile.selected{transform:translateY(-14px);filter:drop-shadow(0 5px 4px rgba(255,255,255,.25))}
#hand .tile.invalid{animation:shake .18s linear 2}
@keyframes shake{25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
#message{position:absolute;top:30%;left:50%;transform:translateX(-50%);font-size:20px;font-weight:800;text-shadow:0 2px 4px #000;min-height:28px}
#panel{position:absolute;right:14px;bottom:14px;width:190px;max-height:180px;background:rgba(5,24,19,.62);border:1px solid rgba(255,255,255,.25);border-radius:10px;padding:10px;overflow:auto;font-size:13px}
.panel-title{font-weight:800;margin-bottom:6px}#roundLog div{padding:3px 0;border-top:1px solid rgba(255,255,255,.1)}
@media(max-width:850px){#panel{display:none}.tile{width:39px;height:75px}.tile.horizontal{width:75px;height:39px}#boardWrap{left:4%;right:4%}#hand{gap:4px}.brand{font-size:13px}header{gap:8px;padding:0 8px}button{padding:7px 9px}}
.auth{min-height:100vh;display:grid;place-items:center;background:#075f4c;color:#18221d}.card{width:min(420px,90vw);background:#f6f0df;padding:28px;border-radius:16px;box-shadow:0 16px 45px #0006}.card h1{letter-spacing:2px}.card form{display:grid;gap:14px}.card label{font-weight:700}.card input{display:block;width:100%;box-sizing:border-box;margin-top:6px;padding:12px;border:1px solid #aaa;border-radius:8px;font-size:16px}.card button,.lobby button,.button-link{background:#efe5c7;color:#172019;border:0;border-radius:9px;padding:10px 16px;font-weight:800;text-decoration:none;cursor:pointer}.notice{padding:10px;background:#fff3bd;border-radius:8px}.error{background:#ffd9d9}.small{font-size:13px}.lobby{min-height:calc(100vh - 64px);background:#075f4c;color:#fff;display:grid;grid-template-columns:1fr 340px;gap:20px;padding:24px}.lobby-main, .lobby aside>div{background:#0a4f40;border:1px solid #ffffff22;border-radius:14px;padding:18px}.seat-grid{height:430px;position:relative}.seat{position:absolute;background:#123f35;padding:12px;border-radius:12px;text-align:center;min-width:130px}.seat span{display:block;margin:7px}.seat0{bottom:0;left:50%;transform:translateX(-50%)}.seat2{top:0;left:50%;transform:translateX(-50%)}.seat1{left:0;top:50%;transform:translateY(-50%)}.seat3{right:0;top:50%;transform:translateY(-50%)}.lobby aside{display:grid;gap:18px;align-content:start}.dot{display:inline-block;width:9px;height:9px;background:#56e37c;border-radius:50%;margin-right:7px}.online>div>div{padding:5px}.chat #chatList{height:260px;overflow:auto;background:#062f27;padding:9px;border-radius:8px}.chat #chatForm{display:flex;margin-top:8px}.chat input{flex:1;min-width:0;padding:10px;border-radius:8px 0 0 8px;border:0}.chat button{border-radius:0 8px 8px 0}.big{display:inline-block;font-size:20px;margin-top:16px}@media(max-width:800px){.lobby{grid-template-columns:1fr}.lobby aside{grid-row:2}}
.admin-page{min-height:calc(100vh - 58px);background:#075f4c;padding:24px;display:grid;gap:20px;align-content:start}.admin-card{background:#0a4f40;border:1px solid #ffffff22;border-radius:14px;padding:20px}.muted{opacity:.75}.player-create{display:grid;grid-template-columns:1.2fr 1fr 1fr .8fr auto;gap:12px;align-items:end}.player-create label{font-weight:700}.player-create input,.player-create select,.players-table select,.password-form input{display:block;width:100%;margin-top:6px;padding:10px;border:0;border-radius:8px;font-size:15px}.players-table-wrap{overflow:auto}.players-table{width:100%;border-collapse:collapse}.players-table th,.players-table td{text-align:left;padding:12px;border-top:1px solid #ffffff22;vertical-align:middle}.players-table code{color:#fff;font-size:14px}.inline-form{display:inline-flex;gap:8px;align-items:center;margin:0}.player-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.password-form input{width:180px;margin:0}@media(max-width:950px){.player-create{grid-template-columns:1fr 1fr}.player-create button{grid-column:1/-1}.players-table{min-width:850px}}
/* V0.004 game-start + board-layout foundation */
#startArea{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:20;text-align:center;font-weight:800}#startArea button{font-size:20px;padding:14px 24px}#waitingStart{background:#083f34cc;border:1px solid #ffffff2b;border-radius:12px;padding:14px 18px}
#boardWrap{left:10%;right:10%;top:25%;height:50%;display:block}#chain{position:relative;width:100%;height:100%;max-width:none;min-width:0;display:block}.board-tile{position:absolute;transform:translate(-50%,-50%);margin:0}.tile.vertical{width:44px;height:86px;flex-direction:column}.tile.vertical .half{width:100%;height:50%}.tile.vertical .half:first-child{border-bottom:2px solid #222;border-right:0}

.hand-tile.playable{cursor:pointer;transition:transform .12s ease,filter .12s ease}.hand-tile.playable:hover{transform:translateY(-10px);filter:brightness(1.08)}
/* V0.010 explicit two-end choice */
.end-choice{position:absolute;transform:translate(-50%,-50%);z-index:40;padding:8px 10px;border:2px solid #fff6cf;box-shadow:0 3px 10px #0008;font-size:12px;white-space:nowrap}
.hand-tile.selected{transform:translateY(-14px)!important;outline:3px solid #fff1a8;outline-offset:3px}

.restart-button{background:#efe5c7;color:#172019;border:0;border-radius:9px;padding:10px 16px;font-weight:800;cursor:pointer}.restart-button:disabled{opacity:.55;cursor:default}
/* V0.013 continuous chain, relative player view, turn/end indicators */
.end-sub{font-size:15px;font-weight:700}.reveal-tile{transform:scale(.58);transform-origin:center;margin:-18px -10px}.player.left .reveal-tile,.player.right .reveal-tile{transform:scale(.52);margin:-10px -22px}.player .backs:has(.reveal-tile){gap:0}.player.left .backs:has(.reveal-tile),.player.right .backs:has(.reveal-tile){max-height:190px;flex-wrap:wrap}.mood{filter:drop-shadow(0 2px 2px #000)}
/* V0.018 table chat */
#gameChat{position:absolute;right:14px;bottom:14px;width:285px;background:rgba(5,24,19,.78);border:1px solid rgba(255,255,255,.28);border-radius:11px;padding:9px;z-index:35;font-size:12px;box-shadow:0 4px 14px #0004}
.chat-title{font-weight:800;font-size:14px;margin:0 0 6px 2px}
#gameChatList{height:94px;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;gap:3px;padding:4px 5px;background:rgba(0,0,0,.12);border-radius:7px}
.game-chat-message{line-height:1.25;white-space:normal;overflow-wrap:anywhere}
#gameChatForm{display:flex;gap:5px;margin-top:7px}
#gameChatInput{flex:1;min-width:0;border:0;border-radius:7px;padding:7px 8px;font-size:12px}
#gameChatForm button{padding:7px 9px;font-size:11px;border-radius:7px}
@media(max-width:850px){#gameChat{display:block;width:235px;right:8px;bottom:8px}#gameChatList{height:78px}}

/* V0.021 real player names + compact cross-browser board geometry */
#score{font-size:17px;font-weight:700}#scoreLabelA,#scoreLabelB{font-weight:600}

/* V0.022 full administrator player management + team scoreboard */
#score{display:flex;align-items:center;gap:7px;margin-left:auto;font-size:14px;font-weight:800}
.score-team,.score-points{display:inline-flex;align-items:center;justify-content:center;min-height:36px;border-radius:9px;padding:7px 12px;box-shadow:inset 0 1px 0 #ffffff55,0 2px 5px #0005}
.score-team{color:#fff;max-width:330px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.score-team-blue{background:linear-gradient(#1675db,#0751aa);border:1px solid #3294f1}
.score-team-red{background:linear-gradient(#e33b3b,#aa1515);border:1px solid #f05a5a}
.score-points{background:#fff;color:#17241f;gap:8px;min-width:92px;font-size:18px;border:1px solid #e5e5df}
.score-dash{font-weight:500}
.user-edit-form{display:grid;grid-template-columns:minmax(150px,1.2fr) minmax(120px,1fr) 145px auto;gap:8px;align-items:center}
.user-edit-form input,.user-edit-form select{width:100%;padding:10px;border:0;border-radius:8px;font-size:15px;margin:0}
.save-user{white-space:nowrap}.danger-button{background:#b82d2d;color:#fff}.danger-button:hover{background:#d23939}
.players-table{min-width:1200px}.players-table td[colspan="3"]{min-width:560px}
@media(max-width:1100px){#score{gap:4px}.score-team{max-width:220px;padding:6px 8px;font-size:12px}.score-points{padding:6px 8px;min-width:76px;font-size:16px}}
/* V0.023 spectator mode: a watcher sees all four players only as tile backs/counts. */
#human.spectator-view .human-name::before{content:'👁 ESPECTADOR · ';font-weight:800;opacity:.82}
#human.spectator-view #hand{display:flex;justify-content:center;align-items:center;gap:4px;min-height:48px}
#human.spectator-view #hand .spectator-back{display:inline-block}
.invite-controls{display:flex;flex-direction:column;gap:7px;margin-top:10px;min-width:210px}.invite-controls select{padding:9px;border-radius:9px;border:0;background:#fff;color:#17251f}.invite-controls button{padding:8px 12px}.invite-status{min-height:16px;opacity:.85}.invite-notice{margin:18px auto;padding:16px 18px;max-width:520px;border:2px solid #eadfbd;border-radius:14px;background:#102f28;text-align:center;font-size:18px}.invite-notice div{margin-top:12px}.invite-notice button{margin:0 5px}
.host-table-controls{display:flex;gap:12px;flex-wrap:wrap;margin:18px 0}.host-table-controls button{min-width:150px}

/* V0.028: phones prioritize the table; hide in-game chat completely. */
@media (max-width:600px){
  #gameChat{display:none !important;}
  .lobby .chat{display:none !important;}
}
.bot-always{border-bottom:1px solid rgba(255,255,255,.12);padding-bottom:8px;margin-bottom:8px}.bot-always div{padding:4px 0}.bot-controls{display:flex;gap:6px;margin-top:7px}.bot-controls select{min-width:145px}#botBrain{position:fixed;right:12px;bottom:12px;width:min(430px,calc(100vw - 24px));max-height:46vh;overflow:auto;background:rgba(8,15,28,.96);border:1px solid #3d7cff;border-radius:12px;padding:10px;z-index:80;box-shadow:0 8px 30px rgba(0,0,0,.35)}.brain-head{display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:#080f1c;padding-bottom:8px}.brain-card{font-size:12px;border-top:1px solid rgba(255,255,255,.14);padding:8px 0;line-height:1.45}.brain-reason{opacity:.8;margin-top:4px}@media(max-width:600px){#botBrain{display:none!important}}

/* V0.039 lobby lifecycle / spectator banner */
.active-match-banner{margin:18px 0;padding:14px 18px;border:1px solid rgba(255,255,255,.22);border-radius:14px;background:rgba(0,0,0,.16);display:flex;gap:14px;align-items:center;flex-wrap:wrap}.active-match-banner span{font-weight:700}.admin-recovery{margin-top:18px;padding:12px 14px;border:1px solid rgba(255,210,120,.65);border-radius:12px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}.admin-recovery button{background:#f2dfb5}


/* V0.040 administrator game layout: keep chat above BOT BRAIN. */
@media (min-width:601px){
  body.game-admin #gameChat{
    position:fixed;
    right:12px;
    top:70px;
    bottom:auto;
    z-index:70;
  }
}


/* V0.041 administrator: connected humans outside the current table. */
#adminOutsidePlayers{position:fixed;left:12px;bottom:12px;width:220px;max-height:210px;overflow:auto;background:rgba(8,15,28,.94);border:1px solid rgba(255,255,255,.24);border-radius:12px;padding:10px 12px;z-index:75;box-shadow:0 8px 30px rgba(0,0,0,.30);font-size:13px}
.outside-head{padding-bottom:7px;border-bottom:1px solid rgba(255,255,255,.14);margin-bottom:5px}
.outside-person{display:flex;align-items:center;gap:8px;padding:5px 1px;font-weight:700}
.outside-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#56e37c;box-shadow:0 0 7px rgba(86,227,124,.55);flex:0 0 auto}
#adminOutsidePlayersList{opacity:.95}
@media(max-width:600px){#adminOutsidePlayers{display:none!important}}


/* V0.044 Venezuelan Cartón de Apunte: compact half-size card. */
#scoreCard{position:absolute;left:14px;top:14px;width:180px;z-index:32;border:1px solid rgba(255,255,255,.34);border-radius:10px;overflow:hidden;background:rgba(5,24,19,.88);box-shadow:0 5px 18px #0005}
.scorecard-head,.scorecard-row{display:grid;grid-template-columns:1fr 1fr}
.scorecard-team{padding:5px 4px;text-align:center;font-size:11px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.scorecard-blue{background:linear-gradient(#1675db,#0751aa);border-right:1px solid #4aa1f5}.scorecard-red{background:linear-gradient(#e33b3b,#aa1515)}
.scorecard-row>div{height:20px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;border-top:1px solid rgba(255,255,255,.16)}
.scorecard-row>div:first-child{background:rgba(5,62,116,.42);border-right:1px solid #1686e8}.scorecard-row>div:last-child{background:rgba(112,24,24,.42)}
@media(max-width:900px){#scoreCard{width:150px}.scorecard-team{font-size:10px;padding:4px 3px}.scorecard-row>div{height:18px;font-size:11px}}
@media(max-width:600px){#scoreCard{left:6px;top:8px;width:145px}.scorecard-team{font-size:9px;padding:4px 2px}.scorecard-row>div{height:17px;font-size:10px}}

/* V0.045 administrator login history */
.history-page{max-width:1180px;margin:0 auto;padding:28px 24px}.history-head{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:18px}.history-head h2{margin:0 0 5px}.history-head p{margin:0;opacity:.8}.history-table-wrap{overflow:auto;border:1px solid rgba(255,255,255,.18);border-radius:14px;background:rgba(0,0,0,.12)}.history-table{width:100%;border-collapse:collapse;min-width:650px}.history-table th,.history-table td{padding:14px 16px;text-align:left;border-bottom:1px solid rgba(255,255,255,.12)}.history-table th{background:rgba(0,0,0,.2);font-weight:800}.history-table tr:last-child td{border-bottom:0}@media(max-width:700px){.history-page{padding:18px 12px}.history-head{align-items:flex-start;flex-direction:column}.history-table th,.history-table td{padding:11px 12px}}

.admin-end-button{background:#b91c1c!important;border-color:#ef4444!important;color:#fff!important}

/* V0.059 DESIGN ONLY — new SALA presentation. No game/lobby logic changed. */
body.lobby-page{background:#063f34;color:#f8f2df;min-height:100vh;background-image:radial-gradient(circle at 46% 36%,rgba(26,122,91,.24),transparent 34%),linear-gradient(135deg,#073f34 0%,#052f28 100%)}
body.lobby-page>header{height:76px;padding:0 30px;gap:30px;background:rgba(10,31,26,.96);border-bottom:1px solid rgba(220,188,112,.35);box-shadow:0 5px 24px #001d1766}
body.lobby-page>header .brand{font-size:21px;letter-spacing:1.8px;color:#fff;font-weight:900;margin-right:14px}
body.lobby-page>header .button-link{padding:11px 19px;border-radius:12px;background:#efe2bd;box-shadow:inset 0 1px 0 #fff8,0 4px 12px #0003;transition:.15s}
body.lobby-page>header .button-link:hover{transform:translateY(-1px);filter:brightness(1.04)}
body.lobby-page .lobby{min-height:calc(100vh - 76px);background:transparent;grid-template-columns:minmax(650px,1fr) 320px;gap:22px;padding:22px 28px 28px;max-width:1500px;margin:0 auto}
body.lobby-page .lobby-main{position:relative;min-height:760px;padding:18px 24px 26px;border:1px solid rgba(233,218,177,.18);border-radius:20px;background:linear-gradient(145deg,rgba(8,79,63,.76),rgba(4,57,47,.72));box-shadow:inset 0 1px 0 #ffffff0e,0 18px 40px #001b1640;overflow:hidden}
body.lobby-page .lobby-main:before,body.lobby-page .lobby-main:after{content:"";position:absolute;width:170px;height:82px;border:14px solid rgba(239,229,199,.035);border-radius:14px;transform:rotate(-27deg);pointer-events:none}
body.lobby-page .lobby-main:before{left:-70px;top:150px}body.lobby-page .lobby-main:after{right:-75px;bottom:80px;transform:rotate(24deg)}
.lobby-welcome{text-align:center;position:relative;z-index:2;margin:2px 0 12px}.welcome-kicker{font-size:11px;letter-spacing:4px;color:#d7bd78;font-weight:800;margin-bottom:6px}.lobby-welcome h1{margin:0;font-size:clamp(30px,3vw,46px);letter-spacing:.5px;color:#fff;font-family:Georgia,'Times New Roman',serif;text-shadow:0 3px 12px #001b15}.lobby-welcome h1 span{color:#e1bd62}.lobby-welcome p{margin:6px 0 0;color:#f3e8ca;font-size:18px;font-style:italic}.lobby-welcome p:after{content:"";display:block;width:82px;height:2px;background:#c9a750;margin:10px auto 0}.mesa-title{display:none}
body.lobby-page .lobby aside{gap:16px;position:relative;z-index:2}body.lobby-page .lobby aside>div{padding:17px 18px;background:linear-gradient(180deg,rgba(9,75,61,.94),rgba(5,57,47,.94));border:1px solid rgba(231,213,166,.22);border-radius:16px;box-shadow:0 12px 30px #001b1635}body.lobby-page .lobby aside h3{margin:0 0 13px;color:#f8efd6;font-size:17px}.online .dot{box-shadow:0 0 8px #56e37c88}.bot-always{border-bottom-color:rgba(225,189,98,.22)}body.lobby-page .chat #chatList{height:300px;background:rgba(1,35,29,.78);border:1px solid #ffffff0d}body.lobby-page .chat input{background:#f7f2e6;color:#1a2923}
/* Square table used on the welcome state. */
.welcome-table-shell{display:grid;place-items:center;min-height:560px;padding:20px}.welcome-table{position:relative;width:min(430px,72vw);aspect-ratio:1/1;border-radius:18px;background:radial-gradient(circle at 48% 42%,#14725b 0,#0b5b49 55%,#084839 100%);border:18px solid #744923;box-shadow:inset 0 0 0 5px #b98243,inset 0 0 35px #002c22aa,0 20px 35px #001d1777,0 0 0 2px #3b2415}.welcome-table:before,.welcome-table:after{content:"";position:absolute;inset:-9px;border:2px solid rgba(232,190,106,.34);border-radius:10px;pointer-events:none}.welcome-table:after{inset:10px;border-color:rgba(255,255,255,.08)}.table-domino-pair{position:absolute;z-index:5;left:50%;top:42%;transform:translate(-50%,-50%);width:145px;height:70px;filter:drop-shadow(4px 7px 7px #00261e88)}
.decor-domino{position:absolute;width:86px;height:42px;border:3px solid #302c25;border-radius:7px;background:#f4edd9;display:flex;overflow:hidden;box-shadow:inset 0 0 0 1px #fff8}.decor-domino-43{left:4px;top:16px;transform:rotate(-8deg)}.decor-domino-52{right:2px;top:4px;transform:rotate(8deg)}.decor-half{position:relative;width:50%;height:100%}.decor-half:first-child{border-right:2px solid #35322c}.decor-half i{position:absolute;width:7px;height:7px;border-radius:50%;background:#25241f;transform:translate(-50%,-50%)}
.decor-half.p2 i:nth-child(1){left:28%;top:28%}.decor-half.p2 i:nth-child(2){left:72%;top:72%}
.decor-half.p3 i:nth-child(1){left:27%;top:27%}.decor-half.p3 i:nth-child(2){left:50%;top:50%}.decor-half.p3 i:nth-child(3){left:73%;top:73%}
.decor-half.p4 i:nth-child(1){left:28%;top:28%}.decor-half.p4 i:nth-child(2){left:72%;top:28%}.decor-half.p4 i:nth-child(3){left:28%;top:72%}.decor-half.p4 i:nth-child(4){left:72%;top:72%}
.decor-half.p5 i:nth-child(1){left:28%;top:25%}.decor-half.p5 i:nth-child(2){left:72%;top:25%}.decor-half.p5 i:nth-child(3){left:50%;top:50%}.decor-half.p5 i:nth-child(4){left:28%;top:75%}.decor-half.p5 i:nth-child(5){left:72%;top:75%}
.new-table-form{position:absolute;z-index:6;left:50%;top:63%;transform:translate(-50%,-50%);margin:0}.new-table-form button{min-width:230px;padding:13px 20px 11px;border-radius:13px;background:linear-gradient(#f1dfad,#d8b96d);color:#173026;box-shadow:0 7px 16px #00251d99,inset 0 1px 0 #fff9;font-size:16px;letter-spacing:.5px}.new-table-form button b{font-size:21px;margin-right:5px}.new-table-form button small{display:block;font-size:10px;font-weight:600;opacity:.72;margin-top:2px;letter-spacing:.2px}.welcome-table .empty{position:absolute;left:50%;top:62%;transform:translate(-50%,-50%);white-space:nowrap;color:#eadfbd}
/* Existing live table: keep all functional controls, present them as a square club table. */
body.lobby-page .seat-grid{width:min(560px,78%);height:auto;aspect-ratio:1/1;margin:20px auto 24px;border-radius:16px;background:radial-gradient(circle at 50% 45%,#126b56,#084b3d 72%);border:16px solid #704620;box-shadow:inset 0 0 0 4px #b27a3e,inset 0 0 30px #002c22aa,0 20px 35px #001d1766;position:relative}body.lobby-page .seat{background:rgba(5,49,40,.94);border:1px solid rgba(231,213,166,.2);box-shadow:0 6px 15px #001e1888;min-width:145px;z-index:3}body.lobby-page .seat0{bottom:-5px}body.lobby-page .seat2{top:-5px}body.lobby-page .seat1{left:-5px}body.lobby-page .seat3{right:-5px}body.lobby-page .seat b{color:#f0dca6}.status{text-align:center;color:#eadfbd;font-weight:700;margin:4px 0}.host-table-controls{justify-content:center}.host-table-controls button{box-shadow:0 4px 10px #001c1666}.active-match-banner{justify-content:center;background:rgba(3,42,34,.75);border-color:rgba(225,189,98,.35)}
@media(max-width:1000px){body.lobby-page .lobby{grid-template-columns:1fr;padding:16px}.lobby-page .lobby-main{min-height:680px}.lobby-page .lobby aside{grid-row:2;grid-template-columns:1fr 1fr}.welcome-table-shell{min-height:500px}}
@media(max-width:650px){body.lobby-page>header{height:auto;min-height:64px;padding:10px 12px;gap:8px;flex-wrap:wrap}body.lobby-page>header .brand{width:100%;font-size:16px}.lobby-welcome h1{font-size:28px}.lobby-welcome p{font-size:16px}body.lobby-page .lobby{padding:10px;display:block}.lobby-page .lobby-main{min-height:600px;padding:14px 10px}.welcome-table-shell{min-height:440px;padding:8px}.welcome-table{width:min(350px,78vw);border-width:12px}.new-table-form button{min-width:190px}.lobby-page .lobby aside{display:grid;grid-template-columns:1fr;margin-top:12px}body.lobby-page .seat-grid{width:82%;border-width:10px}.invite-controls{min-width:160px}.invite-controls select{max-width:180px}}

/* V0.062 DESIGN ONLY — active table fits one desktop screen; seats live on the four table edges. */
@media (min-width:1001px){
  body.lobby-page{overflow:hidden}
  body.lobby-page>header{height:68px;padding:0 28px}
  body.lobby-page .lobby{height:calc(100vh - 68px);min-height:0;box-sizing:border-box;padding:14px 24px 16px;gap:20px;grid-template-columns:minmax(760px,1fr) 308px;overflow:hidden}
  body.lobby-page .lobby-main{height:100%;min-height:0;box-sizing:border-box;padding:10px 22px 12px;overflow:hidden}
  body.lobby-page .lobby-welcome{margin:0 0 4px}
  body.lobby-page .welcome-kicker{margin-bottom:2px;font-size:9px}
  body.lobby-page .lobby-welcome h1{font-size:clamp(28px,2.45vw,38px);line-height:1.03}
  body.lobby-page .lobby-welcome p{font-size:15px;margin-top:3px}
  body.lobby-page .lobby-welcome p:after{margin-top:6px;width:64px}
  body.lobby-page .status{margin:2px 0 0;font-size:14px;line-height:1.1}

  /* Keep the square table compact enough that every action remains visible. */
  body.lobby-page .seat-grid{width:min(470px,48vw);height:auto;aspect-ratio:1/1;margin:14px auto 12px;border-width:14px;overflow:visible}
  body.lobby-page .seat{box-sizing:border-box;padding:9px 10px;min-width:0;width:238px;border-radius:12px}
  body.lobby-page .seat span{margin:4px 0 6px}
  body.lobby-page .seat b{display:block;line-height:1.05}

  /* Each control panel straddles the edge where that player actually sits. */
  body.lobby-page .seat2{top:0;left:50%;right:auto;bottom:auto;transform:translate(-50%,-38%)}
  body.lobby-page .seat0{bottom:0;left:50%;right:auto;top:auto;transform:translate(-50%,38%);width:150px}
  body.lobby-page .seat1{left:0;top:50%;right:auto;bottom:auto;transform:translate(-54%,-50%)}
  body.lobby-page .seat3{right:0;top:50%;left:auto;bottom:auto;transform:translate(54%,-50%)}

  body.lobby-page .invite-controls{min-width:0;width:100%;gap:4px;margin-top:5px}
  body.lobby-page .invite-controls .native-host-form:first-child{display:grid;grid-template-columns:1fr auto;gap:5px;align-items:center}
  body.lobby-page .invite-controls select{width:100%;min-width:0;max-width:none;padding:6px 7px;font-size:11px}
  body.lobby-page .invite-controls button{padding:6px 8px;font-size:10px;white-space:nowrap}
  body.lobby-page .invite-status{display:none}
  body.lobby-page .bot-controls{display:grid;grid-template-columns:1fr auto;gap:5px;margin-top:1px}
  body.lobby-page .bot-controls select{width:100%;min-width:0;font-size:11px;padding:6px 7px}

  /* Actions sit immediately under the table instead of extending the page. */
  body.lobby-page .host-table-controls{margin:5px 0 4px;gap:10px}
  body.lobby-page .host-table-controls button{min-width:138px;padding:8px 12px;font-size:11px}
  body.lobby-page #hostStartGame{text-align:center;margin:2px 0}
  body.lobby-page #hostStartGame .big{margin-top:2px;font-size:14px;padding:9px 18px}
  body.lobby-page .admin-recovery{margin:6px 0 0;padding:7px 10px;min-height:0;font-size:12px}
  body.lobby-page .admin-recovery button{padding:7px 10px;font-size:11px}
  body.lobby-page .active-match-banner{margin:5px 0 8px;padding:8px 12px}

  body.lobby-page .lobby aside{height:100%;min-height:0;grid-template-rows:auto minmax(0,1fr);gap:12px}
  body.lobby-page .lobby aside>div{padding:13px 15px}
  body.lobby-page .lobby aside h3{margin-bottom:8px}
  body.lobby-page .chat{min-height:0;display:flex;flex-direction:column}
  body.lobby-page .chat #chatList{height:auto;min-height:0;flex:1}
}

/* Short desktop/laptop screens get a slightly smaller square, still without vertical scrolling. */
@media (min-width:1001px) and (max-height:820px){
  body.lobby-page>header{height:60px}
  body.lobby-page .lobby{height:calc(100vh - 60px);padding-top:9px;padding-bottom:9px}
  body.lobby-page .lobby-welcome h1{font-size:30px}
  body.lobby-page .lobby-welcome p{font-size:13px}
  body.lobby-page .welcome-kicker{display:none}
  body.lobby-page .seat-grid{width:min(410px,43vw);margin-top:10px;margin-bottom:8px;border-width:12px}
  body.lobby-page .seat{width:225px;padding:7px 8px}
  body.lobby-page .seat0{width:140px}
  body.lobby-page .seat span{font-size:12px;margin:3px 0}
  body.lobby-page .host-table-controls{margin:3px 0}
  body.lobby-page .admin-recovery{margin-top:4px}
}

/* V0.063 - admin-only lobby chat clear control */
body.lobby-page .chat .chat-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:13px}body.lobby-page .chat .chat-head h3{margin:0}body.lobby-page .chat .admin-clear-chat{background:#9f2d2d;color:#fff;border:1px solid #c65b5b;border-radius:8px;padding:6px 10px;font-size:11px;font-weight:900;letter-spacing:.3px;white-space:nowrap}body.lobby-page .chat .admin-clear-chat:hover{background:#b63838}body.lobby-page .chat .admin-clear-chat:disabled{opacity:.55;cursor:wait}

/* V0.064 - force admin clear-chat control to top-right of chat header */
body.lobby-page .chat .chat-head{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:10px!important;margin-bottom:8px!important;width:100%!important}
body.lobby-page .chat .chat-head h3{margin:0!important}
body.lobby-page .chat .admin-clear-chat{margin-left:auto!important;position:static!important;background:#9f2d2d!important;color:#fff!important;border:1px solid #c65b5b!important;border-radius:8px!important;padding:6px 10px!important;font-size:11px!important;font-weight:900!important;white-space:nowrap!important}


/* V0.065 DESIGN ONLY — wider, clearer creator seat controls with raised 3D edges. */
@media (min-width: 651px){
  body.lobby-page .seat:not(.seat0){
    width:310px;
    padding:12px 14px 13px;
    border:2px solid rgba(232,211,153,.34);
    border-top-color:rgba(255,240,194,.56);
    border-left-color:rgba(255,240,194,.44);
    border-right-color:rgba(0,25,20,.70);
    border-bottom-color:rgba(0,25,20,.78);
    border-radius:15px;
    box-shadow:
      inset 1px 1px 0 rgba(255,255,255,.08),
      inset -2px -2px 0 rgba(0,0,0,.20),
      0 5px 0 rgba(2,38,31,.72),
      0 10px 20px rgba(0,22,17,.42);
  }
  body.lobby-page .seat:not(.seat0) b{font-size:17px;text-shadow:0 1px 0 #0008}
  body.lobby-page .seat:not(.seat0) .seat-name{font-size:14px}
  body.lobby-page .invite-controls{gap:7px;margin-top:7px}
  body.lobby-page .invite-controls .native-host-form:first-child,
  body.lobby-page .bot-controls{
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
  }
  body.lobby-page .invite-controls select,
  body.lobby-page .bot-controls select{
    font-size:13px;
    padding:8px 9px;
    border:1px solid rgba(0,0,0,.22);
    box-shadow:inset 0 1px 2px rgba(0,0,0,.12),0 1px 0 rgba(255,255,255,.18);
  }
  body.lobby-page .invite-controls button{
    font-size:12px;
    padding:8px 11px;
    border:1px solid #d8c89c;
    border-top-color:#fff5d7;
    border-left-color:#fff5d7;
    border-right-color:#9f8d5d;
    border-bottom-color:#8d7b4e;
    box-shadow:0 3px 0 #8e7d51,0 5px 8px #001b1655;
    transform:translateY(-1px);
  }
  body.lobby-page .invite-controls button:active{transform:translateY(2px);box-shadow:0 1px 0 #8e7d51}
  body.lobby-page .seat1{transform:translate(-58%,-50%)}
  body.lobby-page .seat3{transform:translate(58%,-50%)}
}

/* V0.066 DESIGN ONLY — matching raised 3D edge on the three main SALA panels. */
body.lobby-page .lobby-main,
body.lobby-page .lobby aside > .online,
body.lobby-page .lobby aside > .chat{
  border:2px solid rgba(214,191,126,.42) !important;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.075),
    inset -3px -3px 0 rgba(0,27,21,.42),
    0 2px 0 rgba(1,25,20,.95),
    0 10px 22px rgba(0,24,19,.30) !important;
}
body.lobby-page .lobby-main{
  border-radius:22px !important;
}
body.lobby-page .lobby aside > .online,
body.lobby-page .lobby aside > .chat{
  border-radius:18px !important;
}

/* V0.067 DESIGN ONLY — lower table actions, black button edges, and 3D edge for the creator seat. */
@media (min-width:651px){
  /* Bottom creator seat (Tú / name) now matches the raised 3D treatment of the other seats. */
  body.lobby-page .seat0{
    border:2px solid rgba(232,211,153,.34) !important;
    border-top-color:rgba(255,240,194,.56) !important;
    border-left-color:rgba(255,240,194,.44) !important;
    border-right-color:rgba(0,25,20,.78) !important;
    border-bottom-color:rgba(0,25,20,.88) !important;
    border-radius:15px !important;
    box-shadow:
      inset 1px 1px 0 rgba(255,255,255,.08),
      inset -2px -2px 0 rgba(0,0,0,.22),
      0 5px 0 rgba(2,38,31,.78),
      0 10px 20px rgba(0,22,17,.42) !important;
    padding:9px 14px 10px !important;
  }
  body.lobby-page .seat0 b{font-size:17px;text-shadow:0 1px 0 #0008}

  /* Leave breathing room below the player's seat before the creator actions. */
  body.lobby-page .host-table-controls{
    margin-top:30px !important;
    margin-bottom:10px !important;
  }
  body.lobby-page .host-table-controls button,
  body.lobby-page .host-table-controls .button-link{
    border:3px solid #151b18 !important;
    border-radius:12px !important;
    box-shadow:0 4px 0 #0b100e,0 7px 12px rgba(0,0,0,.30) !important;
  }

  /* Start button gets its own lower row and the same strong black edge. */
  body.lobby-page #hostStartGame{
    margin:12px 0 0 !important;
  }
  body.lobby-page #hostStartGame .big{
    border:3px solid #151b18 !important;
    border-radius:12px !important;
    box-shadow:0 4px 0 #0b100e,0 7px 12px rgba(0,0,0,.30) !important;
  }

  /* Administrator close/reset strip sits lower and its action has a black edge too. */
  body.lobby-page .admin-recovery{
    margin-top:18px !important;
    border:2px solid rgba(225,189,98,.72) !important;
    box-shadow:inset 1px 1px 0 rgba(255,255,255,.05),inset -2px -2px 0 rgba(0,0,0,.18) !important;
  }
  body.lobby-page .admin-recovery button{
    border:3px solid #151b18 !important;
    border-radius:11px !important;
    box-shadow:0 4px 0 #0b100e,0 7px 12px rgba(0,0,0,.28) !important;
  }
}

/* Preserve the one-screen laptop layout while keeping visible separation. */
@media (min-width:1001px) and (max-height:820px){
  body.lobby-page .host-table-controls{margin-top:24px !important;margin-bottom:6px !important}
  body.lobby-page #hostStartGame{margin-top:8px !important}
  body.lobby-page .admin-recovery{margin-top:12px !important}
}

/* V0.069 custom 48x48 mood artwork */
.mood.mood-image{width:48px;height:48px;min-width:48px;display:inline-flex;align-items:center;justify-content:center}
.mood.mood-image img{display:block;width:48px;height:48px;object-fit:contain;background:transparent;filter:drop-shadow(0 2px 2px #000)}

/* V0.074 — Modo Aprendizaje: ownership colors are visual only; game logic is unchanged. */
.learning-mode-button{white-space:nowrap;border:2px solid #d7bd72;background:#183e34;color:#f4ead0;font-weight:900;border-radius:10px;padding:7px 10px;box-shadow:inset 1px 1px 0 #ffffff18,0 2px 0 #061b16;cursor:pointer}
.learning-mode-button.on{background:#d7bd72;color:#102e27;border-color:#fff0b5;box-shadow:0 0 0 2px #17201d,0 0 14px #e8c96666}
.learning-mode-button:disabled{opacity:.72;cursor:default}
/* Fixed seat colors: seat 0 blue, seat 1 red, seat 2 gold, seat 3 purple. */
.tile.learning-tile.seat-color-0{background:linear-gradient(145deg,#dcecff 0,#8fc3ff 72%,#5e9fe9 100%);box-shadow:inset 0 0 0 2px #f5fbff,inset 0 0 0 4px #5f9fdf,2px 4px 5px rgba(0,0,0,.45)}
.tile.learning-tile.seat-color-1{background:linear-gradient(145deg,#ffe0e0 0,#ff9b9b 72%,#df6666 100%);box-shadow:inset 0 0 0 2px #fff8f8,inset 0 0 0 4px #d85f5f,2px 4px 5px rgba(0,0,0,.45)}
.tile.learning-tile.seat-color-2{background:linear-gradient(145deg,#fff5c9 0,#f2d66f 72%,#c9a83f 100%);box-shadow:inset 0 0 0 2px #fffdf0,inset 0 0 0 4px #c6a43b,2px 4px 5px rgba(0,0,0,.45)}
.tile.learning-tile.seat-color-3{background:linear-gradient(145deg,#f0e2ff 0,#c49aee 72%,#9564c7 100%);box-shadow:inset 0 0 0 2px #fcf7ff,inset 0 0 0 4px #8f5fc0,2px 4px 5px rgba(0,0,0,.45)}
.back.learning-back.seat-color-0{background:linear-gradient(135deg,#9bc9ff,#4f93df);box-shadow:inset 0 0 0 2px #dceeff,1px 2px 2px #001c15}
.back.learning-back.seat-color-1{background:linear-gradient(135deg,#ffaaaa,#d95d5d);box-shadow:inset 0 0 0 2px #ffe1e1,1px 2px 2px #001c15}
.back.learning-back.seat-color-2{background:linear-gradient(135deg,#f5dd78,#c3a13b);box-shadow:inset 0 0 0 2px #fff3b6,1px 2px 2px #001c15}
.back.learning-back.seat-color-3{background:linear-gradient(135deg,#caa4ef,#8f5ec1);box-shadow:inset 0 0 0 2px #ead8fb,1px 2px 2px #001c15}
/* V0.082: connection banner + error toast */
.net-banner{position:fixed;top:8px;left:50%;transform:translateX(-50%);z-index:200;background:#7a1f1f;color:#fff;font-weight:800;font-size:13px;letter-spacing:.5px;padding:6px 14px;border-radius:999px;box-shadow:0 3px 10px #0007;pointer-events:none}
.net-toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:200;background:#1d2a25;color:#fff;border:1px solid #d7bd72;font-weight:700;font-size:14px;padding:10px 16px;border-radius:10px;box-shadow:0 4px 14px #0008;max-width:90vw;text-align:center}
.net-banner[hidden],.net-toast[hidden]{display:none}

/* V0.084: small on-screen version label (bottom-right, faint, never clickable). */
.app-version{position:fixed;right:6px;bottom:4px;z-index:1;font:600 10px/1 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;letter-spacing:.04em;color:rgba(255,255,255,.38);pointer-events:none;user-select:none;-webkit-user-select:none}
/* Lobby: the chat panel reaches the bottom corner and the phone lobby scrolls, so the label sits in the empty top-right corner of the header instead. */
body.lobby-page .app-version{position:absolute;top:5px;bottom:auto;right:8px}

/* ======================================================================
   V0.085 PHONE GAME LAYOUT. Every rule below is scoped to html.phone-ui,
   which game.php sets only on phone-sized screens (landscape height <= 500px,
   or portrait width <= 500px). Desktop and tablet are not affected.
   ====================================================================== */
.phone-only{display:none}
html.phone-ui{--sl:env(safe-area-inset-left,0px);--sr:env(safe-area-inset-right,0px);--st:env(safe-area-inset-top,0px);--sb:env(safe-area-inset-bottom,0px);
  --hh:min(calc(var(--app-h,100vh) * .19),82px);--side:62px;--top:54px;--msg:24px}
html.phone-ui{--hw:calc(var(--hh) * .51)}
html.phone-portrait{--hw:min(46px,calc((100vw - var(--sl) - var(--sr) - 114px) / 7),calc(var(--app-h,100vh) * .066));--hh:calc(var(--hw) * 1.95);--side:54px;--top:132px;--msg:56px}
/* V0.087: the page is pinned to the area the player can really see (--app-h is set from
   visualViewport by game.php/game.js) and painted felt-green edge to edge, so no dark band can show. */
html.phone-ui,html.phone-ui body{background:#063c31;overflow:hidden;overscroll-behavior:none}
html.phone-ui body{position:fixed;left:0;top:0;width:100%;height:100vh;height:100dvh;height:var(--app-h,100dvh);touch-action:manipulation}
html.phone-ui #app{position:absolute;left:0;top:0;width:100%;height:100%}
html.phone-ui #table{min-height:0;height:100%}
/* header bar -> hidden; its buttons live in the ⚙ menu */
html.phone-ui #app>header{display:none}
html.phone-ui.menu-open #app>header{display:flex;position:fixed;z-index:95;top:auto;left:auto;bottom:calc(var(--sb) + 52px);right:calc(var(--sr) + 6px);width:min(250px,calc(100vw - 24px));height:auto;max-height:calc(var(--app-h,100vh) - var(--sb) - var(--st) - 110px);overflow:auto;flex-direction:column;align-items:stretch;gap:8px;padding:12px;background:rgba(15,34,28,.97);border:1px solid rgba(233,218,177,.35);border-radius:14px;box-shadow:0 12px 30px #000a}
html.phone-ui.menu-open #app>header .brand{font-size:12px;letter-spacing:1.4px;text-align:center;opacity:.85}
html.phone-ui.menu-open #app>header #score{display:none}
html.phone-ui.menu-open #app>header button,html.phone-ui.menu-open #app>header .button-link{width:100%;margin:0;font-size:13px;padding:10px 12px;text-align:center;white-space:normal}
html.phone-ui #scoreCard{display:none}
html.phone-ui.menu-open #scoreCard:not([hidden]){display:block;position:fixed;z-index:95;top:calc(var(--st) + 6px);left:calc(var(--sl) + 6px);bottom:auto;right:auto;width:150px}
html.phone-portrait.menu-open #scoreCard:not([hidden]){top:calc(var(--st) + 92px);left:calc(var(--sl) + 6px)}
#phoneMenuBtn{position:fixed;z-index:96;width:40px;height:40px;border-radius:11px;border:2px solid #1d2a25;background:linear-gradient(#f4f1e8,#cfcabb);color:#23302b;font-size:22px;line-height:1;padding:0;align-items:center;justify-content:center;box-shadow:0 3px 8px #0007;cursor:pointer}
/* V0.088: bottom-right, for the right thumb. Desktop never shows this button. */
html.phone-ui #phoneMenuBtn{display:flex;top:auto;left:auto;bottom:calc(var(--sb) + 6px);right:calc(var(--sr) + 6px)}
/* score box (reference style: purple, two stacked rows, goal underneath) */
#phoneScore{position:fixed;z-index:60;top:calc(var(--st) + 4px);right:calc(var(--sr) + 6px);width:140px;pointer-events:none}
html.phone-ui #phoneScore{display:block}
html.phone-portrait #phoneScore{width:126px}
#phoneScore .ps-box{border:2px solid #d9ccff;border-radius:10px;overflow:hidden;box-shadow:0 3px 10px #0007}
#phoneScore .ps-row{display:flex;align-items:center;justify-content:space-between;gap:6px;height:22px;padding:0 9px;color:#fff;font-size:16px;line-height:1}
#phoneScore .ps-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-weight:600}
#phoneScore .ps-row b{font-size:18px;font-weight:800}
#phoneScore .ps-row-a{background:#4b2483}#phoneScore .ps-row-b{background:#6a3fb0;border-top:1px solid #9b7fe0}
/* portrait hint */
#rotateHint{position:fixed;z-index:61;left:50%;transform:translateX(-50%);top:calc(var(--st) + 92px);align-items:center;gap:8px;padding:5px 6px 5px 12px;border-radius:999px;background:rgba(10,30,25,.9);border:1px solid rgba(255,255,255,.3);font-size:12px;font-weight:700;white-space:nowrap;box-shadow:0 3px 10px #0006}
html.phone-portrait #rotateHint:not([hidden]){display:flex}
#rotateHint button{width:24px;height:24px;border-radius:50%;padding:0;border:0;background:#efe5c7;color:#172019;font-weight:900;font-size:15px;line-height:24px}
/* chat hidden on phones (the chat poll keeps running, nothing changes server-side) */
html.phone-ui #gameChat{display:none!important}
/* opponents: tile backs only */
html.phone-ui .player{gap:4px;font-size:11px;z-index:20}
html.phone-ui .player .name{font-size:10px;max-width:58px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:rgba(0,0,0,.28);padding:2px 6px;border-radius:7px}
html.phone-ui .mood{min-width:0;font-size:24px}
html.phone-ui .player .mood:empty,html.phone-ui .human-name .mood:empty{display:none}
html.phone-ui .mood.mood-image,html.phone-ui .mood.mood-image img{width:26px;height:26px;min-width:26px}
html.phone-ui .player.top{top:calc(var(--st) + 5px);left:50%;transform:translateX(-50%);flex-direction:row;align-items:center}
html.phone-portrait .player.top{top:calc(var(--st) + 56px)}
html.phone-ui .player.left,html.phone-ui .player.right{top:50%;transform:translateY(-58%);flex-direction:column;align-items:center;width:calc(var(--side) - 8px)}
html.phone-ui .player.left{left:calc(var(--sl) + 4px)}html.phone-ui .player.right{right:calc(var(--sr) + 4px)}
html.phone-ui .player.left .backs,html.phone-ui .player.right .backs{order:1}
html.phone-ui .player.left .mood,html.phone-ui .player.right .mood{order:2}
html.phone-ui .player.left .name,html.phone-ui .player.right .name{order:3;max-width:100%}
html.phone-ui .back{width:13px;height:24px;border-width:1.5px;border-radius:3px}
html.phone-ui .vertical .back{width:24px;height:12px}
html.phone-portrait .back{width:12px;height:22px}html.phone-portrait .vertical .back{width:22px;height:11px}
html.phone-ui .backs{gap:2px}
/* revealed hands at the end of a hand: small real tiles */
html.phone-ui .reveal-tile{transform:none!important;margin:0!important;border-width:1px!important;border-radius:3px!important;box-shadow:none!important}
html.phone-ui .player .reveal-tile.vertical{width:17px!important;height:34px!important}
html.phone-ui .player .reveal-tile.horizontal{width:34px!important;height:17px!important}
html.phone-ui .player .reveal-tile .pip{width:3.5px;height:3.5px}
html.phone-ui .player .reveal-tile .half:first-child{border-width:1px}
html.phone-ui .player .backs:has(.reveal-tile){gap:2px;max-height:none;flex-wrap:nowrap}
/* board area: everything between the side players, the top row and the hand */
html.phone-ui #boardWrap{position:absolute;display:block;left:calc(var(--sl) + var(--side));right:calc(var(--sr) + var(--side));top:calc(var(--st) + var(--top));bottom:calc(var(--sb) + var(--hh) + 22px + var(--msg));height:auto!important;width:auto}
html.phone-landscape #boardWrap{left:calc(var(--sl) + var(--side) + 4px);right:calc(var(--sr) + var(--side) + 4px)}
html.phone-ui #chain{width:100%;height:100%}
html.phone-ui #chain .board-tile{border-width:var(--tb,2px);border-radius:var(--tr,5px);box-shadow:inset 0 0 0 1px #fff,0 1px 2px rgba(0,0,0,.5)}
html.phone-ui #chain .pip{width:var(--pip,6px);height:var(--pip,6px)}
html.phone-ui #chain .half:first-child{border-width:max(1px,calc(var(--tb,2px) * .7))}
/* white tiles with black pips (learning-mode colours still win) */
html.phone-ui .tile:not(.learning-tile){background:linear-gradient(160deg,#fff 0,#f6f6f1 62%,#dedcd2 100%)}
html.phone-ui .tile{border-color:#262626}
html.phone-ui .pip{background:#0d0d0d}
html.phone-ui .end-choice.phone-end-choice{padding:0;border-radius:6px;border:2px dashed #fff6cf;background:rgba(255,241,168,.88);color:#17241f;font-weight:900;box-shadow:0 0 10px #fff6;line-height:1;white-space:nowrap}
/* own hand: big tiles on a small wooden tray, bottom centre */
html.phone-ui #human{bottom:calc(var(--sb) + 4px);left:calc(var(--sl) + 4px);right:calc(var(--sr) + 52px);width:max-content;max-width:100%;margin-left:auto;margin-right:auto;transform:none;gap:0;z-index:30}
html.phone-ui #hand{position:relative;z-index:0;gap:5px;min-height:0;padding:4px 12px 9px;align-items:flex-end}
html.phone-ui #hand::after{content:"";position:absolute;z-index:-1;left:0;right:0;bottom:0;height:calc(var(--hh) * .42);border-radius:10px;background:linear-gradient(#c4864a,#8f5526 70%,#6e3f1a);box-shadow:inset 0 2px 0 #e6b07c,0 4px 10px #0008}
html.phone-ui #hand:empty::after{display:none}
html.phone-ui #hand .tile.vertical,html.phone-ui #hand .tile{width:var(--hw);height:var(--hh);border-width:2px;border-radius:6px;box-shadow:inset 0 0 0 1px #fff,0 3px 4px rgba(0,0,0,.5)}
html.phone-ui #hand .pip{width:calc(var(--hw) * .19);height:calc(var(--hw) * .19)}
html.phone-ui #hand .half:first-child{border-bottom-width:1.5px}
html.phone-ui #hand .tile.playable{box-shadow:inset 0 0 0 1px #fff,0 0 0 2px #ffe27a,0 3px 6px rgba(0,0,0,.5)}
html.phone-ui .hand-tile.selected{transform:translateY(-10px)!important;outline-width:2px}
html.phone-ui .human-name{position:absolute;left:auto;right:100%;bottom:6px;margin-left:0;margin-right:12px;white-space:nowrap;font-size:12px;gap:4px;flex-direction:column;align-items:center}
html.phone-ui .human-name .name{background:rgba(0,0,0,.28);padding:2px 6px;border-radius:7px;max-width:90px;overflow:hidden;text-overflow:ellipsis}
html.phone-portrait .human-name{left:50%;right:auto;bottom:100%;margin:0 0 4px;transform:translateX(-50%);flex-direction:row}
html.phone-ui #human.spectator-view .human-name::before{content:'👁 ';}
html.phone-ui #human.spectator-view #hand{min-height:0;padding:6px 12px 8px}
html.phone-ui #human.spectator-view #hand .spectator-back{width:18px;height:34px}
/* messages: one line just above the tray; end-of-hand result as a box over the board */
html.phone-ui #message{top:auto;bottom:calc(var(--sb) + var(--hh) + 20px);font-size:14px;min-height:0;white-space:nowrap;z-index:40;text-align:center;line-height:1.15;pointer-events:none}
html.phone-ui #message:not(:empty){padding:3px 12px;border-radius:999px;background:rgba(0,0,0,.35)}
html.phone-portrait #message{bottom:calc(var(--sb) + var(--hh) + 44px)}
html.phone-ui #message:has(.end-sub){white-space:normal;width:max-content;max-width:min(88vw,620px);padding:5px 14px;border-radius:12px;background:rgba(6,30,24,.92);border:1px solid rgba(255,240,190,.55);font-size:14px;box-shadow:0 6px 18px #000a}
html.phone-ui #message .end-sub{display:block;font-size:11px;margin-top:2px;line-height:1.25}
html.phone-ui #startArea button{font-size:16px;padding:10px 18px}
html.phone-ui #startArea #waitingStart{font-size:13px;padding:10px 12px;max-width:80vw}
html.phone-ui .app-version{right:auto;left:calc(var(--sl) + 6px);bottom:calc(var(--sb) + 3px)}
html.phone-ui .net-banner{z-index:99}
html.phone-ui:has(#continueGame:not([hidden])) #phoneMenuBtn:not([aria-expanded="true"])::after{content:"";position:absolute;top:-4px;right:-4px;width:13px;height:13px;border-radius:50%;background:#ffcf3f;border:2px solid #17241f;box-shadow:0 0 8px #ffcf3f}
html.phone-ui #human.spectator-view .human-name::before{content:none}
html.phone-ui #phoneScore{width:auto;min-width:140px;max-width:210px}
html.phone-portrait #phoneScore{min-width:126px;max-width:170px}

/* V0.086: the board area never changes during a hand (tiles never move). The result of a hand
   is shown on one line in the strip above the tray (two lines in portrait, where the strip is taller). */
html.phone-landscape #message:has(.end-sub){white-space:nowrap;max-width:calc(100vw - 2 * var(--side) - 16px);overflow:hidden;text-overflow:ellipsis;padding:3px 12px;border-radius:999px;font-size:12px;background:rgba(6,30,24,.82)}
html.phone-landscape #message:has(.end-sub) br{display:none}
html.phone-landscape #message .end-sub{display:inline;font-size:12px;margin:0}
html.phone-landscape #message .end-sub::before{content:" · "}
html.phone-portrait #message:has(.end-sub){bottom:calc(var(--sb) + var(--hh) + 22px);background:rgba(6,30,24,.82)}
html.phone-portrait:has(#message .end-sub) .human-name{visibility:hidden}
