/*
 * kugou.css — feature "kugou" (spec 08): bottom tab bar, game panel, bet sheet, records
 * dialog, account manager, toast. Values follow spec 08 §4.4, §5, §6.8, §7, §8.6, §11, §12.
 * Rule order follows the original cascade where it matters (legacy rules first, the
 * !important tab-bar rule, then the ≤767 / shell / records overrides).
 * Legacy rules that no element uses (.kugou-entry-btn, .kugou-spell-*, .kugou-dot…) are omitted.
 * Note: the global `section { margin-top: 12px }` (base.css) applies to the panels and to
 * #kugouGameHistory / #kugouGameGrid / .kugou-account-list – that offset is part of the look.
 */

/* ------------------------------------------------------------------ */
/* Legacy entry-bar rules: every property except the backdrop blur is  */
/* overridden by the !important .kugou-android-tabbar rule below.      */
/* ------------------------------------------------------------------ */
.kugou-entry-buttons {
  position: fixed;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* ------------------------------------------------------------------ */
/* Panel containers (spec 08 §5.1)                                     */
/* ------------------------------------------------------------------ */
.kugou-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 820;
  display: grid;
  place-items: center;
  padding: 12px;
  color: #fff8df;
  font-family: -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei, sans-serif;
}

.kugou-modal[hidden] {
  display: none !important;
}

#kugouGameModal {
  left: var(--kugou-panel-left, 0);
  right: auto;
  width: var(--kugou-panel-width, 100vw);
  place-items: center;
  padding: clamp(8px, 3vh, 18px) 4px;
}

.kugou-modal-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #02081194;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.kugou-window {
  position: relative;
  width: min(420px, calc(100vw - 18px));
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(137, 171, 214, .34);
  border-radius: 18px;
  background: radial-gradient(circle at 20% 0%, rgba(69, 132, 202, .2), transparent 34%), linear-gradient(180deg, #10243d, #07101d 74%);
  box-shadow: 0 24px 74px #0000009e;
}

.kugou-game-window {
  width: min(424px, 100%);
  max-height: calc(100vh - clamp(16px, 6vh, 36px));
  margin-top: 0;
  margin-inline: auto;
  background: #07101d;
}

#kugouGameModal .kugou-game-window {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.kugou-topbar {
  flex: 0 0 auto;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(137, 171, 214, .24);
  background: linear-gradient(180deg, #162d4af5, #0c1828f5);
}

.kugou-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kugou-brand-logo {
  width: 42px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 198, 244, .55);
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, rgba(126, 221, 255, .42), transparent 46%), linear-gradient(135deg, #124167eb, #0c1b30eb);
  color: #d9f5ff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 16px #5cb7f429;
}

.kugou-title h2 {
  margin: 0;
  color: #fff8df;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: none;
}

.kugou-content,
.kugou-game-content {
  min-height: 0;
  overflow: auto;
  padding: 7px;
  background: #07101e6b;
}

/* ------------------------------------------------------------------ */
/* Account manager (spec 08 §8.6)                                       */
/* ------------------------------------------------------------------ */
.kugou-account-list {
  display: grid;
  gap: 5px;
}

.kugou-account-card {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(137, 171, 214, .24);
  border-radius: 10px;
  background: #0a14229e;
  align-items: center;
}

.kugou-account-card.is-current {
  border-color: #f5d88ec7;
  background: linear-gradient(90deg, #f5d88e29, #5497dd24 48%, #0a1422b8), #0a1422c7;
  box-shadow: 0 0 0 2px #f5d88e38, 0 0 26px #58a7e938, inset 0 0 0 1px #ffffff0f;
}

.kugou-account-card.is-current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #f5d88e, #69c9ff);
  box-shadow: 0 0 14px #69c9ff8a;
}

.kugou-account-card.is-current .kugou-avatar {
  border-color: #f5d88eb3;
  box-shadow: 0 0 16px #f5d88e57;
}

.kugou-account-card.is-current .kugou-account-name {
  color: #fff8df;
  text-shadow: 0 0 10px rgba(105, 201, 255, .32);
}

.kugou-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(145deg, #29364a, #101827);
  border: 1px solid rgba(255, 255, 255, .12);
}

.kugou-avatar-fallback {
  display: grid;
  place-items: center;
  color: #d8f9e1;
  background: #62d483;
  font-weight: 1000;
}

.kugou-account-main {
  min-width: 0;
}

.kugou-account-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.kugou-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.kugou-account-validity {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
}

.kugou-account-validity.is-valid {
  color: #9cf0bd;
  background: #2e825457;
  border: 1px solid rgba(111, 227, 151, .4);
}

.kugou-account-validity.is-invalid {
  color: #ffc0c6;
  background: #792a3857;
  border: 1px solid rgba(238, 100, 112, .4);
}

.kugou-account-meta {
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #aebbd0;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.kugou-account-date {
  color: #aebbd0;
  font-size: 11px;
  font-weight: 700;
}

.kugou-account-coin {
  color: #ffd868;
  font-weight: 900;
  font-size: 12px;
}

.kugou-account-coin::before {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: -1px;
  background: radial-gradient(circle at 35% 30%, #fff5a3, #f0c239 58%, #9f6b0f);
  box-shadow: 0 0 8px #f0c23973;
}

.kugou-account-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}

/* ------------------------------------------------------------------ */
/* Buttons (spec 08 §5.2) – no hover, no pointer cursor                 */
/* ------------------------------------------------------------------ */
.kugou-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(122, 166, 216, .48);
  border-radius: 10px;
  background: #1b304eb8;
  color: #fff8df;
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #ffffff0d;
}

.kugou-account-actions .kugou-btn {
  min-height: 28px;
  padding: 0 8px;
}

.kugou-btn.primary {
  border-color: #e7c46eb3;
  background: linear-gradient(180deg, #5a401af2, #302212f2);
}

.kugou-btn.danger {
  border-color: #ec6d788f;
  background: #5a222eb8;
  color: #ffd8dc;
}

.kugou-btn.select {
  border-color: #7aa6d894;
  background: linear-gradient(180deg, #264063e6, #12223af0);
}

.kugou-btn.select.is-current {
  border-color: #f5d88ecc;
  background: linear-gradient(180deg, #634a1ffa, #2c2212fa);
  color: #fff8df;
  box-shadow: inset 0 0 0 1px #ffffff14, 0 0 14px #f5d88e3d;
}

.kugou-btn.ghost {
  background: #0c1828ad;
}

.kugou-btn:disabled {
  opacity: .58;
  cursor: default;
}

.kugou-empty {
  padding: 22px 12px;
  border: 1px dashed rgba(137, 171, 214, .24);
  border-radius: 16px;
  color: #aebbd0;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.kugou-empty.is-error {
  color: #ffc0c6;
  border-color: #ee647066;
}

/* ------------------------------------------------------------------ */
/* QR login card                                                        */
/* ------------------------------------------------------------------ */
.kugou-login-card {
  margin-top: 8px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
  border: 1px solid rgba(137, 171, 214, .34);
  border-radius: 14px;
  background: radial-gradient(circle at 20% 0%, rgba(84, 157, 230, .18), transparent 38%), #07101efa;
  padding: 12px;
}

.kugou-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: 0;
}

.kugou-modal-title {
  font-size: 16px;
  font-weight: 900;
}

.kugou-modal-subtitle {
  margin-top: 3px;
  color: #aebbd0;
  font-size: 11px;
  font-weight: 800;
}

.kugou-qr-login-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(137, 171, 214, .24);
  border-radius: 14px;
  background: #060e1a8f;
}

.kugou-qr-preview {
  width: 260px;
  height: 260px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(231, 196, 110, .34);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.kugou-qr-image {
  width: 238px;
  height: 238px;
  object-fit: contain;
  image-rendering: pixelated;
}

.kugou-qr-loading {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #21304a;
  text-align: center;
  padding: 20px;
}

.kugou-qr-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(31, 53, 82, .18);
  border-top-color: #375d92;
  border-radius: 50%;
  animation: kugouQrSpin .8s linear infinite;
}

.kugou-qr-status {
  min-height: 18px;
  color: #aebbd0;
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
  font-weight: 800;
}

.kugou-login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ------------------------------------------------------------------ */
/* Game panel: mini block grid head (spec 08 §6.8)                      */
/* ------------------------------------------------------------------ */
.kugou-sound-toggle {
  margin-left: auto;
  width: 32px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(122, 166, 216, .38);
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff8df;
  background: #0c1828b8;
}

.kugou-sound-svg {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.kugou-sound-body {
  fill: currentColor;
}

.kugou-sound-wave,
.kugou-sound-x {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kugou-sound-x {
  display: none;
  color: #ff737d;
}

.kugou-sound-toggle.is-muted .kugou-sound-wave {
  display: none;
}

.kugou-sound-toggle.is-muted .kugou-sound-x {
  display: block;
}

.kugou-game-content {
  display: grid;
  gap: 0;
  padding: 0;
  background: transparent;
}

.kugou-game-history {
  overflow: hidden;
  border: 1px solid rgba(137, 171, 214, .34);
  border-radius: 10px;
  background: linear-gradient(180deg, #0c1828e6, #050d19f0), radial-gradient(circle at 20% 0%, rgba(95, 175, 238, .12), transparent 42%);
}

.kugou-game-history-head {
  min-height: 20px;
  display: grid;
  grid-template-columns: minmax(148px, 1fr) 64px 22px;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 8px;
  border-bottom: 1px solid rgba(137, 171, 214, .18);
  color: #fff8df;
}

.kugou-game-history-title {
  min-width: 0;
  width: max-content;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kugou-game-history-head strong {
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
}

/* No min-height override: the global button min-height (36px) keeps the head ~36px tall. */
.kugou-game-history-title .kugou-sound-toggle {
  margin-left: 0;
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.kugou-game-history-title .kugou-sound-svg {
  width: 13px;
  height: 13px;
}

.kugou-game-close {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid rgba(122, 166, 216, .42);
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #0c1828bd;
  color: #fff8df;
  font-size: 18px;
  line-height: 1;
  font-weight: 650;
}

.kugou-game-close:hover {
  border-color: #ff737db8;
  color: #ffd7dc;
}

.kugou-history-grid {
  --history-line: #d7dbe4;
  display: grid;
  grid-template-columns: repeat(var(--kugou-history-columns, 24), minmax(0, 1fr));
  grid-auto-rows: var(--kugou-history-cell-size, 15px);
  height: calc(var(--kugou-history-cell-size, 15px) * 15);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  border-left: 1px solid var(--history-line);
  background: #d8deea1f;
}

.kugou-history-columns {
  position: relative;
  justify-self: center;
  flex: 0 0 auto;
}

.kugou-history-column-toggle {
  position: relative;
  width: 52px;
  min-height: 20px;
  padding: 0 15px 0 7px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #5c3300;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  box-shadow: inset 0 1px #ffffff8c, 0 2px 8px #0000002e;
}

.kugou-history-column-toggle::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
}

.kugou-history-column-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  width: 68px;
  overflow: hidden;
  border: 1px solid rgba(245, 216, 142, .62);
  border-radius: 8px;
  background: #17181ef5;
  box-shadow: 0 10px 22px #00000059;
}

.kugou-history-column-menu button {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #fff7df;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.kugou-history-column-menu button:hover,
.kugou-history-column-menu button.is-active {
  background: #f5d88e38;
  color: #fff;
}

.kugou-history-grid .history-cell {
  width: 100%;
  height: var(--kugou-history-cell-size, 15px);
  min-height: 0;
  font-size: clamp(8px, calc(var(--kugou-history-cell-size, 15px) * .74), 12px);
}

.kugou-history-grid .history-cell.num-9 {
  font-size: clamp(8px, calc(var(--kugou-history-cell-size, 15px) * .78), 12px);
}

.kugou-history-grid .pending-countdown {
  font-size: clamp(8px, calc(var(--kugou-history-cell-size, 15px) * .74), 12px);
}

.kugou-history-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  height: calc(var(--kugou-history-cell-size, 15px) * 15);
  color: #aebbd0;
  font-size: 12px;
  font-weight: 900;
}

/* ------------------------------------------------------------------ */
/* Game panel: skill cards                                              */
/* ------------------------------------------------------------------ */
.kugou-game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.kugou-skill {
  position: relative;
  min-height: 82px;
  padding: 5px 6px;
  border: 1px solid var(--skill-color, rgba(137, 171, 214, .24));
  border-radius: 12px;
  background: radial-gradient(circle at 50% 20%, var(--skill-glow, rgba(255, 255, 255, .08)), transparent 58%), #091321b8;
  color: #fff8df;
  display: grid;
  grid-template-rows: 39px auto;
  align-items: center;
  justify-items: center;
  overflow: hidden;
}

.kugou-skill.top {
  grid-column: 1 / -1;
  min-height: 82px;
  grid-template-columns: 58px 78px 86px minmax(92px, auto);
  grid-template-rows: 1fr;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.kugou-skill.active {
  border-color: #fff8df;
  background: linear-gradient(180deg, rgba(255, 248, 223, .12), transparent 54%), radial-gradient(circle at 50% 20%, var(--skill-glow, rgba(255, 255, 255, .08)), transparent 58%), #091321e6;
  box-shadow: 0 0 0 3px #fff8df80, 0 0 24px var(--skill-color, rgba(255, 255, 255, .2)), inset 0 0 0 1px #fff8df2e;
}

.kugou-skill.active::after {
  content: "已选";
  position: absolute;
  right: 5px;
  top: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fff8df;
  color: #07101d;
  font-size: 9px;
  line-height: 1;
  font-weight: 1000;
  box-shadow: 0 2px 8px #00000042;
}

.kugou-skill.result {
  border-color: #fff8a0f2;
  box-shadow: 0 0 0 2px #fff8df59, 0 0 26px #ffd95b6b;
}

.kugou-skill-num {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  margin-left: 4px;
  border-radius: 50%;
  background: #fff;
  color: #111927;
  font-weight: 900;
  font-size: 15px;
}

.kugou-skill.active .kugou-skill-num {
  background: var(--skill-color);
  color: #07101d;
  box-shadow: 0 0 14px var(--skill-color);
}

.kugou-skill-key {
  color: var(--skill-color);
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
}

.kugou-skill-name {
  margin-top: 2px;
  font-weight: 900;
  font-size: 12px;
}

.kugou-skill-meta {
  margin-top: 1px;
  color: #aebbd0;
  font-size: 10px;
  font-weight: 700;
}

.kugou-skill-visual {
  width: 54px;
  height: 39px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.kugou-skill-img {
  width: 64px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .42));
}

.kugou-skill-copy {
  min-width: 0;
  text-align: center;
}

.kugou-skill.top .kugou-skill-visual {
  width: 76px;
  height: 58px;
}

.kugou-skill.top .kugou-skill-img {
  width: 92px;
  height: 70px;
}

.kugou-skill.top .kugou-skill-key {
  font-size: 32px;
}

.kugou-top-room {
  width: 58px;
  min-width: 0;
  display: grid;
  grid-template-rows: 36px auto;
  justify-items: center;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.kugou-top-room-avatar {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(117, 217, 141, .68);
  border-radius: 50%;
  object-fit: cover;
  background: radial-gradient(circle at 35% 25%, rgba(255, 248, 223, .35), transparent 45%), #0d1f32eb;
  box-shadow: 0 0 14px #75d98d38;
}

.kugou-top-room-avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff8df;
  font-size: 13px;
  font-weight: 1000;
}

.kugou-top-room span {
  max-width: 58px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff8df;
  font-size: 10px;
  line-height: 1.05;
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .65);
}

.kugou-top-countdown {
  width: 78px;
  min-height: 64px;
  border: 1px solid rgba(109, 167, 217, .34);
  border-radius: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  padding: 5px 4px;
  background: radial-gradient(circle at 50% 18%, rgba(109, 167, 217, .2), transparent 62%), #050c16c2;
}

.kugou-top-countdown span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #aebbd0;
  font-size: 10px;
  font-weight: 900;
}

.kugou-top-countdown strong {
  color: #fff8df;
  font-size: 28px;
  line-height: 1;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.kugou-top-countdown em {
  color: #fff8dfc2;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.kugou-top-countdown.phase-bet {
  border-color: #75d98dad;
}

.kugou-top-countdown.phase-draw {
  border-color: #e5c36bb8;
}

.kugou-top-countdown.phase-result {
  border-color: #ff737db8;
}

/* ------------------------------------------------------------------ */
/* Bet sheet (inline under the cards)                                   */
/* ------------------------------------------------------------------ */
.kugou-sheet {
  grid-column: 1 / -1;
  position: relative;
  z-index: 20;
  width: 100%;
  margin: 0;
  border: 1px solid rgba(231, 196, 110, .62);
  border-radius: 14px;
  background: radial-gradient(circle at 12% 0%, rgba(92, 167, 236, .18), transparent 36%), #050d19f5;
  box-shadow: 0 16px 42px #00000075, 0 0 0 1px #ffffff0a inset;
  overflow: hidden;
}

.kugou-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px;
  border-bottom: 1px solid rgba(137, 171, 214, .14);
}

.kugou-sheet-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.kugou-sheet-head-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.kugou-sheet-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px;
}

.kugou-sheet-body label {
  flex: 1 1 120px;
  min-width: 0;
  display: grid;
  gap: 3px;
  color: #aebbd0;
  font-size: 12px;
  font-weight: 800;
}

.kugou-status,
.kugou-sheet-actions,
.kugou-bet-message {
  width: 100%;
  flex-basis: 100%;
}

.kugou-sheet-body select,
.kugou-sheet-body input {
  min-height: 30px;
  width: 100%;
  border: 1px solid rgba(113, 151, 198, .35);
  border-radius: 10px;
  background: #08111edb;
  color: #fff8df;
  padding: 0 10px;
  outline: none;
}

.kugou-status {
  color: #aebbd0;
  font-size: 12px;
  font-weight: 900;
}

.kugou-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Two original rules merged (legacy margin-top/centre + current size/colour). */
.kugou-bet-message {
  min-height: 16px;
  margin-top: 8px;
  color: #f5d979;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Toast (spec 08 §5.3)                                                 */
/* ------------------------------------------------------------------ */
.kugou-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 980;
  transform: translate(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border: 1px solid rgba(231, 196, 110, .38);
  border-radius: 999px;
  background: #040a13eb;
  color: #fff8df;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.kugou-toast.show {
  opacity: 1;
  transform: translate(-50%) translateY(-8px);
}

body.has-kugou-tabbar .kugou-toast {
  bottom: calc(100px + env(safe-area-inset-bottom));
}

@keyframes kugouQrSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 430px) {
  .kugou-modal {
    padding: 4px;
  }

  .kugou-window,
  .kugou-game-window {
    width: calc(100vw - 8px);
    max-height: calc(100vh - 8px);
    border-radius: 16px;
  }

  .kugou-account-card {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }
}

/* ------------------------------------------------------------------ */
/* Bottom tab bar (spec 08 §4.4) – wins over the legacy entry-bar rule  */
/* ------------------------------------------------------------------ */
.kugou-android-tabbar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 900 !important;
  display: flex !important;
  grid-template-columns: unset !important;
  justify-content: stretch !important;
  gap: 0 !important;
  width: 100% !important;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom)) !important;
  transform: none !important;
  border: 0 !important;
  border-top: 1px solid rgba(140, 180, 230, .22) !important;
  border-radius: 0 !important;
  background: linear-gradient(180deg, #0e1a2cfa, #060c16fc) !important;
  box-shadow: 0 -4px 20px #0006 !important;
}

.kugou-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #c8d8ee99;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none !important;
  transition: color .15s;
}

.kugou-tab-btn.is-active {
  color: #f5d88e;
}

.kugou-advanced-tab {
  display: none;
}

@media (max-width: 767px) {
  .kugou-advanced-tab {
    display: flex;
  }
}

.kugou-tab-btn svg {
  opacity: .7;
}

.kugou-tab-btn.is-active svg {
  opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Phones: full-screen panels above the tab bar (spec 08 §12)           */
/* ------------------------------------------------------------------ */
@media (max-width: 767px) {
  .kugou-modal {
    padding: 0;
  }

  .kugou-modal-bg {
    background: #08101cf2;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .kugou-window {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
    background: radial-gradient(circle at 20% 0%, rgba(80, 150, 220, .18), transparent 30%), linear-gradient(180deg, #142840, #0a1520 74%);
    box-shadow: none;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 60px;
  }

  .kugou-game-window {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 60px;
  }

  .kugou-game-close {
    display: none;
  }
}

/* ------------------------------------------------------------------ */
/* Manxiang Android shell (UA contains ManxiangApp) – spec 08 §11       */
/* ------------------------------------------------------------------ */
body.is-manxiang-app .kugou-modal {
  padding: 0;
}

body.is-manxiang-app .kugou-modal-bg {
  background: #08101cf2;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.is-manxiang-app .kugou-window {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at 20% 0%, rgba(80, 150, 220, .18), transparent 30%), linear-gradient(180deg, #142840, #0a1520 74%);
  box-shadow: none;
  padding-bottom: 60px;
}

body.is-manxiang-app .kugou-game-window {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  padding-bottom: 60px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-manxiang-app .kugou-game-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.is-manxiang-app #kugouGameHistory {
  flex-shrink: 1;
  min-height: 0;
  overflow: hidden;
}

body.is-manxiang-app #kugouGameHistory .kugou-history-grid {
  height: 100%;
}

body.is-manxiang-app #kugouGameGrid {
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 60vh;
}

body.is-manxiang-app .kugou-game-close {
  display: none;
}

body.is-manxiang-app .kugou-topbar {
  background: linear-gradient(180deg, #1c3454fa, #0e1e34fa);
  border-bottom: 1px solid rgba(140, 180, 230, .18);
}

body.is-manxiang-app .kugou-content {
  background: #0a1424e0;
}

body.is-manxiang-app .kugou-account-card {
  border-color: #8cb4e647;
  background: linear-gradient(180deg, #182c48eb, #0c1a2cf2);
}

body.is-manxiang-app .kugou-account-card.is-current {
  border-color: #f5d88e80;
  background: linear-gradient(180deg, #24364ef2, #101e32f5);
}

body.is-manxiang-app .kugou-login-card {
  border-color: #8cb4e642;
  background: linear-gradient(180deg, #142844f5, #0a1426fa);
}

body.is-manxiang-app .kugou-qr-preview {
  background: #fffffff5;
  border-radius: 12px;
}

body.is-manxiang-app .kugou-skill {
  border-color: #8cb4e64d;
  background: linear-gradient(180deg, #162a44f0, #0a1628f5);
}

body.is-manxiang-app .kugou-skill.active {
  border-color: #f5d88e94;
  background: linear-gradient(180deg, #263850f5, #122236f7);
}

body.is-manxiang-app .kugou-sheet {
  border-color: #8cb4e64d;
  background: linear-gradient(180deg, #1a304cf5, #0c1a2cfa);
}

body.is-manxiang-app .kugou-game-history {
  background: #0a1220f0;
  border-color: #8cb4e63d;
}

body.is-manxiang-app .kugou-btn.primary {
  border-color: #ffe18cad;
  background: linear-gradient(180deg, #fff0b447, #8c5f1c14), linear-gradient(180deg, #9c7028, #583416);
  color: #fff8d8;
}

body.is-manxiang-app .kugou-btn {
  border-color: #a0c8f561;
  background: linear-gradient(180deg, #1c324ef0, #0c1a2ef5);
  color: #e4f0ff;
}

/* ------------------------------------------------------------------ */
/* Records dialog (spec 08 §7)                                          */
/* ------------------------------------------------------------------ */
#kugouRecordModal .kugou-window,
#kugouRecordModal .kugou-record-window {
  width: min(340px, calc(100vw - 32px)) !important;
  max-width: min(340px, calc(100vw - 32px)) !important;
  height: auto !important;
  max-height: min(420px, 70vh) !important;
  border: 1px solid rgba(137, 171, 214, .34) !important;
  border-radius: 14px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

#kugouRecordModal {
  padding: 16px !important;
}

#kugouRecordModal .kugou-modal-bg {
  background: #03081066 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.kugou-records-summary {
  padding: 10px 12px 4px;
  color: #c8d8ee99;
  font-size: 12px;
  font-weight: 700;
}

.kugou-records-loading,
.kugou-records-empty {
  padding: 24px 16px;
  color: #c8d8eeb3;
  font-size: 13px;
  text-align: center;
}

.kugou-records-list {
  max-height: min(300px, 50vh);
  overflow-y: auto;
  padding: 8px;
}

.kugou-record-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.kugou-record-item:last-child {
  border-bottom: 0;
}

.kugou-record-spell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kugou-record-spell strong {
  font-size: 16px;
  font-weight: 900;
}

.kugou-record-spell span {
  font-size: 11px;
  opacity: .7;
}

.kugou-record-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kugou-record-count {
  color: #fff7df;
  font-size: 13px;
  font-weight: 700;
}

.kugou-record-time {
  color: #c8d8ee80;
  font-size: 11px;
}

.kugou-record-result {
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.kugou-record-result.win {
  color: #8cf0a7;
}

.kugou-record-result.lose {
  color: #ff9f9f;
}

.kugou-record-result.pending {
  color: #c8d8ee80;
}

/* ------------------------------------------------------------------ */
/* Backdrop-filter removal (phones, standalone) and visibility rules    */
/* ------------------------------------------------------------------ */
@media (max-width: 767px) {
  .kugou-entry-buttons {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .kugou-modal-bg {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: #030810e0 !important;
  }
}

@media (display-mode: standalone) {
  .kugou-entry-buttons,
  .kugou-modal-bg {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

body.auth-locked .kugou-android-tabbar,
body.auth-locked .kugou-entry-buttons {
  display: none !important;
}

/* The nav is appended after #authModal, so the sibling selector applies. */
.auth-modal:not([hidden]) ~ .kugou-android-tabbar,
.auth-modal:not([hidden]) ~ .kugou-entry-buttons {
  display: none !important;
}

#kugouSheetContainer {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .kugou-android-tabbar {
    left: 0 !important;
    right: auto !important;
    width: min(56.25vh, 100vw) !important;
    border-radius: 0 !important;
  }
}

/* Dead rule of the original (history precedes the grid, so it never matches) – kept for parity. */
.kugou-game-grid:has(.kugou-sheet) ~ #kugouGameHistory .kugou-history-grid,
#kugouGameGrid:has(.kugou-sheet) ~ #kugouGameHistory .kugou-history-grid {
  height: calc(var(--kugou-history-cell-size, 15px) * 10);
}

.kugou-history-grid.is-compact {
  height: calc(var(--kugou-history-cell-size, 15px) * 10) !important;
}
