/* 基础重置 & 主题色 */
:root {
  --primary: #1a5fb4;
  --primary-dark: #0d3a6f;
  --secondary: #e63946;
  --accent: #f1faee;
  --court-green: #2a9d8f;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --shadow: 0 4px 12px rgba(0,0,0,0.15);
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 80px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 移动端顶部栏 */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #e9ecef;
}

.mobile-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dark);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn.primary {
  background: var(--primary);
}

.btn.finish-btn {
  background: linear-gradient(45deg, #27ae60, #2ecc71);
  padding: 12px 20px;
}

.btn.back-btn, .btn.close-fullscreen {
  background: #95a5a6;
  padding: 8px 12px;
  border-radius: 8px;
}

.btn.add-btn {
  background: var(--court-green);
  min-width: 44px;
}

/* 主页样式 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 30px 0;
}

.feather-animation {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
  margin-bottom: 20px;
  display: inline-block;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.group-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.group-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-header h3 {
  font-size: 1.2rem;
  color: var(--text-dark);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
}

.badge.a-leading {
  background: #d4edda;
  color: #155724;
}

.badge.b-leading {
  background: #f8d7da;
  color: #721c24;
}

.participants-preview {
  color: var(--text-light);
  margin-bottom: 15px;
}

.match-status {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--text-light);
}

.court-change {
  color: #e74c3c;
  font-weight: bold;
}

/* 组局详情页 */
.group-detail > section {
  background: white;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.count-badge {
  background: var(--accent);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

/* 计分板样式 */
.score-section {
  padding: 0 !important;
  overflow: hidden;
}

.score-container {
  background: linear-gradient(135deg, #1d3557 0%, #457b9d 50%, #1d3557 100%);
  border-radius: 20px;
  padding: 25px;
  color: white;
  position: relative;
}

.score-header {
  text-align: center;
  margin-bottom: 25px;
}

.score-header h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: white;
}

.match-info {
  display: flex;
  gap: 20px;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0.9;
}

.scoreboard-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 30px;
  margin: 30px 0;
}

.team-score {
  text-align: center;
  position: relative;
}

.team-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 600;
}

.team-icon {
  font-size: 1.5rem;
  animation: spin 4s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.score-display {
  font-size: 5rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 15px rgba(0,0,0,0.3);
  margin: 20px 0;
  font-family: 'Orbitron', monospace;
  transition: all 0.3s ease;
}

.score-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.score-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-btn.plus {
  background: linear-gradient(135deg, #2a9d8f, #264653);
  color: white;
}

.score-btn.minus {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}

.score-divider {
  text-align: center;
  position: relative;
}

.vs {
  font-size: 1.5rem;
  font-weight: bold;
  background: rgba(255,255,255,0.2);
  padding: 10px 20px;
  border-radius: 50px;
  margin-bottom: 20px;
  display: inline-block;
}

.serve-btn, .ghost-btn {
  display: block;
  margin: 5px auto;
  padding: 8px 16px;
  border-radius: 20px;
}

.serve-btn {
  background: #f1faee;
  color: var(--text-dark);
}

.ghost-btn {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

/* 比分历史 */
.set-history {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px dashed rgba(255,255,255,0.3);
}

.set-history h3 {
  margin-bottom: 15px;
  opacity: 0.9;
}

.set-tracker {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.set-item {
  background: rgba(255,255,255,0.1);
  padding: 10px 15px;
  border-radius: 12px;
  min-width: 80px;
  text-align: center;
}

.set-item.completed {
  background: rgba(255,255,255,0.2);
  font-weight: bold;
}

.set-number {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 5px;
}

.set-score {
  font-size: 1.1rem;
  font-weight: bold;
}

/* 比分状态特效 */
.score-container.deuce::after {
  content: "DEUCE! 需领先2分";
  position: absolute;
  top: 20px;
  right: 20px;
  background: #e76f51;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  animation: pulse 2s infinite;
}

.score-container.game-point::after {
  content: "局点!";
  position: absolute;
  top: 20px;
  right: 20px;
  background: #2a9d8f;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 参与者列表 */
.participants-list {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.participant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  padding: 12px 15px;
  border-radius: 12px;
  border-left: 4px solid var(--court-green);
}

.player-name {
  font-weight: 500;
}

.remove-form {
  display: inline;
}

.btn-icon {
  background: #e9ecef;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #6c757d;
}

.btn-icon:hover {
  background: #dc3545;
  color: white;
}

/* 费用区域 */
.fee-block {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 1px solid #e9ecef;
}

.fee-block:last-child {
  border-bottom: none;
}

.fee-block h3 {
  margin-bottom: 10px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.fee-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.contributor-row, .shuttle-row {
  display: grid;
  grid-template-columns: 2fr 1fr 40px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.shuttle-row {
  grid-template-columns: 120px 1fr 120px 100px 40px;
}

.contributor-row input, .shuttle-row input, .shuttle-row select {
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
}

.contributor-row input:first-child, 
.shuttle-row input:first-child,
.shuttle-row select {
  background: #f8f9fa;
}

/* 费用预览 */
.fee-preview {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 16px;
  margin: 25px 0;
}

.preview-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.preview-item {
  text-align: center;
  padding: 15px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
}

.preview-item.highlight {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.preview-item span {
  display: block;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 8px;
}

.preview-item strong {
  font-size: 1.4rem;
  font-weight: bold;
}

.full-width {
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
}

/* 结果页面 */
.results-section {
  text-align: center;
}

.results-header {
  margin-bottom: 30px;
}

.match-summary {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 15px;
  color: var(--text-light);
}

.score-badge {
  background: var(--primary);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: bold;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.result-card {
  padding: 25px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
  text-align: left;
}

.result-card.receiver {
  border-left: 5px solid #27ae60;
}

.result-card.payer {
  border-left: 5px solid #e74c3c;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.result-header h3 {
  color: var(--text-dark);
}

.balance {
  font-weight: bold;
  font-size: 1.5rem;
  padding: 5px 12px;
  border-radius: 8px;
}

.balance.positive {
  background: #d4edda;
  color: #155724;
}

.balance.negative {
  background: #f8d7da;
  color: #721c24;
}

.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 12px;
}

.collect-hint {
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
}

/* 分享区域 */
.share-section {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.share-link {
  flex: 1;
  min-width: 250px;
  display: flex;
  gap: 10px;
}

.share-link input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: #f8f9fa;
  font-family: monospace;
}

.copy-btn {
  min-width: 100px;
}

.restart-btn {
  background: #fca311;
}

/* 全屏计分板 */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.fullscreen-overlay.active {
  display: flex;
}

.fullscreen-content {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  text-align: center;
}

.close-fullscreen {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
}

.fullscreen-score {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 40px 0;
}

.team-full {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-large {
  font-family: 'Orbitron', monospace;
  font-size: 12vw;
  font-weight: 700;
  color: white;
  text-shadow: 0 0 20px rgba(255,255,255,0.5);
  margin-bottom: 10px;
}

.set-score {
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
}

.vs-large {
  font-size: 3rem;
  font-weight: bold;
  color: rgba(255,255,255,0.3);
  margin: 0 20px;
}

.swipe-hint {
  display: flex;
  justify-content: space-between;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  margin-bottom: 40px;
}

.court-visual {
  position: relative;
  height: 200px;
  background: linear-gradient(180deg, #2a9d8f 0%, #1e7f6a 100%);
  border-radius: 20px;
  margin: 30px 0;
  overflow: hidden;
}

.net {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 4px;
  background: #e9d8a6;
  transform: translateY(-50%);
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.net::after {
  content: "网";
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #333;
}

.serve-indicator-full {
  margin-top: 30px;
  color: white;
  font-size: 1.2rem;
}

.serve-indicator-full button {
  margin-left: 15px;
  background: rgba(255,255,255,0.2);
  color: white;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .container { padding: 15px; }
  
  /* 全屏计分板优化 */
  .score-large { font-size: 15vw; }
  .vs-large { font-size: 2rem; }
  
  /* 响应式布局调整 */
  .scoreboard-main {
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
  }
  
  .score-divider {
    order: -1;
    margin: 20px 0;
  }
  
  .contributor-row, .shuttle-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .shuttle-row {
    grid-template-columns: 1fr 1fr;
  }
  
  .shuttle-row > *:nth-child(n+3) {
    grid-column: span 2;
  }
  
  .preview-card {
    grid-template-columns: 1fr;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .share-section {
    flex-direction: column;
  }
  
  .share-link {
    min-width: auto;
  }
  
  /* 隐藏桌面元素 */
  .desktop-only { display: none !important; }
  
  /* 移动端导航 */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
  }
  
  .nav-item {
    padding: 8px 12px;
    border-radius: 20px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
  }
  
  .nav-item.active {
    color: var(--primary);
    background: #e3f2fd;
  }
  
  /* 按钮触摸优化 */
  .btn {
    min-height: 44px;
    font-size: 1rem;
  }
  
  .score-btn {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.8rem !important;
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  .score-display {
    font-size: 3.5rem;
  }
  
  .groups-grid {
    grid-template-columns: 1fr;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .share-link {
    flex-direction: column;
    gap: 10px;
  }
}

/* 工具提示 */
.help-btn {
  background: #e9ecef;
  color: var(--text-dark);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.9rem;
}

/* 隐藏表单 */
.hidden-form {
  display: none;
}

/* 空状态 */
.empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px;
}

/* Toast 消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 15px 25px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 2000;
  min-width: 200px;
}

.toast.match-end {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.toast .final-score {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary);
  margin: 15px 0;
  font-family: 'Orbitron', monospace;
}

/* 创建页面样式 */
.create-page {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow);
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
}

.input-group input {
  width: 100%;
  padding: 14px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 预设卡片 */
.preset-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.preset-card {
  border: 2px solid #e9ecef;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.preset-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.preset-card.active {
  border-color: var(--court-green);
  background: #f0f9f7;
}

.preset-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  display: block;
}

.preset-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.preset-card small {
  color: var(--text-light);
}

/* 功能展示 */
.feature-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  text-align: center;
  padding: 25px;
  background: #f8f9fa;
  border-radius: 16px;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

/* 分割线装饰 */
.feather-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 30px 0;
  color: var(--text-light);
}

.feather-divider::before,
.feather-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e9ecef;
}

.feather-divider::before { margin-right: 15px; }
.feather-divider::after { margin-left: 15px; }

/* 提交按钮 */
.submit-btn {
  margin-top: 30px;
  padding: 18px;
  font-size: 1.1rem;
  font-weight: bold;
}

/* 状态徽章 */
.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
}

.status-badge.finished {
  background: #d4edda;
  color: #155724;
}

/* 辅助类 */
.full-width { width: 100%; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }

/* 打印优化 */
@media print {
  .btn, .mobile-nav, .score-btn { display: none !important; }
  .score-display { font-size: 4rem !important; }
}