/* styles.css */
* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #d9dce5;
  --text: #222;
  --sub: #666;
  --primary: #2563eb;
  --secondary: #6b7280;
  --danger: #dc2626;
  --good: #15803d;
  --bad: #b91c1c;
  --soft-blue: #eef3ff;
  --soft-gray: #f8fafc;
  --soft-warn: #fff7ed;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

.container {
  width: min(100% - 32px, 980px);
  margin: 32px auto 48px;
}

.app-header {
  margin-bottom: 24px;
}

.app-header h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.app-header p {
  margin: 0;
  color: var(--sub);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

input[type="text"],
select {
  width: 100%;
  border: 1px solid #c7ccd8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  background: #fff;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}

button:hover {
  opacity: 0.92;
}

button.secondary {
  background: var(--secondary);
}

button.danger {
  background: var(--danger);
}

button.choice-btn {
  width: 100%;
  text-align: left;
  background: var(--soft-gray);
  color: var(--text);
  border: 1px solid #d5dbe7;
}

button.choice-btn:hover {
  background: var(--soft-blue);
}

button.choice-btn.correct {
  background: #ecfdf5;
  border-color: #86efac;
}

button.choice-btn.incorrect {
  background: #fef2f2;
  border-color: #fca5a5;
}

.meta {
  font-size: 14px;
  color: var(--sub);
  margin-bottom: 8px;
}

.question-title {
  font-size: 22px;
  margin: 0 0 12px;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.small {
  font-size: 14px;
  color: var(--sub);
}

.good {
  color: var(--good);
  font-weight: 700;
}

.bad {
  color: var(--bad);
  font-weight: 700;
}

.result-score {
  font-size: 24px;
  font-weight: 700;
  margin: 10px 0;
}

.review-item {
  border-top: 1px solid #e5e7eb;
  padding: 16px 0;
}

.review-item:first-child {
  border-top: none;
  padding-top: 0;
}

.badge {
  display: inline-block;
  background: #eef2ff;
  color: #374151;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  margin-left: 8px;
}

.notice {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--soft-warn);
  border: 1px solid #fed7aa;
  color: #9a3412;
  margin-bottom: 16px;
}

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.feedback.correct {
  background: #ecfdf5;
  border-color: #86efac;
}

.feedback.incorrect {
  background: #fef2f2;
  border-color: #fca5a5;
}

.quiz-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid #d7dbe4;
  padding: 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #f3f4f6;
}

.code-inline {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: Consolas, Monaco, monospace;
  font-size: 0.95em;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.unit-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.weak-list {
  margin: 0;
  padding-left: 18px;
}

.progress-card {
  min-height: 120px;
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 20px, 980px);
    margin-top: 20px;
  }

  .card {
    padding: 18px;
    border-radius: 14px;
  }

  .app-header h1 {
    font-size: 26px;
  }

  button {
    width: 100%;
  }
}