/* ================= Domino Must Play v2: credit bar, game screen, tables, chat ================= */

/* ---------- credit bar (top of every page) ---------- */
.credit {
  position: relative; z-index: 30;
  height: 22px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #c8d9cf;
  background: #03170f; border-bottom: 1px solid rgba(242,183,5,.25);
  padding: 0 16px; white-space: nowrap; overflow: hidden;
}
.credit b { color: var(--gold); font-weight: 800; }
.credit .rebel { color: #ff6b6b; font-weight: 800; }
.topbar { top: 0; }

/* ---------- table style swatches / pickers ---------- */
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick {
  position: relative; border: 2px solid transparent; border-radius: 12px; padding: 0; cursor: pointer;
  background: none; color: var(--ink); text-align: center; font-size: 11px; font-weight: 600;
}
.pick .sw { display: block; height: 54px; border-radius: 10px; overflow: hidden; position: relative; }
.pick .lbl { display: block; margin-top: 4px; color: var(--muted); line-height: 1.15; min-height: 26px; }
.pick.on { border-color: var(--gold); }
.pick.on .lbl { color: var(--ink); }
.pick .sw .tile { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg); }
.skin-pick .sw { background: rgba(255,255,255,.05); display: grid; place-items: center; }
.skin-pick .sw .tile { position: static; transform: rotate(-10deg); }
@media (max-width: 420px) { .picker { grid-template-columns: repeat(4, 1fr); gap: 6px; } .pick .sw { height: 46px; } }

/* ---------- table surfaces (8 styles) ---------- */
.surface { background-color: #6b4a2b; }
.board-oak .surface, .sw.board-oak {
  background:
    repeating-linear-gradient(97deg, rgba(120,72,30,.07) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(97deg, rgba(255,255,255,.06) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #e6c99f, #d3ad7d);
}
.board-oak .surface { box-shadow: inset 0 0 0 10px #c08c55, inset 0 0 0 12px #a87442, inset 0 10px 30px rgba(0,0,0,.25); }
.board-mahogany .surface, .sw.board-mahogany {
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.12) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(92deg, rgba(255,160,120,.05) 0 1px, transparent 1px 19px),
    linear-gradient(180deg, #6a2d19, #3f1a0f);
}
.board-mahogany .surface { box-shadow: inset 0 0 0 10px #2a0f07, inset 0 0 0 12px #5b2614, inset 0 10px 30px rgba(0,0,0,.45); }
.board-felt .surface, .sw.board-felt {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.10), transparent 60%),
    repeating-radial-gradient(circle at 30% 30%, rgba(0,0,0,.04) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #1c7a4e, #0f5534);
}
.board-felt .surface { box-shadow: inset 0 0 0 10px #4a2a14, inset 0 0 0 12px #2a160a, inset 0 10px 30px rgba(0,0,0,.4); }
.board-beach .surface, .sw.board-beach {
  background:
    radial-gradient(circle at 20% 30%, rgba(160,120,60,.18) 0 1px, transparent 2px) 0 0 / 9px 9px,
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.35) 0 1px, transparent 2px) 0 0 / 13px 13px,
    radial-gradient(ellipse at 50% 30%, #f6e6c2, #e2c690 70%);
}
.board-beach .surface { box-shadow: inset 0 0 0 10px #b9b2a5, inset 0 0 0 12px #8f877a, inset 0 10px 30px rgba(120,90,40,.25); }
.board-sea .surface, .sw.board-sea {
  background:
    repeating-radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.07) 0 6px, transparent 6px 18px),
    radial-gradient(ellipse at 50% 35%, #33d1df, #0a7a9a 75%);
}
.board-sea .surface { box-shadow: inset 0 0 0 10px #f1e1b8, inset 0 0 0 12px #d4c08e, inset 0 10px 30px rgba(0,40,60,.35); }
.board-rumshop .surface, .sw.board-rumshop {
  background:
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(0,0,0,.28) 58px 60px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #2b86a6, #1f6681);
}
.board-rumshop .surface { box-shadow: inset 0 0 0 10px #e3b23c, inset 0 0 0 12px #b9861a, inset 0 10px 30px rgba(0,0,0,.35); }
.board-marble .surface, .sw.board-marble {
  background:
    linear-gradient(115deg, transparent 40%, rgba(120,120,130,.25) 41%, transparent 43%),
    linear-gradient(35deg, transparent 60%, rgba(140,140,150,.2) 61%, transparent 62.5%),
    linear-gradient(160deg, transparent 20%, rgba(150,150,160,.18) 21%, transparent 22%),
    radial-gradient(ellipse at 40% 30%, #ffffff, #e4e2de 80%);
}
.board-marble .surface { box-shadow: inset 0 0 0 10px #c9a54a, inset 0 0 0 12px #9c7b2a, inset 0 10px 30px rgba(0,0,0,.2); }
.board-midnight .surface, .sw.board-midnight {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(0,229,255,.10), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, #121a2b, #070b14);
}
.board-midnight .surface { box-shadow: inset 0 0 0 8px #0b0f1a, inset 0 0 0 10px #00e5ff, inset 0 0 24px rgba(0,229,255,.35); }

/* ---------- game screen ---------- */
body.in-game { overflow: hidden; }
body.in-game .topbar { display: none !important; }
body.in-game .app { max-width: none; padding: 0; }
.gs {
  height: calc(100dvh - 22px); display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  grid-template-columns: 1fr;
  background: radial-gradient(900px 500px at 50% 0%, rgba(255,255,255,.06), transparent 70%), #08291c;
  overflow: hidden;
}
@media (min-width: 1000px) {
  .gs { grid-template-columns: 1fr 340px; }
  .gs > *:not(.chat-panel) { grid-column: 1; }
  .gs .chat-panel { grid-column: 2; grid-row: 1 / -1; }
}
.gs-top {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 44px;
  background: rgba(0,0,0,.25); border-bottom: 1px solid var(--line);
}
.gs-top .ttl { flex: 1; min-width: 0; line-height: 1.1; }
.gs-top .ttl b { display: block; font-family: var(--display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-top .ttl span { font-size: 11px; color: var(--muted); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05);
  color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; position: relative; flex: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge-dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

.opps { display: flex; gap: 6px; padding: 8px 10px 6px; overflow-x: auto; scrollbar-width: none; }
.opp {
  flex: 1 1 0; min-width: 96px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); position: relative; transition: border-color .2s, box-shadow .2s;
}
.opp.turn { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242,183,5,.25), 0 0 18px rgba(242,183,5,.18); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  color: #fff; flex: none; position: relative; text-transform: uppercase;
}
.avatar.talk::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #3ee07f; animation: talkpulse 1s infinite; }
@keyframes talkpulse { 0% { opacity: 1; transform: scale(.95); } 100% { opacity: 0; transform: scale(1.25); } }
.opp .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp .sub2 { font-size: 10px; color: var(--muted); white-space: nowrap; }
.opp .dots { gap: 3px; margin-top: 3px; }
.opp .dots span { width: 8px; height: 8px; border-width: 1px; }
.opp .info { min-width: 0; flex: 1; }
.peek-badge {
  position: absolute; top: -8px; right: -4px; background: #6cb4ff; color: #04121f; font-weight: 800; font-size: 11px;
  padding: 2px 7px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.table-wrap { position: relative; padding: 4px 8px; min-height: 0; display: flex; }
.surface { position: relative; flex: 1; border-radius: 18px; overflow: hidden; min-height: 160px; }
.chain-box { position: absolute; inset: 18px; }
.chain-box .tile { position: absolute; transition: left .25s ease, top .25s ease; }
.chain-box .tile.last { animation: drop .28s ease-out; }
.chain-box .tile.last.slammed { animation: slamdrop .32s cubic-bezier(.2, 1.6, .4, 1); z-index: 2; }
.chain-box .tile.end { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(242,183,5,.7); }
@keyframes drop { from { transform: translateY(-14px) scale(1.08); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slamdrop { 0% { transform: scale(2.1) rotate(-8deg); opacity: .2; } 70% { transform: scale(.94); opacity: 1; } 100% { transform: none; } }
.surface.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -3px); }
  30%, 50%, 70% { transform: translate(-9px, 4px) rotate(-.4deg); } 40%, 60% { transform: translate(9px, -4px) rotate(.4deg); }
}
.slam-flash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), rgba(255,255,255,.55), transparent 45%); animation: flash .4s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.status-pill {
  position: absolute; left: 50%; top: 22px; transform: translateX(-50%); z-index: 3;
  background: rgba(0,0,0,.6); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
  white-space: nowrap; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(4px);
}
.status-pill.you { background: var(--gold); color: var(--gold-ink); }
.watch-pill {
  position: absolute; right: 22px; bottom: 20px; z-index: 3; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.empty-board { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgba(255,255,255,.85); font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); padding: 30px; }
.board-marble .empty-board, .board-beach .empty-board, .board-oak .empty-board { color: rgba(40,25,10,.8); text-shadow: none; }

.side-bar { display: flex; gap: 8px; justify-content: center; padding: 6px 10px 0; }
.side-bar .btn { animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.me-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.me-bar .me-info { flex: 1; min-width: 0; }
.me-bar .nm { font-weight: 800; font-size: 14px; }
.me-bar .sub2 { font-size: 11px; color: var(--muted); }
.act {
  height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.06);
  color: var(--ink); font-weight: 800; font-size: 12px; letter-spacing: .03em; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  text-transform: uppercase; user-select: none; -webkit-user-select: none; touch-action: none; flex: none;
}
.act svg { width: 16px; height: 16px; }
.act:disabled { opacity: .4; cursor: not-allowed; }
.act.slam.on { background: #e5484d; border-color: #ff8f93; color: #fff; box-shadow: 0 0 16px rgba(229,72,77,.6); animation: armed 1s infinite alternate; }
@keyframes armed { from { box-shadow: 0 0 6px rgba(229,72,77,.5); } to { box-shadow: 0 0 20px rgba(229,72,77,.9); } }
.act.peek.active { background: #6cb4ff; color: #04121f; border-color: #6cb4ff; }
.act.ptt { background: #1f8f55; border-color: #3ee07f; }
.act.ptt.down { background: #3ee07f; color: #04210f; transform: scale(1.04); }
.act.voice-off { background: rgba(255,255,255,.06); }
@media (max-width: 420px) { .act .lbl-long { display: none; } .act { padding: 0 10px; } }

.tray {
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: rgba(0,0,0,.28); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end; min-height: 70px;
}
.tray .tile { cursor: default; transition: transform .12s, opacity .12s, filter .12s; }
.tray.myturn .tile:not(.ok) { opacity: .38; filter: saturate(.6); }
.tray .tile.ok { cursor: pointer; }
.tray.myturn .tile.ok { transform: translateY(-4px); }
.tray .tile.ok:hover { transform: translateY(-8px); }
.tray .tile.sel { transform: translateY(-12px); box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(0,0,0,.5); }
.tray.slam-armed { box-shadow: inset 0 3px 0 #e5484d; }
.tray .watching { color: var(--muted); font-size: 13px; padding: 10px; text-align: center; }

/* ---------- chat panel / sheet ---------- */
.chat-panel { display: flex; flex-direction: column; min-height: 0; background: #06231a; border-left: 1px solid var(--line); }
@media (max-width: 999px) {
  .chat-panel {
    position: fixed; left: 0; right: 0; bottom: 0; height: min(70dvh, 520px); z-index: 50; border-radius: 18px 18px 0 0;
    border: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0,0,0,.5); transform: translateY(105%); transition: transform .25s ease;
  }
  .chat-panel.open { transform: none; }
}
@media (min-width: 1000px) { .chat-panel .close-chat { display: none; } }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-tabs { display: flex; gap: 4px; flex: 1; }
.chat-tabs button { border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.chat-tabs button.on { background: rgba(255,255,255,.1); color: var(--ink); }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.msg { max-width: 85%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg .who .tag { font-size: 9px; padding: 1px 5px; border-radius: 4px; background: rgba(108,180,255,.18); color: #6cb4ff; margin-left: 4px; text-transform: uppercase; font-weight: 800; }
.msg .bubble { display: inline-block; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.08); line-height: 1.35; word-wrap: break-word; overflow-wrap: anywhere; text-align: left; }
.msg.mine .bubble { background: var(--gold); color: var(--gold-ink); }
.moves-list { font-size: 13px; color: var(--muted); }
.moves-list div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.watchers-line { font-size: 12px; color: var(--muted); padding: 6px 12px 0; }
.voice-line { font-size: 12px; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.voice-line .vm { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.07); }
.voice-line .vm.talk { background: #3ee07f; color: #04210f; font-weight: 700; }
.voice-line .vm.wait { opacity: .6; }

/* ---------- result stamps ---------- */
.stamp {
  display: inline-block; font-family: var(--display); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  border: 4px solid currentColor; padding: 4px 14px; border-radius: 8px; transform: rotate(-8deg);
  animation: stamp .45s cubic-bezier(.2, 1.8, .4, 1) both;
}
.stamp.jailed { color: var(--orange); }
.stamp.antiman { color: #ff6b6b; font-size: 1.15em; }
@keyframes stamp { 0% { transform: scale(3) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(-8deg); opacity: 1; } }
.stamps { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }

/* lobby mini preview */
.mini-sw { width: 54px; height: 40px; border-radius: 8px; flex: none; position: relative; overflow: hidden; }
.mini-sw .tile { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg); }

.chain-box .tile.last-play { outline: 2px solid rgba(242,183,5,.85); outline-offset: 1px; }
.chat-panel.inline { position: static; transform: none; height: 460px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.chat-panel.inline .close-chat { display: none; }
