:root {
  --primary-color: #4a86e8;
  --primary-dark: #3a76d8;
  --primary-light: #e8f0fe;
  --incorrect-color: #e74c3c;
  --correct-color: #2ecc71;
  --background-color: #f5f7fa;
  --card-color: #ffffff;
  --text-color: #333333;
  --text-secondary: #666666;
  --hint-color: #f39c12;
  --border-color: #e0e0e0;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 20px;
  transition: background-color 0.3s ease;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.settings {
  background-color: var(--card-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.settings h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.alphabet-selection {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 1rem;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.checkbox-group > input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-group > label {
  display: inline-flex;
  align-items: center;
  font-weight: bold;
  cursor: pointer;
}

.checkbox-group > label::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.2s ease;
  background-color: var(--card-color);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.checkbox-group > input:checked + label::before {
  content: '✓';
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  line-height: 1;
  box-shadow: none;
}

/* Removed sub-option styles as they are no longer needed */


.tooltip {
  cursor: help;
  color: var(--primary-color);
  margin-left: 5px;
  font-size: 14px;
}

.general-settings {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  margin-bottom: 1rem;
}

.general-settings h3 {
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
}

.general-settings .setting-group {
  margin-top: 1rem;
  margin-bottom: 1rem;
  max-width: 300px;
}

.kanji-themes {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  display: none;
}

.kanji-themes.visible {
  display: block;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.theme-checkbox {
  display: flex;
  align-items: center;
}

.flashcard-container {
  background-color: var(--card-color);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.kana-display {
  font-size: 8rem;
  margin-bottom: 1.5rem;
  min-height: 200px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow-wrap: break-word;
  word-break: keep-all;
  max-width: 100%;
}

.kana-display:empty:before {
  content: '?';
  color: var(--border-color);
  opacity: 0.5;
}

.meaning-display {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  min-height: 30px;
  font-style: italic;
  color: #666;
}

.first-time-hint {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  padding: 12px 16px;
  background-color: var(--hint-color);
  color: white;
  border-radius: 8px;
  font-weight: bold;
  display: none;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
  animation: fadeIn 0.5s ease;
}

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

.input-container {
  position: relative;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 10px;
}

.romaji-input {
  flex: 1;
  padding: 14px;
  font-size: 1.3rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.submit-button {
  padding: 12px 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  align-self: stretch;
}

.submit-button:hover {
  background-color: #3a76d8;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.romaji-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 134, 232, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.romaji-input.correct {
  border-color: var(--correct-color);
  background-color: rgba(46, 204, 113, 0.1);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
  animation: correctPulse 0.6s ease;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.romaji-input.incorrect {
  border-color: var(--incorrect-color);
  background-color: rgba(231, 76, 60, 0.1);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.feedback {
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  min-height: 30px;
}

.correct-feedback {
  color: var(--correct-color);
}

.incorrect-feedback {
  color: var(--incorrect-color);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 20px;
}

button {
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.stats {
  background-color: var(--card-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.stats h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
}

.stat-item {
  padding: 15px;
  text-align: center;
  background-color: var(--primary-light);
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.9rem;
  color: #777;
}

/* Debug Section */
.debug-section {
  background-color: var(--card-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.debug-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.debug-content {
  display: none;
}

.debug-content.visible {
  display: block;
}

.debug-settings {
  margin-bottom: 2rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.setting-group {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #eee;
}

.setting-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: bold;
}

.setting-group input,
.setting-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 0.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setting-group input:focus,
.setting-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 134, 232, 0.2);
}

.setting-select {
  background-color: white;
  font-size: 1rem;
  cursor: pointer;
  appearance: menulist;
}

.setting-description {
  font-size: 0.85rem;
  color: #777;
  margin-top: 0.25rem;
}

.debug-stats {
  margin-top: 1rem;
}

.stats-item {
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.debug-stats .stat-label {
  width: 200px;
  text-align: left;
  margin-right: 1rem;
  font-size: 0.9rem;
}

.debug-stats .stat-value {
  font-size: 1.2rem;
}

.progress-bar-container {
  width: 200px;
  height: 10px;
  background-color: #f0f0f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.5s ease;
  background-image: linear-gradient(to right, var(--primary-color), #6aa2f8);
  box-shadow: 0 0 5px rgba(74, 134, 232, 0.3);
}

#save-settings, #reset-settings {
  margin-right: 10px;
  margin-top: 1rem;
}

.action-button {
  background-color: var(--correct-color);
  margin-top: 0.5rem;
  width: 100%;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 6px rgba(46, 204, 113, 0.3);
}

.action-button:hover {
  background-color: #27ae60;
  box-shadow: 0 4px 8px rgba(46, 204, 113, 0.4);
}

.danger-button {
  background-color: var(--incorrect-color);
  color: white;
  margin-top: 1.5rem;
  padding: 12px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(231, 76, 60, 0.3);
  transition: all 0.2s ease;
}

.danger-button:hover {
  background-color: #c0392b;
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);
}

.debug-button {
  background-color: var(--hint-color);
  color: white;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding: 12px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(243, 156, 18, 0.3);
  transition: all 0.2s ease;
}

.debug-button:hover {
  background-color: #d35400;
  box-shadow: 0 4px 8px rgba(243, 156, 18, 0.4);
}

.debug-output {
  margin-top: 1rem;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.4;
}

/* Media Queries */
@media (max-width: 768px) {
  .kana-display {
    font-size: 6rem;
    min-height: 150px;
  }
  
  .flashcard-container {
    padding: 20px;
  }
  
  .controls {
    flex-direction: column;
  }
  
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .debug-stats .stat-label {
    width: 100%;
    margin-bottom: 0.25rem;
  }
  
  .progress-bar-container {
    width: 100%;
    margin: 0.5rem 0;
  }
}