/* NodeLoc 小游戏公共外壳（games/_kit）：大厅、钱包、匹配、登录、好友房、结算、提示。
   配色跟 NodeLoc 和斗地主一致：品牌绿 #009966、橙 #ff9933；恩娜绿 #1f8a4c、奶油 #fff6e2、金 #d4a84a。
   #ui 是设计尺寸（kit.js 按游戏的 W×H 设 --W、--H），整体等比缩放；右上角 ~220×90 留给宿主的胶囊按钮。 */
:root {
  --green: #009966; --green-hi: #2ed39a; --green-deep: #06553b; --orange: #ff9933; --gold: #ffd36b;
  --ink: #13211b; --paper: #fffaf0; --red: #d0452f; --felt: #0d4433;
  --enna: #1f8a4c; --enna-deep: #136234; --brass: #d4a84a; --cream: #fff6e2;
  --W: 1280px; --H: 720px; --accent: #1f8a4c; --accent-deep: #136234;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #fff; background: radial-gradient(ellipse at 50% 42%, #1a8460 0%, #0e5a40 55%, #062e21 100%);
}
#bg { position: fixed; inset: 0; background: var(--bg, radial-gradient(ellipse at 50% 35%, #1d8a5e 0%, #0d4a33 60%, #052419 100%)); }
#bg::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background: radial-gradient(circle at 18% 22%, rgba(255,211,107,.18), transparent 30%), radial-gradient(circle at 85% 80%, rgba(46,211,154,.16), transparent 35%),
  repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 18px); }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#ui { position: fixed; left: 0; top: 0; width: var(--W); height: var(--H); transform-origin: 0 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > #hud { pointer-events: none; }
[hidden] { display: none !important; }
svg { display: block; }
body[data-screen="table"] #bg::before { opacity: .25; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
h1 { margin: 0; font-size: 46px; letter-spacing: 6px; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25); }
h2 { margin: 0; font-size: 30px; }
.sub { margin: 4px 0 0; opacity: .78; font-size: 17px; }
.fine { margin: 0; font-size: 13px; opacity: .55; text-align: center; padding: 0 20px; }
.status { min-height: 22px; margin: 0; font-size: 16px; color: var(--gold); font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.7); text-align: center; }

/* ===== 按钮 ===== */
.btn { position: relative; border: 0; border-radius: 16px; min-width: 110px; height: 56px; padding: 0 24px;
  font-family: inherit; font-size: 21px; font-weight: 800; letter-spacing: 2px; cursor: pointer; white-space: nowrap;
  color: #4a2300; background: linear-gradient(180deg, #ffd48a 0%, #ffaa3c 45%, #ff8f1f 100%);
  box-shadow: 0 5px 0 #c46510, 0 10px 20px rgba(0,0,0,.28), inset 0 1.5px 0 rgba(255,255,255,.65);
  transition: transform .08s, box-shadow .08s, filter .15s; }
.btn::after { content: ""; position: absolute; left: 6px; right: 6px; top: 3px; height: 42%; border-radius: 12px 12px 18px 18px;
  background: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,0)); pointer-events: none; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #c46510, 0 4px 10px rgba(0,0,0,.25), inset 0 1.5px 0 rgba(255,255,255,.5); }
.btn.blue { color: #fff; text-shadow: 0 1px 1px rgba(0,60,40,.5); background: linear-gradient(180deg, #4fe3ad 0%, #17b47c 50%, #0a9566 100%);
  box-shadow: 0 5px 0 #066b48, 0 10px 20px rgba(0,0,0,.28), inset 0 1.5px 0 rgba(255,255,255,.5); }
.btn.blue:active:not(:disabled) { box-shadow: 0 1px 0 #066b48, 0 4px 10px rgba(0,0,0,.25); }
.btn.red { color: #fff; text-shadow: 0 1px 1px rgba(80,10,0,.5); background: linear-gradient(180deg, #ff8a74 0%, #e4523a 50%, #c23a24 100%);
  box-shadow: 0 5px 0 #8e2414, 0 10px 20px rgba(0,0,0,.28), inset 0 1.5px 0 rgba(255,255,255,.45); }
.btn.red:active:not(:disabled) { box-shadow: 0 1px 0 #8e2414, 0 4px 10px rgba(0,0,0,.25); }
.btn.ghost { color: #fff; background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  box-shadow: 0 5px 0 rgba(0,0,0,.28), 0 10px 20px rgba(0,0,0,.2), inset 0 0 0 1.5px rgba(255,255,255,.28); }
.btn.ghost::after { opacity: .35; }
.btn.ghost:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0,0,0,.28), inset 0 0 0 1.5px rgba(255,255,255,.28); }
.btn:disabled { filter: grayscale(.85); opacity: .45; cursor: default; }
.btn.small { height: 44px; min-width: 0; font-size: 17px; border-radius: 12px; padding: 0 16px; letter-spacing: 1px; }
.btn.tiny { height: 36px; min-width: 0; font-size: 15px; border-radius: 10px; padding: 0 12px; letter-spacing: 0; box-shadow: 0 3px 0 #c46510; }
.btn.tiny.blue { box-shadow: 0 3px 0 #066b48; }
.btn.tiny.ghost { box-shadow: 0 3px 0 rgba(0,0,0,.28), inset 0 0 0 1.5px rgba(255,255,255,.28); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.06); } }
.row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; cursor: pointer;
  background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); font-family: inherit; font-size: 20px; font-weight: 800; }
.round svg { width: 24px; height: 24px; }
.round:active { transform: scale(.94); }
.chip { border: 0; border-radius: 999px; padding: 7px 14px; font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
  color: #4a2300; background: linear-gradient(#ffd48a, #ffa53a); box-shadow: 0 2px 0 #c46510; }
.chip:active { transform: translateY(2px); box-shadow: none; }
.chip.ghost { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.chip.ghost-dark { background: #fff; color: var(--green-deep); box-shadow: inset 0 0 0 1.5px rgba(0,153,102,.45); }
.chip:disabled { opacity: .4; cursor: default; }

/* ===== 大厅 ===== */
.lobby { justify-content: flex-end; padding: 0 40px 34px; gap: 16px; }
.lobby-top { position: absolute; left: 40px; right: 40px; top: 28px; padding-right: 200px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portrait .lobby-top { flex-direction: column; align-items: flex-start; padding-right: 0; top: 110px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 { font-size: 42px; text-shadow: 0 3px 0 rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.45); }
.brand .sub { text-shadow: 0 1px 6px rgba(0,0,0,.6); opacity: .9; font-size: 16px; }
.logo { flex: none; width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #34c97a, var(--enna-deep) 70%); box-shadow: 0 10px 24px rgba(0,0,0,.4), inset 0 0 0 2px rgba(243,214,138,.55); }
.logo svg { width: 76px; height: 76px; }
.wallet { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 999px; font-size: 16px; cursor: pointer;
  background: rgba(6,28,18,.62); box-shadow: inset 0 0 0 1px rgba(243,214,138,.3), 0 6px 18px rgba(0,0,0,.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wallet b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--gold); margin-right: 4px; }
.w-label { opacity: .85; }
.bolt { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ffc06a, #ff8a1a); box-shadow: 0 2px 6px rgba(255,140,30,.5); }
.bolt svg { width: 20px; height: 20px; }
.lobby .host { position: absolute; right: 30px; bottom: 150px; height: 470px; pointer-events: none; filter: drop-shadow(0 16px 30px rgba(0,0,0,.45));
  animation: hostin .5s cubic-bezier(.3, 1.3, .5, 1) both, bob 3.2s ease-in-out .5s infinite alternate; }
.portrait .lobby .host { right: 50%; transform: translateX(50%); bottom: auto; top: 300px; height: 520px; animation: hostin .5s both; }
.tables { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; justify-content: center; position: relative; }
.table-card { position: relative; overflow: hidden; width: 260px; height: 128px; border: 0; border-radius: 22px; padding: 16px 18px; cursor: pointer;
  color: #fff; text-align: left; font-family: inherit; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px;
  box-shadow: 0 6px 0 rgba(0,0,0,.28), 0 16px 30px rgba(0,0,0,.35), inset 0 0 0 1.5px rgba(243,214,138,.45), inset 0 1.5px 0 rgba(255,255,255,.4);
  transition: transform .14s, box-shadow .14s; background: linear-gradient(160deg, #35b86c, var(--enna) 55%, var(--enna-deep)); }
.portrait .table-card { width: 310px; }
.table-card::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 85% 10%, rgba(255,255,255,.28), transparent 45%), repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 2px, transparent 2px 14px); }
.table-card.stake { background: linear-gradient(160deg, #ffbb57, #f07f1e 60%, #c85d0c); }
.table-card.friend { background: linear-gradient(160deg, #a58ae8, #7a5cc9 60%, #5a3fa6); }
.table-card.blue { background: linear-gradient(160deg, #5fc3f0, #2a87c9 60%, #1b5e98); }
.table-card.red { background: linear-gradient(160deg, #ff8a74, #d9472f 60%, #a8301c); }
.table-card.join { width: 170px; background: linear-gradient(170deg, rgba(255,250,236,.22), rgba(255,250,236,.08)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.table-card.join .t-art { width: 40px; height: 40px; right: auto; left: 18px; top: 18px; color: #f3d68a; }
.table-card.join .t-name { font-size: 24px; letter-spacing: 2px; }
.table-card:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.25), inset 0 0 0 1.5px rgba(243,214,138,.45); }
@media (hover: hover) { .table-card:hover:not(:disabled) { transform: translateY(-4px); } }
.table-card:disabled { opacity: .45; }
.t-art { position: absolute; right: 6px; top: 4px; width: 88px; height: 88px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.2)); }
.t-tag { position: absolute; left: 14px; top: 12px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: rgba(0,0,0,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.t-name { position: relative; font-size: 27px; font-weight: 900; letter-spacing: 3px; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.t-desc { position: relative; font-size: 14px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 匹配中、登录：恩娜在旁边陪你等 ===== */
.waiting { padding-left: 380px; }
.portrait .waiting { padding-left: 0; padding-top: 520px; }
.waiting .host { position: absolute; left: 40px; bottom: -40px; height: 640px; pointer-events: none; filter: drop-shadow(0 16px 30px rgba(0,0,0,.45));
  animation: hostin .5s cubic-bezier(.3, 1.3, .5, 1) both, bob 3.2s ease-in-out .5s infinite alternate; }
.portrait .waiting .host { left: 50%; margin-left: -230px; bottom: auto; top: 60px; height: 500px; }
@keyframes hostin { from { opacity: 0; transform: translateX(-60px); } }
@keyframes bob { to { transform: translateY(-8px); } }
.spinner { display: flex; gap: 10px; height: 54px; align-items: flex-end; }
.spinner i { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3a3, #f0a030); box-shadow: 0 6px 12px rgba(0,0,0,.3);
  animation: hop 1.1s ease-in-out infinite; }
.spinner i:nth-child(2) { animation-delay: .15s; background: radial-gradient(circle at 35% 30%, #c9f5d6, #2fbf8f); }
.spinner i:nth-child(3) { animation-delay: .3s; background: radial-gradient(circle at 35% 30%, #fff, #e9dcc0); }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-18px); } }
.waiting h2, .waiting .sub { text-align: center; text-shadow: 0 2px 8px rgba(0,0,0,.6); }

/* ===== 牌桌 HUD（游戏往 #hud 里放自己的按钮）===== */
#hud { position: absolute; inset: 0; }
#hud > * { pointer-events: auto; }
#hud .pe-none { pointer-events: none; }
#table-info { position: absolute; left: 20px; top: 14px; font-size: 15px; line-height: 1.4; background: rgba(0,0,0,.32);
  padding: 7px 14px; border-radius: 999px; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); white-space: nowrap; }
#table-info b { color: var(--gold); }
#table-info:empty { display: none; }
#k-back { position: absolute; left: 20px; top: 14px; }
#table-info.with-back { left: 78px; top: 18px; }
#chat { position: absolute; left: 20px; top: 66px; }
#chat-menu { position: absolute; top: 56px; left: 0; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
#chat-menu button { white-space: nowrap; border: 0; border-radius: 12px; padding: 9px 14px; font-family: inherit; font-size: 15px; font-weight: 600;
  background: rgba(10,30,22,.86); color: #fff; text-align: left; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); cursor: pointer; }
#chat-menu button:active { background: var(--green); }
#auto-cancel { position: absolute; right: 24px; bottom: 24px; z-index: 2; }
#net-status { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(160,40,30,.9); padding: 6px 14px; border-radius: 999px; font-size: 14px; z-index: 3; }
.chat-bubble { position: absolute; transform: translate(-50%, -100%); max-width: 360px; padding: 9px 15px; border-radius: 14px; z-index: 3; pointer-events: none;
  font-size: 17px; font-weight: 700; color: #17231e; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.3); animation: chatin .25s ease-out;
  transition: opacity .3s; white-space: nowrap; }
.chat-bubble.out { opacity: 0; }
@keyframes chatin { from { opacity: 0; margin-top: 8px; } }

/* 座位牌（kit.seatHTML 生成，游戏决定放在哪） */
.k-seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.k-av { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; overflow: visible; }
.k-av .face { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  font-size: 28px; font-weight: 900; color: #fff; background: linear-gradient(150deg, #2fbf8f, #0b7a55);
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px #7fcfae, 0 8px 16px rgba(0,0,0,.4); }
.k-av .face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.k-av .face.enna { background: radial-gradient(circle at 50% 35%, #fffaf0, #d9efd9 70%); }
.k-av .face.enna[data-tint="1"] { background: radial-gradient(circle at 50% 35%, #fff6fb, #f3d3e4 70%); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px #e58fb6, 0 8px 16px rgba(0,0,0,.4); }
.k-av .face.enna[data-tint="2"] { background: radial-gradient(circle at 50% 35%, #f6fbff, #cfe3f6 70%); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px #7fb4e8, 0 8px 16px rgba(0,0,0,.4); }
.k-av .face.enna[data-tint="3"] { background: radial-gradient(circle at 50% 35%, #fffbf2, #f6e3c4 70%); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px #f0b860, 0 8px 16px rgba(0,0,0,.4); }
.k-seat.turn .k-av .face { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #3fe0a0, 0 0 22px rgba(63,224,160,.7), 0 8px 16px rgba(0,0,0,.4); }
.k-seat.out .k-av { filter: grayscale(.9) brightness(.75); }
.k-seat.offline .k-av { filter: grayscale(1) brightness(.8); }
.k-seat.empty .k-av { opacity: .4; }
.enna-face { position: absolute; width: 132%; height: 132%; left: -16%; top: -6%; pointer-events: none;
  background: url(img/enna-faces.webp) no-repeat; background-size: 300% 200%; background-position: 50% 100%; }
.enna-face[data-mood="bid"] { background-position: 0 0; }
.enna-face[data-mood="thinking"] { background-position: 50% 0; }
.enna-face[data-mood="win"] { background-position: 100% 0; }
.enna-face[data-mood="lose"] { background-position: 0 100%; }
.k-botb { position: absolute; right: -8px; bottom: -2px; padding: 2px 6px; border-radius: 8px; font-size: 11px; font-weight: 900;
  color: #fff; background: var(--orange); box-shadow: 0 0 0 2px var(--felt); z-index: 1; }
.k-secs { position: absolute; left: -12px; bottom: -6px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; display: grid; place-items: center;
  font-size: 15px; font-weight: 900; color: var(--ink); background: #fff8e6; box-shadow: 0 3px 8px rgba(0,0,0,.35); z-index: 1; font-variant-numeric: tabular-nums; }
.k-secs:empty { display: none; }
.k-seat.urgent .k-secs { color: #fff; background: #ff5a4a; animation: beat .5s ease-in-out infinite alternate; }
@keyframes beat { to { transform: scale(1.15); } }
.k-plate { margin-top: 10px; min-width: 96px; max-width: 160px; padding: 4px 10px 5px; border-radius: 12px; text-align: center;
  background: rgba(4,26,18,.62); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.k-nm { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-sub { display: block; font-size: 13px; color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-sub:empty { display: none; }
.k-tag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 900; color: #5a3500; background: linear-gradient(#ffe39a, #f2b93b); box-shadow: 0 3px 8px rgba(0,0,0,.3); z-index: 2; }
.k-tag:empty { display: none; }
.k-tag.green { color: #0b6b4a; background: linear-gradient(#f2fff8, #c7efdc); }
.k-tag.red { color: #fff; background: linear-gradient(#ff8a74, #d9472f); }

/* ===== 弹窗 ===== */
.dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 560px; max-width: calc(var(--W) - 40px); padding: 28px 30px; border-radius: 26px;
  background: linear-gradient(175deg, #fffdf6, #f4ead0); color: var(--ink); text-align: center; z-index: 5;
  box-shadow: 0 0 0 3000px rgba(4,20,12,.5), 0 24px 60px rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(255,255,255,.7); }
.dialog h3 { margin: 0; font-size: 28px; letter-spacing: 2px; }
.dialog .sub { color: #4a4a40; opacity: 1; }
.dialog .row { margin-top: 20px; }
.dialog .btn.ghost { color: var(--ink); background: linear-gradient(#fff, #efe6cf); box-shadow: 0 5px 0 #c9b98f, 0 10px 18px rgba(0,0,0,.15), inset 0 0 0 1px rgba(0,0,0,.06); }
.dialog .btn.ghost:active { box-shadow: 0 1px 0 #c9b98f; }
.dialog-close { position: absolute; right: 16px; top: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; font-size: 26px; line-height: 1;
  background: rgba(0,0,0,.06); color: var(--ink); cursor: pointer; font-family: inherit; }
@keyframes dlg { from { opacity: 0; transform: translate(-50%, -46%) scale(.92); } }

/* 场次选择 */
.tier-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.tier { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px; padding: 14px 18px; border: 0; border-radius: 18px; cursor: pointer;
  font-family: inherit; text-align: left; color: var(--ink); background: #fff; box-shadow: 0 4px 0 #e0d3b0, inset 0 0 0 1.5px rgba(16,34,27,.08); }
.tier:active { transform: translateY(3px); box-shadow: 0 1px 0 #e0d3b0; }
.tier b { font-size: 21px; }
.tier span { grid-column: 1; font-size: 14px; color: #5a5a50; }
.tier em { grid-row: 1 / 3; grid-column: 2; font-style: normal; font-weight: 900; font-size: 18px; color: #b85a10; display: flex; align-items: center; gap: 4px; }

/* 结算 */
.result { width: 620px; padding: 58px 30px 26px; animation: dlg .35s cubic-bezier(.3, 1.5, .5, 1); }
.landscape .result.with-art { margin-left: 120px; }
.res-art { position: absolute; right: 100%; margin-right: -40px; bottom: -110px; height: 520px; pointer-events: none;
  filter: drop-shadow(0 16px 30px rgba(0,0,0,.45)); animation: hostin .45s cubic-bezier(.3, 1.3, .5, 1) .1s both; }
.portrait .res-art { right: auto; left: 50%; margin: 0 0 0 -160px; bottom: 100%; height: 320px; margin-bottom: -40px; }
.res-art:not([src]) { display: none; }
.ribbon { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); width: 330px; height: 78px; display: grid; place-items: center; z-index: 1;
  clip-path: polygon(0 0, 100% 0, 93% 50%, 100% 100%, 0 100%, 7% 50%); background: linear-gradient(180deg, #ffbf5a, #f07f1e); }
.result.lose .ribbon { background: linear-gradient(180deg, #7f97a8, #4f6575); }
.result.draw .ribbon, .result.aborted .ribbon { background: linear-gradient(180deg, #a5b0a9, #6c7a73); }
.ribbon h2 { color: #fff; font-size: 38px; font-weight: 900; letter-spacing: 10px; text-indent: 10px; text-shadow: 0 3px 0 rgba(0,0,0,.2); white-space: nowrap; }
.tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tags i, .tags b { font-style: normal; font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: rgba(16,34,27,.07); color: #3d4a43; }
.tags b { color: #fff; background: linear-gradient(#ffb35a, #e0702c); }
.rows { margin: 16px 0 4px; display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow: auto; }
.rows .r { display: grid; grid-template-columns: 44px 1fr auto 80px 96px; align-items: center; gap: 12px; padding: 7px 14px; border-radius: 14px; text-align: left; }
.rows .r.me { background: rgba(0,153,102,.09); box-shadow: inset 0 0 0 1.5px rgba(0,153,102,.35); }
.ava { position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  font-size: 19px; font-weight: 900; color: #fff; background: linear-gradient(150deg, #2fbf8f, #0b7a55); }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ava.enna { background: radial-gradient(circle at 50% 35%, #fffaf0, #d9efd9 70%); }
.ava.enna .enna-face { width: 140%; height: 140%; left: -20%; top: -8%; }
.who { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who em { font-style: normal; font-size: 12px; margin-left: 6px; padding: 1px 6px; border-radius: 6px; color: #fff; background: var(--green); vertical-align: 2px; }
.rl { justify-self: start; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; color: #0b6b4a; background: #d6f3e5; white-space: nowrap; }
.rl:empty { visibility: hidden; }
.sc { font-size: 24px; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; color: #6b746f; }
.sc.pos, .en.pos { color: var(--red); }
.sc.neg, .en.neg { color: #2f7a5a; }
.en { display: flex; align-items: center; justify-content: flex-end; gap: 2px; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; color: #6b746f; }
.bolt-i { width: 15px; height: 15px; color: var(--orange); }
.note { margin: 10px 0 0; font-size: 14px; color: #6a6a5e; }
.res-body { margin-top: 10px; font-size: 17px; color: #3d4a43; }
.res-body .big { display: block; font-size: 46px; font-weight: 900; color: var(--green-deep); font-variant-numeric: tabular-nums; }
#toast { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); background: rgba(8,24,18,.88); padding: 11px 20px; z-index: 9;
  border-radius: 999px; font-size: 17px; pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.12); white-space: nowrap; }

/* 钱包面板 */
.wallet-panel { width: 600px; max-height: calc(var(--H) - 60px); display: flex; flex-direction: column; z-index: 6; text-align: left; padding: 24px 28px 18px; }
.wallet-panel h4 { margin: 16px 0 6px; font-size: 16px; color: #6a6a5e; }
.wp-sum { display: flex; gap: 12px; margin-top: 14px; }
.wp-sum div { flex: 1; padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px rgba(16,34,27,.08); }
.wp-sum span { display: block; font-size: 14px; color: #6a6a5e; }
.wp-sum b { font-size: 30px; font-variant-numeric: tabular-nums; color: var(--green-deep); }
.wp-limits { margin: 10px 0 0; font-size: 14px; color: #4a4a40; }
.wp-actions { display: flex; gap: 10px; margin-top: 12px; }
.wp-history { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 120px; max-height: 360px; flex: 1; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.wp-history li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 9px 2px; border-bottom: 1px solid rgba(16,34,27,.08); }
.wp-history .k { font-size: 16px; font-weight: 700; }
.wp-history .t { font-size: 12px; color: #8a8a7e; }
.wp-history .a { grid-row: 1 / 3; grid-column: 2; align-self: center; text-align: right; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wp-history .a small { display: block; font-size: 12px; font-weight: 500; color: #8a8a7e; }
.wp-history .a.pos { color: var(--red); }
.wp-history .a.neg { color: #2f7a5a; }
.wp-more { margin: 6px 0 0; min-height: 18px; font-size: 13px; color: #8a8a7e; text-align: center; }

/* 好友房 */
.code-input { display: block; width: 320px; margin: 18px auto 0; padding: 10px 0; border: 0; border-radius: 16px; outline: none;
  background: #fff; color: var(--ink); text-align: center; font-size: 44px; font-weight: 800; letter-spacing: 14px; text-indent: 14px; font-family: inherit;
  font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 2px rgba(16,34,27,.2); user-select: text; -webkit-user-select: text; touch-action: manipulation; }
.code-input:focus { box-shadow: inset 0 0 0 3px var(--green); }
.join-error { min-height: 22px; margin: 10px 0 0; color: #c0392b; font-size: 17px; font-weight: 700; }
.room-code-box { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 22px; border-radius: 18px; background: rgba(0,0,0,.3);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.rc-label { font-size: 18px; opacity: .8; }
.rc-code { font-size: 44px; letter-spacing: 8px; color: var(--gold); font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }

/* 规则说明 */
.help-dialog { width: 640px; text-align: left; max-height: calc(var(--H) - 60px); overflow-y: auto; touch-action: pan-y; }
.help-dialog h3 { text-align: center; }
.help-dialog .help-body { font-size: 16px; line-height: 1.65; color: #3d4a43; }
.help-dialog .help-body b { color: var(--green-deep); }
.help-dialog .help-body ul { padding-left: 22px; margin: 6px 0; }
#k-help { position: absolute; right: 230px; top: 26px; }
.portrait #k-help { right: 24px; top: 100px; }

/* 横幅提示（大字从中间弹出） */
.k-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 64px; font-weight: 900; color: var(--gold); z-index: 4;
  -webkit-text-stroke: 3px #5a2a00; paint-order: stroke fill; text-shadow: 0 6px 12px rgba(0,0,0,.4); pointer-events: none; white-space: nowrap;
  animation: banner 1.6s ease-out forwards; letter-spacing: 4px; }
.k-banner.green { color: #c9f5d6; -webkit-text-stroke-color: #0d4a28; }
.k-banner.red { color: #ffd0c4; -webkit-text-stroke-color: #6a1a0a; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  25% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
