/* ============================================================
   麻将账本 — 手机端样式
   纸感米色 + 麻将绿 + 印章红
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --paper: #f3eee2;
  --paper-deep: #eae2d1;
  --surface: #fffdf7;
  --surface-soft: #f7f2e6;
  --ink: #20261f;
  --muted: #7c8274;
  --faint: #a7ab9e;
  --jade: #1e6a54;
  --jade-deep: #10382d;
  --jade-soft: #e5efe8;
  --red: #b23a2e;
  --red-soft: #f7e6e2;
  --gold: #a8792a;
  --gold-soft: #f3ead8;
  --line: rgba(32, 38, 31, 0.09);
  --radius: 18px;
  --shadow-card: 0 10px 26px -20px rgba(32, 38, 31, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

/* ------------------------------ 手机外壳 ------------------------------ */

.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(32, 38, 31, 0.035) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ------------------------------ 顶部 ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 18px) 20px 12px;
  flex: none;
}

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

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(160deg, #fffdf6, #f1e7d2);
  border: 1px solid rgba(120, 100, 60, 0.18);
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 #d9cdb2,
    0 8px 14px -10px rgba(60, 50, 20, 0.6);
  color: var(--red);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.tile span {
  transform: translateY(-1px);
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.7);
  color: var(--ink);
  transition: background 0.2s, transform 0.15s;
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--surface);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

/* ------------------------------ 主区域 ------------------------------ */

#main {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(104px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

#main::-webkit-scrollbar {
  display: none;
}

.view {
  animation: fade-up 0.28s ease both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 3px 9px;
}

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(32, 38, 31, 0.72);
}

.section-hint {
  font-size: 10.5px;
  color: var(--muted);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--jade);
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------ 卡片 ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.info-card {
  padding: 2px 15px;
}

.info-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 49px;
}

.info-field > span {
  flex: none;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.info-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  text-align: right;
}

.info-field input::placeholder {
  color: var(--faint);
}

.info-field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.info-field input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: 6px;
  opacity: 0.45;
}

.info-divider {
  height: 1px;
  background: var(--line);
}

/* ------------------------------ 四人输入 ------------------------------ */

.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.player-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.player-card:focus-within {
  border-color: rgba(30, 106, 84, 0.45);
  box-shadow: 0 0 0 3px rgba(30, 106, 84, 0.09);
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-id {
  display: flex;
  align-items: center;
  gap: 7px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--c, var(--jade));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.player-name {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.sign-btn {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(30, 106, 84, 0.25);
  border-radius: 9px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sign-btn.minus {
  border-color: transparent;
  background: var(--red-soft);
  color: var(--red);
}

.amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.yen {
  flex: none;
  font-size: 12px;
  color: var(--faint);
}

.amount-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.amount-input::placeholder {
  color: rgba(32, 38, 31, 0.18);
  font-weight: 600;
}

/* ------------------------------ 配平状态 ------------------------------ */

.balance {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.balance-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--faint);
  transition: background 0.2s;
}

.balance.ok {
  color: var(--jade);
}

.balance.ok .balance-dot {
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(30, 106, 84, 0.12);
}

.balance.bad {
  color: var(--red);
}

.balance.bad .balance-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(178, 58, 46, 0.1);
}

/* ------------------------------ 预览 ------------------------------ */

.preview {
  position: relative;
  margin-top: 15px;
  padding: 16px 17px 15px;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(150deg, #1c5645 0%, #10382d 72%);
  color: #f6f0e1;
  box-shadow: 0 20px 36px -24px rgba(16, 56, 45, 0.9);
  animation: fade-up 0.25s ease both;
}

.preview::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 213, 139, 0.18), transparent 68%);
  pointer-events: none;
}

.preview-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.preview-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  color: rgba(246, 240, 225, 0.55);
}

.preview-winner {
  margin-top: 5px;
  font-size: 13.5px;
  color: rgba(246, 240, 225, 0.9);
}

.preview-winner b {
  margin-left: 5px;
  color: #f0d58b;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}

.preview-tag {
  flex: none;
  padding: 4px 9px;
  border: 1px solid rgba(240, 213, 139, 0.28);
  border-radius: 99px;
  background: rgba(240, 213, 139, 0.12);
  color: #f0d58b;
  font-size: 10.5px;
  letter-spacing: 0.4px;
}

.preview-rows {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(246, 240, 225, 0.18);
}

.preview-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: rgba(246, 240, 225, 0.7);
}

.preview-row b {
  flex: none;
  color: #f6f0e1;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.preview-row b.gold {
  color: #f0d58b;
}

.net-label {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: 1.4px;
  color: rgba(246, 240, 225, 0.5);
}

.net-chips {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 7px;
}

.net-chip {
  padding: 7px 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
}

.net-chip .p {
  font-size: 9.5px;
  color: rgba(246, 240, 225, 0.5);
  letter-spacing: 0.6px;
}

.net-chip .v {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.preview .pos {
  color: #9fe0be;
}

.preview .neg {
  color: #f4a79a;
}

.preview .zero {
  color: rgba(246, 240, 225, 0.55);
}

/* ------------------------------ 按钮 ------------------------------ */

.primary {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 16px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(160deg, #23765e, #154a3a);
  color: #fdf7e8;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.6px;
  box-shadow: 0 16px 28px -16px rgba(20, 74, 58, 0.85);
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
}

.primary:active:not(:disabled) {
  transform: scale(0.985);
}

.primary:disabled {
  opacity: 0.36;
  box-shadow: none;
  cursor: not-allowed;
}

.footnote {
  margin: 11px 6px 0;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* ------------------------------ 明细 ------------------------------ */

.session {
  padding: 14px 15px 12px;
  margin-bottom: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s;
}

.session:active {
  transform: scale(0.992);
}

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

.session-date {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.session-date small {
  margin-left: 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.4px;
}

.session-note {
  max-width: 130px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-figures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 11px;
}

.figure {
  padding: 6px 2px 5px;
  border-radius: 9px;
  background: var(--surface-soft);
  text-align: center;
  line-height: 1.25;
}

.figure .p {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.4px;
}

.figure .v {
  margin-top: 1px;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--jade);
}

.neg {
  color: var(--red);
}

.zero {
  color: var(--muted);
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.badge {
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(30, 106, 84, 0.07);
  color: var(--jade);
  font-size: 9.5px;
  letter-spacing: 0.3px;
}

.badge.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.badge.red {
  background: rgba(178, 58, 46, 0.07);
  color: var(--red);
}

/* ------------------------------ 空状态 ------------------------------ */

.empty {
  padding: 64px 26px 40px;
  text-align: center;
}

.empty .tile {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 18px;
  font-size: 30px;
  box-shadow:
    inset 0 1px 0 #fff,
    0 4px 0 #d9cdb2,
    0 14px 22px -14px rgba(60, 50, 20, 0.55);
}

.empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

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

/* ------------------------------ 汇总 ------------------------------ */

.fund {
  position: relative;
  margin-top: 6px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(150deg, #1c5645, #10382d 75%);
  color: #f6f0e1;
  box-shadow: 0 22px 40px -26px rgba(16, 56, 45, 0.95);
}

.fund::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 213, 139, 0.16), transparent 70%);
  pointer-events: none;
}

.fund-label {
  position: relative;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 1.4px;
  color: rgba(246, 240, 225, 0.55);
}

.fund-value {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-size: 31px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.8px;
}

.fund-value small {
  margin-left: 4px;
  color: rgba(246, 240, 225, 0.5);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

.fund-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  padding: 4px 9px;
  border: 1px solid rgba(240, 213, 139, 0.28);
  border-radius: 99px;
  background: rgba(240, 213, 139, 0.12);
  color: #f0d58b;
  font-size: 10px;
  letter-spacing: 0.4px;
}

.bar {
  position: relative;
  z-index: 1;
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.13);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #d9b45e, #f4e5b4);
  transition: width 0.5s cubic-bezier(0.22, 0.9, 0.28, 1);
}

.fund-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: rgba(246, 240, 225, 0.55);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

/* 汇总 - 每人 */

.total-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}

.total-row:last-child {
  border-bottom: 0;
}

.total-main {
  flex: 1;
  min-width: 0;
}

.total-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
}

.total-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.total-value {
  flex: none;
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

/* 汇总 - 统计 */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stat {
  padding: 11px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.3px;
}

.rules {
  margin: 0;
  padding: 14px 16px 14px 30px;
  border: 1px dashed rgba(32, 38, 31, 0.14);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.5);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.85;
}

.rules li::marker {
  color: var(--gold);
}

/* ------------------------------ 底部导航 ------------------------------ */

.tabbar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(247, 242, 232, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  border: 0;
  background: none;
  color: #9aa091;
  font-size: 10px;
  letter-spacing: 0.6px;
  transition: color 0.2s;
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.active {
  color: var(--jade);
}

.tab.active svg {
  stroke-width: 2;
}

.tab:active {
  opacity: 0.7;
}

/* ------------------------------ 弹层 ------------------------------ */

.sheet {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 20, 0.46);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sheet.open .sheet-backdrop {
  opacity: 1;
}

.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88%;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: 0 -24px 60px rgba(10, 20, 15, 0.3);
  transform: translateY(102%);
  transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.28, 1);
}

.sheet.open .sheet-panel {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  flex: none;
  margin: 9px auto 0;
  border-radius: 99px;
  background: rgba(32, 38, 31, 0.16);
}

.sheet-body {
  overflow-y: auto;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.detail-date {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.close-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.8);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.detail-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-table th {
  padding: 7px 3px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: right;
}

.detail-table th:first-child {
  text-align: left;
}

.detail-table td {
  padding: 9px 3px;
  border-bottom: 1px dashed var(--line);
  text-align: right;
}

.detail-table td:first-child {
  font-weight: 650;
  text-align: left;
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.detail-total {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 11.5px;
  line-height: 1.6;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.btn-soft,
.btn-danger,
.btn-line {
  height: 44px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.btn-soft {
  border: 1px solid rgba(30, 106, 84, 0.25);
  background: var(--jade-soft);
  color: var(--jade);
}

.btn-danger {
  border: 1px solid rgba(178, 58, 46, 0.2);
  background: var(--red-soft);
  color: var(--red);
}

.btn-line {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

/* 设置 */

.set-group {
  margin-top: 18px;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.set-card {
  margin-top: 7px;
  padding: 2px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.set-row:last-child {
  border-bottom: 0;
}

.set-row > label {
  font-size: 13px;
  line-height: 1.4;
}

.set-row small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 400;
}

.set-input {
  width: 104px;
  flex: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.set-input:focus {
  border-color: rgba(30, 106, 84, 0.45);
}

.segmented {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(32, 38, 31, 0.06);
}

.segmented button {
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2px;
}

.segmented button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(20, 30, 20, 0.1);
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}

.action-row:last-child {
  border-bottom: 0;
}

.action-row span.arrow {
  color: var(--faint);
  font-size: 15px;
}

.action-row.danger {
  color: var(--red);
}

.about {
  margin-top: 22px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.8;
  text-align: center;
}

/* ------------------------------ Toast ------------------------------ */

.toast {
  position: absolute;
  bottom: 98px;
  left: 50%;
  z-index: 90;
  max-width: 88%;
  padding: 9px 16px;
  border-radius: 99px;
  background: rgba(24, 32, 26, 0.94);
  color: #fbf6ea;
  font-size: 12px;
  letter-spacing: 0.2px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.22s, transform 0.22s;
  white-space: nowrap;
}

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

/* ------------------------------ 桌面预览 ------------------------------ */

@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
      radial-gradient(120% 100% at 50% 0%, #2b443a 0%, #14201b 55%, #0b1310 100%);
  }

  .phone {
    height: min(900px, calc(100dvh - 48px));
    border-radius: 34px;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 40px 90px rgba(0, 0, 0, 0.55);
  }

  .topbar {
    padding-top: 22px;
  }
}

/* ============================================================
   多用户版：登录、玩家选择、成员管理
   ============================================================ */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  max-width: 96px;
  overflow: hidden;
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 11px;
  letter-spacing: 0.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------ 登录 / 注册 ------------------------------ */

.auth {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 48px) 22px calc(24px + env(safe-area-inset-bottom));
}

.auth::before {
  content: "";
  position: absolute;
  top: -130px;
  right: -100px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 106, 84, 0.16), transparent 70%);
  pointer-events: none;
}

.auth::after {
  content: "";
  position: absolute;
  bottom: 40px;
  left: -120px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 138, 62, 0.12), transparent 70%);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  margin-bottom: 26px;
  text-align: center;
}

.auth-tile {
  width: 70px;
  height: 70px;
  margin: 0 auto 16px;
  border-radius: 20px;
  font-size: 34px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 3px;
}

.auth-brand p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 1px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 60px -40px rgba(30, 40, 30, 0.55);
}

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgba(32, 38, 31, 0.06);
}

.auth-tabs button {
  flex: 1;
  padding: 9px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 30, 20, 0.08);
}

.auth-field {
  display: block;
  margin-bottom: 12px;
}

.auth-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.6px;
}

.auth-field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 15px;
}

.auth-field input:focus {
  border-color: rgba(30, 106, 84, 0.5);
  box-shadow: 0 0 0 3px rgba(30, 106, 84, 0.08);
}

.auth-field input::placeholder {
  color: var(--faint);
}

.form-error {
  min-height: 16px;
  margin: 2px 2px 8px;
  color: var(--red);
  font-size: 11px;
  line-height: 1.4;
}

.form-hint {
  margin: 0 2px 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.auth .primary {
  margin-top: 6px;
}

.auth-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 22px;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
  letter-spacing: 0.3px;
}

/* ------------------------------ 玩家行 ------------------------------ */

.player-rows {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.player-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.player-row:focus-within {
  border-color: rgba(30, 106, 84, 0.42);
  box-shadow: 0 0 0 3px rgba(30, 106, 84, 0.07);
}

.player-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-badge {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 7px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 11px;
  font-weight: 700;
}

.player-select {
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
}

.player-row .amount-wrap {
  width: 88px;
  flex: none;
  margin: 0;
}

.player-row .amount-input {
  font-size: 19px;
  text-align: right;
}

.guest-input {
  width: 100%;
  height: 32px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px dashed rgba(32, 38, 31, 0.18);
  border-radius: 9px;
  outline: none;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12.5px;
}

.guest-input::placeholder {
  color: var(--faint);
}

/* ------------------------------ 场次卡片 ------------------------------ */

.session-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.session-player {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--surface-soft);
}

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

.sp-value {
  flex: none;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.badge.plain {
  background: rgba(32, 38, 31, 0.05);
  color: var(--muted);
}

.net-chip .p.name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------ 成员管理 ------------------------------ */

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child {
  border-bottom: 0;
}

.member-main {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 13.5px;
  font-weight: 600;
}

.member-phone {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.mini-btn {
  flex: none;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.me-tag {
  margin-left: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
}

.set-select {
  width: 132px;
  padding-right: 4px;
  text-align: left;
  font-size: 13px;
}

.muted-row td {
  color: var(--muted);
}

.muted-row td small {
  margin-left: 4px;
  color: var(--faint);
  font-size: 9px;
}

.total-row .avatar {
  font-size: 11px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
