* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

header {
  background: linear-gradient(135deg, #111827, #1e3a8a);
  color: white;
  text-align: center;
  padding: 32px 16px;
}

header h1 {
  margin: 0 0 10px;
  font-size: 32px;
}

header p {
  margin: 0;
  color: #dbeafe;
}

#quizList {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

#quizList a {
  display: inline-block;
  text-decoration: none;
  color: #111827;
  background: #e5e7eb;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: bold;
}

#quizList a.active {
  background: #2563eb;
  color: white;
}

main {
  max-width: 1120px;
  margin: 28px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.quiz-box {
  background: white;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  min-width: 0;
}

.status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: bold;
  margin-bottom: 14px;
}

.progress {
  height: 12px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: #22c55e;
  transition: width 0.3s;
}

#question {
  font-size: 25px;
  line-height: 1.6;
  margin: 0 0 24px;
  word-break: break-word;
}

#choices {
  display: grid;
  gap: 14px;
}

#choices button {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  background: #f1f5f9;
  color: #111827;
  text-align: left;
  line-height: 1.5;
  white-space: normal;
}

#choices button:hover {
  background: #dbeafe;
}

#choices button:disabled {
  cursor: default;
}

.correct {
  background: #86efac !important;
}

.wrong {
  background: #fca5a5 !important;
}

#result {
  margin-top: 20px;
  font-size: 18px;
  font-weight: bold;
  line-height: 1.6;
}

.finish {
  text-align: center;
  padding: 20px;
}

.finish p {
  font-size: 24px;
  font-weight: bold;
}

.finish button,
.home-btn {
  display: inline-block;
  margin: 10px;
  padding: 14px 22px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

.home-btn {
  background: #111827;
}

.ad-box {
  background: white;
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  min-height: 250px;
  overflow: hidden;
}

.ad-box p {
  margin-top: 0;
  color: #6b7280;
  font-size: 13px;
}

@media (max-width: 800px) {
  header {
    padding: 26px 14px;
  }

  header h1 {
    font-size: 26px;
  }

  #quizList {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 12px;
  }

  #quizList a {
    white-space: nowrap;
    font-size: 13px;
    padding: 9px 12px;
  }

  main {
    display: block;
    margin: 18px auto;
    padding: 0 12px;
  }

  .quiz-box {
    padding: 20px;
    border-radius: 16px;
  }

  #question {
    font-size: 21px;
  }

  #choices button {
    font-size: 16px;
    padding: 14px;
  }

  .ad-box {
    margin-top: 20px;
  }
}
