:root {
  --felt: #0f5a34;
  --felt-dark: #0a3f24;
  --felt-light: #1a7a48;
  --cream: #fbf4e2;
  --cream-edge: #e6dbbd;
  --ink: #1d1d1b;
  --red: #c0282d;
  --gold: #f2c14e;
  --gold-dark: #c99a2e;
  --text: #f3f7f2;
  --muted: rgba(243, 247, 242, 0.65);
  --panel: rgba(0, 0, 0, 0.22);
  --line: rgba(255, 255, 255, 0.14);
  --card-w: 58px;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 35%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%) fixed;
  /* Chặn bôi đen chữ và menu chạm giữ */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Vân nỉ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  font: inherit;
  font-size: 16px; /* >=16px để iOS không tự phóng to khi focus */
}

button { font: inherit; cursor: pointer; }

#app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  height: 100%;
}

.screen { display: none; height: 100%; }
.screen.active { display: flex; flex-direction: column; }

.muted { color: var(--muted); }

/* ------------------------------------------------------------ Nút */
.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: #2a1d00;
  border-color: transparent;
  box-shadow: 0 3px 0 #8a6614;
}
.btn-danger { background: #b3362f; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------ Tải */
.loading {
  margin: auto;
  text-align: center;
}
.spinner {
  width: 36px; height: 36px;
  margin: 24px auto 12px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.logo {
  font-weight: 800;
  font-size: 40px;
  letter-spacing: -1px;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.logo span { color: var(--gold); margin-left: 6px; }

/* ------------------------------------------------------------ Sảnh */
#screen-lobby {
  overflow-y: auto;
  padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  gap: 14px;
}
.lobby-head { text-align: center; padding: 12px 0 4px; }
.tagline { margin: 4px 0 0; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-title { display: flex; align-items: baseline; justify-content: space-between; }
.panel h2 { margin: 0; font-size: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .join-row input, #modal-input {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  width: 100%;
}
.field input:focus, .join-row input:focus, #modal-input:focus { border-color: var(--gold); }

.join-row { display: flex; gap: 10px; }
.join-row input {
  text-transform: uppercase;
  letter-spacing: 6px;
  text-align: center;
  font-weight: 700;
}
.join-row input { flex: 1; min-width: 0; }
.join-row input::placeholder { letter-spacing: 1px; font-weight: 500; font-size: 14px; }

.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-list li.empty { color: var(--muted); text-align: center; padding: 14px 0; font-size: 14px; }
.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}
.room-item .code { font-weight: 800; letter-spacing: 3px; font-size: 18px; color: var(--gold); }
.room-item .info { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.room-item .info b { color: var(--text); font-weight: 600; }

.rules summary { font-weight: 600; cursor: pointer; }
.rules ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ------------------------------------------------------------ Bàn chơi */
#screen-room { padding-top: var(--safe-t); }

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
}
.room-code { font-size: 14px; color: var(--muted); }
.room-code b { color: var(--gold); letter-spacing: 3px; font-size: 18px; margin-left: 4px; }

.opponents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 10px 8px;
}
.seat {
  position: relative;
  width: calc((100% - 24px) / 4);
  max-width: 120px;
  min-width: 76px;
  padding: 8px 6px 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid transparent;
  text-align: center;
  transition: border-color 0.2s, opacity 0.2s;
}
.seat.turn { border-color: var(--gold); box-shadow: 0 0 16px rgba(242, 193, 78, 0.45); }
.seat.offline, .seat.passed { opacity: 0.55; }
.seat .name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat .score { font-size: 12px; color: var(--muted); }
.seat .back-stack { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 4px 0 2px; }
.mini-back {
  width: 22px; height: 31px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, #8e1f24 0 4px, #a8282e 4px 8px);
  border: 2px solid var(--cream);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.seat .count { font-weight: 800; font-size: 18px; }
.seat .tags { display: flex; justify-content: center; gap: 3px; flex-wrap: wrap; min-height: 18px; }
.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}
.tag.gold { background: var(--gold); color: #2a1d00; }
.tag.red { background: var(--red); color: #fff; }
.tag.dim { background: rgba(0, 0, 0, 0.35); color: var(--muted); }
.seat .ring {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--gold);
  border-radius: 0 0 0 10px;
}

.table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 10px;
  padding: 0 12px 8px;
  overflow-y: auto;
}
.table-center {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.played { display: flex; justify-content: center; }

.played-label { font-size: 14px; color: var(--muted); }
.played-label b { color: var(--text); }
.center-msg { font-size: 15px; color: var(--muted); max-width: 320px; }
.center-msg b { color: var(--text); }

.center-panel {
  width: 100%;
  max-width: 380px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.center-panel h3 { margin: 0; font-size: 18px; }
.center-panel p { margin: 0; color: var(--muted); font-size: 14px; }
.center-panel .row { display: flex; gap: 10px; justify-content: center; }
.share-box {
  display: flex; gap: 8px; align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 6px 6px 6px 12px;
  font-size: 13px;
}
.share-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.plist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.plist li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
}
.plist li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .delta { font-weight: 800; }
.plist .plus { color: #7be39b; }
.plist .minus { color: #ff8c8c; }
.reveal { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.reveal .card { --card-w: 26px; }

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 380px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  min-height: 54px;
}
.log li:last-child { color: var(--text); }

/* ------------------------------------------------------------ Phần của tôi */
.me {
  padding: 6px 8px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
}
.me-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; min-height: 26px; }
.me-info { font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.me-info b { font-weight: 700; }
.timer { font-weight: 800; font-size: 15px; color: var(--gold); font-variant-numeric: tabular-nums; }
.timer.urgent { color: #ff7a6b; }
.hint { text-align: center; font-size: 13px; min-height: 20px; color: var(--muted); }
.hint.ok { color: #9ff0b6; }
.hint.bad { color: #ffb1a8; }

.hand {
  display: flex;
  justify-content: center;
  padding: 18px 0 8px;
  min-height: calc(var(--card-w) * 1.42 + 26px);
}
.actions { display: flex; gap: 10px; justify-content: center; padding-top: 4px; }
.actions .btn { flex: 1; max-width: 160px; padding: 13px 0; font-size: 16px; }
.actions .btn-suggest { flex: 0 0 auto; padding: 13px 14px; font-size: 14px; }

/* ------------------------------------------------------------ Lá bài */
.card {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  height: calc(var(--card-w) * 1.42);
  border-radius: calc(var(--card-w) * 0.12);
  background: linear-gradient(160deg, #fffaf0 0%, var(--cream) 60%, #f1e6c8 100%);
  border: 1px solid var(--cream-edge);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  color: var(--ink);
  font-weight: 700;
  transition: transform 0.12s ease-out, box-shadow 0.12s;
}
.card.red { color: var(--red); }
.card .r {
  position: absolute;
  top: calc(var(--card-w) * 0.05);
  left: calc(var(--card-w) * 0.09);
  font-size: calc(var(--card-w) * 0.34);
  line-height: 1;
  letter-spacing: -1px;
}
.card .s1 {
  position: absolute;
  top: calc(var(--card-w) * 0.4);
  left: calc(var(--card-w) * 0.1);
  font-size: calc(var(--card-w) * 0.26);
  line-height: 1;
}
.card .s2 {
  position: absolute;
  right: calc(var(--card-w) * 0.08);
  bottom: calc(var(--card-w) * 0.06);
  font-size: calc(var(--card-w) * 0.55);
  line-height: 1;
}
.hand .card { cursor: pointer; }
.hand .card.sel { transform: translateY(-16px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--gold); }
.played .card { --card-w: 54px; }

/* ------------------------------------------------------------ Hộp thoại & thông báo */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}
.modal[hidden] { display: none; }
.modal-box {
  width: 100%;
  max-width: 360px;
  background: #143f29;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.modal-box h3 { margin: 0 0 10px; font-size: 19px; }
#modal-body { font-size: 15px; line-height: 1.55; color: var(--muted); }
#modal-body b { color: var(--text); }
#modal-body .win { color: #7be39b; }
#modal-body .lose { color: #ff8c8c; }
#modal-input-wrap { margin-top: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal-actions .btn[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + var(--safe-t));
  transform: translateX(-50%);
  z-index: 60;
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.toast[hidden] { display: none; }

@media (min-width: 480px) {
  :root { --card-w: 64px; }
}
@media (max-height: 640px) {
  .log { min-height: 36px; }
  .opponents { padding-bottom: 4px; }
}

/* Chưa chia bài / hết ván: ẩn khu bài và nút để panel giữa bàn có đủ chỗ */
#screen-room:not(.in-hand) .hand,
#screen-room:not(.in-hand) .actions,
#screen-room:not(.in-hand) .hint { display: none; }

.turn-line { font-size: 14px; color: var(--muted); }
.turn-line b { color: var(--text); }
.turn-line.mine { color: var(--gold); }
.turn-line.mine b { color: var(--gold); }
.plist .rank {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px; font-weight: 800;
}
.plist li:first-child .rank { background: var(--gold); color: #2a1d00; }

/* ------------------------------------------------------------ Bàn xếp vòng */
.arena {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "tl top tr"
    "left center right"
    "bottom bottom bottom";
  gap: 6px;
  padding: 2px 8px 0;
}
.arena > .table { grid-area: center; padding: 0 2px; }
.slot { display: flex; gap: 8px; min-width: 0; }
.slot:empty { display: none; }
.slot-tl { grid-area: tl; justify-content: flex-start; }
.slot-top { grid-area: top; justify-content: center; flex-wrap: wrap; }
.slot-tr { grid-area: tr; justify-content: flex-end; }
.slot-left { grid-area: left; align-items: center; }
.slot-right { grid-area: right; align-items: center; }
/* Chưa vào ván: mọi người xếp một hàng phía trên */
.arena:not(.around) .slot-top { grid-column: 1 / -1; }
.arena .seat { width: 82px; min-width: 0; max-width: none; }
.arena:not(.around) .seat { width: calc((100% - 24px) / 4); max-width: 110px; min-width: 74px; }

.order-strip { padding: 2px 10px 0; text-align: center; }
.order-strip:empty { display: none; }
.chips {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.chip.me { border-color: rgba(255, 255, 255, 0.5); }
.chip.last { box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.5); }
.chip.passed { opacity: 0.4; text-decoration: line-through; }
.chip.turn { background: var(--gold); color: #2a1d00; border-color: transparent; opacity: 1; text-decoration: none; }
.chips .arrow { color: var(--muted); font-weight: 700; }
.watching { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------ Chat */
.me-bar { position: relative; }
.me-right { display: flex; align-items: center; gap: 8px; }
.btn-round { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 17px; line-height: 1; }

.bubble, .bubble-me .bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 6px);
  transform: translateX(-50%);
  z-index: 5;
  max-width: 170px;
  width: max-content;
  padding: 6px 10px;
  border-radius: 14px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fffaf0;
}
.bubble.emoji { background: transparent; box-shadow: none; font-size: 38px; padding: 0; }
.bubble.emoji::after { display: none; }
.bubble.fresh { animation: pop 0.35s ease-out; }
.bubble.emoji.fresh { animation: pop-big 0.5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: translateX(-50%) scale(0.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes pop-big { 0% { transform: translateX(-50%) scale(0.2); } 60% { transform: translateX(-50%) scale(1.4); } 100% { transform: translateX(-50%) scale(1); } }
.slot-tl .bubble, .slot-left .bubble { left: 6px; transform: none; }
.slot-tr .bubble, .slot-right .bubble { left: auto; right: 6px; transform: none; }
.slot-tl .bubble.fresh, .slot-left .bubble.fresh, .slot-tr .bubble.fresh, .slot-right .bubble.fresh { animation: none; }
.slot-tl .bubble.emoji, .slot-left .bubble.emoji, .slot-tr .bubble.emoji, .slot-right .bubble.emoji { left: 50%; right: auto; transform: translateX(-50%); }
.slot .seat .bubble { bottom: auto; top: calc(100% - 8px); }
.slot .seat .bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #fffaf0; }
.slot-tl .seat .bubble::after, .slot-left .seat .bubble::after { left: 24px; }
.slot-tr .seat .bubble::after, .slot-right .seat .bubble::after { left: auto; right: 18px; transform: none; }
.bubble-me { position: absolute; left: 60px; bottom: 100%; width: 0; height: 0; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.sheet[hidden] { display: none; }
.sheet-box {
  width: 100%;
  max-width: 560px;
  background: #143f29;
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(14px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slide-up 0.2s ease-out;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-grid button {
  font-size: 28px;
  padding: 6px 0;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
}
.emoji-grid button:active { transform: scale(0.9); }
.preset-list { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-list .chip { font-size: 14px; padding: 7px 12px; max-width: none; color: var(--text); cursor: pointer; }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.chat-form input:focus { border-color: var(--gold); }

/* Bàn xếp vòng: nhật ký gọn 1 dòng cho đỡ chật */
.arena.around .log { min-height: 0; }
.arena.around .log li:not(:last-child) { display: none; }
.arena.around .played .card { --card-w: 46px; }
.arena.around .table-center { gap: 6px; }
.arena.around .table { gap: 4px; }
.arena.around .log { font-size: 11px; }
@media (min-height: 760px) { .arena.around .played .card { --card-w: 54px; } }

/* ------------------------------------------------------------ Gọn giao diện */
.seat { padding: 6px 6px 5px; border-radius: 12px; }
.seat .name { font-size: 13px; line-height: 1.25; }
.seat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
  min-height: 24px;
}
.seat-row .mini-back { width: 16px; height: 22px; border-width: 1.5px; border-radius: 3px; }
.seat-row .count { font-size: 16px; font-weight: 800; }
.seat-row .score { font-size: 12px; color: var(--muted); }
.seat-row .count + .score::before { content: '·'; margin-right: 5px; }
.seat .tags { margin-top: 4px; min-height: 0; }
.arena .seat { width: 78px; }
.crown { font-size: 11px; margin-right: 3px; vertical-align: 1px; }
.me-info { gap: 6px; }

.bubble.emoji { font-size: 26px; }
@keyframes pop-big { 0% { transform: translateX(-50%) scale(0.3); } 60% { transform: translateX(-50%) scale(1.25); } 100% { transform: translateX(-50%) scale(1); } }
.emoji-grid button { font-size: 24px; padding: 5px 0; }

.chip-timer { font-variant-numeric: tabular-nums; font-weight: 800; opacity: 0.8; }
.chips .arrow { font-size: 11px; opacity: 0.6; }
/* Bong bóng của mình: hiện phía trên nút chat, không che dải thứ tự */
.bubble-me { left: auto; right: 24px; }
.bubble-me .bubble { left: auto; right: -10px; transform: none; bottom: 4px; }
.bubble-me .bubble::after { left: auto; right: 14px; transform: none; }
.bubble-me .bubble.fresh, .bubble-me .bubble.emoji.fresh { animation: pop-me 0.35s ease-out; }
@keyframes pop-me { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Ô của bạn: cạnh dưới bàn, xếp ngang cho gọn */
.slot-bottom { grid-area: bottom; justify-content: center; }
.arena .seat.me-seat {
  width: auto;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-color: rgba(255, 255, 255, 0.28);
}
.seat.me-seat .seat-row { margin-top: 0; min-height: 0; }
.seat.me-seat .tags { margin-top: 0; flex-wrap: nowrap; }
.seat.me-seat.turn { border-color: var(--gold); }
.seat.me-seat .bubble { top: auto; bottom: calc(100% + 6px); }
.seat.me-seat .bubble::after { top: 100%; bottom: auto; border-bottom-color: transparent; border-top-color: #fffaf0; left: 50%; transform: translateX(-50%); right: auto; }
.me-info[hidden] { display: none; }
.me-bar { justify-content: flex-end; }
.me-bar .me-info:not([hidden]) { margin-right: auto; }

/* Đang trong ván: đồng hồ đã nằm ở dải thứ tự, nút chat lên cùng hàng dải thứ tự */
.me-bar.compact { min-height: 0; height: 0; padding: 0; }
.me-bar.compact .timer { display: none; }
.me-bar.compact .me-right { position: absolute; right: 4px; bottom: 2px; }
.order-strip.with-chat { padding: 4px 48px 6px; min-height: 44px; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.chips { flex-wrap: nowrap; max-width: 100%; min-width: 0; }
.chip { min-width: 0; flex-shrink: 1; }
.chip.turn, .chip.me { flex-shrink: 0; }
.order-strip.with-chat .chips { gap: 3px; }
.order-strip.with-chat .chip { padding: 3px 7px; }
/* Nút chat nằm cùng hàng với ô của bạn (cạnh dưới bàn), dải thứ tự dùng hết chiều ngang */
.order-strip.with-chat { padding: 4px 6px 6px; min-height: 38px; }
.me-bar.compact .me-right { bottom: 44px; right: 8px; }
