* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: #f8f9fa;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: #333;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background-color: #fff;
  color: #333;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon {
  width: 32px;
  height: 32px;
  background-color: #4a5cc4;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.app-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-title-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.app-title-text p {
  margin: 0;
  font-size: 13px;
  color: #999;
}

.main-content {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.progress-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 16px;
  align-items: center;
}

.progress-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(#4a5cc4 0% 7%, #e0e0e0 7% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  color: #4a5cc4;
  flex-shrink: 0;
  position: relative;
}

.progress-circle::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  background-color: #fff;
  border-radius: 50%;
}

.progress-text {
  position: relative;
  z-index: 1;
}

.progress-info {
  flex: 1;
}

.progress-title {
  font-size: 16px;
  font-weight: 600;
  color: #4a5cc4;
  margin-bottom: 8px;
}

.progress-counter {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: #4a5cc4;
  width: 7%;
  transition: width 0.3s ease;
}

.category-filter-container {
  background-color: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.category-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-icon {
  width: 20px;
  height: 20px;
  color: #999;
  flex-shrink: 0;
}

#category-filter {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background-color: #f5f5f5;
  color: #333;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

#card-container {
  perspective: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.card {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 16 / 10;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.card.flip {
  transform: rotateY(180deg);
}

.card-side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border: 3px solid #4a5cc4;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-color: #fff;
  color: #333;
}

.card-front {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
}

.card-back {
  transform: rotateY(180deg);
  font-size: 16px;
  flex-direction: column;
  text-align: left;
  overflow-y: auto;
  padding: 24px;
}

.card-tap-hint {
  text-align: center;
  font-size: 14px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tap-icon {
  width: 18px;
  height: 18px;
}

.card-info {
  background-color: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.card-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-info-icon {
  width: 20px;
  height: 20px;
  color: #4a5cc4;
}

.card-info-label {
  font-size: 13px;
  color: #999;
  text-transform: uppercase;
}

.card-info-value {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  flex-wrap: wrap;
}

button {
  flex: 1;
  min-width: 100px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid #4a5cc4;
  border-radius: 8px;
  background-color: #fff;
  color: #4a5cc4;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  background-color: #f0f2ff;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  border-color: #d0d0d0;
  color: #d0d0d0;
  cursor: not-allowed;
}

#shuffle-btn {
  background-color: #4a5cc4;
  color: #fff;
  border-color: #4a5cc4;
}

#shuffle-btn:hover:not(:disabled) {
  background-color: #3d4ba8;
}

.tip-section {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 500px;
}

.tip-icon {
  width: 16px;
  height: 16px;
  color: #4a5cc4;
  flex-shrink: 0;
}

.audio-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 500px;
  flex-wrap: wrap;
  justify-content: center;
}

.audio-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid #4a5cc4;
  border-radius: 8px;
  background-color: #fff;
  color: #4a5cc4;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  justify-content: center;
}

.audio-btn:hover:not(:disabled) {
  background-color: #f0f2ff;
}

.audio-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.audio-btn:disabled {
  border-color: #d0d0d0;
  color: #d0d0d0;
  cursor: not-allowed;
}

.audio-btn.playing {
  background-color: #4a5cc4;
  color: #fff;
}

.speed-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
  padding: 12px;
  background-color: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: #666;
}

.speed-control label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
}

.speed-control input[type="radio"] {
  cursor: pointer;
}

footer {
  width: 100%;
  padding: 24px 20px;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  background-color: #fff;
  margin-top: auto;
}

footer a {
  color: #4a5cc4;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

footer a:hover {
  color: #3d4ba8;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .app-title-text h1 {
    font-size: 16px;
  }

  .app-title-text p {
    font-size: 12px;
  }

  .main-content {
    padding: 16px;
    gap: 16px;
  }

  .progress-card {
    flex-direction: row;
    text-align: center;
  }

  .progress-info {
    width: 100%;
  }

  .card {
    max-width: 90vw;
  }

  .card-info {
    max-width: 90vw;
  }

  .controls {
    max-width: 90vw;
  }

  .tip-section {
    max-width: 90vw;
  }

  .card-side {
    padding: 16px;
  }

  .card-front {
    font-size: 2rem;
  }
}
