:root {
  /* Neo-brutalist — 두꺼운 검은 테두리 · 하드 그림자 · 노란 포인트 */
  --bg: #F4F2EA;          /* 웜 오프화이트 캔버스 */
  --panel: #FFFFFF;
  --panel-2: #F4F2EA;
  --text: #111111;
  --muted: #57534E;
  --accent: #FFDE59;      /* 시그니처 옐로(포인트) */
  --accent-hover: #FFD21F;
  --accent-fg: #111111;   /* 옐로 위 글자색 */
  --green: #1F9A5A;       /* 정답 */
  --orange: #E5482E;      /* 오답·경고 */
  --border: #111111;      /* 하드 블랙 보더 */
  --line: 2.5px;          /* 보더 두께 */
  --shadow: 4px 4px 0 #111111;   /* 하드 오프셋 그림자 */
  --shadow-sm: 3px 3px 0 #111111;
  --indigo: #FFDE59;      /* 옛 변수 호환 */
  --font-body: "Public Sans", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --font-label: "Space Grotesk", "Public Sans", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

h1, h2, h3 { margin: 0 0 12px; line-height: 1.12; font-weight: 800; letter-spacing: -0.022em; color: var(--text); }
h1 { font-size: 34px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
a { color: #111; font-weight: 700; text-underline-offset: 2px; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }

/* Space Grotesk 라벨/숫자 — PIN·배지·번호·순위 */
.pin-display, .choice .badge, .qprev .qtitle .num, .opt .oi, .rank, .badge, .order-pos, .num {
  font-family: var(--font-label);
}
/* 대문자 마이크로 라벨(라틴/짧은 라벨용) */
.kicker {
  font-family: var(--font-label); text-transform: uppercase;
  letter-spacing: 0.13em; font-size: 12px; font-weight: 700; color: var(--muted);
}

/* 네오브루탈 카드 — 두꺼운 검은 테두리 + 하드 그림자 */
.card {
  background: var(--panel);
  border: var(--line) solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.muted { color: var(--muted); }
.credit { margin: 28px 0 8px; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
/* 하단 개인정보/문의 링크 바 */
.legal-bar { margin: 6px 0 4px; text-align: center; color: var(--muted); font-size: 13px; }
.legal-bar .sep { margin: 0 8px; color: var(--border); }
.legal-bar a { color: var(--muted); font-weight: 600; }
.linklike {
  background: none; border: none; box-shadow: none; padding: 0; margin: 0;
  color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 2px;
}
.linklike:hover { color: #111; background: none; }
.linklike:active { transform: none; box-shadow: none; }
/* 개인정보 팝업 내 저작권자 */
.legal-owner { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); font-weight: 700; color: var(--text); }

/* 상단 브랜드 제목(진행 화면) */
.brand { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.brand a { text-decoration: none; }
.brand-name {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-label); font-weight: 800; font-size: clamp(28px, 6vw, 44px); color: #111;
  letter-spacing: -0.01em; white-space: nowrap; line-height: 1;
}
.brand-logo { height: 1.4em; width: auto; display: block; }
/* 워드마크 ClassQuiz — 로고와 같은 색 분리(CLASS 남색 / QUIZ 보라) + 첫 대문자 강조 */
.cq-c { color: #242448; }
.cq-q { color: #8448FC; }
.cq-cap { font-weight: 900; font-size: 1.12em; letter-spacing: -0.02em; }
/* 첫 화면 H1 로고 + 텍스트 가운데 정렬 */
.brand-h1 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-links { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }
/* 상단 학급·담임 프로필 */
.brand-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.profile-chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm);
  padding: 4px 14px 4px 4px; font-weight: 800; font-size: 14px; max-width: 280px;
}
.profile-chip .profile-img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex: none; }
.profile-chip .profile-img.hidden { display: none; }
.profile-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-preview { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 2px solid var(--border); }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.spacer { flex: 1; }

label { display: block; font-weight: 600; margin: 4px 0 8px; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--panel);
  border: var(--line) solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  transition: box-shadow 0.1s;
}
textarea { min-height: 220px; line-height: 1.6; }
textarea:focus, input:focus { outline: none; box-shadow: var(--shadow-sm), 0 0 0 3px var(--accent); }
::placeholder { color: #9A968E; }

button {
  background: var(--accent);
  color: var(--accent-fg);
  border: var(--line) solid var(--border);
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s, transform 0.06s, box-shadow 0.06s;
}
button:hover { background: var(--accent-hover); }
button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 #111; } /* 눌리며 그림자 흡수 */
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
/* 보조 버튼 = 흰 배경 + 검은 테두리(포인트 옐로는 주요 행동에) */
button.ghost { background: #fff; border: var(--line) solid var(--border); color: var(--text); }
button.ghost:hover { background: var(--panel-2); }
button.big { font-size: 17px; padding: 14px 24px; }
/* 첫 화면 앱 설치/공유 버튼 — 아래 '퀴즈 만들기/진행하기'(약 224px)와 폭 맞춤 */
button.app-cta { min-width: 224px; }
button.huge {
  width: 100%;
  font-size: 28px;
  padding: 24px 28px;
  border-radius: 10px;
  letter-spacing: 2px;
  font-family: var(--font-label);
  box-shadow: var(--shadow);
}
button.huge:active { transform: translate(4px, 4px); box-shadow: 0 0 0 #111; }

/* 마이크로 라벨 칩 — 두꺼운 검은 테두리 */
.pill {
  display: inline-flex; align-items: center;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* ---- 문제 미리보기(정답 체크) ---- */
.qprev {
  border: var(--line) solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.qprev .qtitle { font-weight: 800; font-size: 17px; margin-bottom: 12px; letter-spacing: -0.01em; }
.qprev .qtitle .num {
  display: inline-block; min-width: 26px; height: 26px; line-height: 24px;
  text-align: center; background: var(--accent); color: #111; border: 2px solid #111; border-radius: 6px;
  margin-right: 8px; font-size: 14px;
}
.opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.opt:hover { background: rgba(255,255,255,0.04); }
.opt input { width: 18px; height: 18px; accent-color: var(--green); }
.opt.correct { background: rgba(31, 154, 90, 0.16); box-shadow: inset 3px 0 0 var(--green); }
.opt.survey { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 12px; color: var(--muted); }
.opt.survey input { accent-color: var(--accent); }
.opt.is-survey { background: rgba(255, 216, 77, 0.12); color: var(--text); }
.opt .oi {
  display: inline-flex; width: 24px; height: 24px; align-items: center;
  justify-content: center; border-radius: 6px; background: var(--accent); color: #111;
  border: 2px solid var(--border); font-size: 13px; font-weight: 700;
}

/* ---- QR / 로비 ---- */
.qrbox { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.qrbox img { width: 220px; height: 220px; border-radius: 10px; background: #fff; padding: 8px; }
.pin-display { font-size: 46px; font-weight: 800; letter-spacing: 6px; }
.playerchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  background: #fff; border: 2px solid var(--border);
  border-radius: 6px; padding: 5px 12px; font-weight: 700;
}

/* ---- 실시간 문제 화면 (멘티미터형 막대) ---- */
.qbig { font-size: 26px; font-weight: 800; margin-bottom: 18px; }
.choices { display: flex; flex-direction: column; gap: 12px; }

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: var(--line) solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow: hidden;
  cursor: pointer;
  min-height: 62px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
.choice:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #111; }
.choice.disabled { cursor: default; }
.choice.disabled:hover { transform: none; box-shadow: var(--shadow-sm); }
.choice.picked { background: #FFF7D6; box-shadow: var(--shadow); }

/* 번호 배지 */
.choice .badge {
  position: relative; z-index: 2;
  display: inline-flex; width: 34px; height: 34px; flex: none;
  align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 800; font-size: 16px;
  background: var(--accent); color: #111; border: 2px solid #111;
}
.choice .label { position: relative; z-index: 2; font-size: 18px; font-weight: 600; }
.choice .cnt {
  position: relative; z-index: 2; margin-left: auto;
  font-weight: 800; font-size: 16px; color: var(--text);
  min-width: 70px; text-align: right;
}

/* 반투명 누적 막대: 번호 배지 바로 우측(=배지 폭+패딩)부터 시작 */
.choice .bar {
  position: absolute;
  top: 0; bottom: 0;
  left: 68px;               /* 패딩(18) + 배지(34) + 간격 근사 */
  width: 0%;
  z-index: 1;
  transition: width 0.5s ease;
  border-radius: 6px;
}
.choice .bar.wrong { background: rgba(229, 72, 46, 0.30); }    /* 오답 */
.choice .bar.right { background: rgba(31, 154, 90, 0.32); }    /* 정답 */
.choice .bar.neutral { background: rgba(17, 17, 17, 0.12); }   /* 공개 전 */
.choice.answerline .label::after { content: " ✓"; color: var(--green); font-weight: 900; }

.statusbar { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; flex-wrap: wrap; }

/* QR 버튼 + 팝업 */
.qr-btn { padding: 8px 14px; font-size: 14px; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 23, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 14px; padding: 26px; text-align: center;
  box-shadow: var(--shadow); max-width: 92vw;
}
.qr-large {
  width: min(72vw, 420px); height: min(72vw, 420px);
  background: #fff; padding: 12px; border-radius: 14px;
}

/* 새 버전 안내 팝업 */
.update-modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 6, 23, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.update-modal {
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 12px; padding: 22px; max-width: min(92vw, 440px);
  box-shadow: var(--shadow);
}
.update-title { font-weight: 800; font-size: 18px; margin-bottom: 12px; color: var(--text); }
.update-notes { margin: 0 0 12px; padding-left: 20px; }
.update-notes li { margin: 6px 0; line-height: 1.55; color: var(--text); }
.update-hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.update-actions { display: flex; gap: 10px; justify-content: flex-end; }
.update-actions button { padding: 10px 16px; font-size: 15px; font-weight: 700; border-radius: 10px; }
.update-keep { background: transparent; border: 2px solid var(--border); color: var(--text); }
.update-keep:hover { background: var(--panel-2); }
.update-go { background: var(--accent); border: 2px solid #111; color: #111; box-shadow: var(--shadow-sm); }

/* 주관식 입력 / 응답 목록 */
.text-answer {
  min-height: 120px; margin-bottom: 12px;
}
.submit-btn { width: 100%; margin-top: 4px; }
.text-list { display: flex; flex-direction: column; gap: 8px; }
.text-item {
  background: var(--panel-2); border: 2px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 10px 14px; font-size: 16px; word-break: break-word;
}

/* 응답 유형 선택 + 주관식 정답 입력 */
.typerow { display: flex; align-items: center; gap: 8px; margin: 8px 0 10px; flex-wrap: wrap; }
.ansrow { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.ansrow .ansinput {
  flex: 1; background: var(--panel); color: var(--text);
  border: 1px solid var(--green); border-radius: 8px; padding: 8px 12px; font-size: 15px; font-family: inherit;
}
.typesel {
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 15px; font-family: inherit; font-weight: 600;
}

/* 재시도·오답감점 설정 (퀴즈 편집) */
.retry-row {
  margin-top: 14px; padding: 12px 14px;
  background: var(--panel); border: 2px solid var(--border); border-radius: 10px;
}
.retry-row #retrySel {
  background: var(--bg); color: var(--text);
  border: 2px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 15px; font-family: inherit; font-weight: 600;
}

/* 재접속용 PIN (진행 화면 상단 상시 노출) */
.pin-pill {
  background: var(--accent); color: #111; border-color: #111;
  font-weight: 800; letter-spacing: 1px; font-size: 15px;
}
/* 기본 프리셋 배지 */
.pill.builtin { background: rgba(34,197,94,0.15); border-color: var(--green); color: var(--green); font-weight: 700; }

/* 보기 내부 콘텐츠(이미지+텍스트) 래퍼 — 막대 위에 표시 */
.choice .cc {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;
}
.choice-img {
  max-height: 96px; max-width: 42%; border-radius: 8px;
  object-fit: contain; background: #fff;
}

/* 문제 이미지/영상 — 화면 크기에 맞춰 자동 축소 (video에도 .qimg 적용) */
.qimg {
  display: block; max-width: 100%; max-height: 44vh;
  margin: 4px 0 16px; border-radius: 10px; object-fit: contain; background: #000;
}
img.qimg, img.qimg-sm, img.prev-img, img.choice-img, img.mini-img { background: #fff; }
.qmedia:empty { display: none; }

/* 유튜브 embed (16:9 반응형) */
.ytwrap { position: relative; width: 100%; max-width: 640px; margin: 4px 0 16px; }
.ytwrap::before { content: ''; display: block; padding-top: 56.25%; }
.ytwrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; background: #000; }
.ytwrap-choice-img { max-width: 260px; margin: 0; }
.ytwrap-prev-img { max-width: 220px; margin: 4px 0; }
.ytwrap-qimg-sm { max-width: 300px; }
video.choice-img { max-height: 120px; }
.qimg-sm { display: block; max-width: 100%; max-height: 26vh; margin: 6px 0 10px; border-radius: 10px; object-fit: contain; background: #fff; }
.prev-img { max-height: 60px; max-width: 120px; border-radius: 6px; object-fit: contain; background: #fff; }
.mini-img { height: 28px; max-width: 60px; vertical-align: middle; border-radius: 4px; object-fit: contain; background: #fff; }

/* 모드 선택 (퀴즈 / 설문) */
.mode-select { display: flex; gap: 12px; margin-bottom: 16px; }
.mode-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 10px;
  padding: 16px; font-size: 18px; font-weight: 800;
}
.mode-btn small { font-size: 12px; font-weight: 600; color: var(--muted); }
.mode-btn:hover { background: var(--panel-2); }
.mode-btn.active {
  border-color: #111; background: var(--accent); color: #111;
  box-shadow: var(--shadow-sm);
}
.mode-btn.active small { color: #111; }

/* 진행 방식 선택 토글 (설문 로비) */
.pacing { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: var(--panel-2); color: var(--text);
  border: 2px solid var(--border); border-radius: 10px;
  padding: 8px 16px; font-size: 15px; font-weight: 800;
}
.seg small { font-size: 11px; font-weight: 600; color: var(--muted); }
.seg.active { border-color: #111; background: var(--accent); color: #111; box-shadow: var(--shadow-sm); }
.seg.active small { color: #111; }

/* 순서 맞히기 (편집 배치 토글 + 참여자 드래그) */
.seg-group { display: inline-flex; gap: 6px; }
.seg.lay { flex-direction: row; align-items: center; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.order-list { display: flex; gap: 8px; margin-bottom: 12px; }
.order-list.order-v { flex-direction: column; }
.order-list.order-h { flex-direction: row; flex-wrap: wrap; }
.order-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 10px;
  padding: 12px 14px; cursor: grab; user-select: none; -webkit-user-select: none;
}
.order-list.order-h .order-item { flex-direction: column; min-width: 96px; text-align: center; cursor: grab; }
.order-item.dragging { opacity: 0.9; box-shadow: var(--shadow); border-color: var(--accent); cursor: grabbing; }
.order-item .cc { flex: 1; display: flex; align-items: center; gap: 8px; }
.order-pos {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #111; font-weight: 800; font-size: 14px; flex: none;
}
.drag-handle { color: var(--muted); font-size: 16px; letter-spacing: -4px; flex: none; }
.order-item.result { cursor: default; }
.order-item.result.right { border-color: var(--green); background: rgba(22, 163, 74, 0.10); }
.order-item.result.wrong { border-color: var(--orange); background: rgba(234, 88, 12, 0.08); }
.order-item .order-mark { font-weight: 800; flex: none; }
.order-item.result.right .order-mark { color: var(--green); }
.order-item.result.wrong .order-mark { color: var(--orange); }

/* 짝 맞추기 (매칭) */
.danger { color: #dc2626; }
.match-prev { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.match-prev .mp-a, .match-prev .mp-b { font-weight: 600; }
.mp-eq { color: var(--muted); font-weight: 700; }
.mp-correct { color: var(--green); font-weight: 700; }
.match-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.match-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.match-row .a-slot { flex: 1; min-height: 42px; display: flex; align-items: center; }
.match-row .b-anchor { flex: 1; font-weight: 700; color: var(--text); }
.a-chip {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--panel); border: 1.5px solid var(--accent); border-radius: 10px;
  padding: 8px 12px; cursor: grab; user-select: none; -webkit-user-select: none;
}
.a-chip.dragging { opacity: 0.9; box-shadow: var(--shadow); cursor: grabbing; }
.match-row.drop-target { border-color: var(--accent); background: rgba(255, 216, 77, 0.12); }
.match-row.result { cursor: default; }
.match-row.result .a-slot { justify-content: flex-start; }
.match-row.result.right { border-color: var(--green); background: rgba(22, 163, 74, 0.10); }
.match-row.result.wrong { border-color: var(--orange); background: rgba(234, 88, 12, 0.08); }
.match-row .order-mark { font-weight: 800; flex: none; }
.match-row.result.right .order-mark { color: var(--green); }
.match-row.result.wrong .order-mark { color: var(--orange); }

/* 설문 모드 읽기전용 보기 */
.opt.readonly { cursor: default; }
.opt.readonly:hover { background: transparent; }

/* 진행 중이던 방 안내 배너 */
.resume-banner { border-left: 4px solid var(--accent); background: rgba(255, 216, 77, 0.06); }

/* 저장된 퀴즈 라이브러리 */
.lib-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 2px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; background: #fff;
}
.lib-meta { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.lib-title { font-weight: 800; font-size: 16px; }
.lib-actions { display: flex; gap: 8px; }
.lib-actions button { padding: 8px 14px; font-size: 14px; }
.lib-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lib-controls button { padding: 8px 14px; font-size: 14px; }

/* 수행평가 메타(과목·학급) 입력 */
.meta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.meta-field { display: flex; flex-direction: column; gap: 4px; }
.meta-field.grow { flex: 1; min-width: 160px; }
.meta-field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.meta-field select, .meta-field input {
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 15px; font-family: inherit;
}
.dash-link {
  display: inline-block; text-decoration: none; font-weight: 800; color: #111;
  border: 2px solid var(--border); border-radius: 8px; padding: 8px 14px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.dash-link:hover { background: var(--accent); }

/* 대시보드 */
.dash-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.dash-stats { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dash-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 2px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fff;
}
.dash-meta { flex: 1; min-width: 0; }
.dash-title { font-weight: 800; font-size: 16px; }
.dash-sub { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.dash-actions { display: flex; gap: 8px; }
.dash-actions button { padding: 8px 12px; font-size: 14px; }
.stu-runs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.detail-box { text-align: left; max-width: min(94vw, 720px); max-height: 86vh; overflow: auto; }
.detail-box h3 { margin: 10px 0 6px; }

/* 사용 안내(도움말) */
.guide-box { text-align: left; max-width: min(94vw, 760px); max-height: 88vh; overflow: auto; }
.guide-box details {
  border: 2px solid var(--border); border-radius: 10px; margin: 8px 0; background: var(--panel-2);
}
.guide-box summary {
  cursor: pointer; padding: 12px 14px; font-weight: 800; font-size: 15px; list-style: none;
}
.guide-box summary::-webkit-details-marker { display: none; }
.guide-box summary::before { content: '▸ '; color: #111; }
.guide-box details[open] > summary::before { content: '▾ '; }
.guide-box details[open] > summary { border-bottom: 1px solid var(--border); }
.guide-box details > ul, .guide-box details > ol { margin: 10px 0; padding: 0 18px 4px 34px; }
.guide-box li { margin: 5px 0; line-height: 1.6; }
.guide-box code { background: var(--panel); border: 2px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
button.mini { padding: 3px 8px; font-size: 13px; }
.ai-fb { font-size: 14px; line-height: 1.6; }
.ai-fb:not(:empty) {
  background: rgba(255, 216, 77, 0.06); border: 2px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin: 6px 0 10px;
}

/* 🤖 AI로 만들기 */
.ai-panel {
  border: 1px solid var(--accent); border-radius: 10px; padding: 14px;
  margin: 4px 0 16px; background: rgba(255, 216, 77, 0.06);
}
.ai-head { font-weight: 800; margin-bottom: 10px; }
.ai-head .muted { font-weight: 400; font-size: 13px; display: block; margin-top: 2px; }
.ai-prompt {
  width: 100%; min-height: 64px; resize: vertical; box-sizing: border-box;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-family: inherit;
}
.ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ai-file-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--panel); border: 2px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-weight: 700; font-size: 14px;
}
.ai-file-btn:hover { background: var(--panel-2); }
.ai-file-hint { font-size: 12px; }
.ai-filelist { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.ai-thumb { position: relative; display: flex; align-items: center; gap: 8px; border: 2px solid var(--border); border-radius: 8px; padding: 6px 26px 6px 6px; background: var(--panel); max-width: 220px; }
.ai-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex: none; }
.ai-thumb-doc { width: 44px; height: 44px; display: grid; place-items: center; font-size: 24px; flex: none; }
.ai-thumb-name { font-size: 12px; font-weight: 600; line-height: 1.25; word-break: break-all; }
.ai-thumb-x { position: absolute; top: 2px; right: 2px; background: transparent; border: none; box-shadow: none; padding: 2px 5px; margin: 0; font-size: 12px; color: var(--muted); cursor: pointer; line-height: 1; }
.ai-thumb-x:hover { color: var(--orange); background: transparent; box-shadow: none; transform: none; }
.ai-file-count { font-size: 12px; }
.ai-panel.drag { outline: 3px dashed var(--accent); outline-offset: 4px; background: rgba(255, 216, 77, 0.16); }
.ai-guide { margin: 6px 0; }
.ai-guide > summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.ai-guide textarea { min-height: 52px; margin-top: 6px; }
.ai-guide-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.ai-status { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.ai-loading::after { content: '…'; animation: aidot 1.2s steps(4) infinite; }
@keyframes aidot { 0% { opacity: .4 } 50% { opacity: 1 } 100% { opacity: .4 } }
button.danger { color: #dc2626; border-color: #fecaca; }
button.danger:hover { background: #fef2f2; }

/* 입력 안내 정보 박스 */
.infobox {
  background: var(--panel-2); border: 2px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
}
.infobox-title { font-weight: 800; margin-bottom: 8px; }
.infobox ul { margin: 0; padding-left: 20px; }
.infobox li { margin: 4px 0; line-height: 1.55; }
.infobox code {
  background: #26231C; color: #FFD84D; font-weight: 600;
  border: 1px solid #111; border-radius: 5px; padding: 1px 6px; font-size: 13px;
  font-family: "Consolas", "D2Coding", monospace;
}

/* ---- 최종 대시보드 차트 ---- */
.q-summary { margin-bottom: 22px; }
.q-summary .qhead { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.dist-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.dist-row .dlabel { width: 40%; font-size: 15px; }
.dist-track {
  flex: 1; height: 26px; background: var(--panel-2);
  border-radius: 6px; overflow: hidden; position: relative; border: 2px solid var(--border);
}
.dist-fill { height: 100%; transition: width 0.6s ease; }
.dist-fill.right { background: var(--green); }
.dist-fill.wrong { background: var(--orange); }
.dist-cnt { width: 90px; text-align: right; font-weight: 700; font-size: 14px; }
.tag-you {
  display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 800;
  background: var(--accent); border-radius: 6px; padding: 1px 7px; color: #fff;
}
.tag-ans {
  display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 800;
  background: var(--green); border-radius: 6px; padding: 1px 7px; color: #06210f;
}
.tag-survey {
  display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 800;
  background: var(--accent); border-radius: 6px; padding: 1px 7px; color: #fff;
}

.scoreline { font-size: 40px; font-weight: 800; }
.lead-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.lead-row .rank { width: 32px; font-weight: 800; color: var(--muted); }
.lead-row.me { background: rgba(255,216,77,0.15); border-radius: 8px; }
.lead-row .lscore { margin-left: auto; font-weight: 800; }

/* ---- 참여자 상단 컨텍스트 헤더 ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 10px; padding: 10px 16px; margin-bottom: 12px;
}
.topbar .tb-room { font-weight: 800; font-size: 17px; }
.topbar .tb-me { color: var(--muted); font-weight: 700; }

/* ---- 진행 단계 스텝퍼 ---- */
.stepper { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stepper .step {
  flex: 1; min-width: 70px; text-align: center;
  padding: 8px 6px; border-radius: 8px; font-size: 13px; font-weight: 700;
  background: #fff; border: 2px solid var(--border); color: var(--muted);
}
.stepper .step.active {
  background: var(--accent); border-color: #111; color: #111;
}

/* 각 단계 카드 상단 라벨 */
.stage-tag {
  display: inline-block; font-family: var(--font-label); text-transform: uppercase;
  font-size: 12px; font-weight: 800; letter-spacing: 0.1em;
  color: #111; background: var(--accent);
  border: 2px solid #111; border-radius: 6px;
  padding: 3px 10px; margin-bottom: 14px;
}

/* 입장 전 방 이름 확인 배너 */
.peek {
  border-radius: 10px; padding: 12px 14px; margin: 8px 0 6px;
  font-weight: 700; font-size: 16px;
}
.peek.ok { background: rgba(34,197,94,0.12); border: 1px solid var(--green); color: #166534; }
.peek.bad { background: rgba(249,115,22,0.12); border: 1px solid var(--orange); color: #9a3412; font-weight: 600; }

/* 로비 QR 옆 방 이름 크게 */
.roomname-big { font-size: 24px; font-weight: 800; margin-bottom: 12px; color: var(--text); }

/* 대기 애니메이션 */
.waiting-dots { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.waiting-dots span {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  animation: bounce 1.2s infinite ease-in-out;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-8px); } }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 2px solid var(--border);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow);
  z-index: 50; font-weight: 600;
}

/* ============ 타이머(제한시간) ============ */
.timer-wrap {
  position: relative; height: 24px; margin: 2px 0 14px;
  background: var(--panel-2, #eee); border: 2.5px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.timer-bar {
  height: 100%; width: 100%;
  background: var(--green);
  transition: width 0.2s linear, background 0.35s;
  will-change: width;
}
.timer-bar.warn { background: #E7A200; }        /* 절반 이하 */
.timer-bar.crit { background: var(--orange); }   /* 20% 이하 */
.timer-wrap.crit { animation: timerPulse 0.7s ease-in-out infinite; }
@keyframes timerPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,46,0); } 50% { box-shadow: 0 0 0 3px rgba(229,72,46,0.5); } }
.timer-num {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-label); font-weight: 700; font-size: 14px; color: #111;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
/* 페이드 연출: 입력창이 점점 흐려짐 */
.choices { transition: opacity 0.25s linear; }

/* 긴장 연출(비네트) — 화면 가장자리가 좁혀오며 붉어짐 */
.tension-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  opacity: 0; /* 배경·opacity 는 timer.js 가 직접 제어 */
  transition: opacity 0.12s linear;
}
.tension-overlay.beat { animation: tensionBeat 0.6s ease-in-out infinite; }
@keyframes tensionBeat {
  0%,100% { box-shadow: inset 0 0 70px 12px rgba(240,40,20,0.28); }
  50% { box-shadow: inset 0 0 150px 60px rgba(240,40,20,0.62); }
}

/* ============ 설정 모달 ============ */
.settings-box { text-align: left; width: min(94vw, 470px); max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.set-group { border-top: 2px dashed var(--border); padding-top: 14px; margin-top: 14px; }
.set-group:first-of-type { border-top: none; padding-top: 0; margin-top: 6px; }
.set-group h3 { margin: 0 0 8px; font-size: 16px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; }
.set-row input[type="range"] { width: 150px; }
#sndSub { padding-left: 4px; }
#sndSub.off { opacity: 0.4; pointer-events: none; }
.time-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.time-chips .seg { flex-direction: row; align-items: center; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.time-custom { gap: 6px; }
.time-custom input { width: 62px; padding: 4px 6px; font-size: 14px; }
.style-opts { display: flex; flex-direction: column; gap: 8px; }
.style-opt {
  display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; align-items: center;
  border: 2px solid var(--border); border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.style-opt small { grid-column: 2; color: var(--muted); font-size: 12px; }
.style-opt:has(input:checked) { background: var(--accent); box-shadow: var(--shadow-sm); }
.style-opt:has(input:checked) small { color: #111; }
.subj-add { display: flex; gap: 8px; margin-bottom: 10px; }
.subj-add input { flex: 1; padding: 8px 10px; font-size: 14px; }
.subj-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.subj-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2, #f2f0e9); border: 2px solid var(--border); border-radius: 999px; padding: 5px 6px 5px 12px; font-weight: 700; font-size: 14px; }
.subj-x { background: transparent; border: none; box-shadow: none; padding: 0 4px; margin: 0; font-size: 13px; color: var(--muted); cursor: pointer; line-height: 1; }
.subj-x:hover { color: var(--orange); background: transparent; box-shadow: none; transform: none; }
/* 번호로 입장 — 설정의 범위 편집 */
.range-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.range-row input { width: 84px; padding: 8px 10px; font-size: 15px; text-align: center; }
#entryBody.off { opacity: 0.4; pointer-events: none; }
/* 참여자 번호 선택 그리드 */
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; margin-top: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.num-btn { background: #fff; color: var(--text); border: var(--line) solid var(--border); padding: 12px 0; font-family: var(--font-label); font-weight: 700; font-size: 18px; }
.num-btn.sel { background: var(--accent); color: #111; box-shadow: var(--shadow); }
.num-btn:disabled { opacity: 0.32; text-decoration: line-through; cursor: not-allowed; }
/* 팀 나누기 — 설정 편집 */
.team-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.team-row input[type="text"] { flex: 1; min-width: 84px; padding: 8px 10px; font-size: 14px; }
.team-row .team-nums { flex: 1.7; min-width: 140px; }
#teamBody.off { opacity: 0.4; pointer-events: none; }
/* 참여자 팀 선택 */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.team-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fff; color: var(--text); border: var(--line) solid var(--border); padding: 14px 8px; font-weight: 800; font-size: 16px; }
.team-btn.sel { background: var(--accent); color: #111; box-shadow: var(--shadow); }
.team-cnt { font-size: 12px; font-weight: 600; color: var(--muted); }
.team-btn.sel .team-cnt { color: #111; }
/* 배정 모드 번호 그리드(팀별 그룹) */
.number-grid.grouped { display: block; max-height: 52vh; overflow-y: auto; }
.numgrp { margin-bottom: 12px; }
.numgrp-title { font-family: var(--font-label); font-weight: 800; margin: 4px 0 6px; }
.numgrp-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
/* 팀 순위(결과) */
.team-lead { background: rgba(255, 216, 77, 0.14); }
/* 언어 선택 바 */
.lang-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 6px; }
/* 진행자: 같은 줄에 [가운데 프로필] [오른쪽 언어] */
.lang-bar.has-center { display: grid; grid-template-columns: 1fr auto 1fr; }
.lang-bar.has-center #profileChip { grid-column: 2; justify-self: center; }
.lang-bar.has-center .lb-lang { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 8px; }
.lang-bar label { font-family: var(--font-label); font-weight: 700; font-size: 14px; }
.lang-bar select { padding: 6px 10px; border: var(--line) solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow-sm); }
/* 진행 화면 응답 카운터 — 멀리서도 보이게 크게(약 3배) */
#respCount {
  font-family: var(--font-label); font-size: clamp(24px, 5vw, 34px); font-weight: 800;
  padding: 6px 20px; background: var(--accent); color: #111;
  border: var(--line) solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
  line-height: 1.1;
}
