/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #e8f4f8 0%, #f0e6fa 50%, #fff5e6 100%);
  min-height: 100vh;
  color: #2d2d2d;
  padding: 1rem;
}

/* ---- Layout ---- */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.header { margin-bottom: 1.5rem; }
.footer { margin-top: auto; padding: 1rem; }

/* ---- Trang chủ ---- */
.page-home .header h1 { font-size: 2rem; margin: 0 0 0.25rem 0; }
.page-home .header p { margin: 0; color: #555; }

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  max-width: 600px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 180px;
  padding: 1.5rem;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 4px solid transparent;
}
.game-card:hover { transform: scale(1.05); box-shadow: 0 12px 32px rgba(0,0,0,0.15); }
.game-card:focus-visible { outline: 3px solid #6b4ce6; outline-offset: 4px; }

.game-card.game-counting { border-color: #6b4ce6; }
.game-card.game-counting:hover { border-color: #8b6cf6; }

.game-card.game-alphabet { border-color: #0ea5e9; }
.game-card.game-alphabet:hover { border-color: #38bdf8; }

.game-card.game-color { border-color: #ec4899; }
.game-card.game-color:hover { border-color: #f472b6; }

.game-icon { font-size: 3.5rem; margin-bottom: 0.5rem; line-height: 1; }
.game-card h2 { margin: 0 0 0.25rem 0; font-size: 1.35rem; }
.game-card p { margin: 0; font-size: 0.95rem; color: #666; }

.link-home {
  color: #6b4ce6;
  font-weight: 600;
  text-decoration: none;
}
.link-home:hover { text-decoration: underline; }

/* ---- Trang game đếm ---- */
.page-counting .header h1 { font-size: 1.75rem; margin: 0 0 0.25rem 0; }
.page-counting .header p { margin: 0; color: #555; }

/* ---- Trang Bảng chữ cái ---- */
.page-alphabet .header h1 { font-size: 1.75rem; margin: 0 0 0.25rem 0; }
.page-alphabet .header p { margin: 0; color: #555; }
.question-text.training-letter {
  font-size: clamp(5rem, 25vw, 10rem);
  font-weight: 800;
  margin: 1rem 0;
  color: #0ea5e9;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
  letter-spacing: -0.02em;
}
.letter-wrap {
  justify-content: center;
  align-items: center;
}
.letter-display {
  font-size: clamp(4rem, 22vw, 8rem);
  font-weight: 800;
  color: #0ea5e9;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
  animation: pop 0.3s ease-out;
}
.choice-btn-letter { font-size: 1.75rem; min-width: 56px; }
/* Mode Nghe: chữ to, dễ nhìn */
.page-alphabet.mode-listen .choice-btn-letter {
  font-size: clamp(2.5rem, 14vw, 4.5rem);
  font-weight: 800;
  min-width: clamp(72px, 20vw, 100px);
  min-height: clamp(72px, 20vw, 100px);
  padding: 0.5rem 0.75rem;
  color: #0ea5e9;
  border-color: #0ea5e9;
}
.page-alphabet.mode-listen .choice-btn-letter:hover {
  background: #0ea5e9;
  color: #fff;
}
.page-alphabet.mode-listen .choices {
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.choice-btn-reading { font-size: 1.1rem; min-width: 80px; padding: 0.5rem 0.75rem; }

/* ---- Trang Màu sắc ---- */
.page-color .header h1 { font-size: 1.75rem; margin: 0 0 0.25rem 0; }
.page-color .header p { margin: 0; color: #555; }
.question-text.training-color {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0.5rem 0;
  color: #333;
  line-height: 1;
}
.color-display-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  padding: 1rem;
  margin: 0 0 1rem 0;
}
.color-display-wrap:empty {
  display: none;
}
.color-swatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.color-swatch {
  display: block;
  width: clamp(80px, 25vw, 140px);
  height: clamp(80px, 25vw, 140px);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: pop 0.3s ease-out;
}
.color-swatch-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
}
.choice-btn-color {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 100px;
  min-height: 100px;
  padding: 0.75rem;
  font-size: 1rem;
}
.choice-btn-color .color-swatch {
  width: clamp(56px, 18vw, 80px);
  height: clamp(56px, 18vw, 80px);
  border-radius: 14px;
}
.page-color.mode-listen .choice-btn-color {
  min-width: clamp(100px, 28vw, 140px);
  min-height: clamp(100px, 28vw, 140px);
}
.page-color.mode-listen .choice-btn-color .color-swatch {
  width: clamp(64px, 22vw, 100px);
  height: clamp(64px, 22vw, 100px);
}
.page-color.mode-listen .choices {
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Tab chế độ Chơi / Luyện tập */
.mode-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0.75rem 0;
  border-bottom: 2px solid #e8e0f5;
  gap: 0;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.mode-tab-icon {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 1.1em;
  vertical-align: middle;
}
.mode-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.mode-tab:hover {
  color: #6b4ce6;
}
.mode-tab.active {
  color: #6b4ce6;
  border-bottom-color: #6b4ce6;
}
.mode-tab:focus-visible {
  outline: 2px solid #6b4ce6;
  outline-offset: 2px;
}

.score {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #6b4ce6;
}

.reading-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  color: #6b4ce6;
}

.training-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}
.btn-listen {
  background: #e8f5e9;
  color: #2e7d32;
  border: 2px solid #81c784;
}
.btn-listen:hover { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn-next-training {
  background: #6b4ce6;
  color: #fff;
}
.btn-next-training:hover { background: #5a3dd4; transform: scale(1.05); }
.btn-listen:focus-visible,
.btn-next-training:focus-visible { outline: 3px solid #333; outline-offset: 2px; }

/* Nút Nghe trong mode Chơi (nghe audio rồi chọn số) */
.play-listen-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}
.btn-listen-play {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  color: #1b5e20;
  border: 3px solid #81c784;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-listen-play:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(46, 125, 50, 0.35);
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}
.btn-listen-play:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.5), 0 4px 16px rgba(46, 125, 50, 0.35);
  background: #2e7d32;
  color: #fff;
  border-color: #1b5e20;
}
.btn-listen-play:focus:not(:hover) {
  transform: scale(1.02);
}
.btn-listen-play:hover:focus {
  transform: scale(1.05);
}
.btn-listen-play:focus-visible { outline: 3px solid #1b5e20; outline-offset: 3px; }

.voice-select-wrap {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.voice-select-wrap label { font-size: 0.95rem; font-weight: 600; color: #555; }
.voice-select {
  min-width: 200px;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 2px solid #c9b8f0;
  border-radius: 10px;
  background: #fff;
  color: #333;
}
.voice-select:focus {
  outline: none;
  border-color: #6b4ce6;
}
.btn-test-voice {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: #e8e0f5;
  color: #5a4cb8;
  border: 2px solid #c9b8f0;
  border-radius: 10px;
  cursor: pointer;
}
.btn-test-voice:hover {
  background: #6b4ce6;
  color: #fff;
  border-color: #6b4ce6;
}

/* Nút nhạc nền (trang chủ + trang game) */
.btn-music {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: #e8f5e9;
  color: #2e7d32;
  border: 2px solid #81c784;
  border-radius: 10px;
  cursor: pointer;
}
.btn-music:hover {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}
.page-home .header .btn-music {
  margin-top: 0.5rem;
}

.game-area {
  max-width: 520px;
  width: 100%;
  background: #fff;
  border-radius: 24px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: #333;
}

/* Luyện tập: chỉ hiển thị số thật rõ */
.question-text.training-number {
  font-size: clamp(5rem, 25vw, 10rem);
  font-weight: 800;
  margin: 1rem 0;
  color: #6b4ce6;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(107, 76, 230, 0.25);
  letter-spacing: -0.02em;
}
.page-counting .question .objects-wrap:empty {
  min-height: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
}
/* Mode Nghe (tab Nghe): số to, rõ, dễ nhìn */
.page-counting.mode-listen .choice-btn {
  font-size: clamp(2.5rem, 14vw, 5rem);
  font-weight: 800;
  min-width: clamp(72px, 22vw, 120px);
  min-height: clamp(72px, 22vw, 120px);
  padding: 0.5rem 0.75rem;
  color: #6b4ce6;
  border-width: 4px;
  border-color: #6b4ce6;
}
.page-counting.mode-listen .choice-btn:hover {
  background: #6b4ce6;
  color: #fff;
}
.page-counting.mode-listen .choices {
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.objects-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  min-height: 80px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: #f8f6ff;
  border-radius: 16px;
  border: 3px dashed #c9b8f0;
}

/* Trang alphabet: không dùng ô viền chấm, chỉ hiện chữ */
.page-alphabet .letter-display-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}
.page-alphabet .letter-display-wrap:empty {
  display: none;
}

.object-item {
  font-size: 2.5rem;
  line-height: 1;
  animation: pop 0.3s ease-out;
}
@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.choice-btn {
  min-width: 64px;
  min-height: 64px;
  font-size: 1.5rem;
  font-weight: 700;
  border: 4px solid #6b4ce6;
  background: #fff;
  color: #6b4ce6;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s;
}
.choice-btn:hover {
  background: #6b4ce6;
  color: #fff;
  transform: scale(1.08);
}
.choice-btn:focus-visible {
  outline: 3px solid #333;
  outline-offset: 2px;
}
.choice-btn.correct {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
  pointer-events: none;
  animation: correct 0.4s ease;
}
.choice-btn.wrong {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  pointer-events: none;
  animation: shake 0.4s ease;
}
.choice-btn:disabled { opacity: 0.7; cursor: not-allowed; }

@keyframes correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.feedback {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.75rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.feedback.success { background: #dcfce7; color: #166534; }
.feedback.error { background: #fee2e2; color: #991b1b; }

.actions { text-align: center; }

.btn {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.btn-next {
  background: #6b4ce6;
  color: #fff;
  padding: 0.75rem 1rem;
}
.btn-next:hover { background: #5a3dd4; transform: scale(1.05); }
.btn-next:focus-visible { outline: 3px solid #333; outline-offset: 2px; }
.btn-next-icon {
  display: inline-block;
  font-size: 2rem;
  line-height: 1;
  vertical-align: middle;
}
@media (max-width: 480px) {
  .btn-next-icon { font-size: 1.75rem; }
}

/* ---- Hiệu ứng chúc mừng (đếm đúng) ---- */
.celebration-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.celebration-piece {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.5rem;
  opacity: 0;
  --dx: 0;
  --dy: 0;
  animation: celebration-burst 1.2s ease-out forwards;
}

/* Hướng bay cho từng mảnh */
.celebration-wrap .celebration-piece:nth-child(1) { --dx: -80px; --dy: -60px; }
.celebration-wrap .celebration-piece:nth-child(2) { --dx: 80px; --dy: -60px; }
.celebration-wrap .celebration-piece:nth-child(3) { --dx: -80px; --dy: 60px; }
.celebration-wrap .celebration-piece:nth-child(4) { --dx: 80px; --dy: 60px; }
.celebration-wrap .celebration-piece:nth-child(5) { --dx: 0; --dy: -80px; }
.celebration-wrap .celebration-piece:nth-child(6) { --dx: 0; --dy: 80px; }
.celebration-wrap .celebration-piece:nth-child(7) { --dx: -70px; --dy: -70px; }
.celebration-wrap .celebration-piece:nth-child(8) { --dx: 70px; --dy: -70px; }
.celebration-wrap .celebration-piece:nth-child(9) { --dx: -70px; --dy: 70px; }
.celebration-wrap .celebration-piece:nth-child(10) { --dx: 70px; --dy: 70px; }
.celebration-wrap .celebration-piece:nth-child(11) { --dx: -90px; --dy: 0; }
.celebration-wrap .celebration-piece:nth-child(12) { --dx: 90px; --dy: 0; }
.celebration-wrap .celebration-piece:nth-child(13) { --dx: -50px; --dy: -85px; }
.celebration-wrap .celebration-piece:nth-child(14) { --dx: 50px; --dy: -85px; }
.celebration-wrap .celebration-piece:nth-child(15) { --dx: -50px; --dy: 85px; }
.celebration-wrap .celebration-piece:nth-child(16) { --dx: 50px; --dy: 85px; }
.celebration-wrap .celebration-piece:nth-child(17) { --dx: -60px; --dy: -60px; }
.celebration-wrap .celebration-piece:nth-child(18) { --dx: 60px; --dy: -60px; }
.celebration-wrap .celebration-piece:nth-child(19) { --dx: -60px; --dy: 60px; }
.celebration-wrap .celebration-piece:nth-child(20) { --dx: 60px; --dy: 60px; }
.celebration-wrap .celebration-piece:nth-child(21) { --dx: -40px; --dy: -75px; }
.celebration-wrap .celebration-piece:nth-child(22) { --dx: 40px; --dy: -75px; }
.celebration-wrap .celebration-piece:nth-child(23) { --dx: -40px; --dy: 75px; }
.celebration-wrap .celebration-piece:nth-child(24) { --dx: 40px; --dy: 75px; }

@keyframes celebration-burst {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  25% {
    transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3)) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(1);
    opacity: 0;
  }
}

/* ---- Hiệu ứng khi chọn sai ---- */
.wrong-effect-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.wrong-effect-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.15);
  animation: wrong-flash 0.4s ease-out forwards;
}
.wrong-effect-piece {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.4rem;
  opacity: 0;
  --dx: 0;
  --dy: 0;
  animation: wrong-burst 1s ease-out forwards;
}
.wrong-effect-wrap .wrong-effect-piece:nth-child(1) { --dx: -70px; --dy: -50px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(2) { --dx: 70px; --dy: -50px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(3) { --dx: -70px; --dy: 50px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(4) { --dx: 70px; --dy: 50px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(5) { --dx: 0; --dy: -70px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(6) { --dx: 0; --dy: 70px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(7) { --dx: -60px; --dy: -60px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(8) { --dx: 60px; --dy: -60px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(9) { --dx: -60px; --dy: 60px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(10) { --dx: 60px; --dy: 60px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(11) { --dx: -80px; --dy: 0; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(12) { --dx: 80px; --dy: 0; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(13) { --dx: -45px; --dy: -65px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(14) { --dx: 45px; --dy: -65px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(15) { --dx: -45px; --dy: 65px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(16) { --dx: 45px; --dy: 65px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(17) { --dx: -55px; --dy: -55px; }
.wrong-effect-wrap .wrong-effect-piece:nth-child(18) { --dx: 55px; --dy: 55px; }
@keyframes wrong-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes wrong-burst {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  30% {
    transform: translate(calc(var(--dx) * 0.35), calc(var(--dy) * 0.35)) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.8);
    opacity: 0;
  }
}

/* ---- Settings (góc phải trên, panel dạng dropdown) ---- */
.webgame-settings {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

.webgame-settings-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.75rem;
  line-height: 1;
  border: 2px solid #c9b8f0;
  border-radius: 50%;
  background: #fff;
  color: #6b4ce6;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.webgame-settings-btn:hover {
  background: #f5f0ff;
  border-color: #6b4ce6;
  transform: scale(1.08);
}
.webgame-settings-btn:focus-visible {
  outline: 3px solid #6b4ce6;
  outline-offset: 2px;
}

.webgame-settings-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 260px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  border: 2px solid #e8e0f5;
  overflow: hidden;
}

.webgame-settings-panel-header {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  background: #f8f6ff;
  border-bottom: 1px solid #e8e0f5;
}

.webgame-settings-panel-body {
  padding: 1rem;
}

.webgame-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.webgame-settings-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #555;
}

.webgame-settings-toggle {
  width: 52px;
  height: 28px;
  padding: 0;
  border: 2px solid #c9b8f0;
  border-radius: 14px;
  background: #e8e0f5;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.webgame-settings-toggle:hover {
  border-color: #6b4ce6;
}
.webgame-settings-toggle:focus-visible {
  outline: 2px solid #6b4ce6;
  outline-offset: 2px;
}

.webgame-settings-toggle-inner {
  display: block;
  width: 22px;
  height: 22px;
  margin: 1px 0 0 1px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.webgame-settings-toggle.webgame-settings-toggle-on .webgame-settings-toggle-inner {
  transform: translateX(24px);
}
.webgame-settings-toggle.webgame-settings-toggle-on {
  background: #6b4ce6;
  border-color: #6b4ce6;
}

.webgame-settings-row-volume {
  flex-wrap: wrap;
  gap: 0.5rem;
}
.webgame-settings-volume {
  flex: 1;
  min-width: 100px;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #e8e0f5;
  border-radius: 4px;
  outline: none;
}
.webgame-settings-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6b4ce6;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.webgame-settings-volume::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6b4ce6;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.webgame-settings-volume:focus-visible {
  outline: 2px solid #6b4ce6;
  outline-offset: 2px;
}

.webgame-settings-row-voice {
  flex-wrap: wrap;
}
.webgame-settings-voice-select {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  border: 2px solid #c9b8f0;
  border-radius: 8px;
  background: #fff;
  color: #333;
}
.webgame-settings-voice-select:focus {
  outline: none;
  border-color: #6b4ce6;
}
.webgame-settings-voice-test {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid #c9b8f0;
  border-radius: 8px;
  background: #e8e0f5;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}
.webgame-settings-voice-test:hover {
  border-color: #6b4ce6;
  color: #6b4ce6;
}
.webgame-settings-voice-test:focus-visible {
  outline: 2px solid #6b4ce6;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .game-card { min-width: 160px; min-height: 150px; }
  .object-item { font-size: 2rem; }
  .choice-btn { min-width: 56px; min-height: 56px; font-size: 1.35rem; }
  .webgame-settings { top: 0.5rem; right: 0.5rem; }
  .webgame-settings-panel { min-width: 240px; }
}
