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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #F7F8F3;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ====== 容器 ====== */
.app-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 16px 60px;
  min-height: 100vh;
}

/* ====== 顶部导航 ====== */
.top-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  height: clamp(70px, 16vw, 120px);
  padding-top: clamp(24px, 5vw, 40px);
  position: relative;
}

.nav-title {
  font-size: clamp(18px, 4.5vw, 34px);
  font-weight: 700;
  color: #3A3A3A;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
}

.deco { color: #C99E54; font-size: clamp(14px, 3.7vw, 28px); }

.nav-right {
  position: absolute;
  right: 0;
  top: clamp(30px, 6.5vw, 55px);
}

.admin-link {
  font-size: clamp(14px, 2.9vw, 22px);
  color: #C99E54;
  cursor: pointer;
  padding: 4px 12px;
  border: 1px solid #C99E54;
  border-radius: 20px;
}

/* ====== 联盟头部 ====== */
.alliance-header {
  text-align: center;
  padding: 8px 0 20px;
}

.alliance-logo { margin-bottom: 8px; }

.logo-img {
  width: clamp(140px, 29vw, 220px);
  height: auto;
  max-width: 100%;
}

.alliance-tag {
  font-size: clamp(14px, 3.2vw, 24px);
  color: #888;
  letter-spacing: 2px;
}

/* ====== 状态提示 ====== */
.loading-state, .error-state, .empty-state {
  text-align: center;
  padding: clamp(40px, 10vw, 80px) 0;
}

.loading-icon, .error-icon, .empty-icon {
  font-size: clamp(30px, 6.5vw, 50px);
  display: block;
  margin-bottom: 12px;
}

.loading-text, .error-text, .empty-text {
  font-size: clamp(16px, 3.7vw, 28px);
  color: #999;
}

.loading-spinner {
  display: inline-block;
  width: clamp(30px, 6.5vw, 50px);
  height: clamp(30px, 6.5vw, 50px);
  border: 3px solid #eee;
  border-top-color: #C99E54;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 12px;
}

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

.btn-retry {
  margin-top: 16px;
  padding: 10px 32px;
  background: #C99E54;
  color: #fff;
  border: none;
  border-radius: 28px;
  font-size: clamp(16px, 3.5vw, 26px);
  cursor: pointer;
}

/* ====== 授权区域 ====== */
.auth-section {
  text-align: center;
  margin: 16px 0 24px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: clamp(16px, 3vw, 28px) clamp(12px, 3vw, 24px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.nickname-area {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nickname-input {
  flex: 1;
  height: clamp(44px, 8.5vw, 64px);
  border: 2px solid #e0d5c0;
  border-radius: 14px;
  padding: 0 clamp(10px, 2vw, 20px);
  font-size: clamp(15px, 3.7vw, 28px);
  color: #333;
  background: #FAF8F2;
  outline: none;
  transition: border-color .2s;
  min-width: 0;
}

.nickname-input:focus { border-color: #C99E54; }
.nickname-input::placeholder { color: #ccc; }

.btn-auth-start {
  height: clamp(44px, 8.5vw, 64px);
  padding: 0 clamp(16px, 3.5vw, 32px);
  background: linear-gradient(135deg, #C99E54, #A67F3D);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: clamp(15px, 3.7vw, 28px);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.btn-auth-start:active { opacity: .85; }

.auth-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: clamp(15px, 3.7vw, 28px);
  color: #333;
  background: #fff;
  border-radius: 20px;
  padding: clamp(14px, 2.5vw, 24px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.auth-user .nick { color: #C99E54; font-weight: 600; }

.registered-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 20px;
  background: #f0ede5;
  border-radius: 30px;
  font-size: clamp(13px, 3.2vw, 24px);
  color: #888;
}

/* ====== 标题区域 ====== */
.section-title-wrap {
  text-align: center;
  margin: clamp(20px, 4vw, 36px) 0 clamp(16px, 3vw, 24px);
}

.section-title {
  font-size: clamp(18px, 4.3vw, 32px);
  font-weight: 700;
  color: #3A3A3A;
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: clamp(13px, 2.9vw, 22px);
  color: #999;
}

/* ====== 卡片网格 ====== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 2vw, 16px);
  justify-items: center;
}

/* ====== 卡片 ====== */
.card {
  width: 100%;
  max-width: 230px;
  background: #fff;
  border-radius: clamp(14px, 2.5vw, 20px);
  padding: clamp(14px, 2.5vw, 24px) clamp(8px, 1.5vw, 16px) clamp(12px, 2vw, 20px);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}

.card:active { transform: scale(.97); }

.card.is-full {
  background: #f0f0f0 !important;
  cursor: not-allowed;
  opacity: .55;
  pointer-events: none;
}

.card.is-full .full-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: #bbb;
  color: #fff;
  font-size: clamp(11px, 2.5vw, 20px);
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.card.is-full:active { transform: none; }

.card .icon-wrap {
  width: clamp(44px, 10vw, 80px);
  height: clamp(44px, 10vw, 80px);
  margin: 0 auto clamp(6px, 1.2vw, 12px);
  background: rgba(201,158,84,0.1);
  border-radius: clamp(12px, 2.5vw, 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 5.5vw, 44px);
}

.theme-gold .icon-wrap { background: rgba(201,158,84,0.1); }
.theme-blue .icon-wrap { background: rgba(74,117,180,0.1); }
.theme-purple .icon-wrap { background: rgba(116,78,155,0.1); }
.theme-orange .icon-wrap { background: rgba(215,114,74,0.1); }
.theme-green .icon-wrap { background: rgba(125,151,123,0.1); }

.card .job-name {
  font-size: clamp(15px, 3.7vw, 28px);
  font-weight: 700;
  color: #333;
  margin-bottom: 2px;
}

.card .job-desc {
  font-size: clamp(10px, 2.4vw, 18px);
  color: #aaa;
  margin-bottom: 8px;
}

.card .status-icon {
  font-size: clamp(11px, 2.6vw, 20px);
  color: #999;
  margin-bottom: 2px;
}

.card .fraction {
  font-size: clamp(16px, 4vw, 30px);
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
}

.theme-gold .fraction { color: #C99E54; }
.theme-blue .fraction { color: #4A75B4; }
.theme-purple .fraction { color: #744E9B; }
.theme-orange .fraction { color: #D7724A; }
.theme-green .fraction { color: #7D977B; }

.is-full .fraction { color: #bbb !important; }

.progress-bg {
  width: 100%;
  height: clamp(6px, 1.3vw, 10px);
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .3s;
}

.theme-gold .progress-fill { background: #C99E54; }
.theme-blue .progress-fill { background: #4A75B4; }
.theme-purple .progress-fill { background: #744E9B; }
.theme-orange .progress-fill { background: #D7724A; }
.theme-green .progress-fill { background: #7D977B; }

.is-full .progress-fill { background: #ccc !important; }

.bottom-space { height: clamp(20px, 5vw, 40px); }

/* ====== 隐私页脚 ====== */
.privacy-footer {
  text-align: center;
  padding: 16px 0 24px;
}

.privacy-link {
  font-size: clamp(13px, 2.9vw, 22px);
  color: #999;
  cursor: pointer;
  text-decoration: underline;
}

/* ====== 弹窗 ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: #fff;
  border-radius: 24px;
  padding: clamp(24px, 4vw, 40px) clamp(20px, 3.5vw, 32px) clamp(20px, 3.5vw, 32px);
  width: 90vw;
  max-width: 580px;
  text-align: center;
  animation: scaleIn .2s;
}

@keyframes scaleIn { from { transform: scale(.9); } to { transform: scale(1); } }

.modal-icon { font-size: clamp(36px, 8vw, 60px); margin-bottom: 12px; }
.modal-title { font-size: clamp(18px, 4.5vw, 34px); font-weight: 700; color: #333; margin-bottom: 8px; }
.modal-desc { font-size: clamp(14px, 3.5vw, 26px); color: #666; line-height: 1.6; margin-bottom: 20px; white-space: pre-line; }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn-cancel {
  flex: 1;
  height: clamp(44px, 8.5vw, 64px);
  background: #f0f0f0;
  border: none;
  border-radius: 14px;
  font-size: clamp(15px, 3.7vw, 28px);
  color: #666;
  cursor: pointer;
}

.modal-btn-confirm {
  flex: 1;
  height: clamp(44px, 8.5vw, 64px);
  background: linear-gradient(135deg, #C99E54, #A67F3D);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: clamp(15px, 3.7vw, 28px);
  font-weight: 600;
  cursor: pointer;
}

.modal-btn-confirm:active, .modal-btn-cancel:active { opacity: .8; }

/* ====== 密码输入 ====== */
.password-input-wrap { margin: 0 0 16px; }

.password-input {
  width: 100%;
  height: clamp(44px, 8.5vw, 64px);
  border: 2px solid #e0d5c0;
  border-radius: 14px;
  padding: 0 16px;
  font-size: clamp(16px, 4vw, 28px);
  text-align: center;
  letter-spacing: 4px;
  outline: none;
}

.password-input:focus { border-color: #C99E54; }

/* ====== 隐私页面 ====== */
.privacy-page {
  max-width: 750px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 3.5vw, 32px);
  min-height: 100vh;
}

.privacy-page h1 { font-size: clamp(20px, 4.8vw, 36px); color: #333; text-align: center; margin-bottom: 24px; }
.privacy-page h2 { font-size: clamp(16px, 3.7vw, 28px); color: #555; margin: 20px 0 10px; }
.privacy-page p { font-size: clamp(14px, 3.5vw, 26px); color: #666; line-height: 1.8; margin-bottom: 10px; }
.privacy-page .privacy-back {
  display: block;
  margin: 32px auto 0;
  padding: 12px 40px;
  background: #C99E54;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: clamp(15px, 3.7vw, 28px);
  cursor: pointer;
}

/* ====== 管理后台 ====== */
.admin-page {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 16px 60px;
  min-height: 100vh;
}

.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: clamp(56px, 13vw, 100px);
  padding-top: clamp(16px, 3.5vw, 30px);
}

.admin-nav .back-btn {
  font-size: clamp(14px, 3.7vw, 28px);
  color: #C99E54;
  cursor: pointer;
  padding: 6px 16px;
  border: 1px solid #C99E54;
  border-radius: 16px;
}

.admin-nav .admin-title {
  font-size: clamp(18px, 4.5vw, 34px);
  font-weight: 700;
  color: #3A3A3A;
}

.admin-nav .logout-btn {
  font-size: clamp(14px, 3.2vw, 24px);
  color: #e66;
  cursor: pointer;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1.5vw, 12px);
  margin: clamp(12px, 2.5vw, 20px) 0;
}

.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: clamp(10px, 2vw, 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}

.stat-icon { font-size: clamp(22px, 5vw, 36px); flex-shrink: 0; }
.stat-info { flex: 1; min-width: 0; }
.stat-name { font-size: clamp(13px, 3.2vw, 24px); color: #333; font-weight: 600; }
.stat-count { font-size: clamp(12px, 2.9vw, 22px); color: #888; }

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 16px;
  font-size: clamp(12px, 2.9vw, 22px);
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: all .2s;
}

.filter-btn.active {
  background: #C99E54;
  color: #fff;
  border-color: #C99E54;
}

.records-table {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}

.table-header, .table-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.5fr .8fr;
  padding: clamp(10px, 2vw, 16px);
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
}

.table-header {
  font-size: clamp(13px, 3.2vw, 24px);
  font-weight: 600;
  color: #555;
  background: #fafaf7;
}

.table-row { font-size: clamp(12px, 3.2vw, 24px); color: #333; }

.profession-tag {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 10px;
  font-size: clamp(11px, 2.9vw, 22px);
  font-weight: 600;
}

.btn-delete {
  padding: 4px 12px;
  background: #fff0f0;
  color: #e66;
  border: 1px solid #fcc;
  border-radius: 10px;
  font-size: clamp(11px, 2.6vw, 20px);
  cursor: pointer;
}

.btn-delete:hover { background: #ffe0e0; }

.admin-empty {
  text-align: center;
  padding: 40px 0;
  font-size: clamp(16px, 3.7vw, 28px);
  color: #ccc;
}

.admin-login {
  max-width: 460px;
  margin: clamp(60px, 15vw, 120px) auto 0;
  text-align: center;
}

.admin-login h1 {
  font-size: clamp(20px, 4.5vw, 34px);
  color: #333;
  margin-bottom: 10px;
}

.admin-login .login-subtitle {
  font-size: clamp(14px, 3.2vw, 24px);
  color: #999;
  margin-bottom: 24px;
}

.admin-login .password-input {
  margin-bottom: 20px;
}

.admin-login .login-btn {
  width: 100%;
  height: clamp(44px, 8.5vw, 64px);
  background: linear-gradient(135deg, #C99E54, #A67F3D);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: clamp(16px, 3.7vw, 28px);
  font-weight: 600;
  cursor: pointer;
}

/* ====== 小屏幕适配 (<360px) ====== */
@media screen and (max-width: 360px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .app-container, .admin-page {
    padding: 0 10px 40px;
  }

  .card {
    max-width: none;
  }

  .table-header, .table-row {
    grid-template-columns: 1fr 1fr 1.2fr .6fr;
    gap: 2px;
  }

  .stats-cards {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
}
