/* Remi Online — temă „cazino”: fundal bleumarin, rame aurii, masă verde, suport de lemn pe două rânduri */
:root {
  --bg-1: #0a1220;
  --bg-2: #13203a;
  --panel: #0f1828;
  --panel-2: #162338;
  --gold: #c9a45c;
  --gold-2: #e8c77b;
  --gold-dim: rgba(201, 164, 92, .45);
  --text: #f3eee4;
  --muted: #a9b3c4;
  --pos: #57d36b;
  --neg: #ff5a4f;
  --felt-1: #2a6b35;
  --felt-2: #133f1d;
  --tile: #f6f1e5;
  --tile-2: #e7e0cf;
  --tile-edge: #c2b9a4;
  --c-red: #c9141c;
  --c-yellow: #e59a0c;
  --c-blue: #1b54c0;
  --c-black: #121212;
  --accent: #3fa34d;
  --danger: #d9482b;
  --tw: 52px;              /* lățimea piesei din suport (setată din JS) */
  --th: calc(var(--tw) * 1.36);
  --mw: 32px;              /* piesă pe masă */
  --mh: calc(var(--mw) * 1.36);
  --radius: 14px;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--text); overscroll-behavior: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(60, 90, 150, .25), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--bg-2), var(--bg-1)) fixed;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
a { color: var(--gold-2); font-weight: 800; }
svg { display: block; }

/* ---------- butoane generale ---------- */
.btn {
  font: inherit; font-weight: 800; font-size: 15px; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--gold-dim); color: var(--text);
  background: linear-gradient(180deg, #22324d, #152238);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 3px 0 #070c16; transition: transform .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #4fb95c, #2b7d37); border-color: #7fd88a; color: #fff; }
.btn.warn { background: linear-gradient(180deg, #e8603f, #b3361d); border-color: #ff9a7f; color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 10px; }
.dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 2px var(--bg-1); }

/* ---------- lobby ---------- */
.screen { min-height: 100%; }
#lobby, #waiting { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.brand { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.brand h1 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: .5px; color: var(--gold-2); font-family: Georgia, 'Times New Roman', serif; }
.brand p { margin: 0; color: var(--muted); }
.logo { display: flex; gap: 3px; }
.logo .t {
  width: 34px; height: 46px; border-radius: 5px; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--tile), var(--tile-2));
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif; font-weight: 900; font-synthesis: none; font-size: 21px;
  box-shadow: 0 3px 0 var(--tile-edge), 0 6px 12px rgba(0, 0, 0, .5);
}
.logo .r { color: var(--c-red); } .logo .y { color: var(--c-blue); } .logo .b { color: var(--c-black); }
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.card h2 { margin: 0 0 12px; font-size: 18px; color: var(--gold-2); }
.lbl { display: block; font-weight: 800; margin-bottom: 6px; }
input, select {
  font: inherit; font-size: 16px; width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid rgba(201, 164, 92, .35); background: #0b1322; color: var(--text);
}
select option { color: #000; background: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 90px; font-weight: 800; font-size: 13px; color: var(--muted); }
.row > label select { margin-top: 4px; }
.row > .btn.big { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-weight: 700; }
.check input { width: auto; }
.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .04); padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .06); }
.trow .grow { flex: 1; min-width: 0; }
.trow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow small { color: var(--muted); }
.seats { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.seats li { background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 10px 12px; font-weight: 800; }
.seats li.empty { color: var(--muted); font-style: italic; font-weight: 600; }
.invite { display: flex; gap: 8px; }

/* =================================================================== JOC */
#game {
  height: 100dvh; overflow: hidden; display: grid; gap: 8px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 8px);
}

/* bara de sus */
.g-top { display: flex; align-items: center; gap: 10px; }
.g-top-right { display: flex; gap: 8px; margin-left: auto; }
.gbtn {
  position: relative; width: 46px; height: 46px; border-radius: 12px; cursor: pointer; color: var(--gold-2);
  border: 1.5px solid var(--gold); background: linear-gradient(180deg, #2a1d0c, #120c04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 3px 8px rgba(0, 0, 0, .5); display: grid; place-items: center;
}
.gbtn svg { width: 24px; height: 24px; }
.burger { display: grid; gap: 4px; } .burger i { display: block; width: 20px; height: 3px; border-radius: 2px; background: var(--gold-2); }
.g-pill {
  margin: 0 auto; display: flex; gap: 12px; align-items: baseline; padding: 8px 22px; border-radius: 999px;
  background: linear-gradient(180deg, #151515, #050505); border: 1.5px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5); font-weight: 900; font-size: 17px; white-space: nowrap;
}
.g-pill b { color: var(--gold-2); }

/* zona centrală: coloane laterale + masa */
.g-main { min-height: 0; display: grid; grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) minmax(180px, 250px); gap: 12px; }
.g-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--gold-dim); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 16px rgba(0, 0, 0, .4);
}
.panel-lbl { font-weight: 900; letter-spacing: 1px; color: var(--gold-2); font-size: 13px; text-align: center; }
.panel-val { font-weight: 900; font-size: 24px; text-align: center; letter-spacing: 1px; }
.info-panel { padding: 10px; }
.clock { display: flex; align-items: center; justify-content: center; gap: 8px; }
.clock svg { width: 26px; height: 26px; color: var(--text); }
#timerPanel.low .clock { color: var(--neg); } #timerPanel.low .clock svg { color: var(--neg); }
.atu-panel { padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: auto; }
.atu-big { font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif; font-weight: 900; font-synthesis: none; font-size: 46px; line-height: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.atu-big i { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.atu-big.c0 { color: #ff4a4f; } .atu-big.c1 { color: #ffb21f; } .atu-big.c2 { color: #3f86ff; } .atu-big.c3 { color: #f3eee4; }

/* carduri jucători */
.pcard {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--gold-dim); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 16px rgba(0, 0, 0, .4); transition: box-shadow .2s, border-color .2s;
}
.pcard.turn { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(232, 199, 123, .5), 0 0 22px rgba(232, 199, 123, .35); }
.pcard.me { background: linear-gradient(180deg, #1c2c47, #121d31); }
.avatar {
  position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 22px; color: #fff; border: 2.5px solid var(--gold); text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.avatar .on { position: absolute; left: -1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--pos); border: 2px solid var(--panel); }
.avatar .on.off { background: #7a7f88; }
.avatar .bot { position: absolute; right: -4px; bottom: -3px; font-size: 16px; text-shadow: none; }
.pinfo { min-width: 0; flex: 1; }
.pname { font-weight: 900; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppts { font-weight: 800; color: var(--muted); font-size: 14px; margin-top: 3px; }
.ppts b.pos { color: var(--pos); } .ppts b.neg { color: var(--neg); } .ppts b { color: var(--text); }
.pmeta { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.pmeta .laid { color: var(--pos); }
.pdisc { flex: none; }
.pcard .ptimer { position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px; overflow: hidden; }
.pcard .ptimer i { display: block; height: 100%; background: var(--gold-2); }

/* masa verde */
.table-wrap { min-height: 0; display: flex; }
.felt {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  border-radius: 36px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .06), transparent 65%),
    repeating-radial-gradient(circle at 30% 30%, rgba(0, 0, 0, .035) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, var(--felt-1), var(--felt-2));
  border: 4px solid #b8893b;
  box-shadow: 0 0 0 2px #5a3d12, inset 0 0 0 2px rgba(255, 220, 150, .25), inset 0 0 40px rgba(0, 0, 0, .55), 0 12px 30px rgba(0, 0, 0, .6);
}
.watermark {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); pointer-events: none; text-align: center;
  font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 64px; letter-spacing: 6px;
  color: rgba(0, 0, 0, .18); text-shadow: 0 1px 0 rgba(255, 255, 255, .06); line-height: 1;
}
.watermark small { display: block; font-size: 13px; letter-spacing: 3px; margin-top: 4px; text-transform: uppercase; }
.pile-row { position: relative; display: flex; justify-content: center; align-items: center; gap: 36px; padding-top: 4px; }
.deck { position: relative; cursor: pointer; border-radius: 8px; }
.card-back {
  width: calc(var(--mw) * 2); height: calc(var(--mw) * 2.7); border-radius: 7px; display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .08) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #2a4f9e, #16326e);
  border: 3px solid #f1eee6; outline: 1.5px solid #9fb5e3; outline-offset: -8px;
  box-shadow: 0 2px 0 #d9d5ca, 0 4px 0 #bcb7aa, 0 6px 0 #d9d5ca, 0 8px 0 #bcb7aa, 0 12px 16px rgba(0, 0, 0, .5);
}
.card-back span { font-family: Georgia, serif; font-weight: 700; font-size: calc(var(--mw) * .42); color: #e8eefc; letter-spacing: 1px; background: #1b3a7f; padding: 2px 5px; border-radius: 30%; border: 1px solid #9fb5e3; }
.deck b { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); font-size: 12px; background: #0b1322; border: 1px solid var(--gold-dim); border-radius: 999px; padding: 1px 8px; color: var(--gold-2); }
.deck.can .card-back { animation: glow 1.2s infinite; }
@keyframes glow { 0%,100% { filter: drop-shadow(0 0 0 rgba(255, 215, 110, .0)); } 50% { filter: drop-shadow(0 0 10px rgba(255, 215, 110, .9)); } }
.take { min-width: calc(var(--mw) * 1.4); min-height: calc(var(--mw) * 1.9); display: grid; place-items: center; border-radius: 8px; }
.take .tile { --tw: calc(var(--mw) * 1.4); }
.take.can { cursor: pointer; animation: glow 1.2s infinite; }
.take .empty { width: calc(var(--mw) * 1.4); height: calc(var(--mw) * 1.9); border-radius: 7px; border: 2px dashed rgba(255, 255, 255, .15); }
.hint-pill {
  align-self: center; max-width: 100%; text-align: center; padding: 7px 18px; border-radius: 10px;
  background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .12); color: #cfe6c9;
  font-weight: 900; letter-spacing: .6px; text-transform: uppercase; font-size: 14px;
}
.hint-pill.good { color: #9dff9f; border-color: rgba(120, 255, 130, .35); }
.hint-pill.bad { color: #ffb39f; border-color: rgba(255, 140, 110, .35); }
.melds { position: relative; flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.mgroup { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.mgroup .owner { width: 100%; font-size: 11px; font-weight: 900; color: rgba(255, 255, 255, .55); text-transform: uppercase; letter-spacing: .8px; }
.meld { display: flex; padding: 3px; border-radius: 8px; cursor: pointer; border: 2px dashed transparent; transition: background .15s, border-color .15s; }
.meld.target { border-color: var(--gold-2); background: rgba(255, 215, 110, .15); }
.meld.suggest { border-color: #b98cff; background: rgba(160, 110, 255, .18); }
.meld.new { outline: 2px solid rgba(157, 255, 159, .55); outline-offset: 1px; }
.meld.flash { animation: flash .9s; }
@keyframes flash { from { background: rgba(255, 215, 110, .45); } }
.empty-table { margin: auto; color: rgba(255, 255, 255, .55); font-weight: 700; text-align: center; font-size: 14px; }

/* ---------- piese ---------- */
.tile {
  width: var(--tw); height: calc(var(--tw) * 1.36); flex: none; border-radius: calc(var(--tw) * .1); position: relative;
  background: linear-gradient(180deg, #fffdf7 0%, var(--tile) 45%, var(--tile-2) 100%);
  box-shadow: 0 3px 0 var(--tile-edge), 0 5px 8px rgba(0, 0, 0, .45), inset 0 1px 0 #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: calc(var(--tw) * .12);
  font-family: 'Archivo Black', 'Arial Black', Arial, 'Liberation Sans', sans-serif; font-weight: 900; font-synthesis: none;
  font-size: calc(var(--tw) * .62); line-height: 1; letter-spacing: -.04em;
  user-select: none; -webkit-user-select: none; touch-action: none; transition: transform .12s;
}
/* adâncitura rotundă de sub cifră */
.tile::after {
  content: ''; position: absolute; left: 50%; bottom: calc(var(--tw) * .1); transform: translateX(-50%);
  width: 38%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #e4dccb, #f7f3ea 70%);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .28), 0 1px 0 #fff;
}
.tile.c0 { color: var(--c-red); } .tile.c1 { color: var(--c-yellow); }
.tile.c2 { color: var(--c-blue); } .tile.c3 { color: var(--c-black); }
.tile.joker { justify-content: center; padding-top: 0; }
.tile.joker::after { display: none; }
.tile.joker svg { width: 84%; height: auto; }
.tile.atu::before {
  content: '★'; position: absolute; top: 2px; right: 3px; font-family: Arial, sans-serif;
  font-size: calc(var(--tw) * .22); color: #e0a000; text-shadow: 0 0 1px #7a5b00;
}
.tile.sm { --tw: var(--mw); box-shadow: 0 2px 0 var(--tile-edge), 0 3px 5px rgba(0, 0, 0, .4), inset 0 1px 0 #fff; }
.tile.sm + .tile.sm { margin-left: 1px; }
.tile.rep small.rep { position: absolute; bottom: 1px; font-family: Nunito, sans-serif; font-weight: 900; font-size: 8px; color: #777; letter-spacing: 0; }
.tile.sel { transform: translateY(-8px); box-shadow: 0 3px 0 var(--tile-edge), 0 0 0 3px #ffd54a, 0 12px 16px rgba(0, 0, 0, .5); }
.tile.hintsel { box-shadow: 0 3px 0 var(--tile-edge), 0 0 0 3px #b98cff, 0 5px 8px rgba(0, 0, 0, .45); }
.tile.fresh { box-shadow: 0 3px 0 var(--tile-edge), 0 0 0 3px rgba(87, 211, 107, .9), 0 5px 8px rgba(0, 0, 0, .45); }
.tile.must { box-shadow: 0 3px 0 var(--tile-edge), 0 0 0 3px var(--neg), 0 5px 8px rgba(0, 0, 0, .45); }
.tile.ghost { position: fixed; z-index: 100; pointer-events: none; transform: scale(1.08) rotate(-3deg); opacity: .96; }
.tile.placeholder { opacity: .25; }

/* ---------- suportul de lemn cu două rânduri ---------- */
.rack-area { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) minmax(120px, 190px); gap: 12px; align-items: center; }
.rack-area > .side-btn:first-child { justify-self: end; width: 100%; }
.rackbox { justify-self: center; min-width: 0; max-width: 100%; }
/* suportul: două polițe de lemn lăcuit, cea din spate puțin mai îngustă, cu capete metalice */
.rack { --gap: 6px; --cap: 16px; display: flex; flex-direction: column; }
.tier {
  position: relative; display: grid; grid-template-columns: repeat(var(--cols, 12), var(--tw)); column-gap: var(--gap);
  justify-content: center; padding: 7px calc(var(--cap) + 10px) 11px;
  background:
    linear-gradient(180deg, rgba(255, 225, 180, .45), transparent 3px),
    linear-gradient(180deg, transparent calc(100% - 15px), #e39445 calc(100% - 15px), #c06d27 calc(100% - 11px), #8a4814 calc(100% - 4px), #5a2d0a 100%),
    repeating-linear-gradient(90deg, rgba(70, 30, 0, .09) 0 2px, transparent 2px 15px, rgba(255, 210, 150, .06) 15px 16px, transparent 16px 29px),
    linear-gradient(180deg, #c7782f 0%, #a55e20 55%, #8c4a16 100%);
  border-radius: 7px 7px 5px 5px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .4), 0 8px 14px rgba(0, 0, 0, .55);
}
.tier.back { margin: 0 calc(var(--cap) + 4px); z-index: 1; }
.tier.front { margin-top: -3px; z-index: 2; }
.tier::before, .tier::after {
  content: ''; position: absolute; top: -3px; bottom: -3px; width: var(--cap); border-radius: 5px;
  background:
    radial-gradient(circle at 50% 50%, #3a3a3e 0 2.5px, #9a9aa0 3px, transparent 3.6px),
    linear-gradient(90deg, #5d5d62, #e6e6ea 35%, #b9b9bf 60%, #6a6a70);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.tier::before { left: -2px; } .tier::after { right: -2px; }
.tier .slot { align-self: end; }
.slot { width: var(--tw); height: var(--th); border-radius: 6px; position: relative; }
.slot.drop { background: rgba(255, 230, 150, .25); box-shadow: inset 0 0 0 2px rgba(255, 230, 150, .7); }

/* butoanele laterale ale suportului */
.side-btn {
  position: relative; height: 58px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 900; font-size: 17px; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px;
  border: 1.5px solid rgba(255, 255, 255, .35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 rgba(0, 0, 0, .45), 0 8px 16px rgba(0, 0, 0, .4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform .08s, filter .15s;
}
.side-btn svg { width: 24px; height: 24px; flex: none; }
.side-btn:active:not(:disabled) { transform: translateY(2px); }
.side-btn:disabled { filter: grayscale(.7) brightness(.55); cursor: default; }
.side-btn.red { background: linear-gradient(180deg, #ec6a3f, #b8341b); }
.side-btn.green { background: linear-gradient(180deg, #4fbf5e, #267a33); }
.side-btn.hot { outline: 3px solid #ffd54a; filter: brightness(1.15); }
.side-btn em { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-style: normal; }
.side-btn em .tile { --tw: 22px; }
.pill-atu { display: none; align-items: center; gap: 6px; color: var(--muted); font-size: .85em; }
.pill-atu .tile { --tw: 17px; font-size: 11px; padding-top: 1px; }
.pill-atu .tile::after { width: 30%; bottom: 1px; }

/* butoanele de jos */
.g-bottom { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.gbtn3 {
  min-width: 180px; height: 54px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 900; font-size: 18px; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 18px;
  border: 1.5px solid rgba(255, 255, 255, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 0 rgba(0, 0, 0, .5), 0 8px 16px rgba(0, 0, 0, .4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45); transition: transform .08s, filter .15s;
}
.gbtn3 svg { width: 26px; height: 26px; flex: none; }
.gbtn3:hover:not(:disabled) { filter: brightness(1.1); }
.gbtn3:active:not(:disabled) { transform: translateY(2px); }
.gbtn3:disabled { filter: grayscale(.8) brightness(.5); cursor: default; }
.gbtn3.purple { background: linear-gradient(180deg, #7a4bb8, #4b2a7c); border-color: #a987e0; }
.gbtn3.blue { background: linear-gradient(180deg, #3469c0, #1a3f80); border-color: #7fa4e6; }
.gbtn3.dark { background: linear-gradient(180deg, #3fa34d, #23702e); border-color: #86d98f; }
.gbtn3.dark:disabled { background: linear-gradient(180deg, #3a3f47, #25292f); border-color: #555b64; filter: none; opacity: .75; }
.gbtn3.brown { background: linear-gradient(180deg, #8f6224, #5c3c12); border-color: var(--gold); }

/* ---------- chat ---------- */
.chat {
  position: fixed; right: 12px; top: 66px; width: min(340px, calc(100vw - 24px)); max-height: 60vh; z-index: 30;
  background: #0f1828f5; border: 1px solid var(--gold-dim); border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.chat-log { flex: 1; overflow: auto; font-size: 14px; min-height: 80px; }
.chat-log p { margin: 3px 0; } .chat-log b { color: var(--gold-2); }
.chat form { display: flex; gap: 6px; } .chat form input { padding: 8px 10px; }
.game-log { font-size: 12px; color: var(--muted); max-height: 110px; overflow: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 6px; }
.game-log p { margin: 2px 0; }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(3, 6, 12, .7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1.5px solid var(--gold); color: var(--text);
  border-radius: 16px; padding: 18px; width: min(560px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .7);
}
.modal-card h2, .modal-card h3 { margin-top: 0; color: var(--gold-2); }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { text-align: left; }
.tscroll { overflow-x: auto; }
.score-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.score-table th, .score-table td { padding: 7px 6px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.score-table th { color: var(--gold-2); }
.score-table th:first-child, .score-table td:first-child { text-align: left; }
.hand-left { display: flex; flex-wrap: wrap; gap: 2px; margin: 4px 0 10px; }
.rules { font-size: 14px; line-height: 1.5; }
.rules h3 { margin: 14px 0 4px; font-size: 15px; }
.rules ul { padding-left: 18px; margin: 4px 0; }
.choice { display: flex; gap: 8px; margin-top: 12px; }
.choice .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 60;
  background: #0b1322; border: 1px solid var(--gold); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 800; font-size: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .6); max-width: calc(100vw - 32px); text-align: center;
}
.toast.error { background: #6e1d12; border-color: #ff8a70; }

/* =================================================================== responsive */
/* ecrane medii */
@media (max-width: 1180px) {
  .g-main { grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) minmax(150px, 200px); }
  .avatar { width: 46px; height: 46px; font-size: 18px; }
  .pcard { gap: 8px; padding: 8px; }
  .pname { font-size: 14px; }
  .gbtn3 { min-width: 140px; font-size: 16px; }
  .rack-area { grid-template-columns: 120px minmax(0, 1fr) 120px; }
  .side-btn { font-size: 15px; }
}
/* telefon în landscape (înălțime mică) */
@media (max-height: 560px) and (orientation: landscape) {
  :root { --mw: 22px; }
  .pile-row { gap: 20px; padding-top: 0; }
  .card-back { width: calc(var(--mw) * 1.5); height: calc(var(--mw) * 2); outline-offset: -5px; }
  .card-back span { font-size: 8px; padding: 1px 3px; }
  .take .tile { --tw: calc(var(--mw) * 1.3); }
  .deck b { bottom: -9px; font-size: 10px; }
  #game { gap: 5px; padding-top: calc(env(safe-area-inset-top) + 4px); padding-bottom: calc(env(safe-area-inset-bottom) + 4px); }
  .gbtn { width: 36px; height: 36px; } .gbtn svg { width: 20px; height: 20px; }
  .g-pill { padding: 4px 14px; font-size: 14px; }
  .g-main { grid-template-columns: 150px minmax(0, 1fr) 150px; gap: 8px; }
  .cards { gap: 6px; } .g-side { gap: 6px; }
  .avatar { width: 34px; height: 34px; font-size: 14px; border-width: 2px; }
  .pcard { padding: 5px 7px; border-radius: 10px; }
  .pname { font-size: 13px; } .ppts, .pmeta { font-size: 11px; } .pdisc { display: none; }
  .panel-val { font-size: 18px; } .atu-big { font-size: 30px; } .info-panel { padding: 5px; }
  .felt { border-radius: 22px; padding: 8px 10px; } .watermark { font-size: 40px; }
  .g-side .panel { display: none; } .pill-atu { display: inline-flex; }
  .side-btn em { display: none; }
  .hint-pill { font-size: 11px; padding: 4px 10px; }
  .rack { --gap: 4px; --cap: 12px; }
  .tier { padding: 5px calc(var(--cap) + 6px) 9px; }
  .rack-area { grid-template-columns: 96px minmax(0, 1fr) 96px; gap: 8px; }
  .side-btn { height: 44px; font-size: 13px; padding: 0 6px; } .side-btn svg { display: none; }
  .gbtn3 { height: 38px; min-width: 110px; font-size: 14px; } .gbtn3 svg { width: 20px; height: 20px; }
  .g-bottom { gap: 8px; }
}
/* telefon în portret */
@media (max-width: 760px) and (orientation: portrait), (max-width: 600px) {
  #game { padding: calc(env(safe-area-inset-top) + 6px) 6px calc(env(safe-area-inset-bottom) + 6px); gap: 6px; }
  .gbtn { width: 38px; height: 38px; } .gbtn svg { width: 20px; height: 20px; }
  .g-pill { padding: 5px 12px; font-size: 13px; gap: 8px; }
  .g-main { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .g-left, .g-right { flex-direction: row; overflow: visible; }
  .g-left .cards, .g-right .cards { flex: 1; min-width: 0; }
  .g-left { grid-column: 1; grid-row: 1; } .g-right { grid-column: 2; grid-row: 1; }
  .table-wrap { grid-column: 1 / -1; grid-row: 2; }
  .g-side .panel { display: none; } .pill-atu { display: inline-flex; }
  .side-btn em { display: none; }
  .atu-panel { margin-top: 0; padding: 4px 8px; }
  .atu-big { font-size: 22px; gap: 3px; } .atu-big i { width: 7px; height: 7px; }
  .g-right .info-panel { display: none; }
  .pcard.me { display: none; }
  .avatar { width: 30px; height: 30px; font-size: 13px; border-width: 2px; }
  .avatar .on { width: 10px; height: 10px; } .avatar .bot { font-size: 12px; }
  .pcard { padding: 5px 6px; gap: 6px; border-radius: 10px; }
  .pname { font-size: 12px; } .ppts, .pmeta { font-size: 10.5px; margin-top: 1px; } .pdisc { display: none; }
  .panel-lbl { font-size: 10px; }
  .felt { border-radius: 20px; padding: 8px; border-width: 3px; } .watermark { font-size: 38px; }
  .pile-row { gap: 22px; }
  .hint-pill { font-size: 11px; padding: 4px 10px; letter-spacing: .2px; }
  .rack-area { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rackbox { grid-column: 1 / -1; grid-row: 1; }
  .rack { --gap: 3px; --cap: 10px; }
  .tier { padding: 4px calc(var(--cap) + 4px) 8px; }
  .tier.back { margin: 0 calc(var(--cap) + 2px); }
  .side-btn { height: 40px; font-size: 14px; } .side-btn svg { width: 18px; height: 18px; }
  .g-bottom { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .gbtn3 { min-width: 0; height: 44px; font-size: 11.5px; flex-direction: column; gap: 1px; padding: 0 4px; }
  .gbtn3 svg { width: 18px; height: 18px; }
  .toast { bottom: 120px; }
}
