/* Tong-its Niglo — style (feutre vert, mobile d'abord) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #2d6a4f 0%, #1b4332 55%, #0e2a1e 100%);
  color: #f1f8f4; min-height: 100vh;
}
button { font-family: inherit; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: rgba(0,0,0,.28); position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.hdr-right { display: flex; gap: 8px; align-items: center; }
.hdr-right .iconbtn { background: rgba(255,255,255,.12); border: none; border-radius: 8px; padding: 6px 9px; font-size: 15px; color: #fff; cursor: pointer; }
.langmenu { position: relative; }
.langlist {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; z-index: 70;
  background: #14402e; border: 1px solid rgba(255,255,255,.25); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); overflow: hidden; display: flex; flex-direction: column;
}
.langlist[hidden] { display: none; }
.langlist button {
  background: none; border: none; color: #fff; text-align: left;
  padding: 10px 14px; font-size: 14px; cursor: pointer;
}
.langlist button:hover { background: rgba(255,209,102,.18); }
#hdr-user { display: flex; gap: 8px; align-items: center; font-size: 14px; }
#hdr-user[hidden] { display: none; }
.pill { background: rgba(0,0,0,.3); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.pill.gold { background: #ffd166; color: #3a2c00; font-weight: 700; }
.pill.blue { background: #4ea8de; color: #04293f; font-weight: 700; }

main { max-width: 760px; margin: 0 auto; padding: 12px 12px 40px; }

/* ---------- boutons ---------- */
.btn {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; padding: 10px 16px; font-size: 15px; cursor: pointer; transition: transform .06s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .38; cursor: default; }
.btn.primary { background: #ffd166; color: #3a2c00; font-weight: 700; border-color: #ffd166; }
.btn.danger { background: rgba(239,71,111,.25); border-color: rgba(239,71,111,.6); }
.btn.warn { background: #ef8354; color: #3a1200; font-weight: 700; border-color: #ef8354; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.take { background: #90e0ef; color: #03303c; font-weight: 700; border-color: #90e0ef; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.dim { opacity: .5; } .dim2 { opacity: .65; }
.tiny { font-size: 12px; opacity: .75; margin: 4px 0; }
.sub { opacity: .85; font-size: 14px; }
.hint { font-size: 13px; opacity: .9; }
.warn2 { color: #ffd166; font-weight: 700; }

/* ---------- login ---------- */
.login { display: flex; justify-content: center; padding-top: 6vh; }
.login-card {
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px; padding: 28px 26px; width: 100%; max-width: 380px; text-align: center;
}
.biglogo { font-size: 54px; }
.login-card h1 { margin: 6px 0 2px; font-size: 26px; }
.login-card label { display: block; text-align: left; font-size: 13px; opacity: .85; margin-top: 14px; }
.login-card input, .chatbox input {
  width: 100%; margin-top: 5px; padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.3); color: #fff; font-size: 16px; outline: none;
}
.login-card input:focus { border-color: #ffd166; }
.login-card .row { margin-top: 18px; justify-content: center; }

/* ---------- salon ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  background: rgba(0,0,0,.3); border-radius: 16px; padding: 14px 16px; }
.hello { opacity: .8; font-size: 14px; }
.ndbig { font-size: 30px; font-weight: 800; color: #ffd166; }
.ndu { font-size: 15px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: rgba(255,255,255,.08); border-radius: 12px; padding: 6px 12px; text-align: center; }
.stat b { display: block; font-size: 17px; }
.stat span { font-size: 11px; opacity: .7; }
.brokes { margin-top: 10px; }
h2 { font-size: 18px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.cardbox { background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 14px; }
.cardbox h3 { margin-top: 0; }
.list { margin: 6px 0; }
.listrow { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,.25);
  border-radius: 12px; padding: 8px 12px; margin-bottom: 6px; font-size: 14px; gap: 8px; }
.foot { margin-top: 26px; }

/* ---------- salle d'attente / tournoi ---------- */
.seats3 { display: flex; gap: 10px; flex-wrap: wrap; }
.seats3.wrap .seatbox { flex: 1 1 30%; }
.seatbox { background: rgba(0,0,0,.3); border-radius: 12px; padding: 10px 12px; font-size: 14px; min-width: 90px; text-align: center; }

/* ---------- table de jeu ---------- */
.table { user-select: none; }
.tbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.acbanner { background: rgba(255,209,102,.16); border: 1px solid rgba(255,209,102,.4); color: #ffe08a;
  border-radius: 10px; padding: 6px 12px; font-size: 13px; margin-bottom: 6px; }

.opp-row { display: flex; gap: 10px; }
.opp { flex: 1; background: rgba(0,0,0,.28); border-radius: 14px; padding: 8px 10px; border: 2px solid transparent; }
.opp.active { border-color: #ffd166; }
.opp-name { font-weight: 700; font-size: 14px; }
.opp-nd { font-size: 12px; color: #ffd166; }
.opp-cards { margin: 4px 0; }
.opp-melds { font-size: 12px; }

.center { display: flex; align-items: center; gap: 18px; justify-content: center; margin: 14px 0 6px; min-height: 110px; }
.stockpile { text-align: center; }
.turninfo { min-width: 110px; text-align: center; font-size: 14px; opacity: .9; }
.me-turn { color: #ffd166; }

.mymelds { min-height: 30px; margin: 4px 0; font-size: 13px; }
.meldrow { display: inline-block; background: rgba(0,0,0,.25); border-radius: 8px; padding: 2px 5px; margin: 2px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; min-height: 42px; align-items: center; }

/* cartes */
.card {
  width: 58px; height: 82px; background: linear-gradient(180deg, #ffffff, #eef3f0);
  border-radius: 9px; box-shadow: 0 3px 8px rgba(0,0,0,.45);
  position: relative; display: inline-block; margin: 3px; vertical-align: top;
  border: 2px solid rgba(0,0,0,.12);
}
.card .cor { position: absolute; top: 4px; left: 6px; font-weight: 800; font-size: 15px; }
.card .mid { position: absolute; bottom: 6px; right: 8px; font-size: 26px; }
.card.red { color: #c1121f; } .card.blk { color: #14281d; }
.card.grab { cursor: pointer; }
.card.sel { outline: 3px solid #ffd166; transform: translateY(-14px); }
.card.tint { border-color: #74c69d; }
.card.back2 { background: linear-gradient(135deg, #2d6a4f, #1b4332); color: #d8f3dc; display: flex; align-items: center; justify-content: center; }
.card.bigcard { width: 66px; height: 93px; }

.mini {
  display: inline-block; background: #fff; border-radius: 4px; padding: 1px 4px; margin: 1px;
  font-size: 12px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.mini.red { color: #c1121f; } .mini.blk { color: #14281d; }
.mini.back { background: linear-gradient(135deg, #2d6a4f, #1b4332); color: #d8f3dc; }

.hand { text-align: center; min-height: 110px; padding: 10px 0 4px; overflow-x: auto; white-space: nowrap; }
.hand .card { margin-left: -30px; touch-action: none; }
.hand .card:first-child { margin-left: 3px; }
.hand .card.sel, .hand .card:hover { z-index: 6; }
.hand .card.drag { z-index: 20; opacity: .92; box-shadow: 0 12px 24px rgba(0,0,0,.55); }
.mymelds { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.melds-list { flex: 1; }

.bottomline { display: flex; gap: 10px; margin-top: 10px; align-items: flex-start; }
.logbox {
  flex: 1; background: rgba(0,0,0,.3); border-radius: 12px; padding: 8px 10px;
  font-size: 12px; max-height: 120px; overflow-y: auto; opacity: .95; line-height: 1.5;
}
.chatbox { width: 220px; max-width: 45%; }
.chatmsg { background: rgba(0,0,0,.3); border-radius: 12px; padding: 6px 10px; font-size: 12px; max-height: 100px; overflow-y: auto; margin-top: 6px; }
.chatquick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chipbtn { background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 999px; padding: 4px 9px; font-size: 12px; cursor: pointer; }

/* ---------- modal / toast ---------- */
#modal-wrap {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#modal-wrap[hidden] { display: none; }
#modal {
  background: #14402e; border: 1px solid rgba(255,255,255,.2); border-radius: 20px;
  padding: 22px; max-width: 440px; width: 100%; max-height: 84vh; overflow-y: auto;
}
#modal h2 { margin-top: 0; }
.mbody .row { margin-top: 12px; }
.restab { width: 100%; border-collapse: collapse; font-size: 14px; }
.restab td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.me-row { background: rgba(255,209,102,.14); }
.pos { color: #95d5b2; font-weight: 700; } .neg { color: #ffb3c1; font-weight: 700; }
.res { text-align: center; }
.restitle { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.reswin .restitle { color: #ffd166; }
.rulestext { font-size: 14px; line-height: 1.55; text-align: left; }

#toast-wrap { position: fixed; top: 60px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 99; pointer-events: none; }
.toast { background: #ffd166; color: #3a2c00; font-weight: 700; border-radius: 999px; padding: 9px 18px; font-size: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: opacity .4s; max-width: 90%; }
.toast.terr { background: #ef476f; color: #fff; }
.toast.tok { background: #95d5b2; color: #0b2818; }
.toast.out { opacity: 0; }

.reconn { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 0; font-size: 16px; opacity: .9; }
.spin { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.25); border-top-color: #ffd166; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .card { width: 47px; height: 67px; }
  .hand .card { margin-left: -24px; }
  .hand .card:first-child { margin-left: 2px; }
  .card .cor { font-size: 12px; top: 3px; left: 4px; }
  .card .mid { font-size: 19px; bottom: 4px; right: 5px; }
  .card.bigcard { width: 52px; height: 74px; }
  .opp-row { flex-direction: row; }
  .opp-name { font-size: 12px; }
  .mini { font-size: 10px; padding: 1px 3px; }
  .ndbig { font-size: 24px; }
  .btn { padding: 9px 12px; font-size: 14px; }
  .turninfo { min-width: 80px; font-size: 12px; }
  .bottomline { flex-direction: column; }
  .chatbox { width: 100%; max-width: none; }
}

/* ---------- téléphone en paysage : toute la table sans défilement ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  header { padding: 1px 8px; }
  .logo { font-size: 12px; }
  main { padding: 2px 8px 4px; }
  h2 { font-size: 14px; margin: 6px 0 4px; }
  .tbar { margin-bottom: 2px; gap: 4px; }
  .tbar .pill { padding: 1px 7px; font-size: 10px; }
  .acbanner { padding: 1px 8px; font-size: 10px; margin-bottom: 2px; }
  .opp { padding: 2px 6px; border-radius: 8px; }
  .opp-name { font-size: 10px; }
  .opp-nd { font-size: 9px; }
  .opp-cards { margin: 1px 0; }
  .mini { font-size: 8px; padding: 0 2px; margin: 0 1px; }
  .center { margin: 2px 0 1px; min-height: 56px; gap: 10px; }
  .card { width: 44px; height: 60px; margin: 2px; }
  .card .cor { font-size: 10px; top: 2px; left: 3px; }
  .card .mid { font-size: 15px; bottom: 2px; right: 3px; }
  .card.bigcard { width: 48px; height: 66px; }
  .card.sel { transform: translateY(-8px); }
  .stockpile .tiny { font-size: 9px; }
  .turninfo { font-size: 11px; min-width: 70px; }
  .mymelds { min-height: 14px; margin: 0; font-size: 10px; }
  .meldrow { padding: 1px 3px; margin: 1px; }
  .actions { margin: 2px 0; min-height: 28px; gap: 5px; align-items: center; }
  .btn { padding: 5px 9px; font-size: 11px; border-radius: 8px; }
  .btn.small { padding: 3px 7px; font-size: 10px; }
  .hint { font-size: 10px; }
  .hand { min-height: 66px; padding: 6px 0 0; text-align: center; }
  .hand .card { margin-left: -27px; }
  .hand .card:first-child { margin-left: 2px; }
  .bottomline { margin-top: 2px; gap: 6px; }
  .logbox { font-size: 9px; max-height: 34px; padding: 3px 7px; line-height: 1.3; }
  .chatbox { width: 130px; }
}

/* ---------- mode facile ---------- */
.turnbanner {
  background: #ffd166; color: #3a2c00; font-weight: 800; text-align: center;
  padding: 8px; border-radius: 12px; margin: 6px 0; font-size: 16px;
  animation: tpulse 1.1s infinite;
}
@keyframes tpulse { 50% { box-shadow: 0 0 0 10px rgba(255,209,102,.22); transform: scale(1.015); } }
.hand .card.throwing { z-index: 30; box-shadow: 0 16px 30px rgba(0,0,0,.55); border-color: #ffd166; }
.btn.primary2 { background: #95d5b2; color: #0b2818; font-weight: 700; border-color: #95d5b2; }
