/* 3817 Highland — minimalist burgundy / black / white. Mobile-first. */
:root {
  --brand: #7b1e2e; --brand-2: #9c2a3f; --brand-ink: #ffffff; --gold: #f3c46b;
  --bg: #f7f4f4; --surface: #ffffff; --surface-2: #f1ecec; --text: #151214; --muted: #77696d;
  --line: #e8e0e1; --ok: #1f7a4d; --err: #b42333; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(60,10,20,.06);
  --pos: #7b1e2e;
  --radius: 14px; --tab-h: 60px; --head-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #a53349; --brand-2: #c0445c; --brand-ink: #ffffff;
  --bg: #0d0b0c; --surface: #171415; --surface-2: #221c1e; --text: #f2eced; --muted: #9b8e92;
  --line: #2c2427; --ok: #43b37a; --err: #ec5a6c; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --pos: #ff8fa1;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ok { color: var(--ok); } .err { color: var(--err); }
.pos { color: var(--pos); font-weight: 700; }
.neg { color: var(--muted); }
.sec-title { font-weight: 700; font-size: 15px; margin: 6px 2px 12px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@keyframes fadeIn { from { opacity: 0; } }
.fade-in { animation: fadeUp .35s var(--ease); }

/* ---------- buttons & inputs (animated) ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 16px; background: var(--brand); color: var(--brand-ink);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s, opacity .15s, background .2s;
}
.btn svg.i { width: 17px; height: 17px; }
@media (hover: hover) { .btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(123,30,46,.22); } }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.soft { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--err); }
.btn.glass { background: rgba(255,255,255,.16); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(165,51,73,0); transform: scale(1.06); } 0% { box-shadow: 0 0 0 0 rgba(165,51,73,.5); } }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); animation: ripple .6s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }
.spin svg { animation: spin .7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.input {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(123,30,46,.12); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0; }
.icon-btn { background: none; border: 0; padding: 7px; border-radius: 9px; cursor: pointer; color: var(--muted); display: inline-flex; transition: background .15s, color .15s, transform .12s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.copy { padding: 3px; vertical-align: -4px; }
.icon-btn.copy svg { width: 15px; height: 15px; }
.icon-btn.danger-i:hover { color: var(--err); }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 360px; text-align: left; }
.auth-logo { display: block; width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; object-fit: cover; box-shadow: var(--shadow); }
.logo { font-weight: 800; letter-spacing: .4px; color: var(--brand); }
:root[data-theme="dark"] .logo { color: #e06a80; }
.logo-big { font-size: 30px; text-align: center; margin-bottom: 4px; }
.logo-sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 13px; letter-spacing: 2px; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { position: relative; overflow: hidden; flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; transition: background .2s, color .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-err { min-height: 20px; color: var(--err); font-size: 13px; margin-top: 10px; }
.langsw { text-align: center; margin-top: 22px; color: var(--muted); font-size: 13px; }
.langsw button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; }
.langsw button.on { color: var(--brand); font-weight: 700; }

/* ---------- shell ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: var(--bg); }
.head { height: var(--head-h); flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; flex: none; }
.head .logo { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .15s; flex: none; }
.chip:active { transform: scale(.95); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.main.noscroll { overflow: hidden; display: flex; flex-direction: column; }
.page { padding: 16px 16px 28px; }
.tabs { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--surface); height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
.tabs button { position: relative; overflow: hidden; flex: 1; min-width: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--muted); cursor: pointer; transition: color .2s; }
.tabs button span:not(.badge) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.tabs button svg { transition: transform .25s var(--ease); }
.tabs button.on { color: var(--brand); font-weight: 600; }
.tabs button.on svg { transform: translateY(-2px) scale(1.1); }
:root[data-theme="dark"] .tabs button.on { color: #e06a80; }
.tabs .badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--err); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; animation: pop .3s var(--ease); }
@keyframes pop { from { transform: scale(0); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
details.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
details.sec > summary { list-style: none; padding: 14px 16px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background .15s; }
details.sec > summary:hover { background: var(--surface-2); }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .25s var(--ease); margin-right: 4px; flex: none; }
details.sec[open] > summary::after { transform: rotate(-135deg); }
details.sec[open] > .body { animation: fadeUp .25s var(--ease); }
details.sec > .body { padding: 0 16px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 > .input { margin-top: 8px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.tag { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); margin-left: 4px; vertical-align: 1px; font-weight: 600; }
.tag.brand { background: var(--brand); color: #fff; }
.tag.brand.soft { background: rgba(123,30,46,.14); color: var(--brand); }
:root[data-theme="dark"] .tag.brand.soft { background: rgba(224,106,128,.18); color: #ff9db0; }

/* ---------- game list ---------- */
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--surface); border-radius: 22px; padding: 0; text-align: left; cursor: pointer; box-shadow: var(--shadow); color: var(--text); display: flex; flex-direction: column; aspect-ratio: 1 / 1.18; transition: transform .25s var(--ease), box-shadow .25s; animation: fadeUp .4s var(--ease) both; }
.game:nth-child(2) { animation-delay: .08s; }
@media (hover: hover) { .game.ccd:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(123,30,46,.25); } }
.game.ccd:active { transform: scale(.97); }
.g-art { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #b8324b, #5c1220 75%); overflow: hidden; }
.g-glow { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(243,196,107,.35), transparent 30%); animation: spin 6s linear infinite; }
.g-env { position: relative; z-index: 1; width: 56px; height: 70px; border-radius: 9px; background: linear-gradient(#d9475f, #a52a40); box-shadow: 0 8px 20px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; animation: float 3s ease-in-out infinite; }
.g-env::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 26px; border-radius: 9px 9px 50% 50%; background: #c13a52; }
.g-env span { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #7b1e2e; font-weight: 900; display: flex; align-items: center; justify-content: center; margin-top: 6px; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-3deg); } }
.game.soon { cursor: default; opacity: .75; }
.game.soon .g-art { background: var(--surface-2); }
.g-q { font-size: 40px; font-weight: 800; color: var(--muted); }
.g-info { padding: 12px 14px 14px; }
.g-name { font-weight: 800; font-size: 15px; }
.g-sub { font-size: 12px; color: var(--muted); }
.g-live { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live-dot.on { background: #2fbf71; box-shadow: 0 0 0 0 rgba(47,191,113,.6); animation: livep 1.6s infinite; }
@keyframes livep { 70% { box-shadow: 0 0 0 6px rgba(47,191,113,0); } }

/* entering animation */
.enter { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; pointer-events: none; }
.enter-bg { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, #b8324b, #3b0a14 70%, #120306); animation: entBg .5s var(--ease); clip-path: circle(150% at 50% 45%); }
@keyframes entBg { from { clip-path: circle(0% at 50% 45%); } }
.enter-env { position: relative; width: 92px; height: 116px; border-radius: 14px; background: linear-gradient(#e04e66, #a52a40); box-shadow: 0 18px 50px rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; animation: entEnv .8s var(--ease) both; }
.enter-env .flap { position: absolute; top: 0; left: 0; right: 0; height: 44px; border-radius: 14px 14px 50% 50%; background: #c13a52; transform-origin: top; animation: flap .5s .55s var(--ease) both; }
.enter-env span { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--gold); color: #7b1e2e; font-weight: 900; font-size: 22px; display: flex; align-items: center; justify-content: center; margin-top: 10px; animation: coin .6s .6s var(--ease) both; }
@keyframes entEnv { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.12) rotate(6deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes flap { to { transform: rotateX(180deg); } }
@keyframes coin { 50% { transform: translateY(-34px) scale(1.25); } 100% { transform: translateY(-6px) scale(1.1); } }
.enter-title { position: relative; margin-top: 22px; font-size: 26px; font-weight: 800; letter-spacing: 6px; animation: title .7s .25s var(--ease) both; }
@keyframes title { from { letter-spacing: 18px; opacity: 0; } }
.enter-sub { position: relative; font-size: 13px; opacity: .8; letter-spacing: 4px; animation: fadeIn .6s .45s both; }
.enter-burst { position: absolute; left: 50%; top: 45%; }
.enter-burst i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); transform: rotate(var(--a)) translateY(0); animation: burst .9s calc(.45s + var(--d)) var(--ease) both; }
.enter-burst i:nth-child(3n) { background: #fff; width: 5px; height: 5px; }
@keyframes burst { 0% { transform: rotate(var(--a)) translateY(0) scale(0); opacity: 1; } 100% { transform: rotate(var(--a)) translateY(-150px) scale(1); opacity: 0; } }
.enter.out { animation: entOut .45s var(--ease) forwards; }
@keyframes entOut { to { opacity: 0; transform: scale(1.08); } }

/* ---------- room ---------- */
.lobby { position: relative; display: flex; flex-direction: column; height: 100%; animation: fadeIn .3s; }
.roombar { flex: none; display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.roombar .rt { font-weight: 800; font-size: 15px; line-height: 1.2; }
.ann { flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--brand); color: #fff; font-size: 13.5px; animation: fadeUp .3s; }
.ann .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ann button { background: none; border: 0; color: #fff; opacity: .8; cursor: pointer; padding: 2px 4px; display: inline-flex; }
.phase { flex: none; margin: 10px 12px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; gap: 12px; align-items: center; }
.ring { position: relative; width: 54px; height: 54px; flex: none; }
.ring svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--surface-2); }
.ring .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring .n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.ring.urgent .fg { stroke: var(--err); }
.ring.urgent .n { color: var(--err); animation: tick 1s infinite; }
@keyframes tick { 0% { transform: scale(1.25); } 30% { transform: scale(1); } }
.phase .title { font-weight: 700; font-size: 14.5px; }
.phase .line { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase .mine { font-size: 12.5px; color: var(--pos); font-weight: 600; }
.trendrow { margin-top: 4px; display: flex; flex-wrap: nowrap; overflow: hidden; align-items: center; }
.tr { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; }
.tr.latest { background: var(--brand); color: #fff; font-weight: 700; }
.tr-arrow { font-size: 10px; color: var(--muted); margin: 0 2px; }
.idle-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.admin-start { flex: none; margin: 8px 12px 0; }
.admin-start details.sec { margin: 0; }
.admin-start .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.admin-start .grid3 .input { padding: 9px 10px; }

.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 6px; -webkit-overflow-scrolling: touch; }
.msg { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-start; }
.msg.fresh { animation: msgIn .3s var(--ease); }
.msg.me.fresh { animation-name: msgInMe; }
@keyframes msgIn { from { opacity: 0; transform: translateX(-10px); } }
@keyframes msgInMe { from { opacity: 0; transform: translateX(10px); } }
.msg.me { flex-direction: row-reverse; }
.av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; overflow: hidden; background: #8a7a7e; }
.av[data-profile] { cursor: pointer; transition: transform .15s; }
.av[data-profile]:active { transform: scale(.9); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sys { background: var(--text); color: var(--bg); font-size: 11px; letter-spacing: .5px; }
.av.sm { width: 30px; height: 30px; font-size: 12px; }
.av.lg { width: 64px; height: 64px; font-size: 24px; }
.av.xl { width: 104px; height: 104px; font-size: 38px; }
.mbody { max-width: 78%; min-width: 0; }
.msg.me .mbody { display: flex; flex-direction: column; align-items: flex-end; }
.mname { font-size: 11.5px; color: var(--muted); margin: 0 4px 3px; }
.mname[data-profile] { cursor: pointer; }
.mname[data-profile]:hover { color: var(--brand); }
.bubble { background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; border-radius: 4px 14px 14px 14px; word-break: break-word; white-space: pre-wrap; }
.msg.me .bubble { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); border-radius: 14px 4px 14px 14px; }
.bubble.sys { font-size: 14px; }
.bubble.bet { font-weight: 700; font-variant-numeric: tabular-nums; }
.bubble.sc, .bubble.res { white-space: normal; }
.mtime { font-size: 10.5px; color: var(--muted); margin: 3px 4px 0; }
.msg.ann-msg .bubble { border-color: var(--brand); }
.at { color: var(--pos); font-weight: 600; cursor: pointer; }
.at:hover { text-decoration: underline; }
.sc { min-width: 230px; }
.sc .h { font-weight: 700; margin-bottom: 6px; }
.sc .kv { padding: 4px 0; font-size: 13.5px; }
.sc .list { margin-top: 8px; font-size: 13.5px; }
.sc .list div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }

.packet { position: relative; width: 240px; border-radius: 14px; overflow: hidden; background: linear-gradient(160deg, #a12a40, #6e1726); color: #fff; box-shadow: 0 6px 18px rgba(110,23,38,.3); cursor: pointer; transition: transform .2s var(--ease); }
.packet:active { transform: scale(.98); }
.packet.ended { filter: saturate(.75); }
.packet.pop { animation: packetPop .7s var(--ease) both; }
@keyframes packetPop { 0% { transform: scale(.2) rotate(-12deg); opacity: 0; } 55% { transform: scale(1.08) rotate(3deg); opacity: 1; } 75% { transform: scale(.97) rotate(-1deg); } 100% { transform: none; } }
.packet .shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-100%); pointer-events: none; }
.packet.pop .shine, .packet:not(.ended) .shine { animation: shine 2.4s .6s ease-in-out infinite; }
.packet.ended .shine { display: none; }
@keyframes shine { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }
.packet .top { padding: 14px 16px 10px; display: flex; gap: 12px; align-items: center; }
.packet .env { width: 38px; height: 46px; border-radius: 6px; background: #c8394f; position: relative; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.packet .env::after { content: '¥'; position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #8b1b2e; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.packet .bot { background: rgba(0,0,0,.18); padding: 8px 16px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.packet .grab-btn { position: relative; overflow: hidden; background: var(--gold); color: #6e1726; border: 0; border-radius: 999px; padding: 6px 16px; font-weight: 800; cursor: pointer; animation: pulse 1.2s ease-in-out infinite; }

.res { min-width: 250px; font-size: 13.5px; }
.res .h { font-weight: 700; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.res .p { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.res .p:last-of-type { border-bottom: 0; }
.res .badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 5px; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; margin-right: 6px; vertical-align: -1px; }
.res .badge.w { background: var(--brand); color: #fff; }
.res .badge.l { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.res .badge.d { background: var(--text); color: var(--bg); }
.res .bk { margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--line); }
.res .trend { display: flex; flex-wrap: wrap; gap: 3px 0; margin-top: 6px; align-items: center; }
.res details { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.res details summary { cursor: pointer; }
.res details code { word-break: break-all; font-size: 10.5px; }

.composer { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer .input { padding: 10px 14px; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.composer .btn { border-radius: 999px; padding: 10px 18px; }
.ann-toggle { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 7px 10px; font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap; transition: all .2s; }
.ann-toggle.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tobottom { position: absolute; right: 14px; bottom: 72px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: 0 6px 18px rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transform: translateY(10px) scale(.8); pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
.tobottom.show { opacity: 1; transform: none; pointer-events: auto; }
.tobottom .dotnew { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--err); border: 2px solid var(--surface); }

/* grab list / search / chart */
.glist .gi { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); animation: fadeUp .3s var(--ease) both; }
.glist .gi:last-child { border-bottom: 0; }
.rrow { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 4px; cursor: pointer; transition: background .15s; font-size: 13.5px; }
.rrow:hover { background: var(--surface-2); }
.chart-wrap { position: relative; margin-top: 12px; touch-action: pan-y; }
.ch-title { font-size: 13px; font-weight: 600; margin: 10px 0 2px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .zero { stroke: var(--muted); stroke-width: 1; opacity: .6; }
svg.chart .axis { fill: var(--muted); font-size: 9px; }
svg.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
svg.chart .dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
svg.chart .bar.up { fill: var(--brand); }
svg.chart .bar.dn { fill: var(--muted); opacity: .55; }
svg.chart .xh { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.tip { position: absolute; top: 0; width: 150px; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 8px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.tip .pos { color: #ff9db0; }

/* ---------- wallet ---------- */
.bal { background: linear-gradient(150deg, var(--brand), #4a0f1a); color: #fff; border: 0; animation: fadeUp .4s var(--ease); }
.bal .n { font-size: 32px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.bal .s { opacity: .8; font-size: 12.5px; }
.bal .acts { display: flex; gap: 10px; margin-top: 14px; }
.bal .acts .btn { flex: 1; background: rgba(255,255,255,.16); }
.bal .acts .btn.w { background: #fff; color: #7b1e2e; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat .v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11.5px; color: var(--muted); }
.li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .a { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li .t { font-size: 13.5px; }
.li .sub { font-size: 11.5px; color: var(--muted); }
.st { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.st.approved { color: var(--ok); } .st.declined { color: var(--err); } .st.pending { color: var(--pos); }
.empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 13.5px; }
.rep-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.rep-tabs button { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13.5px; text-align: left; transition: all .2s var(--ease); }
.rep-tabs button svg { flex: none; color: var(--muted); }
.rep-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rep-tabs button.on svg { color: #fff; }
.rep-tabs button:active { transform: scale(.97); }
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rep-grid .btn { justify-content: flex-start; white-space: normal; text-align: left; }
.sumgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.sumgrid > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.sumgrid .l { font-size: 11px; color: var(--muted); }
.sumgrid .v { font-weight: 700; }
.rng { margin-top: 10px; }
.rng button { font-size: 12.5px; padding: 6px; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; background: var(--surface-2); position: sticky; top: 0; }
.tbl td.num { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.rep tbody tr:last-child td { font-weight: 700; }
.tbl.sfx td { white-space: normal; vertical-align: middle; }
.sfx-acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- account / users / config ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.avup { position: relative; cursor: pointer; }
.avedit { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.avedit svg { width: 13px; height: 13px; }
.uidrow { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.ulist .u { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ulist .u:last-child { border-bottom: 0; }
.ulist .u .row { align-items: flex-start; }
.ulist .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-left: 42px; }
.subform { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.botlist { margin-top: 14px; border-top: 1px solid var(--line); }
.botrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.botrow .bn { font-weight: 600; font-size: 14px; }
.logo-prev { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.danger-zone { margin-top: 18px; padding: 14px; border: 1px solid var(--err); border-radius: 12px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-2); border-radius: 999px; transition: .25s var(--ease); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---------- rules ---------- */
.rules h3 { color: var(--pos); }
.rules ol { margin: 0; padding-left: 20px; }
.rules li { margin-bottom: 8px; }
.odds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.odds div { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.odds b { display: block; font-size: 15px; }
.odds .x { color: var(--pos); font-weight: 800; float: right; }

/* ---------- overlays ---------- */
.toasts { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 300; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: tin .25s var(--ease); max-width: 90vw; transition: opacity .25s, transform .25s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.error { background: var(--err); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px) scale(.95); } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 150; animation: fadeIn .18s; }
.modal-bg.out { animation: fadeOut .18s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.modal { position: relative; background: var(--surface); width: 100%; max-width: 460px; max-height: 88dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 20px 18px calc(18px + var(--safe-b)); animation: sup .28s var(--ease); }
.modal.tall { min-height: 60dvh; }
.modal.wide { max-width: 760px; max-height: 92dvh; }
@keyframes sup { from { transform: translateY(40px); opacity: .5; } }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } .modal.center { animation-name: zin; } }
.modal.center { animation-name: zin; }
@keyframes zin { from { transform: scale(.85); opacity: 0; } }
.modal h3 { margin: 0 0 6px; padding-right: 30px; }
.modal .mclose { position: absolute; top: 12px; right: 12px; }
.modal .acts { display: flex; gap: 10px; margin-top: 18px; }
.modal .acts .btn { flex: 1; }
.open-packet { text-align: center; padding: 6px 0; }
.op-env { width: 70px; height: 70px; margin: 0 auto 10px; border-radius: 50%; background: var(--gold); color: #7b1e2e; font-weight: 900; font-size: 30px; display: flex; align-items: center; justify-content: center; animation: coinFlip .8s var(--ease); }
@keyframes coinFlip { 0% { transform: rotateY(0) scale(.3); } 70% { transform: rotateY(540deg) scale(1.15); } 100% { transform: rotateY(720deg) scale(1); } }
.open-packet .amt { font-size: 44px; font-weight: 800; color: var(--pos); font-variant-numeric: tabular-nums; animation: fadeUp .5s .3s both; }
.open-packet .hand { font-size: 18px; font-weight: 700; animation: fadeUp .5s .45s both; }
.profcard { text-align: center; padding: 8px 0 4px; }
.profcard .pav { display: flex; justify-content: center; margin-bottom: 12px; }
.profcard .pav .av { cursor: zoom-in; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: transform .2s; }
.profcard .pav .av:hover { transform: scale(1.04); }
.profcard .pname { font-size: 20px; font-weight: 800; }
.zoom { position: fixed; inset: 0; z-index: 250; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; touch-action: pinch-zoom; }
.zoom img { max-width: 92vw; max-height: 86dvh; border-radius: 12px; transition: transform .3s var(--ease); animation: zin .3s var(--ease); cursor: zoom-in; touch-action: pinch-zoom; }
.zoom .zx { position: absolute; top: 16px; right: 16px; color: #fff; }
.zoom.out { animation: fadeOut .2s forwards; }
.temppw { font-size: 30px; font-weight: 800; text-align: center; margin: 14px 0; letter-spacing: 4px; }

@media (min-width: 760px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
@media (max-width: 360px) { .tabs button { font-size: 9.5px; } .games { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* v3 tweaks */
.roombar .rt { background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--text); text-align: left; transition: color .15s; }
.roombar .rt:hover { color: var(--brand); }
.icon-btn.labeled { gap: 4px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface-2); padding: 6px 10px; border-radius: 999px; margin-right: 2px; }
.icon-btn.labeled svg { width: 16px; height: 16px; }
.mine-row { background: rgba(123,30,46,.08); box-shadow: inset 3px 0 0 var(--brand); border-radius: 6px; margin: 0 -6px; padding-left: 9px !important; padding-right: 6px !important; }
:root[data-theme="dark"] .mine-row { background: rgba(224,106,128,.12); }
.sc .list .mine-row { padding-top: 3px; padding-bottom: 3px; }
.tabs { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tabs.reordering button:not(.dragging) { transition: transform .15s; opacity: .7; }
.tabs button.dragging { transform: translateY(-8px) scale(1.12); background: var(--surface-2); border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.18); z-index: 2; color: var(--brand); }

/* iPhone home-screen app: keep the header below the status bar and fill the whole screen */
:root { --safe-t: env(safe-area-inset-top, 0px); }
.app { position: fixed; top: 0; bottom: 0; left: 0; right: 0; height: auto; margin: 0 auto; }
.head { height: calc(var(--head-h) + var(--safe-t)); padding-top: var(--safe-t); }
.auth { padding-top: calc(24px + var(--safe-t)); }
.enter { padding-top: var(--safe-t); }
.zoom .zx { top: calc(16px + var(--safe-t)); }

/* brand → lobby */
.brand { cursor: pointer; transition: opacity .15s; }
.brand:active { opacity: .6; }
/* upcoming game teasers */
.game.soon { cursor: pointer; opacity: 1; }
.game.soon .g-art { overflow: hidden; }
.game.soon .g-name, .game.soon .g-sub { opacity: .85; }
.game.poker .g-art { background: radial-gradient(circle at 50% 45%, #5a1a28, #24070e 75%); }
.game.bj .g-art { background: radial-gradient(circle at 50% 45%, #23395d, #0c1628 75%); }
.game.soon .g-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.18) 50%, transparent 65%); transform: translateX(-100%); animation: shine 3.2s ease-in-out infinite; }
.game.bj .g-art::after { animation-delay: 1.4s; }
.soon-badge { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.45); color: #fff; backdrop-filter: blur(4px); }
.t-cards { position: relative; width: 84px; height: 72px; z-index: 1; filter: grayscale(.15); }
.pc { position: absolute; top: 4px; width: 46px; height: 64px; border-radius: 7px; background: #fbf7f0; box-shadow: 0 6px 16px rgba(0,0,0,.35); color: #151214; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.pc b { font-size: 17px; font-weight: 800; }
.pc i { font-style: normal; font-size: 20px; }
.pc.red { color: #c0283c; }
.pc1 { left: 6px; transform: rotate(-12deg); animation: cardL 3s ease-in-out infinite; }
.pc2 { left: 32px; transform: rotate(10deg); animation: cardR 3s ease-in-out infinite; }
@keyframes cardL { 50% { transform: rotate(-16deg) translateY(-3px); } }
@keyframes cardR { 50% { transform: rotate(14deg) translateY(-3px); } }
.t-chip { position: absolute; width: 26px; height: 26px; border-radius: 50%; border: 4px dashed #fff; z-index: 1; }
.t-chip.c1 { background: #c0283c; right: 18%; bottom: 14%; }
.t-chip.c2 { background: #1d4ed8; left: 16%; bottom: 18%; width: 22px; height: 22px; }
.bj21 { position: absolute; right: 14%; bottom: 12%; z-index: 1; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #0c1628; font-weight: 900; font-size: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px rgba(255,255,255,.6), 0 6px 14px rgba(0,0,0,.4); }
.game.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* re-bet pill in the chat bar */
.rebet-pill { position: relative; overflow: hidden; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; border: 0; border-radius: 999px; padding: 6px 13px; background: var(--brand); color: #fff; cursor: pointer; animation: pop .3s var(--ease); transition: transform .15s; }
.rebet-pill:active { transform: scale(.94); }
.rebet-pill:disabled { opacity: .5; }
.rebet-pill .rb-l { font-size: 10.5px; font-weight: 600; opacity: .9; white-space: nowrap; }
.rebet-pill .rb-v { font-size: 14px; font-weight: 800; white-space: nowrap; }

.inwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.inwrap .input { flex: 1; min-width: 0; }
.inwrap .input.with-rebet { padding-right: 92px; }
.inwrap .rebet-pill { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); padding: 4px 12px; }
.inwrap .rebet-pill:active { transform: translateY(-50%) scale(.94); }
.inwrap .rebet-pill .rb-l { font-size: 10px; }
.inwrap .rebet-pill .rb-v { font-size: 13px; }

/* notifications sit at the bottom, just above the chat bar / tabs */
.toasts { top: auto; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); flex-direction: column-reverse; }
body.in-room .toasts { bottom: calc(var(--tab-h) + var(--safe-b) + 74px); }
.toast { animation: tup .25s var(--ease); }
.toast.out { transform: translateY(8px); }
@keyframes tup { from { opacity: 0; transform: translateY(12px) scale(.95); } }
.cfg-group { display: flex; align-items: baseline; gap: 8px; margin: 18px 2px 8px; padding-bottom: 6px; border-bottom: 2px solid var(--brand); font-weight: 800; font-size: 15px; color: var(--brand); letter-spacing: .3px; }
.cfg-group:first-child { margin-top: 2px; }
.cfg-group em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--muted); }
.gsel { margin-top: 10px; }
.pmod { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); text-align: left; }
.pmod .row { gap: 8px; margin-top: 6px; }
.memeic { font-size: 22px; width: 32px; text-align: center; }
/* no double-tap zoom anywhere (fast chip / button taps on phones) */
html, body, button, a, input, label, .chipb, .btn { touch-action: manipulation; }
button, .chipb { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
/* upcoming: 3 Card Poker, NGAO */
.game.tcp .g-art { background: radial-gradient(circle at 50% 45%, #1f5c45, #0b2219 75%); }
.t-cards.three { width: 104px; }
.t-cards.three .pc1 { left: 4px; } .t-cards.three .pc2 { left: 52px; }
.pc3 { left: 28px; top: 0; z-index: 1; animation: cardM 3s ease-in-out infinite; }
@keyframes cardM { 50% { transform: translateY(-5px); } }
.game.ngao .g-art { background: radial-gradient(circle at 50% 45%, #7a5414, #2a1a04 75%); display: flex; align-items: center; justify-content: center; }
.t-fan { position: relative; width: 120px; height: 76px; z-index: 1; }
.t-fan .fc { position: absolute; left: 44px; bottom: 2px; width: 32px; height: 46px; border-radius: 5px; background: #fbf7f0; color: #151214; box-shadow: 0 4px 10px rgba(0,0,0,.35);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 4px; transform-origin: 50% 130%; transform: translateX(calc(var(--k) * 7px)) rotate(calc(var(--k) * 17deg)); }
.t-fan .fc b { font-size: 13px; font-weight: 800; } .t-fan .fc.red { color: #c0283c; }
.t-bull { position: absolute; left: calc(50% - 12px); top: -2px; font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); animation: cardM 2.4s ease-in-out infinite; }
.lobby .roombar .grow > .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
