/* ===== 麻将战绩管家 移动端样式 (蓝色主题) ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #eef2f7;
  color: #1f2329;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* 全屏APP容器 - 移动端自适应，适配所有安卓屏幕尺寸 */
#phone {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #eef2f7;
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  /* 适配刘海屏/打孔屏安全区 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* 桌面端预览 - 仅在大屏显示手机壳效果 */
@media (min-width: 600px) and (min-height: 900px) {
  html, body {
    background: #0b1120;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  #phone {
    width: 390px;
    min-height: 844px;
    height: 844px;
    border-radius: 44px;
    border: 12px solid #0b1120;
    box-shadow: 0 30px 80px rgba(0,0,0,.6);
    padding: 0;
    overflow: hidden;
  }
}

/* 虚假状态栏 - 移动端完全隐藏，使用系统真实状态栏 */
.statusbar {
  display: none;
}
@media (min-width: 600px) and (min-height: 900px) {
  .statusbar {
    display: flex;
    height: 36px;
    flex-shrink: 0;
    background: #1e40af;
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px 0 26px;
    font-size: 13px;
    font-weight: 600;
  }
  .statusbar .signal { letter-spacing: 1px; }
}

.app {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  background: #eaeef5;
  overscroll-behavior-y: contain;
}

/* 页面切换 */
.page {
  display: none;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* 头部 */
.hdr {
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  color: #fff;
  padding: 18px 20px 20px;
  position: relative;
  width: 100%;
}
.hdr .title { font-size: 20px; font-weight: 700; letter-spacing: 1px; width: 100%; word-break: break-all; }
.hdr .sub { font-size: 12px; opacity: .85; margin-top: 4px; width: 100%; }

/* 运势卡 - 深蓝渐变 */
.luck-card {
  margin: -12px 14px 0;
  background: linear-gradient(140deg, #1e3a8a 0%, #0f172a 100%);
  border: 1px solid #3b82f6;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(37,99,235,.25);
  position: relative;
  color: #f8fafc;
}
.luck-card::before {
  content: "🀄";
  position: absolute;
  right: 14px;
  top: 10px;
  font-size: 30px;
  opacity: .3;
}
.luck-top { display: flex; justify-content: space-between; align-items: center; }
.luck-title { font-size: 14px; font-weight: 700; color: #bfdbfe; }
.luck-score {
  font-size: 22px; font-weight: 800;
  background: #fff; border-radius: 20px; padding: 2px 12px;
  color: #16a34a;
}
.luck-recommend {
  margin: 8px 0 10px; font-size: 15px; font-weight: 700;
  color: #ffffff;
}
.luck-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.luck-item {
  background: rgba(255,255,255,.12); border-radius: 10px;
  padding: 8px 10px;
}
.lk-label { font-size: 11px; color: #93c5fd; }
.lk-val { font-size: 13px; font-weight: 700; margin-top: 2px; color: #f8fafc; }
.luck-meta { margin-top: 10px; font-size: 11px; color: #94a3b8; line-height: 1.5; white-space: pre-line; }

/* 累计收支明细 */
.breakdown-card {
  margin: 14px; background: #fff; border-radius: 14px; padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.bd-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px; border-bottom: 1px dashed #e5e7eb; margin-bottom: 12px;
  font-size: 13px; color: #475059; font-weight: 600;
}
.switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1; border-radius: 22px; transition: .25s;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 2px; bottom: 2px;
  background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on .slider { background: #2563eb; }
.switch.on .slider::before { transform: translateX(18px); }
.bd-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.bd-item { text-align: center; }
.bd-lab { font-size: 11px; color: #8a929b; }
.bd-val { font-size: 18px; font-weight: 800; margin-top: 4px; color: #1f2329; }
.bd-val.pos { color: #16a34a; }
.bd-val.neg { color: #dc2626; }
.bd-net-row {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid #f0f1f4;
  text-align: right; font-size: 13px; font-weight: 600; color: #475059;
}
.bd-net { font-size: 17px; font-weight: 800; margin-left: 6px; }
.bd-net.pos { color: #16a34a; }
.bd-net.neg { color: #dc2626; }

/* 统计栏 */
.stat-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 14px;
}
.stat-box {
  background: #fff; border-radius: 14px; padding: 12px 8px;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.sb-label { font-size: 11px; color: #8a929b; }
.sb-val { font-size: 18px; font-weight: 800; margin-top: 4px; }
.sb-val.pos { color: #16a34a; }
.sb-val.neg { color: #dc2626; }

/* 区块标题 */
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 8px; font-size: 14px; font-weight: 700; color: #475059;
}
.section-title .link { font-size: 12px; color: #2563eb; font-weight: 600; }

/* 最近战绩列表 */
.recent-list { padding: 0 14px; }
.rec-item {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.rec-left .ri-date { font-size: 13px; font-weight: 600; color: #1f2329; }
.rec-left .ri-place { font-size: 11px; color: #8a929b; margin-top: 2px; }
.rec-right { text-align: right; }
.rec-right .ri-money { font-size: 17px; font-weight: 800; }
.rec-right .ri-money.pos { color: #16a34a; }
.rec-right .ri-money.neg { color: #dc2626; }
.rec-right .ri-tag { font-size: 10px; color: #8a929b; margin-top: 2px; }
/* 统计页分组展开 */
.stat-group { margin-bottom: 6px; }
.stat-group-body { padding: 0 8px; }
.stat-sub-item {
  margin-bottom: 4px !important; padding: 10px 12px !important;
  background: #f8f9fb !important; border-left: 3px solid #3b82f6;
}
.stat-sub-item .ri-date { font-size: 12px !important; }
.stat-sub-item .ri-place { font-size: 10px !important; }
.stat-sub-item .ri-money { font-size: 15px !important; }
.empty {
  text-align: center; padding: 30px 0; color: #9ca3af; font-size: 13px;
}

/* 按钮 */
.quick-btns { display: flex; gap: 10px; padding: 16px 14px; }
.qbtn {
  flex: 1; border: none; border-radius: 12px; padding: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  background: #fff; color: #475059; box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.qbtn.primary { background: linear-gradient(135deg,#2563eb,#1e3a8a); color: #fff; }
.qbtn.ghost { background: transparent; border: 1px solid #d1d5db; color: #475059; }
.qbtn.danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }

/* 表单卡片 */
.card {
  margin: 14px; background: #fff; border-radius: 14px; padding: 4px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* 快速文本导入 */
.quick-import { padding: 14px; }
.qi-title { font-size: 14px; font-weight: 700; color: #1e3a8a; margin-bottom: 4px; }
.qi-hint { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
.qi-input {
  width: 100%; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 11px 12px; font-size: 16px; outline: none; background: #f9fafb;
  color: #1f2329; margin-bottom: 8px;
}
.qi-input:focus { border-color: #2563eb; background: #fff; }
.qi-btn { width: 100%; flex: none; }
.qi-hint2 { font-size: 11px; color: #9ca3af; margin-top: 8px; line-height: 1.5; }
.form-row {
  display: flex; align-items: center; padding: 12px 0;
  border-bottom: 1px solid #f0f1f4; gap: 10px;
}
.form-row:last-child { border-bottom: none; }
.form-row label { width: 84px; font-size: 13px; color: #475059; flex-shrink: 0; }
.form-row input, .form-row select {
  flex: 1; border: none; outline: none; font-size: 16px;
  background: transparent; color: #1f2329; height: 28px;
}
.form-row input::placeholder { color: #c5cad3; }

/* 对手明细录入 */
.opp-list { padding: 0 14px; }
.opp-row {
  background: #fff; border-radius: 10px; padding: 8px 10px;
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.opp-row select { flex: 1.4; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px; font-size: 13px; }
.opp-row input { flex: 1; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px; font-size: 13px; }
.opp-row .del { background: #fee2e2; color: #dc2626; border: none; border-radius: 8px; width: 28px; height: 28px; font-size: 16px; cursor: pointer; }

/* tabs */
.tabs {
  display: flex; background: #fff; margin: 14px; border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.tab {
  flex: 1; border: none; padding: 11px 0; background: transparent;
  font-size: 14px; font-weight: 600; color: #8a929b; cursor: pointer;
}
.tab.active { background: linear-gradient(135deg,#2563eb,#1e3a8a); color: #fff; }

/* 汇总卡 */
.summary-card {
  margin: 0 14px; background: linear-gradient(135deg,#1e3a8a,#0f172a);
  color: #fff; border-radius: 14px; padding: 18px; text-align: center;
}
.sc-label { font-size: 12px; opacity: .8; }
.sc-val { font-size: 30px; font-weight: 800; margin: 6px 0; }
.sc-val.pos { color: #4ade80; }
.sc-val.neg { color: #f87171; }
.sc-sub { font-size: 12px; opacity: .8; }

/* 柱状图 */
.bar-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 110px;
  padding: 14px; margin: 14px; background: #fff; border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 80%; background: linear-gradient(#3b82f6,#1e40af); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.neg { background: linear-gradient(#64748b,#334155); }
.bar-label { font-size: 9px; color: #8a929b; margin-top: 4px; }

/* 排行榜 */
.rank-list { padding: 0 14px; }
.rank-item {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.rank-top { display: flex; justify-content: space-between; align-items: center; }
.rank-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.rank-medal { width: 22px; height: 22px; border-radius: 50%; background: #e5e7eb; color: #8a929b; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.rank-medal.g1 { background: #fbbf24; color: #fff; }
.rank-medal.g2 { background: #cbd5e1; color: #fff; }
.rank-medal.g3 { background: #f59e0b; color: #fff; }
.rank-money { font-size: 15px; font-weight: 800; }
.rank-money.pos { color: #16a34a; }
.rank-money.neg { color: #dc2626; }
.rank-bar { height: 6px; background: #f0f1f4; border-radius: 4px; margin: 8px 0 4px; overflow: hidden; }
.rank-bar > div { height: 100%; background: linear-gradient(90deg,#3b82f6,#60a5fa); }
.rank-bar.neg > div { background: linear-gradient(90deg,#475569,#94a3b8); }
.rank-meta { font-size: 11px; color: #8a929b; display: flex; justify-content: space-between; }

/* profile */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  margin: 14px; background: linear-gradient(135deg,#2563eb,#1e3a8a);
  color: #fff; border-radius: 16px; padding: 16px;
}
.avatar {
  width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.prof-name { font-size: 17px; font-weight: 700; }
.prof-meta { font-size: 12px; opacity: .85; margin-top: 3px; }

.hint-text { font-size: 11px; color: #9ca3af; padding: 4px 4px 10px; line-height: 1.5; }

.footer-note { text-align: center; font-size: 11px; color: #9ca3af; padding: 14px; }

/* 高光时刻 */
.hl-form { padding: 14px; }
.hl-upload { margin: 10px 0 4px; }
.hl-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eff6ff; border: 1px dashed #2563eb; border-radius: 10px;
  padding: 10px 14px; color: #2563eb; font-size: 13px; font-weight: 600; cursor: pointer;
}
.hl-preview { max-width: 100%; max-height: 200px; border-radius: 10px; margin-top: 8px; display: block; border: 1px solid #e5e7eb; }
.hl-list { padding: 0 14px; }
.hl-card {
  display: flex; gap: 12px; background: #fff; border-radius: 14px; padding: 10px;
  margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.04); position: relative; align-items: center;
}
.hl-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: #f1f5f9; }
.hl-noimg {
  width: 84px; height: 84px; background: linear-gradient(135deg,#eff6ff,#dbeafe);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 34px; flex-shrink: 0;
}
.hl-info { flex: 1; min-width: 0; padding-right: 20px; }
.hl-pattern { font-size: 15px; font-weight: 700; color: #1e3a8a; display: inline-block; }
.hl-meta { font-size: 12px; color: #6b7280; margin-top: 4px; }
.hl-note { font-size: 12px; color: #475059; margin-top: 4px; word-break: break-all; line-height: 1.5; }
.hl-del {
  position: absolute; top: 6px; right: 8px; background: #fee2e2; color: #dc2626;
  border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; cursor: pointer; line-height: 1;
}
.hl-del:hover { background: #fecaca; }

/* 底部导航 - 安全区适配 */
.tabbar {
  flex-shrink: 0;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 100;
  width: 100%;
}
.tb-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #8a929b; cursor: pointer; gap: 2px;
  min-width: 0;
}
.tb-item.active { color: #2563eb; }
.tb-ico { font-size: 20px; }
.tb-txt { font-size: 10px; white-space: nowrap; }

/* ===== 防缩放关键样式 ===== */
/* 输入框/按钮强制16px以上，防止iOS/安卓WebView聚焦时自动放大 */
input, select, textarea, button {
  font-size: 16px !important;
  max-width: 100%;
}
input[type="date"], input[type="number"], input[type="text"], select {
  -webkit-appearance: none;
  appearance: none;
}
/* 禁用双击缩放 + 禁止长按选择文字（按钮区域） */
button, .qbtn, .tb-item, .link, .tab, .hl-upload-btn {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* 滚动条隐藏 */
.app::-webkit-scrollbar { display: none; }
.app { scrollbar-width: none; }

/* ===== 战绩详情弹窗 ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.55); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 16px; width: 100%; max-width: 380px;
  max-height: 80vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 16px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-title {
  font-size: 17px; font-weight: 700; color: #1e3a8a;
  text-align: center; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid #f0f1f4;
}
.modal-body { margin-bottom: 14px; }
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid #f5f6f8; font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .dl { color: #8a929b; flex-shrink: 0; }
.detail-row .dv { color: #1f2329; font-weight: 600; text-align: right; word-break: break-all; }
.detail-row .dv.pos { color: #16a34a; }
.detail-row .dv.neg { color: #dc2626; }
.detail-section { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.ds-title { font-size: 13px; font-weight: 700; color: #475059; margin-bottom: 6px; }
.ds-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.ds-row .pos { color: #16a34a; font-weight: 700; }
.ds-row .neg { color: #dc2626; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; padding-top: 6px; }
.modal-actions .qbtn { flex: 1; padding: 10px; font-size: 14px; }

/* 可点击的战绩项 */
.rec-item.clickable { cursor: pointer; }
.rec-item.clickable:active { background: #f0f4ff; }

/* ===== 高光图片全屏查看器 ===== */
.img-viewer {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.92); z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.img-viewer img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.hl-thumb { cursor: pointer; }
.hl-thumb:active { opacity: .8; }

/* ===== 生日选择器 ===== */
.birth-picker {
  display: flex; gap: 8px; justify-content: space-between; margin-bottom: 10px;
}
.bp-col { flex: 1; text-align: center; }
.bp-label { font-size: 12px; color: #8a929b; margin-bottom: 6px; font-weight: 600; }
.bp-select {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 10px 6px; font-size: 16px !important; background: #f9fafb;
  color: #1f2329; outline: none; text-align: center;
  -webkit-appearance: none; appearance: none;
}
.bp-select:focus { border-color: #2563eb; background: #fff; }
.birth-zodiac-hint {
  text-align: center; font-size: 13px; color: #2563eb; font-weight: 700;
  padding: 6px 0 10px;
}
