:root {
  color-scheme: light;
  --ink: #172c2b;
  --muted: #65716d;
  --paper: #fffaf0;
  --paper-2: #f3ead4;
  --deep: #173b3a;
  --deep-2: #245753;
  --gold: #d8a84e;
  --red: #a84634;
  --jade: #4d857b;
  --line: rgba(23, 44, 43, .16);
  --shadow: 0 18px 40px rgba(20, 43, 40, .18);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #d7e2dc; color: var(--ink); }
body { min-height: 100dvh; }
button, input, select { font: inherit; }
button, label[for], .secondary-button { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.toast {
  position: fixed; z-index: 100; left: 50%; top: max(18px, env(safe-area-inset-top)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: #172c2b; color: #fff;
  box-shadow: var(--shadow); font-size: 14px; text-align: center;
}

.auth-screen, .game-shell { width: min(100%, 480px); min-height: 100dvh; margin: 0 auto; background: var(--paper); box-shadow: var(--shadow); }
.auth-screen { padding: max(34px, env(safe-area-inset-top)) 20px 32px; background: linear-gradient(160deg, var(--deep) 0 31%, var(--paper) 31%); }
.auth-brand { min-height: 155px; display: flex; align-items: center; gap: 16px; color: #fff8e9; }
.auth-brand h1 { margin: 0; font-family: STKaiti, KaiTi, serif; font-size: 34px; letter-spacing: 5px; font-weight: 500; }
.auth-brand p { margin: 8px 0 0; color: rgba(255,255,255,.72); font-size: 14px; }
.brand-seal { width: 66px; height: 66px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid rgba(255,255,255,.75); border-radius: 18px; background: var(--red); font: 38px STKaiti, KaiTi, serif; box-shadow: 0 8px 0 rgba(0,0,0,.15); }
.auth-panel { padding: 20px; border-radius: 22px; background: #fff; box-shadow: 0 14px 36px rgba(27,52,48,.16); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; border-radius: 13px; background: var(--paper-2); }
.auth-tabs button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.auth-tabs button.active { background: var(--deep); color: #fff; }

.form-stack { display: grid; gap: 15px; }
.form-stack > label:not(.consent) { display: grid; gap: 7px; font-size: 14px; font-weight: 500; }
.form-stack input, .form-stack select { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fffdf8; font-size: 16px; }
.form-stack input:focus, .form-stack select:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(77,133,123,.13); }
.form-stack small { color: var(--muted); font-size: 12px; font-weight: 400; }
.consent { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.consent input { width: 18px; min-height: 18px; margin-top: 1px; accent-color: var(--red); }
.primary-button, .secondary-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 15px; font-weight: 500; }
.primary-button { border: 0; background: var(--red); color: #fff; box-shadow: 0 4px 0 #743328; }
.secondary-button { padding: 0 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary-button.danger { color: var(--red); border-color: rgba(168,70,52,.35); }

.avatar-upload { display: grid; grid-template-columns: 78px 1fr; gap: 13px; align-items: center; }
.avatar-preview { width: 78px; height: 78px; overflow: hidden; display: grid; place-items: center; border: 1px dashed var(--jade); border-radius: 20px; background: var(--paper-2); color: var(--muted); font-size: 13px; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.avatar-actions .secondary-button { min-height: 60px; padding: 8px; text-align: center; font-size: 13px; }

.game-shell { position: relative; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.game-header { position: sticky; z-index: 20; top: 0; min-height: 78px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; color: #fff8e9; background: var(--deep); box-shadow: 0 3px 15px rgba(0,0,0,.16); }
.profile-button { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.profile-button img, .avatar-fallback { width: 43px; height: 43px; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.avatar-fallback { display: grid; place-items: center; background: var(--gold); color: var(--deep); font: 23px STKaiti, KaiTi, serif; }
.profile-text { min-width: 0; }
.profile-text strong, .profile-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text strong { font-size: 15px; font-weight: 500; }
.profile-text small { margin-top: 4px; color: rgba(255,255,255,.65); font-size: 12px; }
.wallets { min-width: 135px; display: grid; gap: 5px; }
.wallets span { min-height: 27px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; background: rgba(255,255,255,.1); }
.wallets small { color: rgba(255,255,255,.62); font-size: 11px; }
.wallets strong { justify-self: end; color: #ffdf93; font-size: 12px; white-space: nowrap; font-weight: 500; }

.view { min-height: calc(100dvh - 152px); }
.home-view { padding: 20px 14px; background: radial-gradient(circle at 50% 32%, rgba(216,168,78,.22), transparent 28%), linear-gradient(160deg,#9abcb2 0,#d8cf9f 53%,#8cad9d 100%); }
.town-heading { color: var(--deep); text-align: center; text-shadow: 0 1px rgba(255,255,255,.55); }
.town-heading h2 { margin: 0; font: 28px STKaiti, KaiTi, serif; letter-spacing: 5px; }
.town-heading p { margin: 4px 0 0; font-size: 13px; }
.town-board { position: relative; min-height: 560px; margin-top: 13px; border: 1px solid rgba(23,59,58,.15); border-radius: 28px; background: linear-gradient(145deg,rgba(255,255,255,.25),rgba(23,59,58,.08)), repeating-linear-gradient(38deg,transparent 0 43px,rgba(255,255,255,.08) 44px 46px); overflow: hidden; }
.town-board::before, .town-board::after { content: ""; position: absolute; width: 150%; height: 54px; left: -25%; background: rgba(255,248,221,.28); border-top: 1px solid rgba(255,255,255,.25); border-bottom: 1px solid rgba(23,59,58,.08); }
.town-board::before { top: 235px; transform: rotate(-14deg); }
.town-board::after { top: 315px; transform: rotate(57deg); }
.scene { position: absolute; z-index: 2; width: 126px; min-height: 73px; padding: 12px 9px; border: 2px solid rgba(255,251,232,.7); border-radius: 18px 18px 10px 10px; color: #fff; background: linear-gradient(145deg,var(--red),#693b34); box-shadow: 0 7px 0 rgba(23,59,58,.7),0 13px 22px rgba(23,59,58,.2); }
.scene:nth-of-type(odd) { background: linear-gradient(145deg,var(--deep-2),var(--deep)); }
.scene:active { transform: translateY(3px); box-shadow: 0 4px 0 rgba(23,59,58,.7),0 8px 14px rgba(23,59,58,.18); }
.scene b, .scene span { display: block; }
.scene b { font-size: 15px; font-weight: 500; }
.scene span { margin-top: 5px; color: rgba(255,255,255,.72); font-size: 11px; }
.scene-bank { left: 50%; top: 28px; transform: translateX(-50%); }
.scene-bank:active, .scene-guild:active { transform: translateX(-50%) translateY(3px); }
.scene-bounty { left: 18px; top: 137px; }
.scene-casino { right: 18px; top: 137px; }
.scene-auction { left: 18px; top: 270px; }
.scene-guild { left: 50%; top: 220px; transform: translateX(-50%); }
.scene-arena { right: 18px; top: 270px; }
.scene-rank { left: 42px; top: 414px; }
.scene-shop { right: 42px; top: 414px; }
.mvp-note { margin: 14px 5px 0; padding: 11px 13px; border-radius: 12px; color: var(--deep); background: rgba(255,250,240,.74); font-size: 12px; line-height: 1.55; }

.page-view { padding: 18px 14px 28px; background: var(--paper); }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; padding: 4px 3px 13px; border-bottom: 1px solid var(--line); }
.page-title h2 { margin: 0; font: 24px STKaiti, KaiTi, serif; letter-spacing: 2px; }
.page-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; background: var(--red); color: #fff; font: 23px STKaiti, KaiTi, serif; }
.guild-list { display: grid; gap: 11px; }
.guild-card { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 10px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.guild-emblem { width: 54px; height: 58px; display: grid; place-items: center; clip-path: polygon(10% 0,90% 0,90% 73%,50% 100%,10% 73%); background: linear-gradient(145deg,var(--red),var(--deep)); color: #fff6dd; font: 24px Georgia,serif; }
.guild-copy strong, .guild-copy span, .guild-copy small { display: block; }
.guild-copy strong { font-size: 16px; font-weight: 500; }
.guild-copy span { margin-top: 5px; color: var(--gold); font-size: 13px; }
.guild-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.guild-card button { min-height: 42px; padding: 0 11px; border: 1px solid var(--red); border-radius: 11px; background: #fff; color: var(--red); font-size: 13px; }
.guild-card button.pending { background: var(--red); color: #fff; }
.guild-card button:disabled { opacity: .5; }
.application-panel { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.application-panel h3, .admin-card h3 { margin: 0 0 12px; font-size: 17px; font-weight: 500; }
.application-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.application-item strong, .application-item small { display: block; }
.application-item small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.decision-buttons { display: flex; gap: 7px; }
.decision-buttons button { min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.decision-buttons .approve { border-color: var(--jade); color: var(--jade); }
.decision-buttons .reject { border-color: var(--red); color: var(--red); }

.admin-card { margin-bottom: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.admin-users { display: grid; gap: 1px; background: var(--line); }
.admin-user { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; background: #fff; font-size: 13px; }
.admin-user span { color: var(--muted); }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.balance-card { min-height: 112px; display: grid; align-content: center; gap: 7px; padding: 18px; border-radius: 18px; color: #fff8e9; box-shadow: 0 7px 18px rgba(23,59,58,.13); }
.balance-card.personal { background: linear-gradient(145deg,var(--red),#71372f); }
.balance-card.guild { background: linear-gradient(145deg,var(--deep-2),var(--deep)); }
.balance-card small { color: rgba(255,255,255,.72); font-size: 13px; }
.balance-card strong { font: 28px STKaiti,KaiTi,serif; font-weight: 500; }
.ledger-section { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.ledger-section h3 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.ledger-row { min-height: 45px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row time { color: var(--muted); font-size: 13px; }
.ledger-row strong { font-size: 15px; }
.ledger-row strong.positive { color: #347466; }
.ledger-row strong.negative { color: var(--red); }
.empty-note { margin: 8px 0; color: var(--muted); font-size: 13px; text-align: center; }

.bounty-list, .shop-list, .ranking-list { display: grid; gap: 11px; }
.bounty-card, .shop-card { width: 100%; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: #fff; text-align: left; }
.bounty-token, .item-token { width: 50px; height: 58px; display: grid; place-items: center; border-radius: 8px 8px 18px 18px; color: #fff7dd; background: linear-gradient(145deg,var(--red),#72372e); font: 25px STKaiti,KaiTi,serif; }
.bounty-card strong, .bounty-card small, .shop-card strong, .shop-card small { display: block; }
.bounty-card strong, .shop-card strong { font-size: 16px; font-weight: 500; }
.bounty-card small, .shop-card small { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.bounty-status, .item-price { white-space: nowrap; color: var(--red); font-size: 13px; font-weight: 600; }

.segmented-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 14px; padding: 4px; border-radius: 13px; background: var(--paper-2); }
.segmented-tabs.shop-tabs { grid-template-columns: repeat(3,1fr); }
.segmented-tabs button { min-height: 41px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 13px; }
.segmented-tabs button.active { color: #fff; background: var(--deep); }
.ranking-row { min-height: 66px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.rank-number { font: 23px Georgia,serif; color: var(--muted); text-align: center; }
.ranking-row:nth-child(-n+3) .rank-number { color: var(--gold); font-weight: 700; }
.ranking-copy strong, .ranking-copy small { display: block; }
.ranking-copy strong { font-size: 15px; font-weight: 500; }
.ranking-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.ranking-balance { color: var(--red); font-size: 14px; }
.shop-balance-note { margin: -3px 0 13px; padding: 10px 12px; border-radius: 11px; color: var(--deep); background: var(--paper-2); font-size: 13px; }
.shop-card { grid-template-columns: 54px 1fr; }
.shop-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.shop-actions button { min-height: 39px; padding: 0 14px; border: 1px solid var(--red); border-radius: 10px; color: var(--red); background: #fff; }
.shop-actions button:disabled { opacity: .55; }
.inventory-status { padding: 6px 9px; border-radius: 10px; color: var(--muted); background: var(--paper-2); font-size: 12px; }

.detail-dialog { width: min(calc(100% - 34px),430px); padding: 26px 22px 22px; border: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.detail-dialog::backdrop { background: rgba(10,26,25,.6); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 25px; }
.dialog-seal { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto; border-radius: 15px; color: #fff; background: var(--red); font: 27px STKaiti,KaiTi,serif; }
.detail-dialog h3 { margin: 12px 0 18px; text-align: center; font: 25px STKaiti,KaiTi,serif; }
.detail-block { margin: 11px 0; padding: 13px; border-radius: 13px; background: var(--paper-2); }
.detail-block small { color: var(--muted); }
.detail-block p { margin: 7px 0 0; line-height: 1.6; font-size: 14px; }
.detail-dialog > .primary-button { width: 100%; margin-top: 8px; }
.pending-review { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pending-review:last-child { border-bottom: 0; }
.pending-review strong, .pending-review small { display: block; }
.pending-review small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.arena-schedule { display: grid; gap: 13px; }
.arena-card { display: grid; grid-template-columns: 64px 1fr; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 7px 20px rgba(23,59,58,.07); }
.arena-day { width: 62px; min-height: 74px; display: grid; place-items: center; align-content: center; border-radius: 14px; color: #fff8e9; background: linear-gradient(145deg,var(--red),#71372f); }
.arena-day small, .arena-day strong { display: block; }
.arena-day small { font-size: 12px; color: rgba(255,255,255,.72); }
.arena-day strong { margin-top: 2px; font: 30px STKaiti,KaiTi,serif; }
.arena-copy h3 { margin: 1px 0 7px; font-size: 17px; font-weight: 600; }
.arena-copy p { margin: 0; color: #465451; font-size: 14px; line-height: 1.65; }
.arena-copy > small { display: block; margin-top: 9px; color: var(--muted); font-size: 13px; }
.arena-reward { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.arena-reward span { padding: 5px 8px; border-radius: 9px; color: var(--deep); background: var(--paper-2); font-size: 12px; }
.arena-card.upcoming { border-style: dashed; }
.arena-card.upcoming .arena-day { background: linear-gradient(145deg,var(--deep-2),var(--deep)); }
.profile-card { display: grid; justify-items: center; padding: 26px 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: center; }
.profile-card img, .profile-large-fallback { width: 94px; height: 94px; border-radius: 26px; object-fit: cover; }
.profile-large-fallback { display: grid; place-items: center; background: var(--gold); color: var(--deep); font: 44px STKaiti,KaiTi,serif; }
.profile-card h3 { margin: 15px 0 3px; font-size: 20px; font-weight: 500; }
.profile-card p { margin: 5px 0; color: var(--muted); font-size: 14px; }
.profile-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.profile-actions .secondary-button { min-height: 52px; padding: 7px; text-align: center; font-size: 13px; }
.profile-card > .secondary-button { margin-top: 10px; width: 100%; }
.install-button { width: 100%; margin-top: 10px; }
.install-help { width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--paper-2); text-align: left; }
.install-help strong { font-size: 14px; }
.install-help p { margin: 7px 0 0; font-size: 13px; line-height: 1.55; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%,480px); min-height: calc(66px + env(safe-area-inset-bottom)); display: flex; align-items: flex-start; justify-content: space-around; padding: 7px 5px env(safe-area-inset-bottom); background: var(--deep); box-shadow: 0 -4px 18px rgba(23,59,58,.2); }
.bottom-nav button { min-width: 54px; min-height: 52px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 12px; color: rgba(255,255,255,.58); background: transparent; }
.bottom-nav button.active { color: #ffe3a1; background: rgba(255,255,255,.08); }
.bottom-nav span { font: 19px STKaiti,KaiTi,serif; }
.bottom-nav small { font-size: 11px; }

@media (min-width: 700px) {
  body { padding: 22px 0; }
  .auth-screen, .game-shell { min-height: calc(100dvh - 44px); border-radius: 28px; overflow: hidden; }
  .bottom-nav { bottom: 22px; border-radius: 0 0 28px 28px; }
}

@media (max-width: 370px) {
  .wallets { min-width: 122px; }
  .wallets small { font-size: 10px; }
  .scene { width: 112px; }
  .scene-rank { left: 28px; }
  .scene-shop { right: 28px; }
  .guild-card { grid-template-columns: 50px 1fr; }
  .guild-emblem { width: 47px; height: 51px; }
  .guild-card button { grid-column: 1 / -1; width: 100%; }
}

/* =========================================================
   契谱江湖 · 国潮市井主题 v2
   主城使用江湖市集插画，功能内页使用钱庄账簿语言。
   ========================================================= */
:root {
  --ink: #1d2f2c;
  --muted: #68736d;
  --paper: #f7f0df;
  --paper-2: #ece0c5;
  --deep: #153f3b;
  --deep-2: #28675d;
  --gold: #c89b43;
  --gold-light: #f1d58a;
  --red: #a94332;
  --red-dark: #6f2d26;
  --jade: #4d857b;
  --line: rgba(62, 50, 33, .16);
  --shadow: 0 18px 44px rgba(19, 43, 39, .2);
}

html, body {
  background:
    radial-gradient(circle at 50% 0, rgba(241, 213, 138, .23), transparent 34%),
    #cbd7d0;
}

.auth-screen, .game-shell {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)),
    repeating-linear-gradient(0deg, rgba(80,59,28,.025) 0 1px, transparent 1px 4px);
}

.auth-screen {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(12,40,37,.3) 0 30%, rgba(247,240,223,.97) 44%),
    url('/assets/jianghu-town-v1.webp') center top / auto 55% no-repeat,
    var(--paper);
}

.auth-screen::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 260px;
  background: linear-gradient(180deg, rgba(8,31,29,.38), rgba(8,31,29,.08) 65%, transparent);
  pointer-events: none;
}

.auth-brand { text-shadow: 0 2px 12px rgba(0,0,0,.55); }
.brand-seal {
  border-radius: 50% 50% 46% 48%;
  border-color: rgba(255,239,195,.92);
  background: linear-gradient(145deg, #bc533e, var(--red-dark));
  box-shadow: 0 6px 0 rgba(54,22,18,.42), inset 0 0 0 4px rgba(255,239,195,.13);
}

.auth-panel {
  border: 1px solid rgba(117,86,42,.2);
  background:
    linear-gradient(135deg, rgba(255,255,255,.9), rgba(250,244,228,.96)),
    var(--paper);
  box-shadow: 0 17px 40px rgba(36,48,40,.2), inset 0 0 0 4px rgba(255,255,255,.28);
}

.primary-button {
  background: linear-gradient(180deg, #b64c38, var(--red));
  box-shadow: 0 4px 0 var(--red-dark), 0 8px 18px rgba(111,45,38,.18);
}
.primary-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--red-dark); }

.game-header {
  min-height: 82px;
  border-bottom: 1px solid rgba(241,213,138,.38);
  background:
    linear-gradient(90deg, rgba(255,255,255,.035), transparent 35%, rgba(255,255,255,.035)),
    linear-gradient(180deg, #184a45, #123936);
  box-shadow: 0 5px 20px rgba(8,35,32,.3);
}

.game-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 22px, transparent 22px 29px);
  opacity: .58;
}

.profile-button img, .avatar-fallback {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(8,35,32,.28), 0 5px 12px rgba(0,0,0,.24);
}

.profile-text strong { color: #fff5d8; letter-spacing: .5px; }
.profile-text small { color: rgba(255,245,216,.68); }

.wallets span {
  position: relative;
  padding-left: 27px;
  border: 1px solid rgba(241,213,138,.2);
  background: linear-gradient(90deg, rgba(8,31,29,.38), rgba(255,255,255,.07));
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}
.wallets span::before {
  content: "票";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: #5b341d;
  background: var(--gold-light);
  font: 11px STKaiti, KaiTi, serif;
}
.wallets span:nth-child(2)::before { color: #f8f2df; background: #7a4a3f; }

.home-view {
  padding: 16px 11px 20px;
  background:
    linear-gradient(180deg, #e8ddc2 0, #d0c7a9 76%, #c5d4ca),
    var(--paper);
}

.town-heading { position: relative; z-index: 2; margin-bottom: -44px; color: #fff5d8; text-shadow: 0 2px 8px rgba(0,0,0,.78); }
.town-heading::before, .town-heading::after {
  content: "";
  display: inline-block;
  width: 38px;
  height: 1px;
  margin: 0 9px 3px;
  background: linear-gradient(90deg, transparent, var(--gold-light));
}
.town-heading::after { background: linear-gradient(90deg, var(--gold-light), transparent); }
.town-kicker { display: inline-block; font-size: 10px; letter-spacing: 3px; color: #f3dda0; }
.town-heading h2 { margin-top: 3px; color: #fff7df; font-size: 30px; letter-spacing: 7px; }
.town-heading p { color: rgba(255,247,223,.78); font-size: 11px; letter-spacing: 1px; }

.town-board {
  min-height: 660px;
  margin-top: 0;
  border: 2px solid rgba(77,55,27,.52);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(8,31,29,.24) 0 14%, transparent 37%, rgba(15,41,35,.1) 78%, rgba(10,31,28,.38)),
    url('/assets/jianghu-town-v1.webp') center center / cover no-repeat;
  box-shadow:
    0 16px 32px rgba(26,52,43,.23),
    inset 0 0 0 3px rgba(242,216,159,.26),
    inset 0 0 40px rgba(8,31,29,.24);
}
.town-board::before {
  top: auto;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 92px;
  border: 0;
  background: linear-gradient(transparent, rgba(11,37,33,.48));
  transform: none;
}
.town-board::after { display: none; }

.map-mist {
  position: absolute;
  z-index: 1;
  width: 185px;
  height: 55px;
  border-radius: 50%;
  background: rgba(255,248,228,.32);
  filter: blur(17px);
  pointer-events: none;
  animation: mist-drift 9s ease-in-out infinite alternate;
}
.map-mist-one { left: -34px; top: 103px; }
.map-mist-two { right: -52px; top: 392px; animation-delay: -4s; }
@keyframes mist-drift { to { transform: translateX(25px); opacity: .52; } }

.scene {
  width: auto;
  min-width: 103px;
  max-width: 136px;
  min-height: 52px;
  padding: 8px 10px 8px 31px;
  overflow: visible;
  border: 1px solid rgba(255,229,160,.78);
  border-radius: 7px;
  color: #fff4d4;
  background: linear-gradient(180deg, rgba(36,78,68,.94), rgba(17,52,48,.96));
  box-shadow: 0 4px 0 rgba(59,37,24,.75), 0 8px 16px rgba(10,26,23,.34), inset 0 1px rgba(255,255,255,.13);
  backdrop-filter: blur(4px);
  text-align: left;
}
.scene:nth-of-type(odd) { background: linear-gradient(180deg, rgba(157,65,47,.95), rgba(100,42,34,.97)); }
.scene::before {
  content: attr(data-mark);
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,237,188,.86);
  border-radius: 6px 6px 12px 12px;
  color: #5b321f;
  background: linear-gradient(145deg, #f2da9b, #c5943d);
  box-shadow: 0 3px 0 rgba(68,40,23,.62);
  font: 19px STKaiti, KaiTi, serif;
}
.scene::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 1px;
  height: 10px;
  background: rgba(255,231,169,.72);
}
.scene b { font: 16px STKaiti, KaiTi, serif; letter-spacing: 1px; white-space: nowrap; }
.scene span { margin-top: 2px; color: rgba(255,244,212,.72); font-size: 9px; line-height: 1.25; }
.scene:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(59,37,24,.75), 0 5px 10px rgba(10,26,23,.3); }
.scene-bank { left: 50%; top: 226px; transform: translateX(-50%); }
.scene-bank:active, .scene-guild:active { transform: translateX(-50%) translateY(2px); }
.scene-bounty { right: 13px; top: 116px; }
.scene-casino { left: 17px; top: 114px; }
.scene-auction { right: 13px; top: 364px; }
.scene-guild { left: 50%; top: 316px; transform: translateX(-50%); }
.scene-arena { left: 16px; top: 250px; }
.scene-rank { left: 18px; top: 472px; }
.scene-shop { right: 18px; top: 510px; }

.mvp-note {
  position: relative;
  margin: -22px 12px 0;
  padding: 13px 14px 13px 53px;
  border: 1px solid rgba(113,78,35,.28);
  border-radius: 10px;
  color: #4b4436;
  background: rgba(250,243,224,.96);
  box-shadow: 0 9px 18px rgba(38,50,42,.14);
}
.mvp-note::before {
  content: "讯";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px 4px 11px 11px;
  color: #fff4d4;
  background: var(--red);
  font: 17px STKaiti, KaiTi, serif;
}
.mvp-note strong { display: block; margin-bottom: 2px; color: var(--deep); font: 14px STKaiti, KaiTi, serif; }

.page-view {
  min-height: calc(100dvh - 148px);
  padding: 20px 14px 30px;
  background:
    radial-gradient(circle at 90% 0, rgba(200,155,67,.13), transparent 25%),
    repeating-linear-gradient(0deg, rgba(80,59,28,.025) 0 1px, transparent 1px 4px),
    var(--paper);
}
.page-title {
  position: relative;
  margin-bottom: 18px;
  padding: 5px 4px 15px;
  border-bottom: 1px solid rgba(127,91,41,.3);
}
.page-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 78px;
  height: 3px;
  background: linear-gradient(90deg, var(--red), transparent);
}
.page-title h2 { color: var(--deep); font-size: 27px; letter-spacing: 3px; }
.page-title p { color: #7a7468; }
.page-mark {
  position: relative;
  border: 1px solid #8e372b;
  border-radius: 50%;
  background: linear-gradient(145deg, #bd543e, #913629);
  box-shadow: inset 0 0 0 3px rgba(255,238,194,.2), 0 4px 8px rgba(94,46,32,.19);
}

.guild-card, .admin-card, .ledger-section, .bounty-card, .shop-card, .ranking-row, .arena-card, .profile-card {
  border-color: rgba(113,78,35,.2);
  background:
    linear-gradient(135deg, rgba(255,255,255,.94), rgba(249,242,224,.96));
  box-shadow: 0 7px 18px rgba(45,59,48,.075), inset 0 1px rgba(255,255,255,.88);
}
.guild-card, .bounty-card, .shop-card, .ranking-row, .arena-card { transition: transform .16s ease, box-shadow .16s ease; }
.guild-card:active, .bounty-card:active, .shop-card:active, .ranking-row:active, .arena-card:active { transform: scale(.988); }

.balance-card.personal { background: linear-gradient(145deg, #184d47, #103633); }
.balance-card.guild { background: linear-gradient(145deg, #a94b38, #743127); }
.balance-card { border: 1px solid rgba(255,231,169,.27); box-shadow: 0 8px 18px rgba(37,46,37,.14), inset 0 1px rgba(255,255,255,.13); }

.bounty-token, .item-token {
  border: 1px solid rgba(255,232,175,.54);
  background: linear-gradient(145deg, #b6503b, #6f3028);
  box-shadow: 0 4px 0 rgba(87,42,30,.25);
}
.guild-emblem { background: linear-gradient(145deg, var(--red), var(--deep)); box-shadow: 0 4px 8px rgba(49,54,40,.13); }
.rank-number { font-family: STKaiti, KaiTi, serif; }
.ranking-row:nth-child(-n+3) { border-color: rgba(200,155,67,.42); background: linear-gradient(135deg, #fffdf5, #f2e4be); }

.segmented-tabs, .shop-balance-note, .install-help, .detail-block, .arena-reward span {
  border: 1px solid rgba(113,78,35,.12);
  background: rgba(232,218,187,.62);
}
.segmented-tabs button.active { background: linear-gradient(180deg, #245d55, var(--deep)); box-shadow: 0 3px 7px rgba(21,63,59,.18); }

.bottom-nav {
  border-top: 1px solid rgba(241,213,138,.24);
  background:
    linear-gradient(90deg, rgba(255,255,255,.035), transparent 35%, rgba(255,255,255,.035)),
    linear-gradient(180deg, #194a45, #123a37);
}
.bottom-nav button { position: relative; }
.bottom-nav button.active { color: #ffe9af; background: rgba(241,213,138,.1); }
.bottom-nav button.active::before {
  content: "";
  position: absolute;
  top: -7px;
  width: 25px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold-light);
  box-shadow: 0 2px 7px rgba(241,213,138,.38);
}
.bottom-nav span { width: 27px; height: 25px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 5px 5px 9px 9px; }

.detail-dialog {
  border: 1px solid rgba(113,78,35,.28);
  background:
    repeating-linear-gradient(0deg, rgba(80,59,28,.025) 0 1px, transparent 1px 4px),
    var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  .map-mist { animation: none; }
  .guild-card, .bounty-card, .shop-card, .ranking-row, .arena-card { transition: none; }
}

@media (max-width: 370px) {
  .town-board { min-height: 620px; }
  .scene { min-width: 94px; max-width: 119px; padding-right: 7px; }
  .scene b { font-size: 14px; }
  .scene span { font-size: 8px; }
  .scene-bank { top: 213px; }
  .scene-bounty { right: 9px; top: 107px; }
  .scene-casino { left: 13px; top: 105px; }
  .scene-arena { left: 13px; top: 240px; }
  .scene-guild { top: 303px; }
  .scene-auction { right: 9px; top: 350px; }
  .scene-rank { left: 14px; top: 452px; }
  .scene-shop { right: 14px; top: 489px; }
}

/* =========================================================
   契谱江湖 · v3 一屏主城与刀剑标题
   ========================================================= */
.auth-screen {
  min-height: 100dvh;
  padding: max(26px, env(safe-area-inset-top)) 20px 28px;
  background:
    linear-gradient(180deg, rgba(7,29,27,.25) 0, rgba(7,29,27,.08) 34%, rgba(7,29,27,.35) 100%),
    url('/assets/jianghu-town-v2.webp') center center / cover no-repeat;
}
.auth-screen::before {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(5,25,23,.45), transparent 31%),
    linear-gradient(0deg, rgba(5,25,23,.18), transparent 35%);
}
.auth-brand {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 16px 2px 5px;
}
.brand-wordmark {
  display: block;
  width: min(96%, 410px);
  height: auto;
  filter: drop-shadow(0 5px 2px rgba(0,0,0,.5)) drop-shadow(0 0 13px rgba(5,28,25,.72));
}
.auth-panel {
  background: rgba(255,250,238,.94);
  backdrop-filter: blur(9px);
}

.game-shell.home-mode {
  height: 100dvh;
  min-height: 100dvh;
  padding-bottom: 0;
  overflow: hidden;
}
.game-shell.home-mode .game-header {
  position: relative;
  height: calc(72px + env(safe-area-inset-top));
  min-height: calc(72px + env(safe-area-inset-top));
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 8px;
}
.game-shell.home-mode .home-view {
  height: calc(100dvh - 72px - env(safe-area-inset-top) - 66px - env(safe-area-inset-bottom));
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #132f2c;
}
.game-shell.home-mode .town-board {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(9,34,31,.11), transparent 16%, transparent 84%, rgba(9,34,31,.16)),
    url('/assets/jianghu-town-v2.webp') center center / cover no-repeat;
  box-shadow: inset 0 0 32px rgba(7,27,24,.18);
}
.game-shell.home-mode .town-board::before,
.game-shell.home-mode .town-board::after { display: none; }

.game-shell.home-mode .scene {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
  min-height: 43px;
  padding: 7px 7px 6px 31px;
  border-radius: 6px;
  border-color: rgba(255,229,160,.88);
  box-shadow: 0 3px 0 rgba(54,35,22,.76), 0 6px 12px rgba(10,26,23,.31), inset 0 1px rgba(255,255,255,.16);
  text-align: center;
}
.game-shell.home-mode .scene::before {
  left: -7px;
  width: 31px;
  height: 33px;
  font-size: 17px;
}
.game-shell.home-mode .scene::after { display: none; }
.game-shell.home-mode .scene b {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: .5px;
}
.game-shell.home-mode .scene span { display: none; }
.game-shell.home-mode .scene-bank {
  left: 50%;
  right: auto;
  top: 18%;
  transform: translateX(-50%);
}
.game-shell.home-mode .scene-arena { left: 6%; right: auto; top: 28%; }
.game-shell.home-mode .scene-bounty { right: 6%; left: auto; top: 29%; }
.game-shell.home-mode .scene-casino { left: 6%; right: auto; top: 45%; }
.game-shell.home-mode .scene-auction { right: 6%; left: auto; top: 47%; }
.game-shell.home-mode .scene-guild { left: 6%; right: auto; top: 64%; transform: none; }
.game-shell.home-mode .scene-rank { left: 50%; right: auto; top: 70%; transform: translateX(-50%); }
.game-shell.home-mode .scene-shop { right: 6%; left: auto; top: 65%; }
.game-shell.home-mode .scene:active { transform: translateY(2px); }
.game-shell.home-mode .scene-bank:active,
.game-shell.home-mode .scene-rank:active { transform: translateX(-50%) translateY(2px); }
.game-shell.home-mode .scene-guild:active { transform: translateY(2px); }

@media (max-width: 370px) {
  .auth-brand { min-height: 145px; }
  .brand-wordmark { width: min(92%, 350px); }
  .game-shell.home-mode .scene {
    width: 98px;
    min-width: 98px;
    max-width: 98px;
    padding-left: 28px;
  }
  .game-shell.home-mode .scene b { font-size: 13px; }
  .game-shell.home-mode .scene-arena,
  .game-shell.home-mode .scene-casino,
  .game-shell.home-mode .scene-guild { left: 5%; }
  .game-shell.home-mode .scene-bounty,
  .game-shell.home-mode .scene-auction,
  .game-shell.home-mode .scene-shop { right: 5%; }
}

@media (max-height: 700px) {
  .auth-brand { min-height: 120px; }
  .brand-wordmark { width: min(82%, 350px); }
  .auth-panel { padding: 16px; }
  .form-stack { gap: 11px; }
  .form-stack input, .form-stack select { min-height: 44px; }
}

/* v4：细节位置修正 */
.game-shell.home-mode .scene-rank { top: 73.5%; }
.bottom-nav button { transform: translateY(-4px); }
.bottom-nav button:active { transform: translateY(-2px); }

/* v5：动态主城、背包、帮会会徽与如意赌坊 */
.town-life { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.scene-mist {
  position: absolute;
  width: 45%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(238,246,231,.18), rgba(225,239,225,.08) 48%, transparent 72%);
  filter: blur(7px);
  opacity: .45;
  animation: mist-drift 16s ease-in-out infinite alternate;
}
.scene-mist-one { left: -17%; top: 4%; }
.scene-mist-two { right: -20%; top: 39%; animation-delay: -7s; animation-duration: 20s; }
@keyframes mist-drift { from { transform: translateX(-4%) scale(.94); opacity: .25; } to { transform: translateX(30%) scale(1.08); opacity: .58; } }

.harbor-ripple, .river-ripple {
  position: absolute;
  overflow: hidden;
  opacity: .32;
  mix-blend-mode: screen;
}
.harbor-ripple {
  left: 34%;
  top: -2%;
  width: 66%;
  height: 13%;
  background: repeating-linear-gradient(105deg, transparent 0 13px, rgba(255,238,172,.26) 14px 16px, transparent 17px 28px);
  animation: water-glide 7s linear infinite;
}
.river-ripple {
  left: -5%;
  bottom: -3%;
  width: 58%;
  height: 29%;
  background: repeating-radial-gradient(ellipse at 30% 60%, transparent 0 10px, rgba(224,247,226,.22) 11px 12px, transparent 13px 24px);
  animation: river-breathe 5s ease-in-out infinite alternate;
}
@keyframes water-glide { to { background-position: 60px 0; } }
@keyframes river-breathe { from { transform: translate(-8px, 3px) scale(.98); opacity: .2; } to { transform: translate(10px, -3px) scale(1.04); opacity: .4; } }

.arena-breath {
  position: absolute;
  left: 8.5%;
  top: 12.2%;
  width: 23%;
  aspect-ratio: 1.55;
  border: 1px solid rgba(255,221,126,.12);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,205,91,.23), transparent 66%);
  transform: rotate(-3deg);
  animation: arena-breathe 2.8s ease-in-out infinite;
}
@keyframes arena-breathe { 0%,100% { opacity: .2; transform: rotate(-3deg) scale(.88); } 50% { opacity: .72; transform: rotate(-3deg) scale(1.12); } }

.lantern-light {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff8f3e;
  box-shadow: 0 0 6px 2px rgba(255,129,48,.65), 0 0 15px 7px rgba(255,188,79,.2);
  animation: lantern-flicker 1.7s ease-in-out infinite alternate;
}
.lantern-one { right: 12%; top: 35%; }
.lantern-two { right: 18%; top: 64%; animation-delay: -.65s; }
.lantern-three { left: 28%; top: 72%; animation-delay: -1.1s; }
@keyframes lantern-flicker { from { opacity: .48; transform: scale(.78); } to { opacity: .95; transform: scale(1.18); } }

.market-smoke {
  position: absolute;
  width: 16px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 90%, rgba(247,239,216,.35), transparent 70%);
  filter: blur(3px);
  animation: smoke-rise 5.6s ease-in-out infinite;
}
.market-smoke-one { right: 20%; top: 43%; }
.market-smoke-two { right: 9%; top: 72%; animation-delay: -2.8s; }
@keyframes smoke-rise { 0% { opacity: 0; transform: translate(0,10px) scale(.6); } 30% { opacity: .5; } 100% { opacity: 0; transform: translate(7px,-28px) scale(1.35); } }

.drifting-leaf { position: absolute; color: #d88742; font-size: 5px; opacity: 0; animation: leaf-drift 9s linear infinite; }
.leaf-one { left: 72%; top: 26%; }
.leaf-two { left: 47%; top: 52%; animation-delay: -3s; }
.leaf-three { left: 18%; top: 67%; animation-delay: -6s; }
@keyframes leaf-drift { 0% { opacity: 0; transform: translate(0,-8px) rotate(0); } 12% { opacity: .75; } 100% { opacity: 0; transform: translate(-46px,82px) rotate(420deg); } }

.guild-flag {
  position: absolute;
  top: 49%;
  width: 10px;
  height: 22px;
  border-left: 2px solid #5b3a25;
  transform-origin: left top;
}
.guild-flag::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 11px;
  height: 9px;
  clip-path: polygon(0 0,100% 12%,76% 100%,0 83%);
  background: #b64b39;
  animation: flag-wave 1.8s ease-in-out infinite alternate;
  transform-origin: left center;
}
.guild-flag-one { left: 15%; }
.guild-flag-two { left: 20%; top: 48%; }
.guild-flag-two::after { background: #d2a543; animation-delay: -.5s; }
.guild-flag-three { left: 25%; }
.guild-flag-three::after { background: #315d88; animation-delay: -1s; }
@keyframes flag-wave { from { transform: skewY(-5deg) scaleX(.88); } to { transform: skewY(7deg) scaleX(1.08); } }

.guild-avatar {
  width: 54px;
  height: 54px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 9px rgba(31,48,40,.16);
}
.guild-actions { display: grid; gap: 6px; min-width: 76px; }
.guild-card .guild-actions button { width: 100%; min-height: 36px; }
.guild-card .guild-avatar-button { border-color: var(--deep); color: var(--deep); }

.shop-tabs { grid-template-columns: repeat(2, 1fr); }
.profile-inventory-button { width: 100%; margin-top: 14px; }
.inventory-card { grid-template-columns: 54px 1fr; }
.inventory-dates { display: grid; gap: 2px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); }
.inventory-dates small { margin-top: 0; color: #766c5b; }
.inventory-status { color: var(--red); font-size: 13px; font-weight: 600; }
.inventory-status.used { color: var(--muted); }

.casino-view { padding-bottom: 34px; }
.casino-table-shell {
  overflow: hidden;
  border: 2px solid #b8863d;
  border-radius: 20px;
  background: linear-gradient(145deg, #174b45, #0f3733);
  box-shadow: 0 12px 25px rgba(17,48,44,.2), inset 0 0 0 3px rgba(255,235,181,.08);
}
.casino-table-heading { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; color: #fff3d1; border-bottom: 1px solid rgba(241,213,138,.28); }
.casino-table-heading > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 15px STKaiti,KaiTi,serif; letter-spacing: .5px; }
.casino-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #ead192; background: rgba(0,0,0,.2); font-size: 11px; }
.casino-status[data-status="betting"] { color: #fff; background: #a94433; }
.casino-table {
  min-height: 248px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 154px 94px;
  grid-template-areas: "big triple triple small" "odd odd even even";
  border-bottom: 1px solid rgba(241,213,138,.4);
  background:
    radial-gradient(circle at 50% 31%, rgba(244,211,128,.11), transparent 35%),
    linear-gradient(135deg, rgba(255,255,255,.035), transparent 46%);
}
.casino-zone { position: relative; min-width: 0; }
.casino-zone input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.casino-zone > span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: rgba(255,245,215,.86);
  border-right: 1px solid rgba(241,213,138,.35);
  border-bottom: 1px solid rgba(241,213,138,.35);
  background: rgba(6,36,32,.12);
  transition: background .18s ease, box-shadow .18s ease, color .18s ease;
}
.casino-zone b { font: 34px STKaiti,KaiTi,serif; font-weight: 500; }
.casino-zone small { color: rgba(255,235,182,.67); font-size: 11px; }
.casino-zone input:checked + span { color: #fff1bd; background: rgba(166,67,48,.72); box-shadow: inset 0 0 0 2px #e5bc66, inset 0 0 24px rgba(255,201,91,.16); }
.casino-zone-big { grid-area: big; }
.casino-zone-triple { grid-area: triple; }
.casino-zone-small { grid-area: small; }
.casino-zone-odd { grid-area: odd; }
.casino-zone-even { grid-area: even; }
.casino-zone-small > span, .casino-zone-even > span { border-right: 0; }
.casino-zone-odd > span, .casino-zone-even > span { border-bottom: 0; }
.casino-zone-triple b { font-size: 20px; }
.casino-dice { display: flex; gap: 5px; margin: 2px 0 1px; }
.casino-dice i {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid #e3b85b;
  border-radius: 9px;
  color: #643225;
  background: #fff2cb;
  box-shadow: 0 3px 0 #743a2d, 0 6px 10px rgba(0,0,0,.17);
  font-style: normal;
  font-size: 29px;
  line-height: 1;
}
.casino-dice.rolling i { animation: dice-roll .22s linear infinite; }
.casino-dice.rolling i:nth-child(2) { animation-delay: -.08s; }
.casino-dice.rolling i:nth-child(3) { animation-delay: -.15s; }
@keyframes dice-roll { 0% { transform: rotate(0) scale(.94); } 50% { transform: rotate(180deg) scale(1.08); } 100% { transform: rotate(360deg) scale(.94); } }
.casino-stake-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; padding: 11px 12px 6px; color: #fff2cb; }
.casino-stake-row label { display: grid; grid-template-columns: auto minmax(76px,1fr); align-items: center; gap: 8px; font-size: 12px; }
.casino-stake-row select { min-height: 38px; padding: 5px 28px 5px 10px; border-color: rgba(241,213,138,.42); color: #fff4d7; background: #123d39; }
.casino-stake-row small { max-width: 96px; color: rgba(255,240,202,.62); font-size: 10px; line-height: 1.35; text-align: right; }
.casino-table-shell > .primary-button { width: calc(100% - 24px); min-height: 44px; margin: 6px 12px 13px; }
.casino-panel {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid rgba(113,78,35,.2);
  border-radius: 17px;
  background: linear-gradient(135deg,rgba(255,255,255,.94),rgba(249,242,224,.96));
  box-shadow: 0 7px 18px rgba(45,59,48,.075);
}
.casino-panel h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.casino-rule { margin: 10px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.casino-admin-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.casino-admin-actions button { min-height: 43px; border: 1px solid var(--red); border-radius: 10px; color: var(--red); background: #fff; }
.casino-admin-actions button:disabled { opacity: .4; }
.casino-round-records { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.casino-record-panel { min-width: 0; overflow: hidden; border: 1px solid rgba(113,78,35,.2); border-radius: 15px; background: rgba(255,252,243,.94); box-shadow: 0 6px 15px rgba(45,59,48,.07); }
.casino-record-panel h3 { margin: 0; padding: 10px 9px 8px; color: var(--deep); font-size: 14px; font-weight: 600; }
.casino-winner-panel h3 { color: var(--red-dark); }
.casino-record-head, .casino-record-row { display: grid; grid-template-columns: minmax(0,1.2fr) .65fr .75fr; align-items: center; gap: 3px; }
.casino-record-head { padding: 6px 7px; color: var(--muted); background: var(--paper-2); font-size: 9px; }
.casino-record-row { min-height: 36px; padding: 6px 7px; border-top: 1px solid rgba(113,78,35,.1); font-size: 10px; }
.casino-record-row span, .casino-record-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.casino-record-row strong { color: var(--red); text-align: center; }
.casino-record-row span:last-child { text-align: right; }
.casino-record-row.winner span:last-child { color: #2c7a59; font-weight: 700; }
.casino-record-list { max-height: 180px; overflow-y: auto; }
.casino-record-list .empty-note { margin: 0; padding: 18px 6px; font-size: 10px; text-align: center; }

@media (max-width: 370px) {
  .casino-table { grid-template-rows: 142px 86px; }
  .casino-dice i { width: 30px; height: 30px; font-size: 25px; }
  .casino-zone b { font-size: 30px; }
  .casino-zone-triple b { font-size: 18px; }
  .casino-record-panel h3 { padding-inline: 7px; font-size: 13px; }
  .casino-record-head, .casino-record-row { padding-inline: 5px; }
  .guild-card { grid-template-columns: 50px 1fr; }
  .guild-actions { grid-column: 1 / -1; grid-template-columns: repeat(2,1fr); }
  .guild-card .guild-actions button { grid-column: auto; }
}

/* v6：底部导航完整收进安全区域 */
.game-shell { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.bottom-nav {
  min-height: calc(80px + env(safe-area-inset-bottom));
  padding: 7px 5px max(11px, env(safe-area-inset-bottom));
  align-items: flex-start;
}
.bottom-nav button { min-height: 58px; padding: 2px 0 5px; transform: none; }
.bottom-nav button:active { transform: translateY(1px); }
.bottom-nav small { display: block; padding-bottom: 2px; line-height: 1.35; }
.game-shell.home-mode .home-view {
  height: calc(100dvh - 72px - env(safe-area-inset-top) - 80px - env(safe-area-inset-bottom));
}

/* v7：图标字位与赌坊开奖结果细修 */
.bottom-nav button:first-child span {
  padding-bottom: 4px;
  line-height: 1;
}
.casino-table-shell:not([data-round-status="betting"]) .casino-zone input:checked + span {
  color: rgba(255,245,215,.86);
  background: rgba(6,36,32,.12);
  box-shadow: none;
}
.casino-zone.is-winning > span,
.casino-table-shell:not([data-round-status="betting"]) .casino-zone.is-winning input:checked + span {
  color: #fff8da;
  background: linear-gradient(145deg, #cf9d38, #a85a2f);
  box-shadow: inset 0 0 0 3px #ffe59a, inset 0 0 28px rgba(255,239,168,.27);
  animation: winner-zone-glow 1.45s ease-in-out infinite alternate;
}
@keyframes winner-zone-glow {
  from { filter: brightness(.92); }
  to { filter: brightness(1.13); }
}
.casino-zone-triple b { font-size: 34px; }
.casino-dice i {
  width: 35px;
  height: 35px;
  padding-bottom: 1px;
  place-items: center;
  align-content: center;
  justify-content: center;
  overflow: hidden;
  font-size: 37px;
  line-height: .72;
}
@media (max-width: 370px) {
  .casino-zone-triple b { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-mist, .harbor-ripple, .river-ripple, .arena-breath, .lantern-light, .market-smoke, .drifting-leaf, .guild-flag::after, .casino-dice.rolling i, .casino-zone.is-winning > span { animation: none; }
}
