:root {
  color-scheme: dark;
  --bg: #07100f;
  --panel: rgba(12, 25, 24, 0.78);
  --panel-strong: rgba(17, 36, 35, 0.92);
  --line: rgba(214, 188, 124, 0.22);
  --line-cool: rgba(95, 211, 190, 0.18);
  --gold: #e8c66d;
  --gold-soft: #f5dc95;
  --emerald: #27d0a0;
  --cyan: #71d9ff;
  --coral: #ff7f74;
  --ink: #effbf6;
  --muted: #9db6af;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(232, 198, 109, 0.15), transparent 28rem),
    linear-gradient(160deg, rgba(3, 9, 9, 0.96), rgba(7, 21, 19, 0.86)),
    url("../assets/premium-bg.png") center top / cover fixed;
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(5, 13, 13, 0.72);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(232, 198, 109, 0.75);
  box-shadow: 0 0 0 3px rgba(232, 198, 109, 0.12);
}

.app-shell {
  position: relative;
  width: min(100%, 456px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 16, 15, 0.1), rgba(7, 16, 15, 0.74)),
    radial-gradient(circle at 72% 14%, rgba(113, 217, 255, 0.14), transparent 16rem);
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.boot-mark {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(232, 198, 109, 0.4), rgba(39, 208, 160, 0.12));
}

.topbar,
.segmented,
.view,
.bottom-nav,
.login-screen {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold-soft);
  font-size: 11px;
  line-height: 1.1;
}

.topbar h1,
.hero-copy h2,
.agent-hero h2 {
  margin: 0;
  font-weight: 750;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 148px;
  border: 1px solid rgba(232, 198, 109, 0.28);
  border-radius: 999px;
  padding: 8px 10px;
  color: #f8e7ad;
  background: rgba(21, 18, 10, 0.54);
  font-size: 12px;
  text-align: center;
}

.logout-button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.status-pill.open {
  color: #bafbe7;
  border-color: rgba(39, 208, 160, 0.35);
  background: rgba(9, 55, 43, 0.42);
}

.status-pill.drawn {
  color: #c9ecff;
  border-color: rgba(113, 217, 255, 0.32);
  background: rgba(19, 45, 58, 0.42);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 3), minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 5px;
  margin-bottom: 14px;
  background: rgba(3, 10, 10, 0.58);
  backdrop-filter: blur(16px);
}

.login-screen {
  display: grid;
  gap: 14px;
}

.login-hero,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 34, 32, 0.82), rgba(6, 14, 14, 0.76));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-hero {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 28px 22px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(244, 209, 122, 0.2), rgba(244, 209, 122, 0) 32%),
    linear-gradient(180deg, rgba(10, 10, 9, 0.18), rgba(0, 0, 0, 0.9)),
    url("../assets/premium-bg.png") center 34% / cover;
}

.brand-hero::before {
  content: none;
}

.brand-hero::after {
  content: none;
}

.login-hero h1 {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.95em;
  margin: 0;
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  color: transparent;
  background:
    linear-gradient(
      115deg,
      #7c5a20 0%,
      #fff5bd 14%,
      #d29c34 28%,
      #fff0a2 43%,
      #8a611c 56%,
      #fce4a1 70%,
      #b9822b 84%,
      #fff6c9 100%
    );
  background-size: 260% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: xingxu-metal-sweep 4.8s ease-in-out infinite;
  text-shadow:
    0 1px 0 rgba(255, 243, 191, 0.88),
    0 12px 28px rgba(0, 0, 0, 0.72),
    0 0 26px rgba(224, 171, 67, 0.5);
}

.login-brand-title {
  padding: 0;
  border-bottom: 0;
}

.login-hero h1.image-wordmark {
  width: min(96%, 380px);
  max-width: 100%;
  gap: 0;
  font-size: 0;
  line-height: 0;
  color: inherit;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  animation: xingxu-wordmark-float 5.8s ease-in-out infinite;
  text-shadow: none;
}

.login-brand-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
  filter:
    drop-shadow(0 16px 22px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 18px rgba(232, 198, 109, 0.34));
}

.login-brand-title span {
  display: inline-block;
  transform: translateY(0) scale(1);
  animation: xingxu-metal-float 5.6s ease-in-out infinite;
}

.login-brand-title span:nth-child(2) {
  animation-delay: 0.42s;
}

@keyframes xingxu-metal-sweep {
  0%,
  100% {
    background-position: 0% 50%;
    filter: brightness(0.98) contrast(1.08);
  }

  50% {
    background-position: 100% 50%;
    filter: brightness(1.18) contrast(1.18);
  }
}

@keyframes xingxu-metal-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
    text-shadow:
      0 1px 0 rgba(255, 243, 191, 0.88),
      0 12px 28px rgba(0, 0, 0, 0.72),
      0 0 26px rgba(224, 171, 67, 0.5);
  }

  45% {
    transform: translateY(-3px) scale(1.015);
    text-shadow:
      0 1px 0 rgba(255, 248, 205, 0.96),
      0 15px 30px rgba(0, 0, 0, 0.76),
      0 0 34px rgba(255, 204, 87, 0.72);
  }
}

@keyframes xingxu-wordmark-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1) contrast(1.03);
  }

  46% {
    transform: translateY(-3px) scale(1.012);
    filter: brightness(1.1) contrast(1.08);
  }
}

.login-grid {
  display: grid;
  gap: 12px;
}

.login-panel {
  padding: 15px;
}

.login-form-panel {
  display: grid;
  gap: 12px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form .primary-action {
  width: 100%;
}

.login-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.login-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
}

.login-card span,
.login-card em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.login-card strong {
  display: block;
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.tab-button {
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.tab-button.is-active {
  color: #111712;
  background: linear-gradient(135deg, #f4d77d, #47d8ae);
  box-shadow: 0 10px 24px rgba(39, 208, 160, 0.18);
}

.view {
  display: grid;
  gap: 12px;
}

.hero-panel,
.bet-panel,
.room-lobby,
.result-panel,
.settlement-panel,
.ledger-strip,
.admin-panel,
.agent-panel,
.agent-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 34, 32, 0.82), rgba(6, 14, 14, 0.76));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  min-height: 212px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(10, 26, 25, 0.48), rgba(6, 12, 12, 0.82)),
    url("../assets/premium-bg.png") center 35% / cover;
}

.hero-copy {
  max-width: 340px;
}

.room-tag {
  display: inline-flex;
  margin-bottom: 14px;
  border: 1px solid rgba(232, 198, 109, 0.22);
  border-radius: 999px;
  padding: 7px 10px;
  color: #f6e4a7;
  background: rgba(7, 10, 9, 0.48);
  font-size: 12px;
}

.schedule-strip {
  display: grid;
  gap: 3px;
  max-width: 260px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.24);
}

.schedule-strip span {
  color: var(--muted);
  font-size: 11px;
}

.schedule-strip strong {
  color: var(--ink);
  font-size: 16px;
}

.schedule-strip em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.schedule-strip.is-open {
  border-color: rgba(39, 208, 160, 0.26);
  background: rgba(15, 66, 52, 0.26);
}

.schedule-strip.is-open strong {
  color: #bafbe7;
}

.schedule-strip.is-locked {
  border-color: rgba(244, 118, 96, 0.24);
  background: rgba(72, 31, 28, 0.25);
}

.schedule-strip.is-locked strong {
  color: #ffb29f;
}

.hero-copy h2 {
  font-size: clamp(42px, 14vw, 66px);
  line-height: 0.95;
}

.hero-copy p,
.agent-hero p,
.empty-state p,
.critical-note {
  color: var(--muted);
  line-height: 1.65;
}

.metric-row,
.audit-metrics,
.draw-sync-summary,
.rebate-summary,
.ledger-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-row {
  margin-top: 22px;
}

.draw-sync-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.metric,
.draw-sync-summary .metric,
.ledger-strip div,
.rebate-summary div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.metric span,
.draw-sync-summary .metric span,
.ledger-strip span,
.rebate-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric strong,
.draw-sync-summary .metric strong,
.ledger-strip strong,
.rebate-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
}

.bet-panel,
.room-lobby,
.result-panel,
.settlement-panel,
.admin-panel,
.agent-panel,
.agent-hero {
  padding: 15px;
}

.room-lobby-full {
  min-height: 62vh;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-head h3 {
  margin: 0;
  font-size: 18px;
}

.section-head > span,
.section-head button {
  flex: 0 0 auto;
  border: 1px solid rgba(232, 198, 109, 0.22);
  border-radius: 999px;
  padding: 8px 10px;
  color: #f2d88d;
  background: rgba(232, 198, 109, 0.08);
  font-size: 12px;
}

.bet-form,
.settings-grid,
.transfer-box {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.primary-action {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  color: #10150f;
  font-weight: 750;
  background: linear-gradient(135deg, #f5d978, #33d5a4);
  box-shadow: 0 14px 28px rgba(36, 204, 157, 0.22);
}

.chip-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.chip-row button,
.action-row button,
.section-head button {
  min-height: 36px;
}

.chip-row button,
.action-row button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.locked-bet {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(39, 208, 160, 0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(39, 208, 160, 0.08);
}

.locked-bet span {
  color: var(--muted);
}

.unlimited-bet-summary {
  margin-bottom: 10px;
}

.bet-warning {
  margin-top: 8px;
  border: 1px solid rgba(244, 118, 96, 0.22);
  border-radius: 8px;
  padding: 9px 10px;
  color: #ffcabd;
  background: rgba(74, 33, 29, 0.28);
  font-size: 12px;
}

.primary-action:disabled,
.position-tile:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.room-lobby,
.room-admin-panel,
.room-lock {
  display: grid;
  gap: 12px;
}

.room-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.room-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
}

.room-card.is-active {
  border-color: rgba(232, 198, 109, 0.72);
  background: rgba(232, 198, 109, 0.1);
  box-shadow: inset 0 0 0 1px rgba(232, 198, 109, 0.16);
}

.room-card span,
.room-card em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.room-card strong {
  display: block;
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.create-room-grid,
.unlock-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.create-room-grid .primary-action,
.unlock-box .primary-action {
  grid-column: 1 / -1;
}

.position-grid,
.result-input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.position-tile {
  position: relative;
  display: grid;
  align-content: space-between;
  aspect-ratio: 1 / 1.04;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(145deg, rgba(16, 31, 30, 0.92), rgba(4, 10, 10, 0.86));
}

.position-tile.is-selected {
  border-color: var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(232, 198, 109, 0.42),
    0 12px 22px rgba(232, 198, 109, 0.16);
}

.position-tile.is-occupied {
  background: linear-gradient(145deg, rgba(47, 38, 18, 0.88), rgba(8, 16, 16, 0.86));
}

.position-tile.is-mine {
  border-color: rgba(39, 208, 160, 0.72);
}

.pos-no {
  color: var(--muted);
  font-size: 11px;
}

.position-tile strong {
  color: var(--gold-soft);
  font-size: clamp(20px, 7vw, 31px);
  line-height: 1;
}

.position-tile em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-summary-list,
.position-result-list,
.position-player-list {
  display: grid;
  gap: 8px;
}

.position-summary-list {
  margin-top: 12px;
}

.room-total-bet-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  border: 1px solid rgba(232, 198, 109, 0.22);
  border-radius: 8px;
  padding: 11px 12px;
  background:
    linear-gradient(135deg, rgba(232, 198, 109, 0.1), rgba(43, 226, 168, 0.06)),
    rgba(0, 0, 0, 0.24);
}

.room-total-bet-bar span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.room-total-bet-bar strong {
  color: var(--gold-soft);
  font-size: 20px;
}

.room-total-bet-bar em {
  border-radius: 999px;
  padding: 5px 8px;
  color: #bafbe7;
  background: rgba(43, 226, 168, 0.11);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.position-summary-row,
.position-result-row {
  border: 1px solid rgba(232, 198, 109, 0.14);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.position-summary-main,
.position-result-head,
.position-player-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.position-summary-main {
  grid-template-columns: auto 1fr;
  margin-bottom: 8px;
}

.position-summary-main strong,
.position-result-head strong,
.position-player-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.position-summary-main strong,
.position-result-head strong {
  color: var(--gold-soft);
}

.position-summary-main span,
.position-result-head em,
.position-player-row strong {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.position-player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.position-player-chips span {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.position-player-chips b,
.position-player-chips em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.position-player-chips em {
  color: var(--gold-soft);
  font-style: normal;
}

.position-result-row {
  display: grid;
  gap: 8px;
}

.position-result-head b,
.position-player-row em {
  color: var(--emerald);
  font-style: normal;
  font-weight: 800;
}

.position-result-row.lose .position-result-head b,
.position-result-row.partial .position-result-head b,
.position-player-row.lose em,
.position-player-row.partial em {
  color: var(--coral);
}

.position-player-row {
  grid-template-columns: 1fr auto auto;
  border-radius: 8px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.05);
}

.compact-empty {
  margin-top: 12px;
  padding: 12px;
}

.number-ribbon {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.number-ribbon span {
  display: grid;
  gap: 4px;
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  place-items: center;
  background: rgba(0, 0, 0, 0.2);
}

.number-ribbon em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.summary-line span {
  border-radius: 999px;
  padding: 7px 9px;
  color: #dbeee8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.rank-list,
.flow-list,
.chain,
.rebate-bars {
  display: grid;
  gap: 8px;
}

.rank-row,
.flow-row,
.chain-node,
.bar-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.rank-row {
  grid-template-columns: auto 0.8fr 1.3fr auto;
}

.rank {
  display: inline-grid;
  width: 34px;
  height: 28px;
  border-radius: 999px;
  place-items: center;
  color: #111712;
  background: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.rank-row em,
.flow-row span,
.chain-node span,
.bar-row span {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.rank-row b {
  color: var(--emerald);
  font-size: 14px;
}

.rank-row.lose b,
.rank-row.partial b {
  color: var(--coral);
}

.ledger-strip {
  padding: 12px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.switch-line input {
  width: auto;
}

.switch-line span {
  margin: 0;
}

.result-input-grid label {
  min-width: 0;
}

.result-input-grid input {
  text-align: center;
}

.video-recognition-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid rgba(232, 198, 109, 0.18);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(140deg, rgba(232, 198, 109, 0.1), transparent 44%),
    rgba(0, 0, 0, 0.22);
}

.video-recognition-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.video-recognition-head h4 {
  margin: 0;
  font-size: 16px;
}

.video-recognition-head span {
  border: 1px solid rgba(232, 198, 109, 0.22);
  border-radius: 999px;
  padding: 6px 8px;
  color: var(--gold-soft);
  background: rgba(232, 198, 109, 0.08);
  font-size: 11px;
  white-space: nowrap;
}

.recognition-form {
  display: grid;
  grid-template-columns: 1.5fr 0.65fr 0.85fr;
  gap: 8px;
  align-items: end;
}

.recognition-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.recognition-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.recognition-result,
.recognition-source,
.recognition-transcript,
.recognition-error {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.recognition-result span,
.recognition-source span,
.recognition-transcript span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.recognition-result strong {
  display: block;
  color: var(--gold-soft);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.recognition-source a {
  color: var(--cyan);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.recognition-transcript p {
  margin: 0;
  color: #dbeee8;
  font-size: 12px;
  line-height: 1.7;
}

.recognition-error {
  border-color: rgba(255, 127, 116, 0.32);
  color: var(--coral);
  line-height: 1.6;
}

.audit-empty {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.history-panel {
  display: grid;
  gap: 12px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  border: 1px solid rgba(232, 198, 109, 0.13);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(232, 198, 109, 0.08), transparent 42%),
    rgba(0, 0, 0, 0.22);
}

.history-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-card-head strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.history-card-head span,
.history-card-head em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.history-card-head em {
  max-width: 48%;
  text-align: right;
  overflow-wrap: anywhere;
}

.history-numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.history-numbers span {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 7px 5px;
  text-align: center;
  background: rgba(8, 15, 14, 0.72);
}

.history-numbers em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
}

.history-numbers strong {
  display: block;
  margin-top: 2px;
  color: var(--gold-soft);
  font-size: 15px;
}

.history-room-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.history-room-block {
  display: grid;
  gap: 6px;
}

.history-room-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.history-room-row span,
.history-room-row strong,
.history-room-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-room-row strong {
  color: var(--ink);
}

.history-room-row em {
  color: #91ead4;
  font-style: normal;
  text-align: right;
}

.history-player-list {
  display: grid;
  gap: 5px;
  padding-left: 8px;
}

.history-player-row {
  display: grid;
  grid-template-columns: 0.9fr 1fr auto;
  gap: 7px;
  align-items: center;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 8px 8px 0;
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 11px;
}

.history-player-row span,
.history-player-row strong,
.history-player-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-player-row span {
  color: var(--muted);
}

.history-player-row strong {
  color: var(--ink);
}

.history-player-row em {
  color: var(--gold-soft);
  font-style: normal;
  text-align: right;
}

.history-player-row.positive {
  border-left-color: rgba(39, 208, 160, 0.6);
}

.history-player-row.negative {
  border-left-color: rgba(255, 127, 116, 0.65);
}

.history-player-row.positive em {
  color: var(--emerald);
}

.history-player-row.negative em {
  color: var(--coral);
}

.history-player-empty {
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
  font-size: 11px;
}

.player-bill-panel,
.player-bill-room-list {
  display: grid;
  gap: 12px;
}

.player-bill-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.player-bill-room {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(232, 198, 109, 0.14);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(232, 198, 109, 0.07), transparent 42%),
    rgba(0, 0, 0, 0.2);
}

.player-bill-room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.player-bill-room-head strong,
.player-bill-room-head span {
  display: block;
}

.player-bill-room-head strong {
  color: var(--ink);
  font-size: 17px;
}

.player-bill-room-head span,
.player-bill-room-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.player-bill-room-head em {
  max-width: 48%;
  text-align: right;
  overflow-wrap: anywhere;
}

.player-bill-own-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-bill-own-list span {
  border: 1px solid rgba(232, 198, 109, 0.16);
  border-radius: 999px;
  padding: 7px 9px;
  color: var(--gold-soft);
  background: rgba(232, 198, 109, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.player-bill-participant-list {
  display: grid;
  gap: 5px;
}

.bill-player-row.is-mine {
  border-color: rgba(232, 198, 109, 0.34);
  border-left-color: rgba(232, 198, 109, 0.9);
  background: rgba(232, 198, 109, 0.08);
}

.player-bill-draw {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(232, 198, 109, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.player-bill-number-ribbon span {
  min-height: 48px;
  color: var(--gold-soft);
  font-weight: 900;
}

.chat-dock {
  position: fixed;
  z-index: 20;
  width: 54px;
  height: 54px;
  touch-action: auto;
}

.chat-bubble {
  position: relative;
  width: 54px;
  height: 54px;
  touch-action: none;
  user-select: none;
  border: 1px solid rgba(232, 198, 109, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 238, 168, 0.24), transparent 34%),
    linear-gradient(145deg, rgba(10, 28, 26, 0.94), rgba(3, 12, 12, 0.92));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.44), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.chat-bubble span {
  position: absolute;
  left: 15px;
  top: 15px;
  width: 24px;
  height: 18px;
  border: 2px solid #f6df98;
  border-radius: 12px;
}

.chat-bubble span::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: -6px;
  width: 8px;
  height: 8px;
  border-left: 2px solid #f6df98;
  border-bottom: 2px solid #f6df98;
  transform: rotate(-18deg);
}

.chat-bubble em,
.chat-friend em {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  color: #fff;
  background: #e83b36;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.chat-bubble em {
  position: absolute;
  right: -3px;
  top: -4px;
}

.chat-panel {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 21;
  display: grid;
  grid-template-rows: auto auto;
  max-width: 428px;
  max-height: calc(100vh - max(14px, env(safe-area-inset-top)) - 96px - env(safe-area-inset-bottom));
  margin: 0 auto;
  border: 1px solid rgba(232, 198, 109, 0.28);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(13, 31, 29, 0.97), rgba(3, 11, 11, 0.98));
  box-shadow: 0 28px 76px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  touch-action: pan-y;
}

.chat-panel-head,
.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-panel-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.chat-panel-head button,
.chat-thread-head button,
.chat-admin-tools button {
  border: 1px solid rgba(232, 198, 109, 0.22);
  border-radius: 999px;
  color: #f8e7ad;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 11px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 128px 1fr;
  grid-template-rows: minmax(0, 1fr);
  min-height: 220px;
  max-height: calc(100vh - max(14px, env(safe-area-inset-top)) - 190px - env(safe-area-inset-bottom));
}

.chat-friend-list {
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  max-height: inherit;
  overflow: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.chat-friend {
  display: grid;
  width: 100%;
  gap: 4px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.chat-friend.is-active {
  border-color: rgba(232, 198, 109, 0.5);
  background: rgba(232, 198, 109, 0.1);
}

.chat-friend strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
}

.chat-friend span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 220px;
}

.chat-thread-head {
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
}

.chat-message-list {
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: auto;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.chat-message {
  display: flex;
}

.chat-message.is-mine {
  justify-content: flex-end;
}

.chat-message div {
  max-width: 82%;
}

.chat-message span,
.chat-admin-message span,
.chat-voice-meta {
  display: block;
  margin-bottom: 4px;
  color: rgba(157, 182, 175, 0.82);
  font-size: 11px;
  font-style: normal;
}

.chat-message p,
.chat-admin-message p {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.055);
  line-height: 1.55;
  word-break: break-word;
}

.chat-message.is-mine p {
  border-color: rgba(39, 208, 160, 0.32);
  background: rgba(39, 208, 160, 0.15);
}

.chat-audio {
  display: block;
  width: min(220px, 100%);
  height: 34px;
}

.chat-image-link {
  display: block;
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 0;
  background: rgba(0, 0, 0, 0.22);
}

.chat-image {
  display: block;
  max-width: min(220px, 100%);
  max-height: 260px;
  object-fit: contain;
}

.chat-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: max(56px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.86);
}

.chat-image-viewer img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
}

.chat-image-viewer span {
  align-self: start;
  max-width: min(420px, 92vw);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-image-viewer-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 1px solid rgba(232, 198, 109, 0.36);
  border-radius: 50%;
  color: #fff4c2;
  background: rgba(15, 19, 18, 0.72);
  font-size: 28px;
  line-height: 1;
}

.chat-voice-warning {
  margin: 0 10px 8px;
  border: 1px solid rgba(232, 198, 109, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--gold-soft);
  background: rgba(232, 198, 109, 0.07);
  font-size: 12px;
  line-height: 1.45;
}

.chat-send-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#chatMessageInput {
  grid-column: 1 / -1;
  padding: 10px;
  min-height: 44px;
}

.chat-send-form button {
  border-radius: 8px;
  min-height: 44px;
  padding: 0 10px;
  color: #061412;
  background: linear-gradient(135deg, #f5df8d, #38ddb2);
  font-weight: 800;
}

.chat-send-form button.is-recording {
  color: #fff;
  background: linear-gradient(135deg, #e83b36, #ff8c72);
}

.chat-image-input {
  display: none;
}

.chat-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.chat-admin-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.chat-admin-tools button {
  border-radius: 8px;
}

.chat-admin-thread {
  display: grid;
  gap: 9px;
  max-height: 560px;
  overflow: auto;
}

.chat-admin-message {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.chat-admin-message strong {
  display: block;
  margin-bottom: 3px;
  color: var(--gold-soft);
}

.network-panel {
  display: grid;
  gap: 12px;
}

.network-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.subsection-title span {
  color: var(--gold-soft);
  font-weight: 700;
}

.subsection-title em {
  overflow-wrap: anywhere;
  font-style: normal;
  text-align: right;
}

.line-card-list,
.account-row-list,
.bet-line-list {
  display: grid;
  gap: 8px;
}

.line-card {
  border: 1px solid rgba(232, 198, 109, 0.16);
  border-radius: 8px;
  padding: 11px;
  background: linear-gradient(145deg, rgba(22, 36, 32, 0.76), rgba(0, 0, 0, 0.22));
}

.line-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.line-card-head strong,
.line-card-head span {
  display: block;
}

.line-card-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.line-card-head em {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 8px;
  color: #bafbe7;
  background: rgba(39, 208, 160, 0.12);
  font-size: 11px;
  font-style: normal;
}

.line-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.agent-badge {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px;
  background: rgba(0, 0, 0, 0.2);
}

.agent-badge span,
.agent-badge em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.agent-badge strong {
  display: block;
  margin: 2px 0;
  color: var(--ink);
  font-size: 16px;
}

.agent-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(232, 198, 109, 0.16);
  border-radius: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.agent-menu button {
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #cfe5dc;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  font-size: 12px;
  font-weight: 800;
}

.agent-menu button.is-active {
  border-color: rgba(232, 198, 109, 0.58);
  color: #101610;
  background: linear-gradient(135deg, var(--gold), var(--emerald));
  box-shadow: 0 10px 26px rgba(39, 208, 160, 0.2);
}

.admin-menu {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.child-rate-list {
  display: grid;
  gap: 10px;
}

.child-rate-row {
  display: grid;
  grid-template-columns: 1fr minmax(88px, 110px);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.child-rate-row span,
.child-rate-row em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.child-rate-row strong {
  display: block;
  margin: 3px 0;
  color: var(--ink);
  font-size: 15px;
}

.child-rate-row input {
  text-align: center;
}

.panel-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.player-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.player-chip-list span {
  border: 1px solid rgba(113, 217, 255, 0.18);
  border-radius: 999px;
  padding: 6px 8px;
  color: #d8f3ff;
  background: rgba(113, 217, 255, 0.08);
  font-size: 12px;
}

.account-row,
.bet-line-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 9px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.account-row span,
.bet-line-row span {
  color: var(--gold-soft);
  font-size: 12px;
}

.account-row strong,
.bet-line-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-row em,
.bet-line-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.account-create-panel {
  display: grid;
  gap: 12px;
}

.operator-select {
  display: block;
}

.operator-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.operator-card div {
  min-width: 0;
  border: 1px solid rgba(232, 198, 109, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.operator-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.operator-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.create-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.create-account-grid .primary-action,
.password-form-grid .primary-action {
  grid-column: 1 / -1;
}

.history-picker,
.password-panel,
.account-manage-panel {
  display: grid;
  gap: 12px;
}

.audit-picker {
  margin-bottom: 12px;
}

.audit-history-list {
  margin-top: 10px;
}

.password-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
}

.account-manage-list {
  display: grid;
  gap: 8px;
}

.account-manage-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.account-manage-info {
  min-width: 0;
}

.account-manage-info span,
.account-manage-info em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.account-manage-info strong {
  display: block;
  margin: 3px 0;
  overflow-wrap: anywhere;
}

.direct-list {
  display: grid;
  gap: 8px;
}

.direct-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 9px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.direct-row span {
  color: var(--gold-soft);
  font-size: 12px;
}

.direct-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ledger-center {
  display: grid;
  gap: 12px;
}

.ledger-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ledger-tool-row,
.ledger-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ledger-tool-row button,
.ledger-pagination button,
.ledger-delete-button {
  min-height: 34px;
  border: 1px solid rgba(232, 198, 109, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.ledger-tool-row button:nth-child(2),
.ledger-tool-row button:nth-child(3),
.ledger-delete-button {
  color: #ffd2c8;
  border-color: rgba(255, 127, 116, 0.24);
  background: rgba(255, 127, 116, 0.08);
}

.ledger-tool-row span,
.ledger-pagination span {
  color: var(--muted);
  font-size: 12px;
}

.ledger-pagination {
  justify-content: center;
}

.ledger-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ledger-row-list {
  display: grid;
  gap: 8px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 11px;
  background: rgba(0, 0, 0, 0.22);
}

.ledger-main {
  min-width: 0;
}

.ledger-main span,
.ledger-main em,
.ledger-side span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ledger-main strong {
  display: block;
  margin: 3px 0;
}

.ledger-side {
  min-width: 72px;
  text-align: right;
}

.ledger-side b {
  display: block;
  color: var(--gold-soft);
}

.ledger-delete-button {
  width: 100%;
  margin-top: 8px;
}

.ledger-row.positive .ledger-side b {
  color: var(--emerald);
}

.ledger-row.negative .ledger-side b {
  color: var(--coral);
}

.bet-trace {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 9px;
}

.bet-trace span {
  border-radius: 999px;
  padding: 5px 7px;
  color: #d8f3ff;
  background: rgba(113, 217, 255, 0.08);
  font-size: 11px;
}

.agent-hero {
  min-height: 174px;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(140deg, rgba(8, 18, 18, 0.25), rgba(7, 14, 14, 0.82)),
    url("../assets/premium-bg.png") center 25% / cover;
}

.agent-hero h2 {
  font-size: 34px;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rate-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.rate-card input {
  margin: 6px 0;
  padding: 10px 8px;
  text-align: center;
}

.rate-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.stake-demo {
  display: block;
  margin: 12px 0;
}

.bar-row {
  grid-template-columns: 44px 1fr 58px;
}

.bar-row div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--emerald), var(--cyan));
}

.chain-node {
  grid-template-columns: 86px 1fr;
}

.transfer-box {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.transfer-box .primary-action {
  grid-column: 1 / -1;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  display: grid;
  width: min(428px, calc(100% - 28px));
  grid-template-columns: repeat(var(--tab-count, 3), minmax(0, 1fr));
  gap: 7px;
  transform: translateX(-50%);
  border: 1px solid rgba(232, 198, 109, 0.18);
  border-radius: 14px;
  padding: 7px;
  background: rgba(3, 10, 10, 0.82);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 140;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(232, 198, 109, 0.24);
  border-radius: 999px;
  color: #f8e7ad;
  background: rgba(6, 12, 12, 0.9);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.live-float-button {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 95;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 126px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0 20px;
  color: #fff3d3;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
  background: rgba(18, 20, 21, 0.72);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.live-float-button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ff1f2d;
  box-shadow: 0 0 0 3px rgba(255, 31, 45, 0.14);
}

.live-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  align-items: end;
  padding: 16px 12px calc(18px + env(safe-area-inset-bottom));
  pointer-events: none;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
}

.live-modal {
  width: min(100%, 520px);
  margin: 0 auto;
  border: 1px solid rgba(232, 198, 109, 0.32);
  border-radius: 12px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(232, 198, 109, 0.12), transparent 44%),
    rgba(7, 18, 17, 0.96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.62);
  pointer-events: auto;
  transform: translateY(var(--live-modal-y, 0px));
  transition: transform 0.16s ease;
  will-change: transform;
}

.live-modal.is-dragging {
  transition: none;
}

.live-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.live-modal.is-dragging .live-modal-head {
  cursor: grabbing;
}

.live-modal-head span {
  display: block;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 900;
}

.live-modal-head strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.live-modal-head button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #ffe8df;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
  line-height: 1;
}

.live-video-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #020706;
}

.live-video-player,
.live-native-video {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #020706;
}

.live-video-player > *,
.live-video-player .xgplayer,
.live-video-player video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.live-native-video {
  display: none;
  object-fit: cover;
}

.live-loading,
.live-error {
  display: grid;
  min-height: 210px;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.live-error {
  color: #ffcabd;
}

.live-note {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .app-shell {
    padding-inline: 10px;
  }

  .bet-form,
  .account-manage-row,
  .create-account-grid,
  .create-room-grid,
  .draw-sync-summary,
  .history-player-row,
  .history-room-row,
  .ledger-filter-grid,
  .chat-admin-tools,
  .password-form-grid,
  .recognition-actions,
  .recognition-form,
  .room-card-list,
  .unlock-box,
  .transfer-box {
    grid-template-columns: 1fr;
  }

  .position-grid {
    gap: 6px;
  }

  .rank-row {
    grid-template-columns: auto 1fr auto;
  }

  .rank-row em {
    grid-column: 2 / -1;
  }

  .account-row,
  .bet-line-row,
  .direct-row {
    grid-template-columns: 44px 1fr;
  }

  .account-row em,
  .bet-line-row em,
  .direct-row em {
    grid-column: 2 / -1;
    text-align: left;
  }

  .ledger-row {
    grid-template-columns: 1fr;
  }

  .history-card-head {
    display: grid;
  }

  .history-card-head em,
  .history-player-row em,
  .history-room-row em {
    max-width: none;
    text-align: left;
  }

  .ledger-side {
    text-align: left;
  }

  .chat-layout {
    grid-template-columns: 126px minmax(0, 1fr);
    min-height: 260px;
    max-height: calc(100vh - max(14px, env(safe-area-inset-top)) - 190px - env(safe-area-inset-bottom));
  }

  .chat-friend-list {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom: 0;
  }

  .chat-friend {
    min-width: 0;
    margin-bottom: 7px;
    padding: 9px 8px;
  }
}

@media (min-width: 760px) {
  body {
    background-size: cover;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
    margin-top: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(232, 198, 109, 0.2);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.54);
  }

  .account-manage-row {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  }

  .password-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
