/* ==========================================================================
   jackane宇 · 移动端极简信息架构、底部 4 格拇指导航坞与卡店玩法大厅 (mobile-shell.css)
   铁律：
   1. PC 桌面端 (> 768px) 100% 像素级零改动，所有手机重构样式严格隔离在 <= 768px 断点内
   2. 严禁在移动端使用 backdrop-filter / <feConvolveMatrix>，保障安卓微信 XWeb GPU 0 黑屏
   ========================================================================== */

/* 提示横幅始终压在所有常规弹窗 (80) 之上，确保大厅内点击预告或切换设置时清晰可见 */
.pull-banner {
  z-index: 96;
}

/* 卡图缩略图加载前优雅占位底纹（纯内置 SVG 零网络请求，彻底消除加载中纯黑空洞） */
.binder-card-thumb,
.pocket-card-frame {
  background-color: #111a2e;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='22' fill='none' stroke='%2394a3b8' stroke-opacity='0.14' stroke-width='2.5'/%3E%3Cpath d='M18 40h15m14 0h15' stroke='%2394a3b8' stroke-opacity='0.14' stroke-width='2.5'/%3E%3Ccircle cx='40' cy='40' r='6.5' fill='none' stroke='%23f5c84c' stroke-opacity='0.22' stroke-width='2.2'/%3E%3C/svg%3E"),
    linear-gradient(155deg, #16233f 0%, #0d1426 56%, #131f39 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: 44% auto, cover;
}

.box-trigger-title {
  min-width: 0;
}

.box-trigger-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ---------- 桌面端默认彻底隐藏手机端专属壳层控件 ---------- */
.mobile-settings-btn,
.mobile-quick-pick-btn,
.mobile-tab-bar,
.mobile-drawer-box-strip {
  display: none !important;
}

/* ---------- 通用弹窗内部样式（卡店玩法大厅 & 舞台设置面板，未来桌面端也可直接复用） ---------- */
.play-hub-sheet {
  width: min(760px, 95vw);
  max-height: 88svh;
}

.play-hub-body {
  padding: 14px 18px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hub-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hub-section-title {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

html[data-studio-light="day"] .hub-section-title {
  color: #475569;
}

.hub-section-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(245, 200, 76, 0.14);
  color: #fde047;
  border: 1px solid rgba(245, 200, 76, 0.32);
}

html[data-studio-light="day"] .hub-section-badge {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
}

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

.hub-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 12px;
  border-radius: 15px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.045);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, border-color 0.16s ease, background-color 0.16s ease;
}

html[data-studio-light="day"] .hub-card {
  background: rgba(15, 23, 42, 0.035);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.hub-card:active:not(:disabled) {
  border-color: rgba(245, 200, 76, 0.7);
}

.hub-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hub-card.is-accent-gold {
  border-color: rgba(245, 200, 76, 0.36);
  background: linear-gradient(140deg, rgba(245, 200, 76, 0.12), rgba(255, 255, 255, 0.03));
}

.hub-card.is-accent-rose {
  border-color: rgba(244, 63, 94, 0.42);
  background: linear-gradient(140deg, rgba(244, 63, 94, 0.14), rgba(255, 255, 255, 0.03));
}

.hub-card.is-accent-sky {
  border-color: rgba(56, 189, 248, 0.36);
  background: linear-gradient(140deg, rgba(56, 189, 248, 0.12), rgba(255, 255, 255, 0.03));
}

.hub-card.is-wide {
  grid-column: 1 / -1;
}

.hub-card.is-soon {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.84;
}

html[data-studio-light="day"] .hub-card.is-soon {
  background: rgba(15, 23, 42, 0.02);
}

.hub-card-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fde047;
}

html[data-studio-light="day"] .hub-card-ico {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #b45309;
}

.hub-card.is-accent-rose .hub-card-ico {
  color: #fb7185;
}

.hub-card.is-accent-sky .hub-card-ico {
  color: #38bdf8;
}

.hub-card.is-soon .hub-card-ico {
  color: #94a3b8;
}

.hub-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.hub-card-copy strong {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hub-card-copy span {
  font-size: 11.5px;
  line-height: 1.4;
  color: #94a3b8;
}

html[data-studio-light="day"] .hub-card-copy span {
  color: #475569;
}

.hub-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(245, 200, 76, 0.18);
  color: #fde047;
}

.hub-tag.soon {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

html[data-studio-light="day"] .hub-tag {
  color: #92400e;
}

html[data-studio-light="day"] .hub-tag.soon {
  color: #475569;
}

/* ---------- 舞台快捷设置底部抽屉 ---------- */
.settings-sheet {
  width: min(480px, 95vw);
  max-height: 82svh;
}

.settings-body {
  padding: 12px 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-row-btn {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.045);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

html[data-studio-light="day"] .settings-row-btn {
  background: rgba(15, 23, 42, 0.035);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.settings-row-btn[hidden] {
  display: none !important;
}

.settings-row-btn:active {
  border-color: rgba(245, 200, 76, 0.65);
}

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.settings-row-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(245, 200, 76, 0.14);
  color: #fde047;
}

html[data-studio-light="day"] .settings-row-ico {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row-text strong {
  font-size: 13.5px;
  font-weight: 800;
}

.settings-row-text span {
  font-size: 11.5px;
  color: #94a3b8;
}

html[data-studio-light="day"] .settings-row-text span {
  color: #64748b;
}

.settings-state-pill {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.36);
  color: #7dd3fc;
}

.settings-state-pill.is-warm {
  background: rgba(245, 200, 76, 0.16);
  border-color: rgba(245, 200, 76, 0.42);
  color: #fde047;
}

.settings-state-pill.is-muted {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.34);
  color: #cbd5e1;
}

html[data-studio-light="day"] .settings-state-pill {
  color: #0369a1;
}

html[data-studio-light="day"] .settings-state-pill.is-warm {
  color: #92400e;
}

html[data-studio-light="day"] .settings-state-pill.is-muted {
  color: #475569;
}

.settings-tip-note {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.45;
}

/* ==========================================================================
   手机端极简重构专项 (<= 768px) — PC 桌面端 0 影响
   ========================================================================== */
@media (max-width: 768px) {
  /* ---------- 1. 顶栏 7 键 → 3 键极简对称居中（账本 | jackane宇 | 设置） ---------- */
  .top-bar {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    min-height: 36px;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .top-left-cluster {
    justify-self: start;
    gap: 0;
  }

  /* 手机端把奖杯和 PK 移入底部 4 格大拇指栏，顶栏彻底解放 */
  .trophy-hall-btn,
  .pk-duel-btn,
  .utility-cluster {
    display: none !important;
  }

  .ledger-pill-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
    gap: 5px;
    max-width: 100%;
  }

  .brand-stage-crest {
    height: 34px;
    padding: 4px 12px 4px 6px;
    gap: 6px;
    justify-self: center;
  }

  .mobile-settings-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    justify-self: end;
    pointer-events: auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    background: var(--chrome-surface);
    border: 1px solid var(--chrome-border);
    color: var(--chrome-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      0 2px 0 rgba(2, 6, 16, 0.65),
      0 6px 14px -4px rgba(0, 0, 0, 0.45);
    transition: border-color 0.14s ease;
  }

  html[data-studio-light="day"] .mobile-settings-btn {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 2px 0 rgba(100, 116, 139, 0.28),
      0 4px 12px -4px rgba(15, 23, 42, 0.14);
  }

  .mobile-settings-btn:active {
    border-color: rgba(245, 200, 76, 0.72);
  }

  /* ---------- 2. 顶部选盒条 + 抽屉内嵌盒况点阵与换新盒 ---------- */
  .series-switcher {
    top: calc(max(10px, env(safe-area-inset-top)) + 42px);
    max-width: calc(100vw - 16px);
  }

  .series-switcher.drawer-open {
    z-index: 65;
  }

  .mobile-drawer-box-strip {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    padding-top: 9px;
    border-top: 1px dashed rgba(148, 163, 184, 0.24);
  }

  .drawer-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--chrome-ink);
  }

  .drawer-box-head .is-hit-tag {
    color: #fde047;
  }

  html[data-studio-light="day"] .drawer-box-head .is-hit-tag {
    color: #b45309;
  }

  .drawer-box-matrix {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
  }

  html[data-studio-light="day"] .drawer-box-matrix {
    background: rgba(15, 23, 42, 0.05);
  }

  .drawer-box-matrix .box-slot-cell {
    width: 8px;
    height: 11px;
  }

  .drawer-box-matrix .box-slot-cell.is-fat-slot {
    width: 18px;
  }

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

  .drawer-box-actions .dock-btn {
    height: 35px;
    font-size: 12px;
    padding: 0 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---------- 3. 舞台高度微调：留出上方纯净视觉 + 下方 4 格底栏 ---------- */
  :root {
    --pack-h: min(378px, 46svh, 92vw);
    --card-w: min(318px, 75vw, calc((100svh - 246px) / 1.3967));
  }

  .pack,
  .card,
  .ground-shadow,
  .pack-aura {
    top: 44.5%;
  }

  /* ---------- 4. 情境行动条（彻底隐藏拥挤的第二排，只保留 2~3 个大拇指主钮） ---------- */
  .bottom-chrome {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 20px);
    max-width: 440px;
    gap: 6px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* 3D 单卡/卡砖检视态隐藏底部 4 格导航坞，把底部完整还给检视操作栏 */
  body.showcase-active .bottom-chrome {
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }

  body.showcase-active .mobile-tab-bar {
    display: none !important;
  }

  .gesture-hint {
    font-size: 10.5px;
    opacity: 0.82;
    line-height: 1.3;
  }

  .console-dock {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    gap: 0;
  }

  /* 彻底移出手机主舞台底部的低频/微小控件（全在 4 格底栏 / 选盒抽屉 / 玩法大厅里） */
  .console-dock .binder-trigger,
  .console-dock .points-trigger,
  .console-dock .box-meter-group,
  .console-dock .console-sep,
  .console-dock .luck-switch,
  #shakeBtn {
    display: none !important;
  }

  /* 手机端拆包展示完毕（spread 态）时隐藏「拆完本盒」，只留「晒海报 + 再来一包 (+ 20张明细)」超清爽一排 */
  body[data-stage-state="spread"] #boxPullBtn {
    display: none !important;
  }

  /* 待拆包态显示手机专属「称重挑包」大按钮，与「整盒开箱」组成黄金双键 */
  .mobile-quick-pick-btn:not([hidden]) {
    display: inline-flex !important;
  }

  .console-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0;
  }

  .console-actions .dock-btn {
    flex: 1 1 auto;
    min-width: max-content;
    max-width: 100%;
    height: 41px;
    padding: 0 13px;
    font-size: 13px;
    border-radius: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .console-actions .dock-btn.secondary {
    background: #141c2f;
    border-color: rgba(148, 163, 184, 0.34);
  }

  html[data-studio-light="day"] .console-actions .dock-btn.secondary {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.18);
  }

  .console-actions #prevCardBtn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 0 12px;
  }

  .console-actions #againBtn {
    flex: 1.3 1 auto;
    min-width: max-content;
  }

  .console-actions #packDetailBtn {
    flex: 0 1 auto;
    min-width: max-content;
    font-size: 12px;
    padding: 0 11px;
  }

  /* 弹窗顶部按钮与检视按钮严禁宽字体溢出边框 */
  .binder-actions .dock-btn,
  .binder-reset,
  .binder-close {
    flex: 0 1 auto;
    min-width: max-content;
    max-width: 100%;
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 3D 检视底部操作坞手机端拉平分组，均衡折行且自适应字体宽度绝不溢出 */
  .showcase-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    padding: 7px;
    border-radius: 18px;
    gap: 6px;
  }

  .showcase-group {
    display: contents;
  }

  .showcase-bar .dock-btn {
    flex: 1 1 auto;
    min-width: max-content;
    max-width: 100%;
    height: 36px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---------- 5. 底部固定 4 格大拇指导航坞（图鉴 · 好友PK · 玩法大厅 · 展厅） ---------- */
  .mobile-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 44;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    background: #0a0f1d;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.42);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout style;
  }

  html[data-studio-light="day"] .mobile-tab-bar {
    background: #ffffff;
    border-top-color: rgba(15, 23, 42, 0.11);
    box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
  }

  .m-tab-btn {
    position: relative;
    height: 50px;
    padding: 3px 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  html[data-studio-light="day"] .m-tab-btn {
    color: #334155;
  }

  .m-tab-btn:active .m-tab-label {
    color: #fde047;
  }

  html[data-studio-light="day"] .m-tab-btn:active .m-tab-label {
    color: #b45309;
  }

  .m-tab-ico-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 20px;
  }

  .m-tab-label {
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    color: #f1f5f9;
  }

  html[data-studio-light="day"] .m-tab-label {
    color: #0f172a;
  }

  .m-tab-sub {
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.1;
    color: #94a3b8;
    white-space: nowrap;
  }

  html[data-studio-light="day"] .m-tab-sub {
    color: #64748b;
  }

  /* 四个入口各自的微色标，一秒区分 */
  .m-tab-btn.is-pk .m-tab-ico-wrap {
    color: #fb7185;
  }

  .m-tab-btn.is-pk .m-tab-sub {
    color: #fda4af;
  }

  html[data-studio-light="day"] .m-tab-btn.is-pk .m-tab-ico-wrap,
  html[data-studio-light="day"] .m-tab-btn.is-pk .m-tab-sub {
    color: #e11d48;
  }

  .m-tab-btn.is-hub .m-tab-ico-wrap {
    color: #f5c84c;
  }

  .m-tab-btn.is-hub .m-tab-sub {
    color: #fde68a;
  }

  html[data-studio-light="day"] .m-tab-btn.is-hub .m-tab-ico-wrap,
  html[data-studio-light="day"] .m-tab-btn.is-hub .m-tab-sub {
    color: #b45309;
  }

  .m-tab-btn.is-trophy .m-tab-ico-wrap {
    color: #fbbf24;
  }

  .m-tab-btn.is-binder .m-tab-ico-wrap {
    color: #38bdf8;
  }

  html[data-studio-light="day"] .m-tab-btn.is-binder .m-tab-ico-wrap {
    color: #0284c7;
  }

  .m-tab-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 1.5px solid #090d18;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.85);
  }

  html[data-studio-light="day"] .m-tab-dot {
    border-color: #ffffff;
  }

  .m-tab-dot[hidden] {
    display: none !important;
  }

  /* 手机端玩法大厅 2 列变紧凑排版 */
  .play-hub-body {
    padding: 12px 12px 18px;
    gap: 13px;
  }

  .hub-grid {
    gap: 8px;
  }

  .hub-card {
    padding: 10px 10px;
    gap: 9px;
    border-radius: 13px;
  }

  .hub-card-ico {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .hub-card-copy strong {
    font-size: 12.5px;
  }

  .hub-card-copy span {
    font-size: 10.5px;
  }
}

/* 超窄屏微调 (<= 370px) */
@media (max-width: 370px) {
  .ledger-pill-btn {
    padding: 0 8px;
    font-size: 11.5px;
    gap: 4px;
  }

  .brand-stage-crest {
    padding: 3px 9px 3px 5px;
  }

  .crest-owner {
    font-size: 12px;
  }

  .console-actions .dock-btn {
    height: 39px;
    font-size: 12px;
    padding: 0 8px;
  }

  .hub-grid {
    grid-template-columns: 1fr;
  }
}
