/* =====================================================
   将棋クイズ - Google Forms インスパイアデザイン
   ===================================================== */

:root {
  --primary: #673ab7;
  --primary-hover: #7b4fc4;
  --bg: #f0ebf8;
  --card-bg: #ffffff;
  --text: #202124;
  --text-sub: #5f6368;
  --border: #dadce0;
  --correct: #137333;
  --correct-bg: #e6f4ea;
  --incorrect: #c5221f;
  --incorrect-bg: #fce8e6;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
}

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

body {
  background: var(--bg);
  font-family: 'Noto Sans JP', 'Segoe UI', sans-serif;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ── ヘッダー ─────────────────────────────────── */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header h1 { font-size: 18px; font-weight: 500; }
.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  transition: background .2s;
}
.header-nav a:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── レイアウト ───────────────────────────────── */
.container { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }

/* ── カード ───────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 12px;
}
.card-accent { border-top: 8px solid var(--primary); }
.card h2 { font-size: 22px; font-weight: 400; margin-bottom: 8px; }
.card .desc { color: var(--text-sub); font-size: 14px; }

/* ── 問題カード ───────────────────────────────── */
.question-card { transition: box-shadow .2s; }
.question-card.unanswered { box-shadow: 0 0 0 2px var(--incorrect); }
.q-number { font-size: 12px; color: var(--text-sub); font-weight: 500; margin-bottom: 10px; }
.q-prompt { font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.q-image { text-align: center; margin: 16px 0; }
.q-image img {
  max-width: 100%;
  max-height: 460px;
  border-radius: 4px;
  border: 1px solid var(--border);
  object-fit: contain;
}
.unanswered-msg {
  color: var(--incorrect);
  font-size: 12px;
  margin-top: 8px;
  display: none;
}
.question-card.unanswered .unanswered-msg { display: block; }

/* ── ラジオボタン ─────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  user-select: none;
}
.radio-option:hover { background: var(--bg); border-color: var(--primary); }
.radio-option:has(input:checked) { background: #ede7f6; border-color: var(--primary); }
.radio-option input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.radio-option .opt-text { font-size: 15px; }
.radio-option:has(input:checked) .opt-text { color: var(--primary); font-weight: 500; }

/* ── ボタン ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 4px; border: none;
  font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: all .2s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: rgba(103,58,183,.08); }
.btn-danger { background: var(--incorrect); color: #fff; }
.btn-danger:hover { background: #a31818; }
.btn-ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f5f5f5; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 12px 32px; font-size: 16px; border-radius: 6px; }

/* ── フォーム ─────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-sub); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 14px; transition: border-color .2s; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(103,58,183,.2); }
.form-control::placeholder { color: #bbb; }
textarea.form-control { min-height: 90px; resize: vertical; }

/* ファイルドロップ */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 32px 24px; border: 2px dashed var(--border); border-radius: 8px;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
  color: var(--text-sub);
}
.file-drop:hover { border-color: var(--primary); background: var(--bg); color: var(--primary); }
.file-drop input[type="file"] { display: none; }
.file-drop .drop-icon { font-size: 32px; }
.file-drop .drop-text { font-size: 14px; }
.file-drop .drop-hint { font-size: 12px; color: var(--text-sub); }

.img-preview { text-align: center; margin-top: 12px; }
.img-preview img { max-width: 100%; max-height: 280px; border-radius: 4px; border: 1px solid var(--border); }

/* ── アラート ─────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--incorrect-bg); color: var(--incorrect); border: 1px solid #f5c6c5; }
.alert-success { background: var(--correct-bg); color: var(--correct); border: 1px solid #b7dfc3; }

/* ── バッジ ───────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-pub { background: var(--correct-bg); color: var(--correct); }
.badge-draft { background: #f1f3f4; color: var(--text-sub); }

/* ── 進捗バー ─────────────────────────────────── */
.progress-bar {
  height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
  margin: 12px 0;
}
.progress-fill {
  height: 100%; background: var(--primary); border-radius: 2px;
  transition: width .4s ease;
}
.progress-label { font-size: 12px; color: var(--text-sub); text-align: right; margin-top: 4px; }

/* ── クイズ一覧 ───────────────────────────────── */
.quiz-grid { display: grid; gap: 14px; }
.quiz-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px;
  border-left: 4px solid var(--primary);
  transition: box-shadow .2s, transform .2s;
}
.quiz-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.quiz-card h3 { font-size: 18px; font-weight: 500; margin-bottom: 6px; }
.quiz-card .meta { font-size: 13px; color: var(--text-sub); }

/* ── 管理ダッシュボード ──────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 500; }
.admin-quiz-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px 20px;
  margin-bottom: 10px; transition: box-shadow .2s;
}
.admin-quiz-row:hover { box-shadow: var(--shadow); }
.admin-quiz-row .info h3 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.admin-quiz-row .info .meta { font-size: 12px; color: var(--text-sub); display: flex; gap: 12px; }
.admin-quiz-row .actions { display: flex; gap: 6px; align-items: center; }

/* ── 問題リスト（管理） ──────────────────────── */
.q-list { list-style: none; }
.q-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 12px 16px;
  margin-bottom: 8px;
}
.q-item .thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0; }
.q-item .qinfo { flex: 1; }
.q-item .qinfo .qno { font-size: 12px; color: var(--text-sub); }
.q-item .qinfo .qans { font-size: 14px; font-weight: 500; margin-top: 2px; }
.ans-tsumi { color: var(--incorrect); }
.ans-futsumi { color: var(--correct); }
.q-item .q-actions { display: flex; gap: 6px; }

/* ── ログイン ─────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg); padding: 24px;
}
.login-card { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); padding: 40px; width: 100%; max-width: 400px; }
.login-card .login-head { text-align: center; margin-bottom: 32px; }
.login-card .login-head h1 { font-size: 22px; font-weight: 400; margin-top: 8px; }

/* ── 結果ページ ───────────────────────────────── */
.score-wrap { text-align: center; padding: 32px 24px; }
.score-num { font-size: 72px; font-weight: 300; color: var(--primary); line-height: 1; }
.score-denom { font-size: 28px; font-weight: 300; color: var(--text-sub); }
.score-sub { font-size: 16px; color: var(--text-sub); margin-top: 8px; }

.result-list { list-style: none; }
.result-item {
  display: flex; gap: 14px; padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.result-item:last-child { border-bottom: none; }
.result-icon { font-size: 22px; width: 28px; flex-shrink: 0; text-align: center; }
.result-correct .result-icon { color: var(--correct); }
.result-incorrect .result-icon { color: var(--incorrect); }
.r-thumb { width: 80px; height: 80px; object-fit: contain; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0; }
.r-info { flex: 1; }
.r-no { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.r-answers { font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.r-answers .label { color: var(--text-sub); }
.r-expl { margin-top: 8px; font-size: 13px; color: var(--text-sub); background: var(--bg); padding: 8px 12px; border-radius: 4px; border-left: 3px solid var(--primary); }

/* ── 空状態 ───────────────────────────────────── */
.empty { text-align: center; padding: 48px 24px; color: var(--text-sub); }
.empty p { font-size: 16px; margin-bottom: 20px; }

/* ── ユーティリティ ───────────────────────────── */
.flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-sub { color: var(--text-sub); }
.font-sm { font-size: 13px; }
