* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  text-align: center;
  padding: 10px;
  margin: 0;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  box-sizing: border-box;
}

h2 {
  tet-decoration: underline;
  background-color: #f0f0f0;
  border-radius: 0.5em;
  border-bottom: 1px solid #ccc;
  max-width: 100%;
  word-wrap: break-word;
  padding: 10px;
  margin: 10px 0;
}

h3 {
  text-align: left;
}

#question {
  font-size: 4em;
  margin-bottom: 20px;
  word-wrap: break-word;
  max-width: 100%;
}

#choices {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  max-width: 100%;
}

.choice-btn {
  padding: 10px 15px;
  font-size: 2.4em;
  cursor: pointer;
  display: none;
  min-width: 1.5em;
  max-width: calc(50% - 5px);
  text-align: center;
  border-radius: 0.5em;
  flex: 0 1 auto;
}

#start-btn {
  padding: 15px 30px;
  font-size: 1.2em;
  cursor: pointer;
}

#history {
  text-align: left;
  margin-top: 20px;
  max-width: 100%;
  overflow-x: hidden;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.history-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.history-table td:nth-child(2),
.history-table td:nth-child(3) {
  text-align: right;
}

.history-table th {
  background-color: #f2f2f2;
  text-align: center;
}

.history-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

#learningMode {
  padding: 8px 12px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  min-width: 150px;
  max-width: 100%;
}

.mode-description {
  font-size: 0.9em;
  color: #666;
  margin-top: 8px;
  text-align: left;
  font-style: italic;
}

/* バッジコレクション */
.badge-collection {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 20px;
  max-width: 100%;
}

.badge-card {
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  transition: all 0.3s ease;
}

.badge-card.earned {
  border-color: #4caf50;
  background-color: #f1f8f4;
}

.badge-card.locked {
  opacity: 0.5;
  background-color: #f5f5f5;
}

.badge-emoji {
  font-size: 3em;
  margin-bottom: 10px;
}

.badge-name {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 0.9em;
}

.badge-description {
  font-size: 0.8em;
  color: #666;
}

.badge-locked-text {
  font-size: 0.75em;
  color: #999;
  margin-top: 5px;
}

/* バッジモーダル */
.badge-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

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

.badge-modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 15px;
  max-width: min(500px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.badge-modal-content h2 {
  margin-top: 0;
  color: #4caf50;
  text-align: center;
}

.badge-list {
  margin: 20px 0;
}

.badge-item {
  background-color: #f1f8f4;
  border: 2px solid #4caf50;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  text-align: center;
}

.badge-item .badge-emoji {
  font-size: 4em;
  margin-bottom: 10px;
}

.badge-item .badge-name {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 5px;
}

.badge-item .badge-description {
  font-size: 0.9em;
  color: #666;
}

.badge-close-btn {
  width: 100%;
  padding: 12px;
  font-size: 1em;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.badge-close-btn:hover {
  background-color: #45a049;
}

/* 達成統計 */
.achievement-stats {
  background-color: #f9f9f9;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.achievement-stats h3 {
  margin-top: 0;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background-color: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.stat-value {
  font-size: 2em;
  font-weight: bold;
  color: #4caf50;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.85em;
  color: #666;
}

/* 学習統計 */
#statistics {
  text-align: left;
  margin-top: 20px;
  max-width: 100%;
  overflow-x: hidden;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  max-width: 100%;
}

.summary-card {
  background-color: #f9f9f9;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  border: 1px solid #ddd;
}

.summary-value {
  font-size: 2.5em;
  font-weight: bold;
  color: #2196f3;
  margin-bottom: 5px;
}

.summary-label {
  font-size: 0.9em;
  color: #666;
}

.weak-questions {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.weak-questions h4 {
  margin-top: 0;
  color: #856404;
}

.weak-questions ul {
  margin: 10px 0;
  padding-left: 20px;
}

.weak-questions li {
  margin-bottom: 5px;
  color: #856404;
}

.weak-questions p {
  color: #856404;
  margin: 10px 0;
}

/* グラフコンテナ */
.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
  max-width: 100%;
}

.chart-wrapper {
  background-color: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #ddd;
  height: 300px;
}

.chart-wrapper canvas {
  max-height: 100%;
}

/* まちがいノート */
#mistake-notebook {
  text-align: left;
  margin-top: 20px;
  max-width: 100%;
  overflow-x: hidden;
}

.mistake-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 15px;
  max-width: 100%;
}

.mistake-card {
  background-color: #fff9e6;
  border: 2px solid #ffcc00;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.mistake-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.mistake-question {
  font-size: 2em;
  font-weight: bold;
  color: #ff6600;
  text-align: center;
  margin-bottom: 10px;
}

.mistake-progress {
  font-size: 1.2em;
  text-align: center;
  margin: 10px 0;
}

.mistake-help {
  font-size: 0.9em;
  color: #666;
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

/* キャラクター育成 */
#character {
  text-align: center;
  margin: 20px 0;
  max-width: 100%;
  overflow-x: hidden;
}

.character-container {
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  overflow-x: hidden;
}

.character-emoji {
  font-size: 6em;
  margin: 10px 0;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.character-name {
  font-size: 2em;
  font-weight: bold;
  color: #2d3436;
  margin: 10px 0;
}

.character-xp {
  font-size: 1.2em;
  color: #636e72;
  margin: 5px 0;
}

.character-progress-bar {
  background-color: #dfe6e9;
  border-radius: 10px;
  height: 20px;
  margin: 15px 0;
  overflow: hidden;
}

.character-progress-fill {
  background: linear-gradient(90deg, #00b894 0%, #00cec9 100%);
  height: 100%;
  transition: width 0.5s ease;
}

.character-progress-text {
  font-size: 1em;
  color: #636e72;
  margin-top: 5px;
}

.character-max-level {
  font-size: 1.5em;
  color: #fdcb6e;
  font-weight: bold;
  margin-top: 10px;
}

/* レベルアップモーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
}

.levelup-content {
  background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
  color: white;
  text-align: center;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.5s;
  max-width: min(400px, 90vw);
}

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

.levelup-emoji {
  font-size: 8em;
  margin: 20px 0;
  animation: rotate 1s ease-in-out;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.levelup-name {
  font-size: 2.5em;
  font-weight: bold;
  margin: 10px 0;
}

.levelup-message {
  font-size: 1.3em;
  margin: 15px 0;
}

.modal-close-btn {
  background-color: white;
  color: #6c5ce7;
  border: none;
  padding: 15px 30px;
  font-size: 1.2em;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 20px;
  font-weight: bold;
  transition: transform 0.2s;
}

.modal-close-btn:hover {
  transform: scale(1.1);
}

/* ごほうびカレンダー */
#reward-calendar {
  text-align: center;
  margin-top: 20px;
  max-width: 100%;
  overflow-x: hidden;
  padding: 0;
}

.calendar-streak {
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 1.5em;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  word-wrap: break-word;
}

.streak-emoji {
  font-size: 1.5em;
  animation: flame 1s infinite;
}

@keyframes flame {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
}

.streak-number {
  font-size: 2em;
  color: #ffeb3b;
}

.calendar-header {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 15px;
  color: #2d3436;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 10px;
  max-width: 100%;
}

.calendar-weekday {
  font-weight: bold;
  padding: 8px 4px;
  background-color: #74b9ff;
  color: white;
  border-radius: 5px;
  font-size: 0.85em;
  min-width: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-width: 100%;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid #dfe6e9;
  border-radius: 5px;
  padding: 2px;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  min-width: 0;
  overflow: hidden;
}

.calendar-day-empty {
  border: none;
  background-color: transparent;
}

.calendar-day-number {
  font-size: 0.75em;
  font-weight: bold;
  color: #636e72;
  line-height: 1;
}

.calendar-day-studied {
  background: linear-gradient(135deg, #fdcb6e 0%, #ffeaa7 100%);
  border-color: #fdcb6e;
  transform: scale(1.05);
}

.calendar-day-studied .calendar-day-number {
  color: #2d3436;
}

.calendar-stamp {
  font-size: 1.5em;
  animation: popIn 0.5s ease;
  line-height: 1;
}

@keyframes popIn {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.calendar-day-today {
  border: 2px solid #0984e3;
  box-shadow: 0 0 8px rgba(9, 132, 227, 0.5);
}

.calendar-day:hover:not(.calendar-day-empty) {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* モバイル対応 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  #question {
    font-size: 3em;
  }

  .choice-btn {
    font-size: 2em;
    padding: 8px 12px;
  }

  .charts-container {
    grid-template-columns: 1fr;
  }

  .badge-modal-content,
  .levelup-content {
    padding: 20px;
  }

  .character-emoji {
    font-size: 4em;
  }

  .levelup-emoji {
    font-size: 5em;
  }

  h2 {
    font-size: 1.3em;
  }

  h3 {
    font-size: 1.1em;
  }

  .calendar-streak {
    font-size: 1.3em;
    padding: 12px;
  }

  .calendar-header {
    font-size: 1.2em;
  }

  .calendar-weekday {
    padding: 6px 2px;
    font-size: 0.75em;
  }

  .calendar-day {
    border-width: 1px;
    padding: 1px;
  }

  .calendar-day-number {
    font-size: 0.7em;
  }

  .calendar-stamp {
    font-size: 1.2em;
  }

  .mistake-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .badge-collection {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  #question {
    font-size: 2.5em;
  }

  .choice-btn {
    font-size: 1.8em;
    max-width: calc(50% - 5px);
  }

  .character-container {
    padding: 15px;
    border-radius: 10px;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .character-container {
    padding: 20px;
  }

  .character-emoji {
    font-size: 3.5em;
  }

  .calendar-streak {
    font-size: 1.1em;
    padding: 10px;
  }

  .calendar-header {
    font-size: 1em;
  }

  .calendar-weekdays {
    gap: 2px;
  }

  .calendar-weekday {
    padding: 5px 1px;
    font-size: 0.65em;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    border-width: 1px;
    padding: 1px;
    border-radius: 3px;
  }

  .calendar-day-number {
    font-size: 0.65em;
  }

  .calendar-stamp {
    font-size: 1em;
  }

  .streak-number {
    font-size: 1.5em;
  }

  .mistake-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .badge-collection {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .charts-container {
    grid-template-columns: 1fr;
  }
}

/* 超狭い画面（Pixel 7など）向け */
@media (max-width: 420px) {
  body {
    padding: 5px;
  }

  h2 {
    padding: 8px;
    font-size: 1.2em;
  }

  .character-container {
    padding: 10px;
    border-radius: 8px;
  }

  .character-emoji {
    font-size: 3em;
  }

  .calendar-streak {
    padding: 8px;
    font-size: 1em;
  }

  .mistake-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .badge-collection {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .mistake-card,
  .badge-card {
    padding: 8px;
  }
}

/* メニューボタン */
.menu-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1000;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.menu-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.menu-btn:active {
  transform: scale(0.95);
}

/* サイドメニュー */
.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease;
  z-index: 999;
  overflow-y: auto;
  padding: 20px 0;
}

.side-menu.open {
  left: 0;
}

.close-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: white;
  border: none;
  font-size: 32px;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.close-menu-btn:hover {
  transform: scale(1.2);
}

.menu-list {
  list-style: none;
  padding: 40px 0 0 0;
  margin: 0;
}

.menu-list li {
  margin: 0;
}

.menu-item {
  display: block;
  padding: 18px 25px;
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: white;
  padding-left: 30px;
}

.menu-item.active {
  background: rgba(255, 255, 255, 0.2);
  border-left-color: white;
  font-weight: 700;
}

/* ページコンテンツ */
.page-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* メニューオーバーレイ */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  display: none;
  transition: opacity 0.3s ease;
}

.menu-overlay.show {
  display: block;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .menu-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
    top: 10px;
    left: 10px;
  }

  .side-menu {
    width: 250px;
    left: -250px;
  }

  .menu-item {
    font-size: 16px;
    padding: 15px 20px;
  }
}

/* ========================================
   設定ページ - カード型レイアウト
   ======================================== */

/* 段ごとのカラーパレット（パステルカラー） */
:root {
  --color-dan-1: #ffebee;
  --color-dan-1-border: #ffcdd2;
  --color-dan-1-hover: #ef9a9a;

  --color-dan-2: #fff3e0;
  --color-dan-2-border: #ffe0b2;
  --color-dan-2-hover: #ffb74d;

  --color-dan-3: #fffde7;
  --color-dan-3-border: #fff9c4;
  --color-dan-3-hover: #fff176;

  --color-dan-4: #e8f5e9;
  --color-dan-4-border: #c8e6c9;
  --color-dan-4-hover: #81c784;

  --color-dan-5: #e3f2fd;
  --color-dan-5-border: #bbdefb;
  --color-dan-5-hover: #64b5f6;

  --color-dan-6: #f3e5f5;
  --color-dan-6-border: #e1bee7;
  --color-dan-6-hover: #ba68c8;

  --color-dan-7: #fce4ec;
  --color-dan-7-border: #f8bbd0;
  --color-dan-7-hover: #f06292;

  --color-dan-8: #e0f7fa;
  --color-dan-8-border: #b2ebf2;
  --color-dan-8-hover: #4dd0e1;

  --color-dan-9: #f1f8e9;
  --color-dan-9-border: #dcedc8;
  --color-dan-9-hover: #aed581;
}

.settings-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
  padding: 10px;
}

.setting-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.setting-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.setting-card-title {
  margin: 0 0 16px 0;
  font-size: 1.3em;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

.setting-card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* モード選択 */
.mode-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.mode-select:hover {
  border-color: #667eea;
}

.mode-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mode-description {
  margin: 0;
  padding: 10px;
  background: #f5f7fa;
  border-radius: 6px;
  font-size: 0.95em;
  color: #666;
  text-align: center;
}

/* 段選択グリッド */
.level-selection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.level-checkbox {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.level-checkbox:hover {
  background: #e8eaf6;
  border-color: #667eea;
}

/* 段ごとのカラーコーディング */
.level-checkbox[data-level="1"] {
  background: var(--color-dan-1);
  border-color: var(--color-dan-1-border);
}

.level-checkbox[data-level="1"]:hover {
  border-color: var(--color-dan-1-hover);
}

.level-checkbox[data-level="2"] {
  background: var(--color-dan-2);
  border-color: var(--color-dan-2-border);
}

.level-checkbox[data-level="2"]:hover {
  border-color: var(--color-dan-2-hover);
}

.level-checkbox[data-level="3"] {
  background: var(--color-dan-3);
  border-color: var(--color-dan-3-border);
}

.level-checkbox[data-level="3"]:hover {
  border-color: var(--color-dan-3-hover);
}

.level-checkbox[data-level="4"] {
  background: var(--color-dan-4);
  border-color: var(--color-dan-4-border);
}

.level-checkbox[data-level="4"]:hover {
  border-color: var(--color-dan-4-hover);
}

.level-checkbox[data-level="5"] {
  background: var(--color-dan-5);
  border-color: var(--color-dan-5-border);
}

.level-checkbox[data-level="5"]:hover {
  border-color: var(--color-dan-5-hover);
}

.level-checkbox[data-level="6"] {
  background: var(--color-dan-6);
  border-color: var(--color-dan-6-border);
}

.level-checkbox[data-level="6"]:hover {
  border-color: var(--color-dan-6-hover);
}

.level-checkbox[data-level="7"] {
  background: var(--color-dan-7);
  border-color: var(--color-dan-7-border);
}

.level-checkbox[data-level="7"]:hover {
  border-color: var(--color-dan-7-hover);
}

.level-checkbox[data-level="8"] {
  background: var(--color-dan-8);
  border-color: var(--color-dan-8-border);
}

.level-checkbox[data-level="8"]:hover {
  border-color: var(--color-dan-8-hover);
}

.level-checkbox[data-level="9"] {
  background: var(--color-dan-9);
  border-color: var(--color-dan-9-border);
}

.level-checkbox[data-level="9"]:hover {
  border-color: var(--color-dan-9-hover);
}

.level-checkbox input[type="checkbox"] {
  margin: 0 8px 0 0;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.level-checkbox input[type="checkbox"]:checked + span {
  font-weight: 700;
  color: #667eea;
}

.level-checkbox input[type="checkbox"]:checked {
  accent-color: #667eea;
}

.level-checkbox span {
  font-size: 1.05em;
  transition: color 0.2s ease;
}

/* 問題数入力 */
.question-count-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.3em;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.question-count-input:hover {
  border-color: #667eea;
}

.question-count-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting-hint {
  margin: 0;
  font-size: 0.9em;
  color: #888;
  text-align: center;
}

/* レスポンシブ対応 - 設定ページ */
@media (max-width: 768px) {
  .settings-container {
    padding: 5px;
    gap: 15px;
  }

  .setting-card {
    padding: 16px;
  }

  .setting-card-title {
    font-size: 1.2em;
  }

  .level-selection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .level-checkbox {
    padding: 10px 8px;
  }

  .level-checkbox span {
    font-size: 1em;
  }
}

@media (max-width: 480px) {
  .level-selection-grid {
    grid-template-columns: 1fr;
  }
}
