/* 全局基础 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg-gradient: radial-gradient(circle at top right, rgba(22, 28, 45, 0.9), rgba(5, 8, 16, 0.98));
  --card-bg: rgba(15, 21, 38, 0.85);
  --card-border: rgba(82, 109, 190, 0.35);
  --primary: #7AA2FF;
  --primary-dark: #4F8CFF;
  --accent: #F9D66B;
  --text: #E7ECFF;
  --text-muted: rgba(186, 200, 238, 0.85);
  --shadow-lg: 0 28px 48px rgba(4, 8, 22, 0.45);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: #7AA2FF;
  color: white;
}

.btn-primary:hover {
  background: #5A82DF;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: #7AA2FF;
  border: 1px solid #7AA2FF;
}

.btn-secondary:hover {
  background: #7AA2FF;
  color: white;
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

/* 卡片布局 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.card, .step-container {
  background: rgba(18, 23, 34, 0.8);
  border: 1px solid rgba(42, 52, 65, 0.5);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(122, 162, 255, 0.16);
  color: rgba(180, 203, 255, 0.95);
  font-size: 0.78rem;
  letter-spacing: 1px;
}

/* 表单 */
label span,
.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #DCE2EC;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: #0B0F14;
  border: 1px solid #2A3441;
  border-radius: 8px;
  padding: 12px 16px;
  color: #DCE2EC;
  font-size: 16px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #7AA2FF;
}

.muted {
  color: #9CA3AF;
  font-size: 0.92rem;
}

/* 导航栏 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(18, 23, 34, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(42, 52, 65, 0.5);
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-logo h2 {
  color: #7AA2FF;
  font-size: 24px;
  font-weight: 600;
}

.nav-buttons {
  display: flex;
  gap: 12px;
}

/* 首页 */
.main-content {
  margin-top: 70px;
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.hero-section {
  max-width: 1200px;
  width: 100%;
}

.hero-content {
  text-align: center;
}

.hero-title {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 700;
  margin-bottom: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.highlight {
  color: #7AA2FF;
  background: linear-gradient(45deg, #7AA2FF, #5A82DF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.3rem;
  color: #9CA3AF;
  margin-bottom: 60px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
  margin-bottom: 80px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.feature {
  background: rgba(18, 23, 34, 0.9);
  border: 1px solid rgba(42, 52, 65, 0.6);
  border-radius: 20px;
  padding: 40px 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.feature:hover {
  transform: translateY(-8px);
  border-color: #7AA2FF;
  box-shadow: 0 20px 40px rgba(122, 162, 255, 0.1);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
}

.feature h3 {
  color: #7AA2FF;
  font-size: 1.4rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.feature p {
  color: #B0B8C7;
  font-size: 1rem;
  line-height: 1.6;
}

.tech-stack {
  text-align: center;
  margin-top: 60px;
}

.tech-stack h4 {
  color: #DCE2EC;
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-weight: 600;
}

.tech-badges {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.tech-badge {
  background: rgba(122, 162, 255, 0.15);
  color: #7AA2FF;
  border: 1px solid rgba(122, 162, 255, 0.4);
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tech-badge:hover {
  background: rgba(122, 162, 255, 0.25);
  transform: translateY(-2px);
}

/* 首页弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #121722;
  border: 1px solid rgba(42, 52, 65, 0.6);
  border-radius: 16px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid rgba(42, 52, 65, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #DCE2EC;
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #9CA3AF;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #DCE2EC;
}

.modal-body {
  padding: 20px;
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  color: #DCE2EC;
  font-weight: 500;
}

.modal-body input {
  width: 100%;
  background: #0B0F14;
  border: 1px solid #2A3441;
  border-radius: 8px;
  padding: 12px 16px;
  color: #DCE2EC;
  font-size: 16px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.modal-body input:focus {
  outline: none;
  border-color: #7AA2FF;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid rgba(42, 52, 65, 0.5);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* 教师端 */
.page-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 80px;
}

.page-title {
  font-size: 2.5rem;
  color: #DCE2EC;
  margin-bottom: 10px;
}

.page-subtitle {
  color: #9CA3AF;
  font-size: 1.1rem;
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.step-number {
  background: #7AA2FF;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 15px;
}

.step-title {
  color: #DCE2EC;
  font-size: 1.25rem;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.device-list {
  display: grid;
  gap: 12px;
}

.device-item {
  background: #0B0F14;
  border: 1px solid #2A3441;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-info {
  flex: 1;
}

.device-id {
  color: #9CA3AF;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.device-name {
  color: #DCE2EC;
  font-weight: 500;
}

.device-actions {
  display: flex;
  gap: 8px;
}

.countdown {
  font-size: 3rem;
  font-weight: 700;
  color: #7AA2FF;
  text-align: center;
  margin: 40px 0;
}

.buzz-button {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  background: #7AA2FF;
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 auto;
  display: block;
}

.buzz-button:hover {
  background: #5A82DF;
  transform: scale(1.05);
}

.buzz-button:disabled {
  background: #2A3441;
  color: #9CA3AF;
  cursor: not-allowed;
  transform: none;
}

.results-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.result-item {
  background: #0B0F14;
  border: 1px solid #2A3441;
  border-radius: 8px;
  padding: 15px;
}

.result-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2A3441;
  color: #DCE2EC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 15px;
}

.result-rank.first {
  background: #FFD700;
  color: #000;
}

.result-rank.second {
  background: #C0C0C0;
  color: #000;
}

.result-rank.third {
  background: #CD7F32;
  color: #000;
}

/* 学生端 */
.student-layout {
  background: var(--bg-gradient);
  min-height: 100vh;
  padding-bottom: 80px;
}

.student-header {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 24px 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.title-block h1 {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  color: #BED3FF;
  margin-bottom: 6px;
}

.title-block p {
  color: var(--text-muted);
  max-width: 520px;
}

.flow-summary {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.summary-item {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(12, 17, 30, 0.78);
  border: 1px solid rgba(82, 109, 190, 0.35);
  border-radius: 16px;
  transition: transform 0.2s ease, border 0.2s ease;
}

.summary-item.active {
  border-color: rgba(249, 214, 107, 0.82);
  box-shadow: 0 18px 32px rgba(249, 214, 107, 0.2);
  transform: translateY(-3px);
}

.summary-step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.student-main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: grid;
  gap: 26px;
}

.card header h2 {
  margin-top: 12px;
  font-size: 1.8rem;
  color: #F4F7FF;
}

.card header p {
  margin-top: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

.form-row {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
}

.hint {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(82, 109, 190, 0.35);
  background: rgba(82, 109, 190, 0.14);
  color: rgba(196, 206, 238, 0.95);
}

.hint.success {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.16);
  color: #6FE5BA;
}

.verify-status {
  margin-top: 26px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(122, 162, 255, 0.18);
  border-top-color: rgba(122, 162, 255, 0.85);
  animation: spin 0.9s linear infinite;
}

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

.metrics-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.metric-label {
  font-size: 0.78rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(156, 175, 220, 0.88);
}

.metric-value {
  margin-top: 8px;
  font-size: 1.3rem;
  color: #F7FAFF;
}

.metric-value.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  color: #A7C9FF;
  font-size: 0.92rem;
}

.metric-value.status.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
}

.buzz-body {
  margin-top: 24px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
}

.countdown {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 26px 38px rgba(249, 214, 107, 0.3);
}

.buzz-btn {
  width: clamp(220px, 45vw, 300px);
  height: clamp(220px, 45vw, 300px);
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 30%, #FB7185, #EF4444 70%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 34px 45px rgba(239, 68, 68, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.buzz-btn:disabled {
  cursor: not-allowed;
  background: radial-gradient(circle at 30% 30%, rgba(148, 163, 184, 0.85), rgba(100, 116, 139, 0.85));
  box-shadow: none;
}

.buzz-btn:not(:disabled):active {
  transform: scale(0.95);
  box-shadow: 0 18px 28px rgba(239, 68, 68, 0.6);
}

.results {
  margin-top: 26px;
  border-top: 1px solid rgba(82, 109, 190, 0.35);
  padding-top: 18px;
}

.results-list {
  display: grid;
  gap: 12px;
}

.result-row {
  display: grid;
  grid-template-columns: 80px 1fr 160px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(9, 12, 22, 0.92);
  border: 1px solid rgba(82, 109, 190, 0.4);
  color: #E2E9FF;
}

.result-row.me {
  border-color: rgba(249, 214, 107, 0.85);
  box-shadow: 0 18px 28px rgba(249, 214, 107, 0.22);
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 15px;
  }
  
  .features {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .header-content {
    flex-direction: column;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .result-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .nav-buttons {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .step-container {
    padding: 20px;
  }
  
  .buzz-button {
    width: 150px;
    height: 150px;
    font-size: 1.2rem;
  }
  
  .result-row {
    grid-template-columns: 1fr;
    text-align: center;
  }
}