@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --cq-bg: #f4f6f8;
  --cq-surface: #ffffff;
  --cq-surface-soft: #f9fafb;
  --cq-ink: #1f2937;
  --cq-muted: #6b7280;
  --cq-line: #e5e7eb;
  --cq-line-strong: #d1d5db;
  --cq-primary: #2563eb;
  --cq-primary-hover: #1d4ed8;
  --cq-danger: #dc2626;
  --cq-success: #16a34a;
  --cq-radius-xl: 4px;
  --cq-radius-lg: 4px;
  --cq-radius-md: 4px;
  --cq-radius-sm: 4px;
  --cq-shadow-lg: none;
  --cq-shadow-md: none;
  --cq-shadow-sm: none;
  --cq-serif: 'Instrument Serif', 'Noto Serif KR', serif;
  --cq-sans: 'IBM Plex Sans KR', 'Pretendard', 'Noto Sans KR', sans-serif;
}

* {
  box-sizing: border-box;
}

.cq-wrap {
  width: min(100%, 600px);
  max-width: 600px;
  margin: 22px auto 58px;
  padding: 0 14px;
  color: var(--cq-ink);
  font-family: var(--cq-sans);
  position: relative;
}

.cq-kicker {
  margin: 0 0 6px;
  color: #1f2937;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cq-list-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.cq-list-more-btn {
  min-width: 160px;
}

.cq-preview-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
}
.cq-preview-banner strong { color: #7c2d12; }
.cq-preview-banner a { color: #b45309; text-decoration: underline; }

.cq-title {
  margin: 0;
  font-family: var(--cq-sans);
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cq-title-sm {
  margin: 0;
  font-family: var(--cq-sans);
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cq-sub {
  margin: 10px 0 0;
  color: var(--cq-muted);
  line-height: 1.64;
}

.cq-meta,
.cq-item-meta,
.cq-autosave-text,
.cq-result-meta {
  color: var(--cq-muted);
}

.cq-author-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.cq-author-link:hover,
.cq-author-link:focus-visible {
  color: #2563eb;
  text-decoration: underline;
}

.cq-description {
  margin: 12px 0 0;
  white-space: pre-line;
  line-height: 1.66;
}

.cq-detail-ad {
  margin: 24px 0;
}

.cq-detail-ad .goldsaju-adsense {
  margin: 0;
}

.cq-hero,
.cq-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cq-hero {
  padding: 30px;
}

.cq-lobby-hero {
  padding: 0;
  border: 0;
  background: transparent;
  margin-bottom: 24px;
}

.cq-hero-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 18px;
}

.cq-lobby-hero .cq-hero-actions {
  margin-top: 0;
}

.cq-create-btn {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.cq-create-btn i {
  font-size: 18px;
}

.cq-panel {
  padding: 20px;
}

.cq-editor-panel,
.cq-detail-panel {
  position: relative;
}

.cq-detail-body {
  min-width: 0;
}

.cq-panel+.cq-panel {
  margin-top: 14px;
}

.cq-panel-head {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 700;
}

.cq-grid-2 {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cq-list {
  display: grid;
  gap: 10px;
}

.cq-list-item,
.cq-my-item {
  border: 2px solid var(--cq-line);
  border-radius: 4px;
  background: var(--cq-surface);
}

.cq-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  padding: 10px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.cq-list-item:hover {
  border-color: #1f2937;
  background: #f9fafb;
}

.cq-item-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cq-item-title {
  display: block;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cq-item-meta {
  display: block;
  font-size: 13px;
}

.cq-thumb-48,
.cq-thumb-fallback {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 4px;
}

.cq-thumb-48 {
  object-fit: cover;
  border: 2px solid var(--cq-line);
}

.cq-thumb-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 2px solid #d1d5db;
  color: #1f2937;
  font-weight: 800;
}

.cq-empty {
  border: 2px dashed #9ca3af;
  border-radius: 4px;
  background: var(--cq-surface-soft);
  color: var(--cq-muted);
  padding: 14px;
  text-align: center;
}

.cq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 4px;
  border: 2px solid transparent;
  text-decoration: none;
  font-family: var(--cq-sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.cq-btn-primary {
  background: #1f2937;
  color: #fff;
  border-color: #1f2937;
}

.cq-btn-primary:hover {
  background: #111827;
  border-color: #111827;
}

.cq-btn-ghost {
  background: #fff;
  color: var(--cq-ink);
  border-color: #d1d5db;
}

.cq-btn-ghost:hover {
  border-color: #1f2937;
  background: #f9fafb;
}

.cq-btn-danger {
  background: #fff;
  color: var(--cq-danger);
  border-color: var(--cq-danger);
}

.cq-btn-danger:hover {
  background: var(--cq-danger);
  color: #fff;
}

.cq-btn-mini {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.cq-hero-actions,
.cq-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#cqStartBtn {
  flex: 1;
}

.cq-hero-actions {
  margin-top: 16px;
}

.cq-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.cq-close-x {
  background: none;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.cq-close-x:hover {
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
}

.cq-editor-flow {
  max-width: 1040px;
}

.cq-editor-head-step {
  margin-bottom: 12px;
}

/* step-track/chip no longer used in wizard — kept minimal for compat */
.cq-step-track { display: none; }
.cq-step-chip { display: none; }

.cq-step-pane {
  margin-top: 14px;
}

.cq-form-grid {
  display: grid;
  gap: 10px;
}

.cq-field {
  display: grid;
  gap: 6px;
}

.cq-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4b5563;
}

.cq-input,
.cq-textarea,
.cq-file {
  width: 100%;
  border: 2px solid var(--cq-line);
  border-radius: 4px;
  background: #fff;
  color: var(--cq-ink);
  font-family: var(--cq-sans);
  font-size: 14px;
  transition: border-color 0.12s ease;
}

.cq-input,
.cq-file {
  min-height: 42px;
  padding: 0 12px;
}

.cq-textarea {
  min-height: 106px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.56;
}

.cq-input:focus,
.cq-textarea:focus,
.cq-file:focus {
  outline: none;
  border-color: #1f2937;
}

.cq-score-field {
  max-width: 180px;
}

.cq-preview-wrap {
  margin-top: 8px;
}

.cq-preview-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--cq-line);
  background: var(--cq-surface-soft);
}

.cq-preview-img-choice {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--cq-line);
  background: var(--cq-surface-soft);
}

.cq-autosave-line {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 4px 0;
}

.cq-status {
  font-size: 13px;
  font-weight: 700;
}

.cq-status.is-ok {
  color: var(--cq-success);
}

.cq-status.is-error {
  color: var(--cq-danger);
}

.cq-editor-bottom {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cq-step-next-wrap {
  align-items: center;
}

.cq-step-note {
  color: var(--cq-muted);
  font-size: 13px;
}

.cq-question-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cq-qtab {
  min-height: 36px;
  border: 1px solid var(--cq-line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.cq-qtab.is-filled::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0ea5e9;
  position: absolute;
  right: 8px;
  top: 8px;
}

.cq-qtab.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.cq-step2-actions {
  align-items: center;
}

.cq-question-card {
  margin-top: 12px;
  border: 1px solid var(--cq-line);
  border-radius: var(--cq-radius-lg);
  background: #fff;
  padding: 12px;
}

.cq-question-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cq-question-head strong {
  font-size: 18px;
  font-weight: 700;
}

.cq-question-meta {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  margin-top: 10px;
}

.cq-choice-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.cq-choice-item {
  border: 1px solid var(--cq-line);
  border-radius: 10px;
  background: var(--cq-surface-soft);
  padding: 10px;
}

.cq-choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.cq-correct-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.cq-detail-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cq-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--cq-line);
  display: block;
}

.cq-rank-list {
  display: grid;
  gap: 8px;
}

.cq-rank-row {
  border: 1px solid var(--cq-line);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  background: #fff;
}

.cq-rank-pos,
.cq-rank-score {
  font-weight: 700;
}

.cq-rank-time {
  color: var(--cq-muted);
  font-size: 12px;
}

.cq-list-my {
  gap: 10px;
}

.cq-my-item {
  padding: 12px;
}

.cq-my-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cq-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--cq-line);
}

.cq-badge.is-draft {
  background: #eef2ff;
  color: #3730a3;
}

.cq-badge.is-published {
  background: #ecfdf5;
  color: #166534;
}

.cq-badge.is-pending {
  background: #fff7ed;
  color: #9a3412;
}

.cq-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.cq-modal.is-open {
  display: flex;
  padding: 0;
}

.cq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.cq-modal.is-open .cq-modal-backdrop {
  display: none;
}

.cq-modal-dialog {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  max-height: none;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: #fff;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}

@supports (min-height: 100dvh) {
  .cq-modal-dialog { min-height: 100dvh; }
}

.cq-modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--cq-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--cq-surface-soft);
}

.cq-modal-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.cq-modal-close {
  border: 1px solid var(--cq-line);
  background: #fff;
  color: var(--cq-ink);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.cq-modal-close:hover {
  border-color: #bfdbfe;
}

.cq-modal-body {
  width: min(100%, 600px);
  flex: 1;
  margin: 0 auto;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: none;
  overflow: auto;
}

body.cq-modal-open {
  overflow: hidden;
}

.cq-play-app {
  min-height: 220px;
}

.cq-message {
  padding: 20px;
  text-align: center;
  color: var(--cq-muted);
}

.cq-message-error {
  color: var(--cq-danger);
}

.cq-play-progress {
  margin-bottom: 14px;
}
.cq-play-progress-bar {
  position: relative;
  height: 22px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.cq-play-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.cq-play-progress-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.cq-play-question-title {
  font-size: 28px;
  line-height: 1.24;
  margin-bottom: 12px;
  font-family: var(--cq-serif);
}

.cq-play-question-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  border: 1px solid var(--cq-line);
  margin-bottom: 12px;
}

.cq-play-crop {
  position: relative;
  overflow: hidden;
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 0 0 1px var(--cq-line), 0 8px 20px rgba(15, 23, 42, 0.12);
}
.cq-play-crop img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: var(--cq-crop-x) var(--cq-crop-y);
  transform: scale(var(--cq-crop-zoom));
  transform-origin: var(--cq-crop-x) var(--cq-crop-y);
}
.cq-play-crop-caption {
  margin: -4px 0 14px;
  color: var(--cq-muted);
  font-size: 13px;
  text-align: center;
}
.cq-play-music {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin: 0 0 14px;
}
.cq-play-music iframe,
.cq-review-music iframe {
  width: min(100%, 420px);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #111827;
}
.cq-play-free-answer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cq-play-free-answer input {
  min-width: 0;
  flex: 1;
  min-height: 46px;
  border: 1px solid var(--cq-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.cq-play-ox {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.cq-play-ox-btn {
  min-height: 84px;
  border: 1px solid var(--cq-line);
  border-radius: 12px;
  background: #fff;
  color: var(--cq-ink);
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
}
.cq-play-ox-btn:hover { border-color: #93c5fd; box-shadow: var(--cq-shadow-sm); }

.cq-play-choice {
  width: 100%;
  border: 1px solid var(--cq-line);
  border-radius: 10px;
  background: #fff;
  color: var(--cq-ink);
  padding: 12px;
  text-align: left;
  margin-bottom: 8px;
  font-family: var(--cq-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.cq-play-choice:hover {
  border-color: #93c5fd;
  box-shadow: var(--cq-shadow-sm);
}

.cq-play-choice.is-selected,
.cq-play-ox-btn.is-selected {
  position: relative;
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px #dbeafe;
}
.cq-play-choice.is-selected { padding-right: 52px; }
.cq-play-choice:disabled:not(.is-selected),
.cq-play-ox-btn:disabled:not(.is-selected) { opacity: .55; }
.cq-play-selected-mark {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
}
.cq-play-selected-mark svg { width: 18px; height: 18px; }
.cq-play-selection-feedback {
  margin: 12px 0 0;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.cq-play-choice-img {
  display: block;
  margin-top: 7px;
  max-width: 130px;
  max-height: 130px;
  border-radius: 8px;
  border: 1px solid var(--cq-line);
}

.cq-result {
  text-align: center;
  display: grid;
  gap: 8px;
  padding: 8px 0;
}

.cq-result h3 {
  margin: 0 0 6px;
  font-family: var(--cq-serif);
  font-size: 34px;
  line-height: 1;
}

.cq-result p {
  margin: 0;
}

/* ─── 결과 페이지 ─── */
.cq-result-score-box {
  text-align: center;
  padding: 24px 16px 16px;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 8px;
}
.cq-result-big-score {
  font-size: 52px;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
}
.cq-result-big-score span { font-size: 22px; font-weight: 600; margin-left: 4px; }
.cq-result-score-sub { margin-top: 8px; font-size: 14px; color: #6b7280; }

.cq-result-chart-wrap { margin: 16px 0 8px; }
.cq-result-chart-title { font-size: 13px; color: #6b7280; margin: 0 0 8px; font-weight: 600; }

.cq-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 16px 0 8px;
  flex-wrap: wrap;
}
.cq-result-actions .cq-btn { min-width: 140px; }

/* ─── 정답 확인 카드 ─── */
.cq-result-review {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
}
.cq-result-review-title {
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 12px;
}
.cq-review-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
}
.cq-review-item.is-ok { border-left: 4px solid #22c55e; }
.cq-review-item.is-ng { border-left: 4px solid #ef4444; }
.cq-review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cq-review-num {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
}
.cq-review-mark {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.cq-review-item.is-ok .cq-review-mark { background: #dcfce7; color: #15803d; }
.cq-review-item.is-ng .cq-review-mark { background: #fee2e2; color: #b91c1c; }
.cq-review-q {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 10px;
  line-height: 1.5;
}
.cq-review-media {
  display: block;
  width: min(100%, 340px);
  max-height: 260px;
  margin: 0 0 10px;
  border: 1px solid var(--cq-line);
  border-radius: 8px;
  object-fit: contain;
}
.cq-review-music { margin: 0 0 10px; }
.cq-review-typed-answer {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f9fafb;
  color: #4b5563;
  font-size: 14px;
}
.cq-review-typed-answer strong { color: #111827; }
.cq-review-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cq-review-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 14px;
  color: #4b5563;
}
.cq-review-choice.is-correct {
  background: #f0fdf4;
  color: #15803d;
  font-weight: 600;
}
.cq-review-choice.is-wrong {
  background: #fef2f2;
  color: #b91c1c;
}
.cq-review-text { flex: 1; }
.cq-review-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}
.cq-review-choice.is-correct .cq-review-tag { background: #22c55e; color: #fff; }
.cq-review-choice.is-wrong .cq-review-tag { background: #ef4444; color: #fff; }

@media (max-width: 520px) {
  .cq-play-question-title { font-size: 23px; }
  .cq-play-free-answer { flex-direction: column; }
  .cq-play-free-answer .cq-btn { width: 100%; }
}

.d-none {
  display: none !important;
}

@media (max-width: 860px) {
  .cq-grid-2 {
    grid-template-columns: 1fr;
  }

  .cq-cover {
    aspect-ratio: 1 / 1;
    max-width: 100%;
  }

  .cq-question-meta {
    grid-template-columns: 1fr;
  }

  .cq-score-field {
    max-width: none;
  }

  .cq-rank-row {
    grid-template-columns: 56px 1fr;
    grid-template-areas:
      'pos nick'
      'score time';
    gap: 4px 10px;
  }

  .cq-rank-pos {
    grid-area: pos;
  }

  .cq-rank-nick {
    grid-area: nick;
  }

  .cq-rank-score {
    grid-area: score;
  }

  .cq-rank-time {
    grid-area: time;
  }
}

@media (max-width: 600px) {
  .cq-wrap {
    margin-top: 14px;
    padding: 0 10px 28px;
  }

  .cq-hero,
  .cq-panel {
    border-radius: 4px;
    padding: 14px;
  }

  .cq-preview-img {
    width: 160px;
    height: 160px;
  }

  .cq-title {
    font-size: 26px;
  }

  .cq-title-sm {
    font-size: 20px;
  }
}

    .mypage-wrap {
        --flat-bg: #eef2f7;
        --flat-surface: #ffffff;
        --flat-ink: #111827;
        --flat-muted: #4b5563;
        --flat-line: #111827;
        --flat-primary: #ef4444;
        --flat-primary-strong: #dc2626;
        --flat-secondary: #2563eb;
        --flat-secondary-soft: #eff6ff;
        max-width: 980px;
        margin: 24px auto 48px;
        padding: 0 16px;
        font-family: 'IBM Plex Sans KR', 'Pretendard', 'Noto Sans KR', sans-serif;
        position: relative;
        color: var(--flat-ink);
    }

    .mypage-wrap::before {
        content: '';
        position: fixed;
        inset: 0;
        background: var(--flat-bg);
        z-index: -2;
    }

    .mypage-wrap::after {
        content: '';
        position: fixed;
        top: 20px;
        right: 24px;
        width: 72px;
        height: 72px;
        border: 2px solid var(--flat-line);
        background: #fde68a;
        z-index: -1;
    }

    .mypage-card {
        border: 2px solid var(--flat-line);
        border-radius: 4px;
        padding: 24px;
        background: var(--flat-surface);
    }

    .mypage-title {
        margin: 0 0 8px;
        font-size: clamp(28px, 4vw, 38px);
        font-weight: 800;
        letter-spacing: -0.02em;
        line-height: 1.1;
        color: var(--flat-ink);
    }

    .mypage-sub {
        margin: 0 0 18px;
        color: var(--flat-muted);
        font-size: 15px;
        line-height: 1.6;
    }

    .mypage-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        margin-bottom: 18px;
    }

    .mypage-btn {
        border: 2px solid var(--flat-line);
        border-radius: 4px;
        padding: 11px 16px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        white-space: nowrap;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    }

    .mypage-btn:focus-visible,
    .mypage-action-btn:focus-visible {
        outline: 3px solid #93c5fd;
        outline-offset: 2px;
    }

    .mypage-btn-primary {
        background: var(--flat-primary);
        color: #fff;
        border-color: var(--flat-primary);
    }

    .mypage-btn-primary:hover {
        background: var(--flat-primary-strong);
        border-color: var(--flat-primary-strong);
    }

    .mypage-btn-dark {
        background: var(--flat-ink);
        color: #fff;
    }

    .mypage-btn-dark:hover {
        background: #000;
    }

    .mypage-empty {
        margin: 0;
        border: 2px dashed #9ca3af;
        border-radius: 4px;
        padding: 18px 14px;
        text-align: center;
        color: var(--flat-muted);
        background: #f9fafb;
    }

    .mypage-quiz-list {
        margin: 0;
        padding: 0;
        list-style: none;
        display: grid;
        gap: 12px;
    }

    .mypage-quiz-item {
        border: 2px solid var(--flat-line);
        border-radius: 4px;
        padding: 14px;
        background: var(--flat-surface);
    }

    .mypage-quiz-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
    }

    .mypage-quiz-title {
        margin: 0;
        font-size: 18px;
        line-height: 1.35;
        font-weight: 800;
        word-break: keep-all;
    }

    .mypage-status {
        border: 2px solid var(--flat-line);
        border-radius: 4px;
        padding: 4px 8px;
        font-size: 12px;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
    }

    .mypage-status.is-draft {
        background: #f3f4f6;
        color: #374151;
        border-color: #9ca3af;
    }

    .mypage-status.is-published {
        background: #dcfce7;
        color: #166534;
        border-color: #4ade80;
    }

    .mypage-status.is-pending {
        background: #ffedd5;
        color: #9a3412;
        border-color: #fb923c;
    }

    .mypage-quiz-meta {
        margin-top: 8px;
        color: var(--flat-muted);
        font-size: 13px;
        line-height: 1.55;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .mypage-quiz-actions {
        margin-top: 12px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .mypage-action-btn {
        border: 2px solid var(--flat-line);
        border-radius: 4px;
        padding: 7px 10px;
        text-decoration: none;
        color: var(--flat-ink);
        font-size: 13px;
        font-weight: 700;
        background: #fff;
        cursor: pointer;
        line-height: 1.1;
        transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    }

    .mypage-action-btn:hover {
        background: var(--flat-ink);
        color: #fff;
    }

    .mypage-action-btn.is-view {
        border-color: var(--flat-secondary);
        color: #1d4ed8;
        background: var(--flat-secondary-soft);
    }

    .mypage-action-btn.is-view:hover {
        background: var(--flat-secondary);
        color: #fff;
    }

    .mypage-action-btn.is-delete {
        border-color: var(--flat-primary);
        color: #b91c1c;
        background: #fef2f2;
    }

    .mypage-action-btn.is-delete:hover {
        background: var(--flat-primary);
        color: #fff;
    }

    /* ═══════ Modal Shell ═══════ */

    .quiz-editor-modal {
        position: fixed;
        inset: 0;
        z-index: 1300;
        display: none;
    }

    .quiz-editor-modal.is-open {
        display: block;
    }

    .quiz-editor-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(17, 24, 39, 0.5);
    }

    .quiz-editor-dialog {
        position: relative;
        width: min(560px, calc(100% - 24px));
        height: calc(100vh - 24px);
        margin: 12px auto;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        border: 2px solid #1f2937;
        display: flex;
        flex-direction: column;
    }

    .quiz-editor-body {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background: #fff;
    }

    .quiz-editor-loading {
        padding: 24px 16px;
        text-align: center;
        color: #475569;
    }

    body.quiz-editor-modal-open {
        overflow: hidden;
    }

    /* ═══════ Popup Wrap Layout ═══════ */

    .cq-popup-wrap {
        margin: 0;
        max-width: 100%;
        padding: 0;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .cq-popup-wrap::before,
    .cq-popup-wrap::after {
        display: none !important;
        content: none !important;
    }

    .cq-popup-wrap .cq-panel {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 20px;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .cq-popup-wrap .cq-editor-head {
        flex-shrink: 0;
        margin-bottom: 8px;
    }

    .cq-popup-wrap .cq-btn,
    .cq-popup-wrap .cq-input,
    .cq-popup-wrap .cq-textarea,
    .cq-popup-wrap .cq-file,
    .cq-popup-wrap .cq-question-card,
    .cq-popup-wrap .cq-choice-item {
        border-radius: 4px;
        box-shadow: none;
    }

    .cq-popup-wrap .cq-autosave-line {
        flex-shrink: 0;
        margin-top: 10px;
        border: 0;
        background: transparent;
        padding: 0;
        gap: 6px;
        justify-content: flex-end;
    }

    .cq-popup-wrap .cq-autosave-text,
    .cq-popup-wrap .cq-status {
        font-size: 11px;
        font-weight: 500;
    }

    /* ═══════ Wizard Progress Bar ═══════ */

    .cqw-progress {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 20px;
        flex-shrink: 0;
    }

    .cqw-progress-track {
        flex: 1;
        height: 6px;
        background: #e5e7eb;
        border-radius: 0;
        overflow: hidden;
    }

    .cqw-progress-bar {
        height: 100%;
        background: #1f2937;
        transition: width 0.3s ease;
        width: 0%;
    }

    .cqw-progress-text {
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        white-space: nowrap;
        font-family: var(--cq-sans);
    }

    /* ═══════ Wizard Content ═══════ */

    .cqw-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .cqw-step-screen {
        padding: 4px 0;
    }

    .cqw-step-headline {
        margin: 0 0 6px;
        font-size: 20px;
        font-weight: 800;
        color: #1f2937;
        letter-spacing: -0.02em;
        font-family: var(--cq-sans);
    }

    .cqw-step-sub {
        margin: 0 0 20px;
        color: #6b7280;
        font-size: 13px;
        line-height: 1.5;
    }

    .cqw-big-input {
        min-height: 52px;
        font-size: 17px;
        font-weight: 600;
        border: 2px solid #d1d5db;
        border-radius: 4px;
        padding: 12px 14px;
    }

    .cqw-big-input:focus {
        border-color: #1f2937;
        outline: none;
    }

    .cqw-big-textarea {
        min-height: 140px;
        font-size: 14px;
        border: 2px solid #d1d5db;
        border-radius: 4px;
        line-height: 1.7;
        padding: 12px 14px;
    }

    .cqw-big-textarea:focus {
        border-color: #1f2937;
        outline: none;
    }

    .cqw-image-field {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .cqw-image-upload-btn {
        border: 2px dashed #9ca3af;
        border-radius: 4px;
        background: #f9fafb;
        color: #6b7280;
        padding: 40px 24px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        width: 100%;
        text-align: center;
        transition: border-color 0.15s ease, background-color 0.15s ease;
    }

    .cqw-image-upload-btn:hover {
        border-color: #1f2937;
        background: #f3f4f6;
        color: #1f2937;
    }

    /* ═══════ Wizard Actions (Bottom) ═══════ */

    .cqw-actions {
        flex-shrink: 0;
        padding-top: 14px;
        border-top: 2px solid #e5e7eb;
        margin-top: 14px;
    }

    .cqw-actions-row {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .cqw-actions-row .cq-btn {
        flex: 1 1 0;
        min-height: 36px;
        font-size: 13px;
        font-weight: 700;
        border-radius: 4px;
        border: 2px solid;
        cursor: pointer;
        transition: background 0.12s ease, color 0.12s ease;
    }

    .cqw-btn-back {
        background: #fff;
        color: #374151;
        border-color: #d1d5db;
    }
    .cqw-btn-back:hover {
        background: #1f2937;
        color: #fff;
        border-color: #1f2937;
    }

    .cqw-btn-skip {
        background: #fff;
        color: #9ca3af;
        border-color: #e5e7eb;
    }
    .cqw-btn-skip:hover {
        background: #f3f4f6;
        color: #6b7280;
    }

    .cqw-btn-next {
        background: #1f2937;
        color: #fff;
        border-color: #1f2937;
    }
    .cqw-btn-next:hover {
        background: #111827;
        border-color: #111827;
    }

    .cqw-btn-save {
        background: var(--flat-primary, #2563eb);
        color: #fff;
        border-color: var(--flat-primary, #2563eb);
    }
    .cqw-btn-save:hover {
        background: var(--flat-primary-strong, #1d4ed8);
        border-color: var(--flat-primary-strong, #1d4ed8);
    }

    .cqw-btn-add-q {
        background: #fff;
        color: #1f2937;
        border-color: #1f2937;
    }
    .cqw-btn-add-q:hover {
        background: #1f2937;
        color: #fff;
    }

    /* ═══════ Flat overrides for inner elements ═══════ */

    .cq-tool-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 6px;
    }

    .cq-tool-btn {
        border: 1px solid #d1d5db;
        border-radius: 4px;
        padding: 3px 8px;
        background: #fff;
        color: #6b7280;
        font-size: 11px;
        font-weight: 600;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        gap: 3px;
        cursor: pointer;
    }

    .cq-tool-btn i {
        font-size: 11px;
    }

    .cq-tool-btn-right {
        margin-left: auto;
    }

    .cq-emoji-picker {
        position: fixed;
        z-index: 1500;
        width: 232px;
        max-width: calc(100vw - 20px);
        border: 2px solid #1f2937;
        border-radius: 4px;
        background: #fff;
        padding: 8px;
        display: none;
    }

    .cq-emoji-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 4px;
    }

    .cq-emoji-item {
        border: 1px solid #e5e7eb;
        border-radius: 2px;
        background: #fff;
        min-height: 30px;
        font-size: 16px;
        line-height: 1;
        cursor: pointer;
    }

    .cq-emoji-item:hover {
        background: #f3f4f6;
        border-color: #1f2937;
    }

    .cq-btn.cq-btn-danger {
        background: var(--flat-primary, #ef4444);
        color: #fff;
        border-color: var(--flat-primary, #ef4444);
    }

    .cq-btn.cq-btn-danger:hover {
        background: var(--flat-primary-strong, #dc2626);
        border-color: var(--flat-primary-strong, #dc2626);
    }

    .cq-choice-item.is-correct {
        border-color: #ef4444 !important;
        border-width: 3px !important;
    }

    .cq-choice-tools {
        margin-top: 10px;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .cq-choice-tools .cq-btn {
        border: 2px solid #1f2937;
        background: #fff;
        color: #1f2937;
        font-weight: 700;
        font-size: 13px;
        padding: 6px 14px;
        border-radius: 4px;
    }

    .cq-choice-tools .cq-btn:hover {
        background: #1f2937;
        color: #fff;
    }

    .cqw-btn-delete-q {
        background: #fff !important;
        color: #b91c1c !important;
        border-color: #ef4444 !important;
    }

    .cqw-btn-delete-q:hover {
        background: #ef4444 !important;
        color: #fff !important;
    }

    /* ═══════ Lobby Redesign ═══════ */

    .cq-section-head {
        font-size: 16px;
        font-weight: 700;
        margin: 20px 0 0;
        padding: 0 4px 10px;
        border-bottom: 2px solid #1f2937;
    }

    .cq-lobby-section + .cq-lobby-section {
        margin-top: 8px;
    }

    .cq-lobby-tabs {
        display: flex;
        margin-top: 16px;
        margin-bottom: 14px;
        border: 2px solid #1f2937;
        border-radius: 4px;
        overflow: hidden;
    }

    .cq-lobby-tab {
        flex: 1;
        padding: 12px 10px;
        font-size: 15px;
        font-weight: 700;
        text-align: center;
        cursor: pointer;
        border: none;
        background: #fff;
        color: #1f2937;
        font-family: var(--cq-sans);
        transition: background 0.15s, color 0.15s;
    }

    .cq-lobby-tab + .cq-lobby-tab {
        border-left: 2px solid #1f2937;
    }

    .cq-lobby-tab:hover {
        background: #f3f4f6;
    }

    .cq-lobby-tab.is-active {
        background: #1f2937;
        color: #fff;
    }

    .cq-comments-panel,
    .cq-random-panel {
        border: none;
        background: transparent;
        padding-left: 0;
        padding-right: 0;
    }

    .cq-lobby-list {
        display: grid;
        gap: 0;
        overflow: hidden;
    }

    .cq-lobby-card {
        display: flex;
        gap: 12px;
        padding: 14px 4px;
        border: none;
        border-bottom: 1px dashed var(--cq-line-strong, #d1d5db);
        border-radius: 0;
        background: transparent;
        text-decoration: none;
        color: inherit;
        transition: background 0.15s;
        cursor: pointer;
        min-width: 0;
        overflow: hidden;
    }

    .cq-lobby-card:last-child {
        border-bottom: none;
    }

    .cq-lobby-card:hover {
        background: #f9fafb;
    }

    .cq-lobby-thumb {
        flex-shrink: 0;
        align-self: flex-start;
        width: 96px;
        height: 96px;
        aspect-ratio: 1 / 1;
        border: none;
        border-radius: 8px;
        overflow: hidden;
        background: #f3f4f6;
    }

    .cq-lobby-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .cq-lobby-thumb-fallback {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 32px;
        background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    }

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

    .cq-lobby-title-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
    }

    .cq-lobby-title {
        margin: 0;
        font-size: 17px;
        font-weight: 800;
        line-height: 1.3;
        color: #1f2937;
        word-break: keep-all;
    }

    .cq-lobby-badge {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 3px 8px;
        border: 2px solid #fbbf24;
        border-radius: 4px;
        background: #fffbeb;
        font-size: 11px;
        font-weight: 700;
        color: #92400e;
        white-space: nowrap;
    }

    .cq-lobby-desc {
        margin: 0;
        font-size: 13px;
        line-height: 1.5;
        color: var(--cq-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cq-lobby-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        font-size: 12px;
        color: var(--cq-muted);
        margin-top: 2px;
    }

    .cq-lobby-meta span {
        white-space: nowrap;
    }

    .cq-lobby-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 4px;
    }

    .cq-lobby-cta {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 6px 14px;
        border: 2px solid #1f2937;
        border-radius: 4px;
        background: #1f2937;
        color: #fff;
        font-size: 13px;
        font-weight: 700;
        white-space: nowrap;
        pointer-events: none;
    }

    .cq-lobby-card:hover .cq-lobby-cta {
        background: #111827;
        border-color: #111827;
    }

    .cq-lobby-empty {
        border: 2px dashed #9ca3af;
        border-radius: 4px;
        background: #f9fafb;
        padding: 40px 20px;
        text-align: center;
    }

    .cq-lobby-empty-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .cq-lobby-empty-text {
        color: var(--cq-muted);
        font-size: 15px;
        line-height: 1.6;
        margin: 0 0 16px;
    }

    @media (max-width: 600px) {
        .cq-lobby-card {
            padding: 14px;
            gap: 12px;
        }

        .cq-lobby-thumb {
            width: 84px;
            height: 84px;
            aspect-ratio: 1 / 1;
        }

        .cq-lobby-title {
            font-size: 15px;
        }

        .cq-lobby-cta {
            padding: 5px 10px;
            font-size: 12px;
        }

        .cq-lobby-badge {
            font-size: 10px;
            padding: 2px 6px;
        }
    }

    /* ═══════ Responsive ═══════ */

    @media (max-width: 768px) {
        .mypage-wrap {
            margin: 16px auto 30px;
            padding: 0 12px;
        }

        .mypage-wrap::after {
            width: 52px;
            height: 52px;
            top: 12px;
            right: 12px;
        }

        .mypage-card {
            padding: 16px;
        }

        .mypage-actions {
            display: grid;
            grid-template-columns: 1fr;
        }

        .mypage-btn {
            width: 100%;
        }

        .mypage-quiz-row {
            flex-direction: column;
            align-items: flex-start;
        }

        .mypage-quiz-actions {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .mypage-action-btn {
            width: 100%;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            min-height: 36px;
            text-align: center;
        }

        .quiz-editor-dialog {
            width: calc(100% - 12px);
            margin: 6px auto;
            height: calc(100vh - 12px);
            border-radius: 4px;
        }

        .cq-popup-wrap .cq-panel {
            padding: 14px;
        }
    }

    @media (max-width: 520px) {
        .mypage-quiz-actions {
            grid-template-columns: 1fr;
        }

        .cqw-actions-row {
            flex-direction: column;
        }
    }
