/* === CSS Variables & Reset === */
:root {
  --brand-green: #0d8c4a;
  --brand-green-dark: #066b36;
  --brand-green-light: #e6f7ee;
  --brand-green-lighter: #f2fbf6;
  --brand-gold: #c9972e;
  --brand-gold-dark: #a67c1e;
  --brand-gold-light: #fdf6e8;
  --wechat-green: #07C160;
  --wechat-green-dark: #06AD56;
  --wechat-green-light: #e8f8ef;
  --wechat-bg: #EDEDED;
  --wechat-bg-subtle: #F5F5F5;
  --wechat-white: #FFFFFF;
  --wechat-text: #191919;
  --wechat-text-secondary: #888888;
  --wechat-text-muted: #B0B0B0;
  --wechat-border: #E5E5E5;
  --wechat-border-light: #F0F0F0;
  --wechat-danger: #FA5151;
  --wechat-danger-light: #fef0f0;
  --wechat-warning: #FFC300;
  --wechat-warning-light: #fff9e6;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-green: 0 4px 16px rgba(13,140,74,0.25);
  --shadow-green-sm: 0 2px 8px rgba(13,140,74,0.18);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--wechat-bg);
  color: var(--wechat-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
}

a { color: var(--brand-green); text-decoration: none; transition: color var(--transition-fast); }
a:active { color: var(--brand-green-dark); }

button {
  font-family: inherit; cursor: pointer; border: none; outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, select, textarea {
  font-family: inherit; font-size: 1rem;
  color: var(--wechat-text);
}

/* === App Shell === */
#app {
  max-width: 600px; margin: 0 auto; min-height: 100vh;
  background: var(--wechat-bg);
  position: relative;
}

/* === Page Transition === */
#page-container { animation: pageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* === Pull-to-refresh hint === */
.pull-hint {
  text-align: center; padding: 12px 8px 20px;
  font-size: 0.75rem; color: var(--wechat-text-muted);
  letter-spacing: 1px;
}

/* === Header === */
.app-header {
  background: linear-gradient(135deg, #0a7e42, var(--brand-green), var(--brand-green-dark));
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(13,140,74,0.3), 0 1px 3px rgba(0,0,0,0.08);
}

.app-header h1 {
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header-left { display: flex; align-items: center; gap: 10px; }

.header-left .back-btn {
  background: rgba(255,255,255,0.15); color: white; font-size: 1.2rem;
  padding: 4px 10px; display: flex; align-items: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  backdrop-filter: blur(4px);
}
.header-left .back-btn:active { background: rgba(255,255,255,0.3); }

.header-right { display: flex; gap: 6px; }

.header-right button {
  background: rgba(255,255,255,0.18); color: white;
  border-radius: var(--radius-full);
  padding: 5px 14px; font-size: 0.82rem; font-weight: 500;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
}
.header-right button:active {
  background: rgba(255,255,255,0.35);
  transform: scale(0.96);
}
.header-right .home-btn { font-size: 1rem; padding: 4px 10px; }

/* === Content Area === */
.page-content {
  padding: 14px 16px;
  padding-bottom: calc(64px + var(--safe-bottom));
}
.page-content.no-tab { padding-bottom: calc(20px + var(--safe-bottom)); }

/* === Bottom Tab Bar === */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  max-width: 600px; width: 100%;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  border-top: 0.5px solid var(--wechat-border-light);
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}

.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 6px 0 4px; color: var(--wechat-text-muted);
  font-size: 0.65rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-item::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 3px;
  background: var(--brand-green);
  border-radius: 0 0 3px 3px;
  transition: width var(--transition-normal);
}

.tab-item.active {
  color: var(--brand-green);
  font-weight: 600;
}
.tab-item.active::before { width: 24px; }

.tab-item .tab-icon {
  font-size: 1.35rem; margin-bottom: 3px;
  transition: transform var(--transition-normal);
}
.tab-item:active .tab-icon { transform: scale(0.9); }
.tab-item.active .tab-icon { transform: scale(1.05); }

/* === Cards === */
.card {
  background: var(--wechat-white);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  border: 0.5px solid var(--wechat-border-light);
}
.card:active {
  box-shadow: var(--shadow-md);
  transform: scale(0.995);
}

.card-title {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  color: var(--wechat-text);
}

.card-info { font-size: 0.85rem; color: var(--wechat-text-secondary); }

.card-info .info-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  line-height: 1.5;
}
.card-info .info-row:last-child { margin-bottom: 0; }
.card-info .info-row .icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 0.9rem; }

/* Match Card (enhanced) */
.match-card {
  background: var(--wechat-white);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  border: 0.5px solid var(--wechat-border-light);
}

.match-card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  opacity: 0;
  background: linear-gradient(180deg, transparent 0%, var(--brand-green-light) 100%);
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.match-card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-md);
}
.match-card:active::after { opacity: 0.5; }

.match-card-header {
  padding: 16px 18px 10px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}

.match-card-title {
  font-size: 1.08rem; font-weight: 700;
  flex: 1; margin-right: 8px;
  line-height: 1.4;
}

.match-card-body { padding: 0 18px 14px; }

.match-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 0.5px solid var(--wechat-border-light);
  background: #fafafa;
  transition: background var(--transition-fast);
}
.match-card:active .match-card-footer { background: #f5faf7; }

.match-card-footer .reg-count {
  font-size: 0.8rem; color: var(--wechat-text-secondary);
  display: flex; align-items: center; gap: 4px;
}
.match-card-footer .reg-count strong {
  color: var(--brand-green); font-weight: 700;
  font-size: 0.9rem;
}

/* Status dot in footer */
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 4px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}
.status-dot.open { background: var(--wechat-green); box-shadow: 0 0 0 2px rgba(7,193,96,0.2); }
.status-dot.closed { background: #999; }
.status-dot.ended { background: var(--wechat-danger); box-shadow: 0 0 0 2px rgba(250,81,81,0.15); }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.badge-formal { background: #e8f4fd; color: #1989fa; }
.badge-friendly { background: #fff3e6; color: #ff7d3f; }
.badge-training { background: #f3eaff; color: #7c3aed; }
.badge-open {
  background: var(--wechat-green-light); color: var(--wechat-green-dark);
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}
.badge-closed { background: #f5f5f5; color: #999; }
.badge-ended { background: var(--wechat-danger-light); color: var(--wechat-danger); }
.badge-charged { background: var(--brand-gold-light); color: var(--brand-gold-dark); }

/* Multi-select option */
.multi-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--wechat-border);
  border-radius: var(--radius-full);
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--wechat-white);
  user-select: none;
  -webkit-user-select: none;
}
.multi-option:active {
  transform: scale(0.96);
  background: var(--wechat-bg-subtle);
}
.multi-option:has(input:checked) {
  border-color: var(--brand-green);
  background: var(--brand-green-light);
  color: var(--brand-green);
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(13,140,74,0.08);
}
.multi-option input { display: none; }

/* === Avatar === */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-green), #0a7a3e);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(13,140,74,0.2);
  letter-spacing: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 34px; height: 34px; font-size: 0.82rem; }
.avatar-lg {
  width: 64px; height: 64px; font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(13,140,74,0.25);
  border: 3px solid white;
}

.avatar-wall {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.avatar-wall .avatar {
  width: 36px; height: 36px; font-size: 0.78rem;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-left: -4px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.avatar-wall .avatar:first-child { margin-left: 0; }
.avatar-wall .avatar:active {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  z-index: 2;
}

.avatar-more {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f0f0f0; color: #999;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
  border: 2px solid white; margin-left: -4px;
}

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 22px; border-radius: var(--radius-full); font-size: 0.9rem;
  font-weight: 600; transition: all var(--transition-fast); gap: 6px;
  position: relative; overflow: hidden;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn:active::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-green), #0a7a3e);
  color: white;
  box-shadow: var(--shadow-green-sm);
}
.btn-primary:active {
  background: linear-gradient(135deg, var(--brand-green-dark), #055a2a);
  transform: scale(0.97);
  box-shadow: var(--shadow-green);
}

.btn-outline {
  background: var(--wechat-white); color: var(--brand-green);
  border: 1.5px solid var(--brand-green);
}
.btn-outline:active {
  background: var(--brand-green-light);
  transform: scale(0.97);
}

.btn-danger {
  background: var(--wechat-danger); color: white;
  box-shadow: 0 2px 8px rgba(250,81,81,0.2);
}
.btn-danger:active {
  opacity: 0.88;
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(250,81,81,0.3);
}

.btn-sm { padding: 5px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

.btn:disabled {
  opacity: 0.45; cursor: not-allowed; transform: none !important;
  box-shadow: none !important;
  filter: grayscale(20%);
}

/* Button spinner */
.btn-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
  border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 4px;
  vertical-align: middle;
}

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 0.9rem; font-weight: 600;
  margin-bottom: 6px; color: var(--wechat-text);
  letter-spacing: 0.01em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--wechat-border);
  border-radius: var(--radius);
  font-size: 0.95rem; line-height: 1.5;
  background: var(--wechat-white);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-green); outline: none;
  box-shadow: 0 0 0 3px rgba(13,140,74,0.08);
  background: #fafffc;
}
.form-input::placeholder { color: var(--wechat-text-muted); }
.form-textarea { resize: vertical; min-height: 60px; }

/* Toggle / Switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
}
.toggle-switch {
  position: relative; width: 50px; height: 30px;
  background: #d1d5db; border-radius: 15px; cursor: pointer;
  transition: background var(--transition-fast);
}
.toggle-switch.on { background: var(--brand-green); }

.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.06);
  transition: transform var(--transition-fast);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* === Registration List === */
.reg-list { margin-top: 14px; }
.reg-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--wechat-border-light);
  transition: background var(--transition-fast);
}
.reg-item:last-child { border-bottom: none; }
.reg-item .reg-info { flex: 1; min-width: 0; }
.reg-item .reg-name {
  font-size: 0.9rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reg-item .reg-time { font-size: 0.75rem; color: var(--wechat-text-muted); margin-top: 2px; }
.reg-item .reg-count {
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 600;
  flex-shrink: 0;
}

/* === Stats Cards === */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--wechat-white);
  border-radius: var(--radius);
  padding: 18px 12px; text-align: center;
  box-shadow: var(--shadow-xs);
  border: 0.5px solid var(--wechat-border-light);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-green), #0a7a3e);
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: 3px 3px 0 0;
}
.stat-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-md);
}
.stat-card:active::before { opacity: 1; }
.stat-card .stat-number {
  font-size: 1.9rem; font-weight: 800; line-height: 1.2;
  background: linear-gradient(135deg, var(--brand-green), #0a7a3e);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  font-size: 0.76rem; color: var(--wechat-text-secondary);
  margin-top: 4px; font-weight: 500;
}

/* === Login Page === */
.auth-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh;
  padding: 40px 24px;
  background: linear-gradient(180deg, #ecfaf2 0%, #dff5e7 20%, var(--wechat-bg) 55%);
}
.auth-logo { margin-bottom: 20px; }
.auth-logo-icon {
  font-size: 3.5rem;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a7e42, var(--brand-green-dark));
  border-radius: 26px;
  box-shadow: 0 12px 32px rgba(13,140,74,0.35), 0 4px 8px rgba(0,0,0,0.06);
  animation: logoIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes logoIn {
  from { opacity: 0; transform: scale(0.6) rotate(-12deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.auth-brand {
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, #0a7e42, var(--brand-green-dark));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: 2px;
}
.auth-desc {
  font-size: 0.9rem; color: var(--wechat-text-secondary);
  margin-bottom: 32px; font-weight: 500;
}
.auth-card {
  width: 100%; max-width: 340px;
  background: var(--wechat-white);
  border-radius: 18px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow-lg);
  border: 0.5px solid var(--wechat-border-light);
}
.auth-tabs {
  display: flex; gap: 0;
  background: var(--wechat-bg-subtle);
  border-radius: var(--radius-full);
  padding: 4px; margin-bottom: 24px;
}
.auth-tab {
  flex: 1; padding: 9px 0; border-radius: var(--radius-full);
  font-size: 0.85rem; font-weight: 600;
  background: transparent; color: var(--wechat-text-secondary);
  transition: all var(--transition-fast);
}
.auth-tab.active {
  background: var(--wechat-white); color: var(--brand-green);
  box-shadow: var(--shadow-sm);
}
.auth-form { width: 100%; }
.auth-footer {
  margin-top: 36px; font-size: 0.75rem;
  color: var(--wechat-text-muted);
  letter-spacing: 1px;
}

/* === Empty State === */
.empty-state {
  text-align: center; padding: 56px 24px; color: var(--wechat-text-secondary);
}
.empty-state .empty-icon {
  font-size: 3.5rem; margin-bottom: 16px;
  display: inline-block;
  animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.empty-state .empty-text {
  font-size: 0.9rem; line-height: 1.7;
  color: var(--wechat-text-secondary);
}

/* === Toast === */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8); color: white;
  padding: 14px 30px; border-radius: 12px; font-size: 0.9rem; font-weight: 500;
  z-index: 9999; animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0.02em;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* === Loading === */
.loading {
  text-align: center; padding: 48px;
  color: var(--wechat-text-secondary);
  font-size: 0.9rem;
}
.loading::before {
  content: '';
  display: block; margin: 0 auto 12px;
  width: 28px; height: 28px;
  border: 3px solid var(--wechat-border);
  border-top-color: var(--brand-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-inline {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; color: var(--wechat-text-secondary); font-size: 0.85rem;
}
.loading-inline::before {
  content: ''; display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--wechat-border);
  border-top-color: var(--brand-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* === Skeleton / Placeholder loading === */
.skeleton {
  background: linear-gradient(110deg, #f0f0f0 30%, #e6e6e6 50%, #f0f0f0 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 28px 24px 24px;
  width: 85%; max-width: 380px;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.88) translateY(24px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 20px; text-align: center;
  color: var(--wechat-text);
}
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.modal-actions .btn { flex: 1; }

/* === Match Detail Actions === */
.match-actions {
  display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
}
.match-actions .btn { flex: 1; min-width: 90px; }

/* === Status row in cards === */
.status-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}

/* === Year selector === */
.year-selector {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin-bottom: 18px;
}
.year-selector button {
  background: var(--wechat-white); border: 1.5px solid var(--wechat-border);
  border-radius: 50%; width: 36px; height: 36px; display: flex;
  align-items: center; justify-content: center; font-size: 0.9rem;
  transition: all var(--transition-fast);
  color: var(--wechat-text-secondary);
  box-shadow: var(--shadow-xs);
}
.year-selector button:active {
  background: var(--brand-green-light);
  border-color: var(--brand-green);
  color: var(--brand-green);
  transform: scale(0.93);
}
.year-selector .year-text {
  font-size: 1.15rem; font-weight: 700;
  min-width: 70px; text-align: center;
  color: var(--brand-green-dark);
}

/* === Admin panel: status action buttons === */
.status-actions {
  display: flex; gap: 6px; margin-top: 6px;
}
.status-actions .btn-status {
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 500;
  border: 1.5px solid var(--wechat-border); background: white;
  color: var(--wechat-text-secondary);
  transition: all var(--transition-fast);
}
.status-actions .btn-status:active {
  background: var(--brand-green-light); color: var(--brand-green);
  border-color: var(--brand-green);
  transform: scale(0.95);
}
.status-actions .btn-status.current {
  background: var(--brand-green-light); color: var(--brand-green);
  border-color: var(--brand-green); font-weight: 700;
  box-shadow: 0 0 0 2px rgba(13,140,74,0.06);
}

/* === Inline flex helpers === */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

/* === Error / Success states === */
.error-banner {
  background: var(--wechat-danger-light);
  color: var(--wechat-danger);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.85rem; margin-bottom: 12px; font-weight: 500;
  border-left: 4px solid var(--wechat-danger);
}
.success-banner {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.85rem; margin-bottom: 12px; font-weight: 500;
  border-left: 4px solid var(--brand-green);
}

/* === Charge info tag === */
.charge-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.75rem; font-weight: 600;
  color: var(--brand-gold-dark);
  background: var(--brand-gold-light);
  padding: 3px 10px; border-radius: var(--radius-full);
}

/* === Ranking === */
.ranking-list { margin-top: 6px; }
.ranking-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--wechat-border-light);
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
}
.ranking-row:last-child { border-bottom: none; }
.ranking-row:active {
  background: var(--brand-green-lighter);
}
.ranking-row.highlight {
  background: var(--brand-green-light);
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(13,140,74,0.1);
}
.ranking-rank {
  width: 36px; text-align: center; font-size: 1.3rem; flex-shrink: 0;
  font-weight: 700;
}
.ranking-name {
  flex: 1; font-size: 0.92rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ranking-count {
  font-size: 0.82rem; font-weight: 600;
  color: var(--wechat-text-secondary);
  background: var(--wechat-bg-subtle);
  padding: 3px 12px; border-radius: var(--radius-full);
}

/* === Quick action button (FAB) === */
.fab {
  position: fixed; bottom: calc(84px + var(--safe-bottom)); right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-green), #0a7a3e);
  color: white;
  font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(13,140,74,0.4);
  z-index: 50; transition: all var(--transition-fast);
}
.fab:active {
  transform: scale(0.88);
  background: var(--brand-green-dark);
  box-shadow: 0 4px 12px rgba(13,140,74,0.3);
}

/* === Match Stats Edit === */
.match-stats-row:hover { background: #f9fefb; }
.match-stats-row input[type="number"]::-webkit-inner-spin-button,
.match-stats-row input[type="number"]::-webkit-outer-spin-button { opacity: 1; }

/* === Registration Status Buttons === */
.reg-status-btn, .edit-status-btn {
  transition: all var(--transition-fast);
  cursor: pointer;
  font-weight: 600;
}
.reg-status-btn:active, .edit-status-btn:active {
  transform: scale(0.95);
}

/* === Pending Approval Page === */
.pending-card {
  border-left: 4px solid var(--wechat-warning);
}
.pending-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--wechat-warning);
  color: #4a3800;
  margin-left: 8px;
}
.pending-list { margin-top: 10px; }
.pending-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 0.5px solid var(--wechat-border-light);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: #fffef8;
  border: 1px solid #fef3c7;
  transition: box-shadow var(--transition-fast);
}
.pending-item:last-child {
  border-bottom: 0.5px solid #fef3c7;
  margin-bottom: 0;
}
.pending-item:active { box-shadow: var(--shadow-md); }
.pending-info { flex: 1; min-width: 0; }
.pending-name-row {
  font-size: 0.92rem; font-weight: 600; margin-bottom: 4px;
}
.pending-nickname { color: var(--brand-green-dark); }
.pending-realname { color: var(--wechat-text-secondary); font-weight: 500; }
.pending-detail {
  font-size: 0.78rem; color: var(--wechat-text-secondary); margin-top: 3px;
}
.pending-notes {
  font-size: 0.78rem; color: #666; margin-top: 6px;
  padding: 6px 10px;
  background: #fffbeb;
  border-radius: var(--radius-sm);
  font-style: italic;
  border-left: 3px solid #fcd34d;
}
.pending-actions {
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}
.pending-actions .btn-sm {
  padding: 5px 14px; font-size: 0.75rem;
  border-radius: var(--radius-full);
}

/* === Roster Page === */

/* Summary cards at top */
.roster-summary {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.roster-summary .summary-item {
  flex: 1;
  background: var(--wechat-white);
  border-radius: var(--radius);
  padding: 14px 6px; text-align: center;
  box-shadow: var(--shadow-xs);
  border: 0.5px solid var(--wechat-border-light);
  transition: transform var(--transition-fast);
}
.roster-summary .summary-item:active {
  transform: scale(0.96);
}
.roster-summary .summary-icon {
  display: block; font-size: 1.35rem; margin-bottom: 4px;
}
.roster-summary .summary-num {
  display: block; font-size: 1.4rem; font-weight: 800;
  color: var(--brand-green); line-height: 1.2;
}
.roster-summary .summary-label {
  display: block; font-size: 0.7rem;
  color: var(--wechat-text-secondary); font-weight: 500;
  margin-top: 2px;
}

/* Table container (horizontal scroll) */
.roster-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: var(--wechat-white);
  border: 0.5px solid var(--wechat-border-light);
}

/* Table */
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 520px;
}

.roster-table thead {
  background: linear-gradient(135deg, #0a7e42, var(--brand-green-dark));
  color: white;
}
.roster-table th {
  padding: 11px 6px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}
.roster-table th.col-name { text-align: left; padding-left: 14px; }
.roster-table th.col-stat { width: 56px; }
.roster-table th.col-action { width: 82px; }
.roster-table th.col-number { width: 44px; }
.roster-table th.col-position { width: 80px; white-space: nowrap; }
.roster-table th.col-duty { width: 90px; white-space: nowrap; }
.roster-table th.col-bio { width: 50px; }
.roster-table td.col-bio { font-size: 0.9rem; }

.bio-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-green-light);
  color: var(--brand-green);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
}
.bio-indicator:active {
  background: var(--brand-green);
  color: white;
  transform: scale(0.88);
}

.roster-table td {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 0.5px solid var(--wechat-border-light);
  vertical-align: middle;
}
.roster-table td.col-name {
  text-align: left; padding-left: 14px;
}
.roster-table td.col-position,
.roster-table td.col-duty {
  white-space: nowrap; font-size: 0.8rem;
}
.roster-table td.col-goal strong { color: #e74c3c; font-weight: 700; }
.roster-table td.col-assist strong { color: #2ecc71; font-weight: 700; }
.roster-table td.col-mvp strong { color: var(--brand-gold); font-weight: 700; }

.roster-table tr:last-child td { border-bottom: none; }
.roster-table tr.has-duty { background: #f9fdf8; }
.roster-table tr:hover { background: var(--brand-green-lighter); }

/* Name cell inside table */
.roster-cell-name {
  display: flex; align-items: center; gap: 10px;
}
.roster-cell-name span {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Action buttons in roster */
.roster-edit-btn,
.roster-del-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  margin: 0 3px;
}
.roster-edit-btn {
  background: var(--brand-green-light);
  color: var(--brand-green);
  border: 1.5px solid var(--brand-green);
}
.roster-edit-btn:active {
  background: var(--brand-green); color: white;
  transform: scale(0.94);
}
.roster-del-btn {
  background: var(--wechat-danger-light);
  color: var(--wechat-danger);
  border: 1.5px solid var(--wechat-danger);
}
.roster-del-btn:active {
  background: var(--wechat-danger); color: white;
  transform: scale(0.94);
}

/* Admin bar */
.roster-admin-bar {
  text-align: center; margin-top: 8px; padding-bottom: 8px;
}

/* === Pie Chart === */
.pie-chart-wrap {
  display: flex; align-items: center; gap: 24px;
  justify-content: center; flex-wrap: wrap;
  padding: 8px 0;
}
.pie-chart {
  width: 130px; height: 130px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.pie-chart-center {
  position: absolute;
  inset: 22px;
  background: var(--wechat-white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800;
  color: var(--wechat-text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pie-legend {
  display: flex; flex-direction: column; gap: 8px;
  font-size: 0.85rem;
}
.pie-legend-item {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500;
}
.pie-legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* === MVP option cards in edit-match-stats === */
.mvp-option {
  transition: all var(--transition-fast);
}
.mvp-option:active { transform: scale(0.96); }
.mvp-option.selected { font-weight: 600; }

/* === Score result badge === */
.score-result {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.9rem; font-weight: 700;
}
.score-result.win { background: #e8fdf0; color: #16a34a; }
.score-result.loss { background: #fef0f0; color: #dc2626; }
.score-result.draw { background: #fefce8; color: #ca8a04; }

/* === Scrollbar styling === */
.roster-table-wrap::-webkit-scrollbar { height: 4px; }
.roster-table-wrap::-webkit-scrollbar-track { background: transparent; }
.roster-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1); border-radius: 2px;
}

/* === Clickable row feedback === */
.reg-item[onclick], .match-card[onclick] {
  cursor: pointer;
}
.reg-item[style*="cursor:pointer"]:active {
  background: var(--brand-green-lighter);
  border-radius: var(--radius-sm);
}
