:root {
  --bg: #ffffff;
  --panel: #f9f9f9;
  --text: #222222;
  --muted: #666666;
  --primary: #4da3ff;
  --accent: #002afe;
  --ok: #3070d1;
  --ng: #ff453a;
  --warn: #ffcc00;

  --radius: 16px;
  --shadow: 0 6px 20px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Helvetica Neue", Arial, sans-serif;
  background: #ffffff;
  color: var(--text);
  line-height: 1.6;
}

.app-header, .app-footer {
  padding: 14px 16px;
  text-align: center;
}
.app-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: .5px;
}
.app-footer small {
  color: var(--muted);
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 56px;
  padding: 0 14px 24px;
}

.control {
  background: var(--panel);
  padding: 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid #ddd;
  outline: none;
}
.input::placeholder { color: #97a3b6; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(77,163,255,0.25); }

.btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 12px;
  margin-top: 10px;
  font-weight: 600;
  letter-spacing: .2px;
}
.btn-primary {
  background: linear-gradient(180deg, #5cb6ff, #428dff);
  color: #061327;
}
.btn-primary:active { transform: translateY(1px); }

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.status {
  min-height: 20px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
}
.status.loading::after {
  content: " …";
  animation: dots 1.2s infinite steps(3, end);
}
@keyframes dots {
  0% { content: " ."; }
  33% { content: " .."; }
  66% { content: " ..."; }
}

.quiz-list { display: grid; gap: 12px; }
.quiz-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.question {
  margin: 0 0 8px 0;
  font-size: 16px;
  line-height: 1.5;
}

.choices {
  display: grid;
  gap: 8px;
}
.choice {
  display: grid;
  grid-template-columns: 20px 36px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ddd;
}
.choice:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(77,163,255,0.2) inset;
}
.choice input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
}
.choice-key {
  font-weight: 700;
  color: var(--primary);
}
.choice-text {
  font-size: 14px;
}

.btn-answer {
  margin-top: 10px;
  background: linear-gradient(180deg, #5cb6ff, #428dff);
  color: #fff;
  border: 1px solid #ccc;
}
.btn-answer:active { transform: translateY(1px); }

.feedback {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
}
.feedback.ok { background: rgba(48,209,88,0.15); color: var(--ok); }
.feedback.ng { background: rgba(255,69,58,0.15); color: var(--ng); }
.feedback.warn { background: rgba(255,204,0,0.15); color: var(--warn); }

.explanation {
  margin-top: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 480px) {
  .app-title { font-size: 20px; }
  .question { font-size: 17px; }
}

:root { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", sans-serif; background:#ffffff; color:#222222; }
.app-header, .app-footer { padding: 12px 14px; }
.app-title { font-size: 18px; margin: 0; }
.container { padding: 12px 14px 24px; max-width: 720px; margin: 0 auto; }
.control { display: grid; gap: 8px; }
.label { font-size: 14px; opacity: .9; }
.input { height: 44px; border-radius: 12px; border: 1px solid #ddd; background:#ffffff; color:#222222; padding: 0 12px; }
.btn { height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background:#162038; color:#e7ecf3; }
.btn-primary { background:#1b2338; }
.status.loading::after { content: " …"; opacity: .7; }
.quiz-list { display: grid; gap: 12px; margin-top: 12px; }

.quiz-card { background:#ffffff; border:1px solid #e5e5e5; border-radius:16px; padding:12px; }
.question { font-size: 16px; margin:0 0 8px; }
.choices { display:grid; gap:8px; }
.choice { display:grid; grid-template-columns: 22px 28px 1fr; align-items: center; gap: 8px; background:#ffffff; border:1px solid #ddd; border-radius:12px; padding:10px; }
.choice input[type=radio]{ width:18px; height:18px; accent-color:#4da3ff; }
.choice-key { font-weight:700; color:#4da3ff; }
.btn-answer { margin-top:4px; }
.feedback, .explanation { margin-top:8px; padding:10px; border-radius:10px; }
.feedback.ok { background: rgba(48,209,88,.15); color:#30d158; }
.feedback.ng { background: rgba(255,69,58,.15); color:#ff453a; }
.feedback.warn { background: rgba(255,204,0,.15); color:#ffcc00; }

.quiz-list .ai-quiz .aiq-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.quiz-list .ai-quiz .aiq-choice {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}

.quiz-list .ai-quiz .aiq-choice input[type="radio"] {
  margin-right: 8px !important;
}

.quiz-list .ai-quiz .aiq-answer {
  order: 999 !important;
  width: 100% !important;
  height: 44px !important;
  background: linear-gradient(180deg, #5cb6ff, #428dff) !important;
  color: #fff !important;
  border: 1px solid #ccc !important;
}

.quiz-list .ai-quiz .aiq-feedback {
  order: 1000 !important;
}

.quiz-list .ai-quiz .aiq-explanation {
  order: 1001 !important;
}

.aiq-controls {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.aiq-regenerate {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
}