*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f0f0f5;
  --text-muted: rgba(240, 240, 245, 0.55);
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.35);
  --star: #fdcb6e;
  --success: #00b894;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(108, 92, 231, 0.15), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(162, 155, 254, 0.08), transparent),
    var(--bg);
  z-index: 0;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent-light);
  border-radius: 50%;
  opacity: 0;
  animation: float-particle linear infinite;
}

@keyframes float-particle {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Hero intro */
.hero {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.logo-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-glow 3s ease-in-out infinite;
}

.logo-icon {
  font-size: 1.8rem;
  color: white;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px var(--accent-glow); }
  50% { box-shadow: 0 0 60px var(--accent-glow), 0 0 100px rgba(108, 92, 231, 0.15); }
}

.hero h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 1.75rem;
}

.hero-intro {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  line-height: 1.85;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-intro p + p {
  margin-top: 0.85rem;
}

.hero-intro strong {
  color: var(--text);
  font-weight: 500;
}

.hero-note {
  margin-top: 1.25rem !important;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem !important;
  text-align: center;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form */
.survey-form {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.question-block {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.question-block:nth-child(1) { animation-delay: 0.05s; }
.question-block:nth-child(2) { animation-delay: 0.08s; }
.question-block:nth-child(3) { animation-delay: 0.11s; }
.question-block:nth-child(4) { animation-delay: 0.14s; }
.question-block:nth-child(5) { animation-delay: 0.17s; }
.question-block:nth-child(6) { animation-delay: 0.2s; }
.question-block:nth-child(7) { animation-delay: 0.23s; }
.question-block:nth-child(8) { animation-delay: 0.26s; }
.question-block:nth-child(9) { animation-delay: 0.29s; }
.question-block:nth-child(10) { animation-delay: 0.32s; }
.question-block:nth-child(11) { animation-delay: 0.35s; }
.question-block:nth-child(12) { animation-delay: 0.38s; }
.question-block:nth-child(13) { animation-delay: 0.41s; }
.question-block:nth-child(14) { animation-delay: 0.44s; }

.q-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  width: fit-content;
}

.open-tag {
  background: rgba(0, 184, 148, 0.12);
  color: var(--success);
}

.rating-tag {
  background: rgba(253, 203, 110, 0.12);
  color: var(--star);
}

.question-block h2 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.5;
}

.q-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: -0.25rem;
}

.input-field,
.textarea-field {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-field + .input-field {
  margin-top: 0.5rem;
}

.input-field:focus,
.textarea-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-field::placeholder,
.textarea-field::placeholder {
  color: rgba(240, 240, 245, 0.3);
}

.textarea-field {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}

.level-grid {
  grid-template-columns: repeat(3, 1fr);
}

.option-chip {
  cursor: pointer;
}

.option-chip input {
  display: none;
}

.option-chip span {
  display: block;
  padding: 0.75rem 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  transition: all 0.25s;
}

.option-chip input:checked + span {
  background: rgba(108, 92, 231, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
}

.option-chip:hover span {
  background: var(--surface-hover);
}

.grade-picker {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.grade-picker.fade-in {
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.grade-picker-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
}

.option-row:hover {
  background: var(--surface-hover);
}

.option-row input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.option-row:has(input:checked) {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
}

.option-row span {
  font-size: 0.95rem;
}

.star-rating {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.star {
  background: none;
  border: none;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0.25rem;
  line-height: 1;
}

.star:hover,
.star.hover {
  color: var(--star);
  transform: scale(1.15);
}

.star.active {
  color: var(--star);
  text-shadow: 0 0 20px rgba(253, 203, 110, 0.4);
}

.star.pop {
  animation: starPop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes starPop {
  0% { transform: scale(1); color: rgba(255, 255, 255, 0.15); }
  40% { transform: scale(1.35); color: var(--star); }
  100% { transform: scale(1); color: var(--star); }
}

.star-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.required-mark {
  color: #ff7675;
  font-weight: 400;
}

.field-error {
  font-size: 0.8rem;
  color: #ff7675;
  margin-top: -0.35rem;
  margin-bottom: 0.25rem;
}

.input-error {
  border-color: #ff7675 !important;
  box-shadow: 0 0 0 3px rgba(255, 118, 117, 0.2) !important;
}

.open-tag.optional-tag {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.submit-area {
  text-align: center;
  padding-top: 0.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 3rem;
  background: linear-gradient(135deg, var(--accent), #7c6cf0);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit {
  width: 100%;
  max-width: 320px;
}

/* Success */
#page-success {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-content {
  text-align: center;
  max-width: 420px;
  animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), #55efc4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: white;
  animation: successPop 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

@keyframes successPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-content h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-content p {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 0.95rem;
}

.success-sub {
  margin-top: 1.25rem;
  font-size: 0.88rem !important;
}

/* Admin */
#page-admin {
  max-width: 900px;
  padding-top: 1.5rem;
}

.admin-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-header-bar h1 {
  font-size: 1.35rem;
  font-weight: 600;
}

.btn-admin-exit {
  padding: 0.45rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-admin-exit:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.admin-tab {
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

.admin-tab.active {
  color: var(--accent-light);
  background: rgba(108, 92, 231, 0.12);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-list-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.admin-tier-filter {
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 7.5rem;
}

.admin-tier-filter:focus {
  outline: none;
  border-color: var(--accent-light);
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  transition: all 0.2s;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
}

.admin-card-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.admin-card-body h3 {
  font-size: 1rem;
  font-weight: 600;
}

.admin-card-side {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-delete {
  width: 3.25rem;
  padding: 0.4rem 0;
  text-align: center;
  background: transparent;
  border: 1px solid rgba(255, 118, 117, 0.35);
  color: #ff7675;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: rgba(255, 118, 117, 0.12);
  border-color: #ff7675;
}

.admin-card:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

.admin-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.tier-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  min-width: 4.5rem;
  text-align: center;
  flex-shrink: 0;
}

.tier-weak { background: rgba(255, 118, 117, 0.15); color: #ff7675; }
.tier-medium { background: rgba(253, 203, 110, 0.15); color: #fdcb6e; }
.tier-strong { background: rgba(0, 184, 148, 0.15); color: #00b894; }
.tier-unknown { background: var(--surface); color: var(--text-muted); }

.admin-loading, .admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
}

.admin-empty-inline {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: #12121a;
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
  animation: fadeUp 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.detail-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-header h3 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.detail-value {
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.analysis-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-wrap {
  max-width: 320px;
  margin: 0 auto 0.75rem;
}

.chart-caption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.chart-fallback {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 0;
}

.chart-fallback-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
}

.chart-fallback-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tier-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.tier-section-weak { border-left: 3px solid #ff7675; }
.tier-section-medium { border-left: 3px solid #fdcb6e; }
.tier-section-strong { border-left: 3px solid #00b894; }

.tier-section h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.tier-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.tier-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.tier-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.tier-issues ul {
  margin: 0 0 0.75rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.tier-suggest {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  background: rgba(108, 92, 231, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.tier-students {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tier-student {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.tier-student:hover {
  border-color: var(--accent);
}

.tier-student-score {
  color: var(--accent-light);
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .question-block h2 { font-size: 1.1rem; }
  .star { font-size: 1.75rem; }
  .level-grid { grid-template-columns: 1fr; }
  .hero-intro { padding: 1.25rem; }
}
