:root {
  --color-bg: #0a0b10;
  --color-panel: rgba(20, 22, 38, 0.7);
  --color-text: #e0e6ed;
  --color-primary: #00f0ff;
  --color-secondary: #ff00ea;
  --color-success: #00ff66;
  --color-error: #ff3366;
  
  --font-main: 'Noto Sans SC', sans-serif;
  --font-en: 'Outfit', sans-serif;
  
  --shadow-neon: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3);
  --shadow-neon-hover: 0 0 15px rgba(255, 0, 234, 0.6), 0 0 30px rgba(255, 0, 234, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow: hidden; /* 防止背景滚动 */
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ── 背景画布 ── */
#starfield, #particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
#particles-canvas {
  z-index: 10;
}

/* ── 容器体系 ── */
.app-container {
  width: 100%;
  max-width: 800px;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  animation: fadeIn 0.4s ease forwards;
}
.screen.active {
  display: flex;
}

/* ── 通用组件 ── */
.glass-panel {
  background: var(--color-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── 首页屏幕 ── */
.hero {
  text-align: center;
  margin-bottom: 30px;
  margin-top: 20px;
}
h1.glitch {
  font-family: var(--font-en);
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0px var(--color-primary), -2px -2px 0px var(--color-secondary);
}
.subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  margin-top: 10px;
}

.setup-group {
  margin-bottom: 25px;
}
.setup-group h2 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: #fff;
}

/* 自定义单选框 */
.radio-group {
  display: flex;
  gap: 15px;
}
.grade-label {
  flex: 1;
  cursor: pointer;
}
.grade-label input {
  display: none;
}
.grade-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.3s ease;
  font-weight: bold;
}
.grade-label input:checked + .grade-card {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-neon);
  color: #fff;
}
.grade-card .icon { font-size: 1.5rem; }

/* 模式按钮 */
.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
}
.mode-btn:hover {
  background: rgba(255, 0, 234, 0.1);
  border-color: var(--color-secondary);
  box-shadow: var(--shadow-neon-hover);
  transform: translateY(-2px);
}
.mode-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mode-info h3 {
  font-size: 1.2rem;
  margin-bottom: 5px;
  color: #fff;
}
.mode-info p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ── 游戏界面 ── */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-top: 10px;
}
.btn-icon {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.3s;
}
.btn-icon:hover {
  color: var(--color-error);
}
.stats {
  display: flex;
  gap: 15px;
}
.stat-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
}
.stat-badge.hidden { display: none; }
.stat-badge .label { font-size: 0.8rem; color: #888; font-family: var(--font-main); }
.stat-badge .value { font-size: 1.2rem; font-weight: bold; color: #fff; }
#stat-combo { border-color: var(--color-secondary); color: var(--color-secondary); }
#stat-time { border-color: var(--color-primary); color: var(--color-primary); }

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.main-word-card {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  position: relative;
  transition: transform 0.1s;
}
.hint-cn {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: #fff;
}
.target-en {
  font-family: var(--font-en);
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.2);
  min-height: 80px;
}
.hint-phonetic {
  font-family: var(--font-en);
  font-size: 1.2rem;
  color: var(--color-primary);
  opacity: 0.8;
  margin-top: 10px;
}

/* 单词输入框 */
.input-area {
  width: 100%;
  position: relative;
}
#word-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 20px;
  font-family: var(--font-en);
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  text-align: center;
  outline: none;
  transition: all 0.3s;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
#word-input:focus {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 10px rgba(0,240,255,0.2), 0 0 15px rgba(0,240,255,0.4);
}

/* 结果屏 */
#screen-result {
  justify-content: center;
  align-items: center;
}
.result-card {
  text-align: center;
  width: 100%;
  max-width: 500px;
}
.result-card h2 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 20px;
}
.final-score {
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
}
.final-score .score-label {
  font-size: 1.2rem;
  color: #888;
}
.final-score .score-number {
  font-family: var(--font-en);
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: var(--shadow-neon-hover);
}
.result-details {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 12px;
}
.detail-item {
  display: flex;
  flex-direction: column;
}
.detail-item span:first-child { font-size: 0.9rem; color: #aaa; }
.detail-item span:last-child { font-family: var(--font-en); font-size: 1.5rem; font-weight: bold; color: #fff; }

.action-buttons {
  display: flex;
  gap: 15px;
}
.btn {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}
.primary-btn {
  background: linear-gradient(135deg, var(--color-primary), #00bfff);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.6);
}
.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── 动画效果 ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
  75% { transform: translateX(-10px); }
}

@keyframes flashRed {
  0% { border-color: rgba(255, 255, 255, 0.2); box-shadow: none; }
  50% { border-color: var(--color-error); box-shadow: 0 0 20px var(--color-error); }
  100% { border-color: rgba(255, 255, 255, 0.2); box-shadow: none; }
}

@keyframes pulseGreen {
  0% { border-color: var(--color-primary); box-shadow: inset 0 0 10px rgba(0,240,255,0.2); }
  50% { border-color: var(--color-success); box-shadow: inset 0 0 30px rgba(0,255,102,0.4), 0 0 20px rgba(0,255,102,0.5); }
  100% { border-color: var(--color-primary); box-shadow: inset 0 0 10px rgba(0,240,255,0.2); }
}

@keyframes comboPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.5) rotate(-5deg); color: #fff; }
  100% { transform: scale(1); }
}

/* JS 操作类 */
.anim-shake { animation: shake 0.4s ease; }
.anim-flash-red { animation: flashRed 0.4s ease; }
.anim-pulse-green { animation: pulseGreen 0.4s ease; }
.anim-combo { animation: comboPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.text-typed { color: var(--color-primary); }
.text-error { color: var(--color-error); }
.text-hidden { opacity: 0 !important; }

/* ── 响应式 ── */
@media (max-width: 768px) {
  h1.glitch { font-size: 2.5rem; }
  .mode-btn { flex-direction: column; text-align: center; gap: 10px; padding: 15px; }
  .radio-group { flex-direction: column; }
  #word-input { font-size: 2rem; padding: 15px; }
  .target-en { font-size: 2.5rem; min-height: 60px; }
  .hint-cn { font-size: 1.5rem; }
  .action-buttons { flex-direction: column; }
}

@media (max-width: 480px) {
  .app-container { padding: 10px; }
  .glass-panel { padding: 20px; border-radius: 16px; }
  h1.glitch { font-size: 2rem; }
  .game-area { gap: 20px; }
  .word-display { padding: 20px 10px; }
  #word-input { font-size: 1.8rem; }
}
