.quiz-page {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  min-height: 100vh;
  margin: 0;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.quiz-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.quiz-header .back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.quiz-header .back-link:hover {
  text-decoration: underline;
}

.quiz-header .spacer {
  width: 120px;
}

.quiz-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.quiz-intro {
  text-align: center;
  margin-bottom: 36px;
}

.quiz-intro h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.quiz-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.quiz-card {
  display: flex;
  align-items: stretch;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.quiz-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0) 0%, rgba(99, 102, 241, 0.06) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.quiz-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.15);
  border-color: var(--primary);
}

.quiz-card:hover::before {
  opacity: 1;
}

.quiz-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.quiz-body h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.quiz-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.quiz-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.quiz-cta {
  align-self: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  transition: background 0.15s ease, color 0.15s ease;
}

.quiz-card:hover .quiz-cta {
  background: var(--primary);
  color: #fff;
}

.quiz-footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 32px;
}

@media (max-width: 520px) {
  .quiz-header .spacer { display: none; }
  .quiz-intro h2 { font-size: 22px; }
  .quiz-card { padding: 16px; gap: 12px; }
  .quiz-num { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
  .quiz-cta { padding: 4px 8px; font-size: 12px; }
}

/* ----- 플레이어 ----- */
.quiz-player-desc {
  text-align: center;
  color: var(--muted);
  margin: 0 0 24px;
  white-space: pre-wrap;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-section {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #c7d2fe;
}
.quiz-section h2 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #4338ca;
}
.quiz-section p {
  margin: 0;
  color: #4f46e5;
  font-size: 14px;
}

.q-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.q-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.q-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.q-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: keep-all;
}

.q-desc {
  margin: -8px 0 16px 46px;
  color: var(--muted);
  font-size: 13px;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 46px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.opt:hover {
  background: #f9fafb;
  border-color: #c7d2fe;
}

.opt input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.opt:has(input:checked) {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--primary);
}

.opt-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.55;
  word-break: keep-all;
}

.opt.opt-correct-mark {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.06);
}

.q-grid {
  margin-left: 46px;
  border-collapse: collapse;
  width: calc(100% - 46px);
  font-size: 14px;
}

.q-grid th,
.q-grid td {
  border: 1px solid var(--border);
  padding: 10px 8px;
  text-align: center;
}

.q-grid thead th {
  background: var(--header-bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

.q-grid tbody th {
  background: var(--header-bg);
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.grid-cell {
  display: inline-flex;
  cursor: pointer;
}

.grid-cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.q-text-input {
  width: calc(100% - 46px);
  margin-left: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
}

textarea.q-text-input {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  resize: vertical;
  min-height: 70px;
  white-space: pre;
  line-height: 1.5;
}

.text-answer-editor {
  margin-left: 46px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.text-answer-editor .answer-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.text-answer-editor .answer-variant {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.text-answer-editor .answer-variant textarea {
  flex: 1;
  margin-left: 0;
  width: auto;
}
.text-answer-editor .danger-link {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 10px;
}

.q-text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.q-feedback {
  margin: 14px 0 0 46px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.q-feedback.ok { background: rgba(16, 185, 129, 0.1); color: #047857; }
.q-feedback.ng { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }

.quiz-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.06);
}

.result-summary {
  text-align: center;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 1px solid #c7d2fe;
  border-radius: 16px;
  padding: 20px 24px;
  width: 100%;
  max-width: 480px;
}

.result-summary p {
  margin: 4px 0;
  font-size: 15px;
  color: #312e81;
}

.result-summary .score {
  font-size: 22px;
  font-weight: 700;
  color: #4338ca;
}

.result-summary .score-na {
  font-size: 13px;
  color: var(--muted);
}

.error {
  text-align: center;
  color: var(--danger);
  padding: 40px 20px;
}

/* ----- 인증 영역 ----- */
.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  justify-content: flex-end;
}

.auth-area .warn {
  color: var(--danger);
  font-size: 12px;
}

.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.auth-user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.auth-name {
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-link:hover { color: var(--danger); text-decoration: underline; }

.quiz-meta-line {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0;
}

.login-hint {
  margin-top: 24px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: 12px;
  border: 1px solid #c7d2fe;
  color: #4338ca;
}

/* ----- 결과 화면 ----- */
.submitted-at {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 12px;
}

.detail-list {
  margin-top: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
}

.detail-list h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.detail-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--header-bg);
  font-size: 14px;
}

.detail-item .status {
  flex-shrink: 0;
  display: inline-block;
  width: 64px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.detail-item.ok .status { background: rgba(16, 185, 129, 0.15); color: #047857; }
.detail-item.ng .status { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.detail-item.na .status { background: rgba(107, 114, 128, 0.15); color: var(--muted); }

.detail-item .qtitle {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- 관리자 테이블 ----- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  text-align: left;
}
.admin-table thead th {
  background: var(--header-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.admin-table tbody tr:hover { background: #f9fafb; }

/* ----- 정답 키 편집 ----- */
.save-bar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.save-bar.hidden { display: none; }
.save-bar .btn-primary { padding: 9px 18px; font-size: 14px; }
.save-bar .btn-secondary { padding: 7px 14px; font-size: 13px; }

.save-status { font-size: 13px; color: var(--muted); }
.save-status.dirty { color: #b45309; font-weight: 600; }
.save-status.ok { color: #047857; font-weight: 600; }
.save-status.err { color: var(--danger); }

.q-num.unfilled {
  background: #fff;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
}

.key-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 0 46px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.meta-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.meta-field input[type="number"],
.meta-field input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}
.meta-field input[type="number"] { width: 72px; text-align: center; }
.meta-field.meta-wide { flex: 1; min-width: 240px; }
.meta-field.meta-wide input { width: 100%; }
.meta-field .suffix { font-size: 12px; }

/* ----- admin hub ----- */
.admin-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-hub-header h2 {
  margin: 0;
  font-size: 22px;
}
.admin-hub-header .btn-link {
  margin-left: 8px;
}
.actions-cell { white-space: nowrap; }
.actions-cell .btn-link { margin-right: 8px; }
.danger-link { color: var(--danger) !important; }
.danger-link:hover { background: rgba(220,38,38,0.08); border-radius: 4px; }

/* import modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-box {
  background: #fff; padding: 24px; border-radius: 16px;
  max-width: 460px; width: 100%;
  box-shadow: 0 18px 40px rgba(0,0,0,0.2);
}
.modal-box.modal-box-wide {
  max-width: 820px;
  max-height: 88vh;
  overflow-y: auto;
}
.submission-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 4px;
}
.submission-detail-header h3 { margin: 0; }
.submission-detail-body { display: flex; flex-direction: column; gap: 10px; }
.text-answer-box {
  margin: 4px 0 8px 0;
  padding: 10px 14px;
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
}
.text-answer-box.wrong { background: rgba(220,38,38,0.06); border-color: #fca5a5; }
.text-answer-box.correct { background: rgba(16,185,129,0.06); border-color: #6ee7b7; }
.text-answer-box.correct-box { background: rgba(16,185,129,0.06); border-color: #6ee7b7; color: #047857; }

.admin-table.clickable tbody tr:hover { background: rgba(99,102,241,0.06); }

.manual-grade-bar {
  margin: 12px 0 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.manual-grade-bar .btn-secondary {
  padding: 5px 12px;
  font-size: 12px;
}
.manual-grade-bar .btn-link {
  padding: 5px 8px;
  font-size: 12px;
}
.manual-info {
  font-size: 12px;
  color: var(--muted);
  margin-right: 8px;
}
.status-badge.manual {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  color: #92400e !important;
  border: 1px solid #f59e0b;
}

.quiz-closed-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(220,38,38,0.12);
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}
.quiz-open-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(16,185,129,0.12);
  color: #047857;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}
.quiz-card.is-closed {
  opacity: 0.6;
}
.closed-banner {
  padding: 16px 20px;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border: 1px solid #fca5a5;
  border-radius: 12px;
  color: #b91c1c;
  font-weight: 600;
  text-align: center;
  margin: 16px 0;
}

.inapp-banner {
  position: sticky;
  top: 0;
  z-index: 500;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-bottom: 2px solid #f59e0b;
  color: #92400e;
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}
.inapp-banner strong { display: block; font-size: 15px; color: #b45309; margin-bottom: 4px; }
.inapp-banner .inapp-guide {
  margin: 6px 0 10px;
  font-size: 13px;
  color: #92400e;
}
.inapp-banner button {
  margin: 0 auto;
  padding: 6px 16px;
  font-size: 13px;
  background: #fff;
  border: 1px solid #f59e0b;
  color: #92400e;
}
.modal-box h3 { margin: 0 0 10px; }
.modal-box .full-field {
  display: block; margin: 12px 0;
}
.modal-box .full-field > span {
  display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px;
}
.modal-box .full-field input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
}
.modal-buttons {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;
}
.message { font-size: 13px; min-height: 16px; margin: 4px 0; }
.message.error { color: var(--danger); }
.message.success { color: #047857; }

/* ----- bulk score bar ----- */
.bulk-bar {
  max-width: 1000px;
  margin: 12px auto 0;
  padding: 12px 20px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #92400e;
}
.bulk-bar.hidden { display: none; }
.bulk-bar input[type="number"] {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  background: #fff;
}
.bulk-bar .btn-secondary {
  padding: 6px 14px;
  font-size: 13px;
}
.bulk-divider {
  color: #d97706;
  margin: 0 4px;
}

/* ----- 결과 화면 (Google Forms 스타일) ----- */
.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 14px;
}
.result-card.ok { border-left-color: #10b981; background: rgba(16,185,129,0.04); }
.result-card.ng { border-left-color: #dc2626; background: rgba(220,38,38,0.04); }
.result-card.na { border-left-color: #9ca3af; }
.result-card.info { border-left-color: #6366f1; background: rgba(99,102,241,0.04); }
.result-card.info .status-badge { background: rgba(99,102,241,0.15); color: #4338ca; }

.result-card-header {
  display: flex; align-items: flex-start; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.result-card-header .status-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.result-card.ok .status-badge { background: rgba(16,185,129,0.15); color: #047857; }
.result-card.ng .status-badge { background: rgba(220,38,38,0.15); color: #b91c1c; }
.result-card.na .status-badge { background: rgba(107,114,128,0.15); color: var(--muted); }
.result-card-header .rc-num { font-weight: 700; }
.result-card-header .rc-title {
  flex: 1; font-weight: 600; line-height: 1.5; word-break: keep-all; white-space: pre-wrap;
}

.result-opts {
  display: flex; flex-direction: column; gap: 6px;
}
.result-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.result-opt .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; font-weight: 700; font-size: 14px;
  border-radius: 999px; flex-shrink: 0;
}
.result-opt .opt-label { flex: 1; }
.result-opt .user-tag {
  font-size: 11px; font-weight: 700;
  background: rgba(15,23,42,0.08); color: var(--muted);
  padding: 2px 8px; border-radius: 999px;
}
.result-opt.is-correct {
  background: rgba(16,185,129,0.1);
  border-color: #10b981;
}
.result-opt.is-correct .mark { background: #10b981; color: #fff; }
.result-opt.is-wrong {
  background: rgba(220,38,38,0.08);
  border-color: #fca5a5;
  text-decoration: line-through;
}
.result-opt.is-wrong .mark { background: #dc2626; color: #fff; }
.result-opt.is-user-correct .user-tag { background: #10b981; color: #fff; }
.result-opt.is-missed { border-style: dashed; }
.result-opt.is-missed .missed-tag { background: #f59e0b; color: #fff; }

.result-grid {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.result-grid th, .result-grid td {
  border: 1px solid var(--border); padding: 8px; text-align: center;
}
.result-grid thead th { background: var(--header-bg); color: var(--muted); font-weight: 600; font-size: 12px; }
.result-grid tbody th { background: var(--header-bg); text-align: left; font-weight: 500; }
.result-grid td.g-correct { background: rgba(16,185,129,0.2); color: #047857; font-weight: 700; }
.result-grid td.g-wrong { background: rgba(220,38,38,0.2); color: #b91c1c; font-weight: 700; }
.result-grid td.g-user.g-wrong { outline: 2px solid #dc2626; outline-offset: -2px; }
.result-grid td.g-user:not(.g-correct):not(.g-wrong) { background: rgba(15,23,42,0.08); }

.ans-row {
  margin: 6px 0; font-size: 14px; line-height: 1.55;
}
.ans-row strong { color: var(--muted); margin-right: 4px; }
.ans-row.correct strong { color: #047857; }
.ans-row.correct span { color: #047857; font-weight: 600; }
.ans-row.explain { color: var(--text); background: rgba(15,23,42,0.04); padding: 10px 12px; border-radius: 8px; }

/* ----- 관리자: 통계 요약 ----- */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}
.stats-summary .stat {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.stats-summary .stat-num {
  display: block; font-size: 26px; font-weight: 700; color: #4338ca;
  line-height: 1.1;
}
.stats-summary .stat-label {
  display: block; font-size: 12px; color: var(--muted); margin-top: 4px;
}

.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.view-toggle { display: inline-flex; gap: 4px; background: var(--header-bg); padding: 3px; border-radius: 999px; }
.view-toggle .btn-secondary {
  border: none; background: transparent;
  font-size: 13px; padding: 6px 14px; border-radius: 999px;
}
.view-toggle .btn-secondary.active {
  background: var(--primary); color: #fff;
}

.question-stats {
  margin-top: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.question-stats h3 { margin: 0 0 12px; font-size: 16px; }
.q-stat-row {
  display: grid;
  grid-template-columns: 32px 1fr 56px 120px;
  align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.q-stat-row:last-child { border-bottom: none; }
.q-stat-num { color: var(--muted); font-weight: 600; }
.q-stat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-stat-rate { font-weight: 700; text-align: right; }
.q-stat-bar { height: 8px; background: var(--header-bg); border-radius: 4px; overflow: hidden; }
.q-stat-fill { height: 100%; transition: width 0.3s ease; }
.q-stat-row.ok .q-stat-fill { background: #10b981; }
.q-stat-row.mid .q-stat-fill { background: #f59e0b; }
.q-stat-row.ng .q-stat-fill { background: #dc2626; }
.q-stat-row.ok .q-stat-rate { color: #047857; }
.q-stat-row.mid .q-stat-rate { color: #b45309; }
.q-stat-row.ng .q-stat-rate { color: #b91c1c; }
.q-stat-na { color: var(--muted); font-size: 12px; }

/* ----- 문항 이미지 ----- */
.q-image {
  margin: 12px 0 4px 46px;
  text-align: center;
}
.q-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px;
}

/* 결과 카드 안의 이미지 */
.result-card .q-image {
  margin: 4px 0 12px;
}

/* 리치 텍스트 내부 강조 */
.q-title b, .q-title strong, .rc-title b, .rc-title strong {
  color: #b91c1c;
  font-weight: 700;
}
.q-title div, .rc-title div { display: block; }
.q-title span, .rc-title span { display: inline; }

@media (max-width: 520px) {
  .q-image { margin-left: 0; }
}

@media (max-width: 520px) {
  .q-card { padding: 18px; }
  .q-options,
  .q-grid,
  .q-text-input,
  .q-feedback,
  .q-desc { margin-left: 0; width: 100%; }
  .q-grid { font-size: 12px; }
}
