/* Mèo Bùm Bùm: pastel, tròn trịa, mềm mại. */

:root {
  --bg: #fff4ea;
  --bg2: #ffe6ef;
  --ink: #5b3a4a;
  --ink-soft: #8c6a78;
  --line: #f1d6de;
  --white: #fff;
  --pink: #ff8fb1;
  --pink-d: #e9668f;
  --mint: #6fd6ad;
  --mint-d: #3fb88a;
  --sky: #7fc3ff;
  --sky-d: #4f9fe6;
  --lav: #b89cff;
  --lav-d: #8f6fe6;
  --butter: #ffd66b;
  --peach: #ffb38a;
  --red: #ff5c7a;
  --shadow: 0 4px 0 rgba(91, 58, 74, 0.1), 0 10px 26px rgba(91, 58, 74, 0.12);
  --cw: 76px;
  --radius: 22px;
  --font: 'Baloo 2', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, #ffe1ec 0, transparent 38%),
    radial-gradient(circle at 92% 22%, #e5f3ff 0, transparent 34%),
    radial-gradient(circle at 30% 96%, #e6fbf1 0, transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 40 40'%3E%3Cg fill='%23ffd2df' opacity='.55'%3E%3Cellipse cx='20' cy='26' rx='6' ry='5'/%3E%3Ccircle cx='12.5' cy='18' r='2.6'/%3E%3Ccircle cx='17.5' cy='13.5' r='2.6'/%3E%3Ccircle cx='22.5' cy='13.5' r='2.6'/%3E%3Ccircle cx='27.5' cy='18' r='2.6'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font-family: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row.gap { gap: 10px; }
.row.center { justify-content: center; margin-top: 14px; }
.warn-text { color: #d9435f; font-weight: 700; }
kbd { background: #fff; border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-family: inherit; font-size: 13px; }
code { background: #fff; border-radius: 6px; padding: 0 6px; font-weight: 800; letter-spacing: 1px; }

/* ---------- nút ---------- */
.btn {
  --c: var(--pink); --cd: var(--pink-d);
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 17px; font-weight: 800;
  color: #fff; background: var(--c); box-shadow: 0 5px 0 var(--cd), 0 10px 18px rgba(91, 58, 74, 0.14);
  transition: transform .08s, box-shadow .08s, filter .15s; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn:disabled { filter: grayscale(0.7) opacity(0.5); cursor: default; }
.btn.mint { --c: var(--mint); --cd: var(--mint-d); }
.btn.sky { --c: var(--sky); --cd: var(--sky-d); }
.btn.lav { --c: var(--lav); --cd: var(--lav-d); }
.btn.ghost { --c: #fff; --cd: #ecd3db; color: var(--ink); text-shadow: none; }
.btn.big { width: 100%; padding: 15px 22px; font-size: 19px; }
.btn.big small { font-weight: 600; opacity: 0.85; font-size: 14px; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; font-size: 20px;
  box-shadow: 0 3px 0 #ecd3db; display: inline-grid; place-items: center; flex: none;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #ecd3db; }
.icon-btn.off { filter: grayscale(1); opacity: 0.55; }
.link { border: 0; background: none; color: var(--pink-d); font-weight: 700; text-decoration: underline; padding: 0 4px; }

.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: #fff; border: 2px solid var(--line); line-height: 1.5; white-space: nowrap; }
.badge.bot { background: #e8f3ff; border-color: #c4defa; }
.badge.away { background: #fff2cc; border-color: #ffe08a; }
.badge.turns { background: var(--red); color: #fff; border-color: var(--red); }
.badge.host { background: #fff6cf; border-color: #ffe08a; }
.badge.dead { background: none; border: 0; font-size: 14px; padding: 0; }

.panel { background: rgba(255, 255, 255, 0.85); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.panel h3 { font-size: 19px; margin-bottom: 4px; }
.panel p { margin: 0 0 12px; }

/* ---------- màn hình chung ---------- */
.screen { max-width: 520px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); min-height: 100dvh; position: relative; }
.center-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; font-weight: 700; }
.loader { width: 96px; animation: bounce 0.8s ease-in-out infinite alternate; }
@keyframes bounce { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-14px) rotate(4deg); } }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.bar h2 { font-size: 22px; }

/* ---------- trang chủ ---------- */
.home { display: flex; flex-direction: column; gap: 16px; padding-top: max(24px, env(safe-area-inset-top)); }
.top-right { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 8px; z-index: 2; }
.logo { text-align: center; margin-top: 18px; position: relative; z-index: 1; }
.logo-art { width: 150px; margin: 0 auto -6px; animation: bounce 1.1s ease-in-out infinite alternate; filter: drop-shadow(0 10px 12px rgba(91, 58, 74, 0.18)); }
.logo-art .spark { animation: spark 0.35s steps(2) infinite; transform-origin: 88px 4px; }
@keyframes spark { 50% { transform: scale(1.25) rotate(20deg); } }
.logo h1 { font-size: 44px; font-weight: 800; letter-spacing: -0.5px; color: var(--ink); text-shadow: 0 3px 0 #fff, 0 5px 0 rgba(91, 58, 74, 0.12); }
.logo h1 span { color: var(--pink-d); }
.tagline { margin: 2px 0 0; font-weight: 700; color: var(--ink-soft); }
.profile { position: relative; z-index: 1; }
.profile label { font-weight: 800; font-size: 14px; display: block; margin-bottom: 6px; }
.profile input, .code-input {
  width: 100%; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); border: 3px solid var(--line);
  border-radius: 16px; padding: 10px 14px; background: #fff; outline: none; transition: border-color 0.15s;
}
.profile input:focus, .code-input:focus { border-color: var(--pink); }
.ava-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.ava { border: 3px solid transparent; background: #fff6f9; border-radius: 18px; padding: 4px; transition: transform 0.15s, border-color 0.15s; aspect-ratio: 1; }
.ava svg { width: 100%; height: 100%; display: block; }
.ava.on { border-color: var(--pink); background: #ffe6ef; transform: translateY(-3px) scale(1.06); }
.home-btns { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.foot { text-align: center; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.float-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.float-deco .card { position: absolute; opacity: 0.85; }
.float-deco .f1 { top: 70px; left: -14px; transform: rotate(-16deg); animation: floaty 4s ease-in-out infinite; }
.float-deco .f2 { top: 150px; right: -18px; transform: rotate(14deg); animation: floaty 5s ease-in-out infinite reverse; }
.float-deco .f3 { top: 8px; left: 18%; transform: rotate(-6deg) scale(0.75); animation: floaty 4.6s ease-in-out infinite; opacity: 0.5; }
.float-deco .f4 { top: 30px; right: 22%; transform: rotate(8deg) scale(0.7); animation: floaty 5.4s ease-in-out infinite; opacity: 0.5; }
@keyframes floaty { 50% { translate: 0 -10px; } }

.bot-count { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 10px; }
.bc { border: 3px solid var(--line); background: #fff; border-radius: 20px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform 0.12s, border-color 0.12s; }
.bc:hover, .bc:focus-visible { border-color: var(--pink); transform: translateY(-2px); }
.bc b { font-size: 18px; }
.bc small { color: var(--ink-soft); }
.bc-avas { display: flex; justify-content: center; height: 44px; }
.bc-avas span { width: 40px; margin: 0 -7px; }

/* ---------- online ---------- */
.me-chip { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 14px; }
.me-chip svg { width: 40px; }
.or { text-align: center; color: var(--ink-soft); font-weight: 700; margin: 12px 0; }
.join-row { display: flex; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-size: 26px; font-weight: 800; }
.room-code { text-align: center; background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 16px; }
.room-code .code { font-size: 50px; font-weight: 800; letter-spacing: 10px; color: var(--pink-d); line-height: 1.1; margin: 2px 0 8px; padding-left: 10px; }
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 18px; padding: 8px 12px; box-shadow: 0 3px 0 var(--line); position: relative; animation: popIn 0.3s ease; }
.slot.empty { background: rgba(255, 255, 255, 0.5); box-shadow: none; border: 2px dashed var(--line); animation: none; }
.slot.offline { opacity: 0.6; }
.slot-ava { width: 46px; height: 46px; display: grid; place-items: center; font-size: 22px; flex: none; }
.slot-ava svg { width: 46px; }
.slot-name { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.kick { border: 0; background: #ffe6ec; color: var(--red); border-radius: 50%; width: 28px; height: 28px; font-weight: 800; flex: none; }
.lobby-btns { display: flex; gap: 10px; margin-top: 18px; }
.lobby-btns .btn.ghost { flex: none; }
.waiting { width: 100%; text-align: center; font-weight: 800; font-size: 18px; margin: 6px 0; }
.dots i { animation: dot 1.2s infinite; font-style: normal; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 50% { opacity: 0.2; } }
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } }

.conn { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; translate: -50% 0; z-index: 90; background: #fff2cc; border: 2px solid #ffe08a; color: var(--ink); font-weight: 800; padding: 6px 14px; border-radius: 99px; box-shadow: var(--shadow); font-size: 14px; }

/* ---------- lá bài ---------- */
.card {
  --c: #ff8fb1; --c2: #fff0f5;
  width: var(--cw); aspect-ratio: 5 / 7; border-radius: 13px; background: #fff; border: 3px solid var(--c);
  box-shadow: 0 3px 0 rgba(91, 58, 74, 0.14), 0 6px 14px rgba(91, 58, 74, 0.1);
  display: flex; flex-direction: column; overflow: hidden; position: relative; flex: none;
}
.card-name {
  background: var(--c); color: #fff; font-weight: 800; font-size: calc(var(--cw) * 0.135); text-align: center;
  padding: 2px 3px 1px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.card-art { flex: 1; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #fff 0, var(--c2) 70%); padding: 4px; min-height: 0; }
.card-art svg { width: 100%; height: 100%; display: block; }
.card-desc { font-size: 11px; line-height: 1.25; padding: 4px 6px 6px; background: #fff; text-align: center; font-weight: 600; }
.card.mini { --cw: 58px; border-width: 2.5px; border-radius: 10px; }
.card.mini .card-name { font-size: 8.5px; }
.card.t-bomb { --c: #4e4468; --c2: #ffe0e6; }
.card.t-defuse { --c: #4fc89a; --c2: #e3fbf1; }
.card.t-attack { --c: #ff7a6b; --c2: #ffeae5; }
.card.t-skip { --c: #6fa8f5; --c2: #e6f1ff; }
.card.t-favor { --c: #a98bff; --c2: #f1ebff; }
.card.t-shuffle { --c: #f5b638; --c2: #fff6dc; }
.card.t-future { --c: #7d78e8; --c2: #eceaff; }
.card.t-nope { --c: #ff5c8d; --c2: #ffe8f0; }
.card.t-mochi { --c: #f59ab7; --c2: #fff0f5; }
.card.t-flan { --c: #e0a050; --c2: #fff4e1; }
.card.t-matcha { --c: #86bf5f; --c2: #eff9e6; }
.card.t-taro { --c: #a986d6; --c2: #f4ecfd; }
.card.t-dau { --c: #ff7088; --c2: #fff0f2; }
.card.back { background: #ff9ebd; border-color: #fff; background-image: radial-gradient(circle, rgba(255, 255, 255, 0.35) 18%, transparent 20%), radial-gradient(circle, rgba(255, 255, 255, 0.35) 18%, transparent 20%); background-size: 16px 16px; background-position: 0 0, 8px 8px; box-shadow: 0 0 0 2px #f07ca1 inset, 0 3px 0 rgba(91, 58, 74, 0.15); }
.back-logo { flex: 1; display: grid; place-items: center; padding: 10%; }
.back-logo svg { width: 100%; }
.card.back.inline { --cw: 20px; display: inline-flex; vertical-align: middle; border-width: 1.5px; border-radius: 4px; }
.card.back.inline .back-logo { padding: 0; }
.card.wobble { animation: wobble 1.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }

/* ---------- ván chơi ---------- */
.game {
  display: flex; flex-direction: column; height: 100dvh; max-width: 980px; margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); gap: 6px; overflow: hidden; position: relative;
}
.g-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.g-title { font-weight: 800; font-size: 15px; background: rgba(255, 255, 255, 0.75); padding: 4px 14px; border-radius: 99px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.opps { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 96px; }
.opp { position: relative; width: 74px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform 0.2s, opacity 0.3s, filter 0.3s; }
.opp-ava { width: 56px; height: 56px; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; padding: 3px; border: 3px solid transparent; transition: border-color 0.2s, box-shadow 0.2s; }
.opp-ava svg { width: 100%; height: 100%; }
.opp-name { font-size: 12.5px; font-weight: 800; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.opp-count { display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; }
.mini-back { width: 10px; height: 14px; border-radius: 3px; background: #ff9ebd; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #f07ca1; }
.opp-badges { display: flex; gap: 2px; min-height: 16px; flex-wrap: wrap; justify-content: center; }
.opp.current .opp-ava { border-color: var(--butter); box-shadow: 0 0 0 4px rgba(255, 214, 107, 0.45), 0 3px 0 var(--line); animation: breathe 1.2s ease-in-out infinite; }
.opp.current { transform: translateY(2px); }
@keyframes breathe { 50% { box-shadow: 0 0 0 8px rgba(255, 214, 107, 0.2), 0 3px 0 var(--line); } }
.opp.dead { opacity: 0.45; filter: grayscale(0.9); }
.opp.away .opp-ava { opacity: 0.6; }
.opp.winner .opp-ava { border-color: var(--butter); }

.table { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 16px; position: relative; flex-wrap: wrap; align-content: center; }
.pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pile-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.pile { --cw: 84px; position: relative; width: var(--cw); aspect-ratio: 5 / 7; border: 0; padding: 0; background: none; }
.deck .stack { position: absolute; inset: 0; }
.deck .stack .card { position: absolute; inset: 0; }
.deck .stack .s3 { transform: translate(5px, 6px) rotate(4deg); }
.deck .stack .s2 { transform: translate(2px, 3px) rotate(-3deg); }
.pile-count { position: absolute; bottom: -8px; right: -10px; background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; min-width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; padding: 0 7px; border: 3px solid #fff; }
.deck.can { cursor: pointer; animation: deckGlow 1.3s ease-in-out infinite; border-radius: 13px; }
.deck.can::after { content: 'Chạm để bốc'; position: absolute; top: -24px; left: 50%; translate: -50% 0; white-space: nowrap; font-size: 12px; font-weight: 800; background: var(--butter); padding: 1px 9px; border-radius: 99px; }
@keyframes deckGlow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 214, 107, 0)); transform: translateY(0); } 50% { filter: drop-shadow(0 0 12px rgba(255, 196, 60, 0.9)); transform: translateY(-3px); } }
.deck.low .pile-count { background: var(--red); }
.deck.spin .stack { animation: spinDeck 0.7s ease; }
@keyframes spinDeck { 30% { transform: rotate(-12deg) scale(1.06); } 60% { transform: rotate(14deg) scale(1.06); } }
.deck.peek .stack .s1 { animation: peek 0.9s ease; }
@keyframes peek { 40% { transform: translateY(-18px) rotate(-6deg); } }
.discard .card { position: absolute; inset: 0; }
.discard .card.d0 { transform: rotate(4deg); z-index: 3; animation: landCard 0.3s ease; }
.discard .card.d1 { transform: rotate(-7deg) translate(-4px, 2px); z-index: 2; filter: brightness(0.96); }
.discard .card.d2 { transform: rotate(10deg) translate(4px, 3px); z-index: 1; filter: brightness(0.92); }
@keyframes landCard { from { transform: scale(1.25) rotate(-8deg); opacity: 0.5; } }
.empty-pile { position: absolute; inset: 0; border: 3px dashed var(--line); border-radius: 13px; display: grid; place-items: center; font-size: 26px; opacity: 0.6; }

.danger { background: rgba(255, 255, 255, 0.85); border-radius: 18px; padding: 8px 12px; min-width: 150px; max-width: 230px; box-shadow: 0 3px 0 var(--line); text-align: center; }
.danger-face { font-weight: 800; font-size: 18px; }
.danger-text { font-size: 12.5px; }
.danger-bar { height: 8px; background: #ffe6ec; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.danger-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--butter), var(--red)); background-size: 300px 100%; border-radius: 99px; transition: width 0.4s; }
.danger[data-lvl='3'] { animation: dangerPulse 0.9s ease-in-out infinite; }
@keyframes dangerPulse { 50% { box-shadow: 0 0 0 4px rgba(255, 92, 122, 0.35); } }
.known { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; font-size: 11px; margin-top: 4px; }
.known:empty { display: none; }
.known > span:first-child { width: 100%; font-weight: 800; }
.kn { background: #f4f0ff; border-radius: 8px; padding: 0 6px; font-weight: 700; }
.kn.t-bomb { background: #4e4468; color: #fff; }

.react {
  position: absolute; z-index: 20; left: 50%; top: 50%; translate: -50% -50%; width: min(340px, 94%);
  background: #fff; border-radius: 22px; padding: 12px 14px; box-shadow: 0 8px 0 rgba(91, 58, 74, 0.12), 0 16px 40px rgba(91, 58, 74, 0.25);
  text-align: center; border: 3px solid var(--butter);
}
.react.pop { animation: popIn 0.25s ease; }
.react-who { font-size: 15px; }
.react-cards { display: flex; justify-content: center; gap: 4px; margin: 8px 0; }
.react-state { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.react-state.off b { color: var(--red); }
.tbar { height: 8px; border-radius: 99px; background: #f6e7ec; overflow: hidden; margin: 8px 0 4px; }
.tbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--pink), var(--butter)); border-radius: 99px; }
.nope-btn { --c: var(--red); --cd: #d43a5c; width: 100%; margin-top: 6px; font-size: 20px; animation: nopeBounce 0.6s ease-in-out infinite alternate; }
@keyframes nopeBounce { to { transform: scale(1.04); } }

.status { text-align: center; font-weight: 700; font-size: 15px; min-height: 24px; }
.status.mine .status-text { background: var(--butter); padding: 2px 14px; border-radius: 99px; }
.status-timer { max-width: 220px; margin: 4px auto 0; height: 6px; }
.status-timer.urgent i { background: var(--red); animation: blink 0.5s infinite alternate; }
@keyframes blink { to { opacity: 0.5; } }

.me-bar { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.85); border-radius: 20px; padding: 6px 10px; box-shadow: 0 3px 0 var(--line); position: relative; }
.me-bar.current { box-shadow: 0 0 0 3px var(--butter), 0 3px 0 var(--line); }
.me-bar.dead { filter: grayscale(0.8); }
.me-ava { width: 48px; flex: none; }
.me-ava .opp-ava { width: 48px; height: 48px; }
.me-info { flex: 1; min-width: 0; }
.me-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { font-weight: 600; color: var(--ink-soft); }
.me-sub { font-size: 13px; color: var(--ink-soft); }

.actions { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.sel-info { flex: 1; font-size: 13px; line-height: 1.25; min-width: 0; }
.sel-info .hint { color: var(--ink-soft); }
.action-btns { display: flex; gap: 6px; flex: none; }
.action-btns .btn { padding: 10px 16px; font-size: 16px; }
.actions.mine .draw-btn:not(:disabled) { animation: pulse 1.4s ease-in-out infinite; }

.hand { --ov: 6px; display: flex; justify-content: center; align-items: flex-end; padding: 22px 12px 6px; min-height: calc(var(--cw) * 1.4 + 30px); overflow: visible; }
.hand .card { transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.6, 1), box-shadow 0.18s; cursor: pointer; }
.hand .card + .card { margin-left: var(--ov); }
.hand .card:hover { transform: translateY(-6px); z-index: 5; }
.hand .card.sel { transform: translateY(-20px) scale(1.04); z-index: 6; box-shadow: 0 0 0 3px var(--butter), 0 10px 18px rgba(91, 58, 74, 0.25); }
.hand .card .card-name { text-align: left; padding-left: 6px; }
.hand .card.usable::after { content: ''; position: absolute; bottom: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--butter); box-shadow: 0 0 0 2px #fff; }
.hand .card.glow { animation: glowNope 0.8s ease-in-out infinite alternate; z-index: 4; }
@keyframes glowNope { to { box-shadow: 0 0 0 4px rgba(255, 92, 141, 0.6), 0 0 20px rgba(255, 92, 141, 0.7); transform: translateY(-10px); } }
.hand .card.new { animation: dealIn 0.45s cubic-bezier(0.3, 1.5, 0.6, 1); }
@keyframes dealIn { from { transform: translateY(-120px) scale(0.6) rotate(-20deg); opacity: 0; } }
.hand-empty { font-weight: 700; color: var(--ink-soft); padding: 20px; text-align: center; }

.emote-bar { position: absolute; bottom: calc(var(--cw) * 1.4 + 120px); left: 50%; translate: -50% 0; background: #fff; border-radius: 99px; padding: 6px; display: flex; gap: 2px; box-shadow: var(--shadow); z-index: 30; animation: popIn 0.2s; max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.emote-bar button { border: 0; background: none; font-size: 26px; width: 42px; height: 42px; border-radius: 50%; }
.emote-bar button:hover { background: #fff0f5; }
.bubble { position: absolute; top: -18px; left: 50%; translate: -50% 0; font-size: 34px; z-index: 40; animation: bubbleUp 2.2s ease forwards; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15)); }
@keyframes bubbleUp { 0% { transform: scale(0.2); opacity: 0; } 12% { transform: scale(1.3); opacity: 1; } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }

.flying { position: fixed; z-index: 70; pointer-events: none; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease-in; }
.flying .card { --cw: 100%; width: 100%; }

.stamp { position: absolute; z-index: 25; left: 50%; top: 42%; translate: -50% -50%; pointer-events: none; text-align: center; animation: stampIn 1.3s ease forwards; }
.stamp-in { font-size: 42px; font-weight: 800; color: #fff; padding: 4px 22px; border-radius: 18px; transform: rotate(-8deg); border: 5px solid #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2); white-space: nowrap; }
.stamp small { display: block; font-weight: 800; font-size: 16px; margin-top: 4px; }
.stamp.nope .stamp-in { background: var(--red); }
.stamp.attack .stamp-in { background: #ff7a6b; }
@keyframes stampIn { 0% { transform: scale(3); opacity: 0; } 15% { transform: scale(0.9); opacity: 1; } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }

.shake { animation: shake 0.5s; }
.big-shake { animation: shake 0.7s; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(5px); } 30%, 50%, 70% { transform: translateX(-8px) rotate(-0.5deg); } 40%, 60% { transform: translateX(8px) rotate(0.5deg); } }

/* hiệu ứng Mèo Bùm */
.bomb-ov { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(60, 40, 70, 0.55); opacity: 0; transition: opacity 0.25s, background 0.3s; pointer-events: none; overflow: hidden; }
.bomb-ov.show { opacity: 1; }
.bomb-card .card { --cw: 150px; animation: bombShake 0.12s linear infinite; }
.bomb-card .card .spark { animation: spark 0.2s steps(2) infinite; transform-origin: 88px 4px; }
@keyframes bombShake { 0% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.04); } 100% { transform: rotate(-4deg) scale(1); } }
.bomb-text { color: #fff; font-size: 24px; font-weight: 800; text-align: center; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); padding: 0 16px; }
.bomb-ov.saved { background: rgba(111, 214, 173, 0.55); }
.bomb-ov.saved .card { animation: savedPop 0.5s cubic-bezier(0.3, 1.6, 0.6, 1); }
@keyframes savedPop { from { transform: scale(0.4) rotate(-20deg); } }
.bomb-ov.boom { background: rgba(255, 180, 90, 0.75); animation: flash 0.5s ease; }
.bomb-ov.boom .bomb-card .card { animation: boomCard 0.6s ease forwards; }
@keyframes boomCard { 30% { transform: scale(1.6); } 100% { transform: scale(0.2) rotate(90deg); opacity: 0; } }
@keyframes flash { 0% { background: rgba(255, 255, 255, 1); } }
.boom-bit { position: absolute; left: 50%; top: 45%; width: 16px; height: 16px; border-radius: 50%; animation: boomBit 1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }
@keyframes boomBit { to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }
.float-heart { position: absolute; bottom: 30%; width: 22px; height: 22px; animation: heartUp 1.4s ease-out forwards; font-style: normal; }
.float-heart::before { content: '💖'; font-size: 22px; }
@keyframes heartUp { from { transform: translateY(0) scale(0.4); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-260px) scale(1.2); opacity: 0; } }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(91, 58, 74, 0.35); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity 0.2s; backdrop-filter: blur(3px); }
.modal-wrap.show { opacity: 1; }
.modal { background: #fffaf6; border-radius: 26px; padding: 22px 18px 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; position: relative; box-shadow: 0 10px 0 rgba(91, 58, 74, 0.1), 0 24px 60px rgba(91, 58, 74, 0.3); transform: scale(0.9) translateY(20px); transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.6, 1); }
.modal-wrap.show .modal { transform: none; }
.modal.small { width: min(400px, 100%); }
.modal.wide { width: min(640px, 100%); }
.modal h2 { font-size: 22px; margin-bottom: 6px; padding-right: 30px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #ffe6ef; font-weight: 800; }
.confirm-text { font-size: 18px; font-weight: 700; text-align: center; margin: 8px 0 4px; }

.target-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.target { display: flex; align-items: center; gap: 10px; border: 3px solid var(--line); background: #fff; border-radius: 18px; padding: 6px 12px; text-align: left; font-size: 17px; font-weight: 800; }
.target:hover:not(:disabled) { border-color: var(--pink); }
.target:disabled { opacity: 0.4; }
.t-ava { width: 44px; flex: none; }
.t-name { flex: 1; }
.t-count { font-size: 13px; color: var(--ink-soft); }
.name-grid, .give-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; margin-top: 12px; justify-items: center; }
.name-pick, .give { border: 0; background: none; padding: 4px; border-radius: 14px; transition: transform 0.12s, background 0.12s; }
.name-pick:hover, .give:hover { transform: translateY(-4px); background: #ffe6ef; }
.future-row { display: flex; justify-content: center; gap: 10px; margin: 14px 0 4px; }
.future-slot { position: relative; animation: popIn 0.4s ease backwards; }
.future-slot:nth-child(2) { animation-delay: 0.12s; }
.future-slot:nth-child(3) { animation-delay: 0.24s; }
.future-slot .card { --cw: 96px; }
.future-slot .num { position: absolute; top: -10px; left: -8px; z-index: 2; background: var(--ink); color: #fff; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; border: 2px solid #fff; }
.defuse-head { display: flex; gap: 12px; align-items: center; }
.quick-pos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.quick-pos button { border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 6px; font-weight: 800; font-size: 15px; }
.quick-pos button:hover { border-color: var(--mint); }
.slider-label { font-size: 14px; font-weight: 700; }
.pos-range { width: 100%; accent-color: var(--pink); height: 28px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.menu-list button { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 12px; font-weight: 800; font-size: 17px; text-align: left; }
.menu-list .danger-btn { color: var(--red); }
.log-list { display: flex; flex-direction: column; gap: 4px; font-size: 14px; max-height: 60dvh; overflow: auto; margin-top: 8px; }
.log-list div { background: #fff; padding: 5px 10px; border-radius: 10px; }
.over { text-align: center; }
.over-ava { width: 120px; margin: 24px auto 6px; position: relative; animation: bounce 0.9s ease-in-out infinite alternate; }
.over-ava .crown { position: absolute; top: -26px; left: 50%; translate: -50% 0; font-size: 38px; }
.over h2 { padding: 0; font-size: 26px; }

/* hướng dẫn */
.modal.guide { width: min(680px, 100%); }
.guide-title { text-align: center; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 10px; scrollbar-width: none; }
.tabs button { border: 0; background: #fff; border-radius: 99px; padding: 7px 13px; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 0 var(--line); font-size: 14px; }
.tabs button.on { background: var(--pink); color: #fff; box-shadow: 0 2px 0 var(--pink-d); }
.guide-body { font-size: 15px; }
.guide-body h3 { font-size: 18px; margin: 4px 0; }
.guide-body h4 { font-size: 16px; }
.guide-body p { margin: 2px 0 6px; }
.guide-hero { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 18px; padding: 12px; }
.steps { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 16px; padding: 10px 12px; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.guide-ui { background: #f4fbff; border-radius: 16px; padding: 10px 14px; }
.guide-ui ul { padding-left: 4px; list-style: none; margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.guide-cards { display: flex; flex-direction: column; gap: 8px; }
.gc { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 8px 12px; }
.gc.cats { flex-direction: column; align-items: stretch; }
.cat-row { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.tips { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tips li { background: #fff; border-radius: 14px; padding: 10px 12px; }

/* toast */
#toasts { position: fixed; top: max(56px, calc(env(safe-area-inset-top) + 50px)); left: 50%; translate: -50% 0; z-index: 95; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(420px, 92vw); }
.toast { background: #fff; border-radius: 16px; padding: 7px 14px; font-size: 14px; box-shadow: 0 4px 0 rgba(91, 58, 74, 0.08), 0 8px 22px rgba(91, 58, 74, 0.18); animation: toastIn 0.3s cubic-bezier(0.3, 1.5, 0.6, 1); transition: opacity 0.35s, transform 0.35s; text-align: center; border: 2px solid var(--line); }
.toast.mine { background: var(--butter); border-color: #ffc93d; font-weight: 700; }
.toast.good { background: #e3fbf1; border-color: #b2ecd4; }
.toast.warn { background: #fff2cc; border-color: #ffe08a; }
.toast.err { background: #ffe6ec; border-color: #ffc2cf; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toastIn { from { transform: translateY(-16px) scale(0.9); opacity: 0; } }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 110; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
.confetti i.heart { width: 14px; height: 14px; border-radius: 50% 50% 0 50%; rotate: 45deg; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* ---------- màn hình lớn / nhỏ ---------- */
@media (min-width: 720px) {
  :root { --cw: 96px; }
  .pile { --cw: 104px; }
  .opp { width: 92px; }
  .opp-ava { width: 66px; height: 66px; }
  .opps { gap: 14px; }
  .card.mini { --cw: 66px; }
  .table { gap: 28px; }
  .react { width: 380px; }
}
@media (max-height: 680px) {
  :root { --cw: 64px; }
  .pile { --cw: 66px; }
  .opps { min-height: 82px; }
  .opp-ava { width: 46px; height: 46px; }
  .hand { padding-top: 16px; }
  .danger { padding: 4px 8px; }
}
@media (max-width: 360px) {
  .action-btns .btn { padding: 9px 12px; font-size: 15px; }
  .danger { min-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
