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

:root {
  --primary: #4a90d9;
  --primary-dark: #3a7bc8;
  --secondary: #f0f4f8;
  --text: #2d3748;
  --text-light: #718096;
  --success: #48bb78;
  --white: #ffffff;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-lg: 20px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  padding: 30px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 8px;
}

header .subtitle {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: normal;
}

.progress {
  font-size: 1rem;
  color: var(--text-light);
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--secondary);
  color: var(--text-light);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tab:hover {
  background: #e2e8f0;
}

.tab.active {
  background: var(--primary);
  color: var(--white);
}

#current-num {
  color: var(--primary);
  font-weight: bold;
}

.category-badge {
  display: inline-block;
  background: var(--secondary);
  color: var(--text-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  text-transform: capitalize;
  margin-bottom: 20px;
}

.phrase-display {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.japanese-text {
  font-size: 2.5rem;
  color: var(--text);
  text-align: center;
  line-height: 2;
}

/* Character mode - large single character display */
.japanese-text.character-mode {
  font-size: 8rem;
  line-height: 1.2;
}

.phrase-display.character-mode {
  min-height: 140px;
}

/* Ruby (furigana) styling */
.japanese-text ruby {
  ruby-position: over;
}

.japanese-text rt {
  font-size: 0.45em;
  color: var(--primary);
}

.reveal-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  min-height: 100px;
}

.panel {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: none;
}

.panel.visible {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

#furigana-content {
  font-size: 1.8rem;
  color: var(--text);
  line-height: 1.8;
}

#furigana-content ruby rt {
  font-size: 0.45em;
  color: var(--primary);
}

#english-content {
  font-size: 1.3rem;
  color: var(--text);
}

#romaji-content {
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 500;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.btn {
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: scale(1.05);
}

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

.btn-play {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-play svg {
  width: 36px;
  height: 36px;
}

.btn-play:hover {
  background: var(--primary-dark);
}

.btn-play.playing {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(74, 144, 217, 0); }
}

.btn-reveal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: bold;
  box-shadow: var(--shadow);
}

.btn-reveal:hover {
  background: #e2e8f0;
}

.btn-reveal.active {
  background: var(--success);
  color: var(--white);
}

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

.btn-nav {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--text);
  box-shadow: var(--shadow);
}

.btn-nav svg {
  width: 28px;
  height: 28px;
}

.btn-nav:hover {
  background: #e2e8f0;
}

.btn-nav.btn-next {
  background: var(--primary);
  color: var(--white);
}

.btn-nav.btn-next:hover {
  background: var(--primary-dark);
}

.btn-nav#btn-shuffle.active {
  background: var(--success);
  color: var(--white);
}

footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 400px) {
  .container {
    padding: 20px;
  }

  .japanese-text {
    font-size: 2rem;
  }

  .japanese-text.character-mode {
    font-size: 6rem;
  }

  #furigana-content {
    font-size: 1.5rem;
  }

  .btn-play {
    width: 60px;
    height: 60px;
  }

  .btn-play svg {
    width: 30px;
    height: 30px;
  }

  .btn-reveal {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .tabs {
    gap: 0.3rem;
  }

  .tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Start Screen */
.start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.start-content {
  text-align: center;
  color: var(--white);
}

.start-content h1 {
  font-size: 4rem;
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.start-content p {
  font-size: 1.2rem;
  margin-bottom: 40px;
  opacity: 0.9;
}

.btn-start {
  background: var(--white);
  color: var(--text);
  padding: 20px 50px;
  border-radius: var(--radius-lg);
  font-size: 1.8rem;
  font-weight: bold;
  box-shadow: var(--shadow-lg);
  line-height: 1.4;
}

.btn-start span {
  font-size: 1rem;
  font-weight: normal;
  color: var(--text-light);
}

.btn-start:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* Listen Prompt */
.listen-prompt {
  font-size: 1.5rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.6;
}

.listen-prompt span {
  font-size: 1rem;
  display: block;
  margin-top: 4px;
}
