/* ============================================================
   너도? 나도! — 스타일
   메인 컬러: 네이비 #22315C · 옐로 #FFC93C · 아이보리 #FAF6EC
   포인트: 코랄 #FF7B6B · 민트 #7FD8C8
   ============================================================ */

/* 학교안심 포스터 웹폰트 */
@font-face {
  font-family: 'Hakgyo Ansim Poster';
  src: url('assets/fonts/HakgyoansimPosterB.woff2') format('woff2'),
       url('assets/fonts/HakgyoansimPosterB.woff') format('woff');
  font-weight: 700;
  font-style: normal;
}

:root {
  /* 폰트 패밀리 */
  --font-logo: 'Hakgyo Ansim Poster', 'IBM Plex Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'IBM Plex Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;

  /* 실제 보이는 화면 높이. script.js가 잰 값으로 덮어쓴다.
     (JS 전에는 vh를 쓰지만, 첫 그림 직전에 바로 실측값으로 바뀐다) */
  --app-h: 100vh;
  --vh1: calc(var(--app-h) / 100);

  --navy: #22315C;
  --navy-deep: #1A2547;
  --yellow: #FFC93C;
  --yellow-deep: #F5B90F;
  --ivory: #FAF6EC;
  --coral: #FF7B6B;
  --mint: #7FD8C8;
  --white: #FFFFFF;
  --text: #22315C;
  --text-soft: #6B7390;
  --shadow: 0 6px 20px rgba(34, 49, 92, 0.12);
  --shadow-soft: 0 3px 10px rgba(34, 49, 92, 0.08);
  --radius: 20px;
  --app-max: 480px;   /* 화면 크기에 따라 아래 반응형 규칙에서 넓어진다 */
}

/* ───────── 카드 더미 색 (모드) ─────────
   --deck      : 큰 면적·굵은 선에 쓰는 원색
   --deck-deep : 흰 배경 위 글자·작은 태그 배경 (명도 대비 확보용)
   --deck-soft : 카드 바탕에 까는 아주 옅은 색                        */
.deck-green {
  --deck: #26A26C;
  --deck-deep: #14764A;
  --deck-soft: #E4F5EC;
  --deck-line: rgba(38, 162, 108, 0.45);
}
.deck-red {
  --deck: #E44B3E;
  --deck-deep: #C1362A;
  --deck-soft: #FCE9E7;
  --deck-line: rgba(228, 75, 62, 0.45);
}
.deck-keyword {
  --deck: #3D7BD0;
  --deck-deep: #2A5AA8;
  --deck-soft: #E8F0FB;
  --deck-line: rgba(61, 123, 208, 0.45);
}

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

html { -webkit-text-size-adjust: 100%; }

html, body {
  height: 100%;
  /* 페이지 스크롤을 아예 없앤다. 스크롤이 필요한 내용은 각 화면 안쪽 영역이 맡는다.
     이래야 화면이 흔들리거나 당겨서 새로고침되는 일이 없다. */
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--ivory);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  /* 한글 줄바꿈을 단어 단위로 (모든 요소에 상속) */
  word-break: keep-all;
  overflow-wrap: break-word;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: var(--app-max);
  margin: 0 auto;
  height: var(--app-h);
  overflow: hidden;
  position: relative;
}

.hidden { display: none !important; }

/* ───────── 화면 공통 ───────── */
.screen {
  display: none;
  height: var(--app-h);
  min-height: 0;
  flex-direction: column;
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
}
.screen.active { display: flex; }

/* ───────── 버튼 공통 ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 1.02rem;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-big { width: 100%; min-height: 54px; font-size: 1.08rem; }
.btn-primary {
  background: var(--yellow);
  color: var(--navy);
  box-shadow: 0 4px 0 var(--yellow-deep);
}
.btn-primary:active { box-shadow: 0 1px 0 var(--yellow-deep); }
.btn-navy {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 4px 0 var(--navy-deep);
}
.btn-navy:active { box-shadow: 0 1px 0 var(--navy-deep); }
.btn-ghost {
  background: var(--white);
  color: var(--navy);
  border: 2px solid rgba(34, 49, 92, 0.15);
}
.btn-nav {
  flex: 1;
  background: var(--white);
  color: var(--navy);
  border: 2px solid rgba(34, 49, 92, 0.15);
}
.btn-nav.btn-primary { border: none; }
.btn-nav:disabled { opacity: 0.35; pointer-events: none; }

.icon-btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: var(--navy);
  background: rgba(34, 49, 92, 0.08);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn-placeholder { background: none; box-shadow: none; pointer-events: none; }

.btn:disabled { opacity: 0.4; box-shadow: none; pointer-events: none; }

/* 작은 보조 버튼 (전체 선택/해제 등) */
.mini-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.14);
  box-shadow: var(--shadow-soft);
  font-size: 0.79rem;
  font-weight: 800;
  color: var(--navy);
}
.mini-btn:active { transform: scale(0.95); }

/* ═══════════ 시작 화면 ═══════════ */
#screen-start {
  /* 세로 간격을 변수로 관리 — 화면 높이(--vh1)에 따라 자연스럽게 줄어든다 */
  --gap-logo-tagline: clamp(6px, calc(var(--vh1) * 1.2), 10px);   /* 로고 ↔ 부제 */
  --gap-tagline-illust: clamp(10px, calc(var(--vh1) * 3), 26px);  /* 부제 ↔ 캐릭터 */
  --gap-section: clamp(14px, calc(var(--vh1) * 4.5), 44px);       /* 브랜드 ↔ 하단 영역 */
  justify-content: center;
  gap: var(--gap-section);
  padding-top: max(22px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  /* 그래도 넘치면 위가 잘리는 대신 스크롤되게 (auto 마진 덕에 평소엔 가운데 정렬) */
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: auto;
}
.logo {
  font-family: var(--font-logo);
  font-size: clamp(2.3rem, 12vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.logo-word { display: inline-block; }
.logo-accent {
  color: var(--yellow);
  text-shadow:
    -2px -2px 0 var(--navy), 2px -2px 0 var(--navy),
    -2px 2px 0 var(--navy), 2px 2px 0 var(--navy),
    0 4px 0 var(--navy);
  transform: rotate(2deg);
}
.tagline {
  margin-top: var(--gap-logo-tagline);
  font-size: 1.05rem;
  color: var(--text-soft);
  font-weight: 500;
}
.start-illust {
  width: min(52vw, 210px);
  height: auto;
  /* 낮은 화면에서는 그림 높이도 함께 줄어든다 (비율은 contain이 지켜준다) */
  max-height: clamp(84px, calc(var(--vh1) * 22), 220px);
  object-fit: contain;
  margin-top: var(--gap-tagline-illust);
}

/* 하단 영역: 소개 문구/진행 카드 + 버튼 묶음 */
.start-bottom {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: auto;
}

/* 진행 카드·답지 카드가 보이면(하단이 길어지면) 휴대폰에서는
   브랜드 영역의 간격과 그림을 조금 접어 로고가 위로 밀리지 않게 한다 */
@media (max-height: 760px) {
  #screen-start:has(.swipe-wrap:not(.hidden)) {
    --gap-tagline-illust: clamp(8px, calc(var(--vh1) * 2), 18px);
    --gap-section: clamp(12px, calc(var(--vh1) * 3.2), 32px);
  }
  #screen-start:has(.swipe-wrap:not(.hidden)) .start-illust {
    max-height: clamp(72px, calc(var(--vh1) * 16), 180px);
  }
  /* 진행 카드와 답지 카드가 동시에 보이는 드문 경우: 그림을 더 줄인다 */
  #screen-start:has(#resume-swipe:not(.hidden)):has(#answer-swipe:not(.hidden)) .start-illust {
    max-height: clamp(56px, calc(var(--vh1) * 11), 130px);
  }
}

/* 진행 기록 없음: 소개 문구 */
.start-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding-bottom: 4px;
}
.start-intro strong {
  font-size: 1.28rem;
  font-weight: 900;
  padding: 0 5px;
  background: linear-gradient(transparent 62%, rgba(255, 201, 60, 0.55) 62%);
}
.start-intro p {
  font-size: 0.94rem;
  color: var(--text-soft);
  font-weight: 600;
  line-height: 1.5;
}

/* 카드 스와이프 삭제: 카드를 왼쪽으로 밀면 뒤에 깔린 빨간 삭제 버튼이 드러난다 */
.swipe-wrap { position: relative; }
.swipe-under {
  position: absolute;
  inset: 2px;   /* 카드보다 살짝 작게 깔아서 닫혀 있을 때 가장자리가 비치지 않게 */
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 24px 0 0;
  border: 0;
  border-radius: 18px;
  background: #E44B3E;
  color: var(--white);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  pointer-events: none;              /* 닫혀 있을 땐 눌리지 않는다 */
  /* 닫혀 있을 땐 아예 투명하게 — 카드의 반투명 테두리·둥근 모서리 틈으로 비치지 않게 */
  opacity: 0;
  transition: opacity 0.2s ease;
}
.swipe-wrap.swipe-open .swipe-under,
.swipe-wrap.swipe-dragging .swipe-under {
  opacity: 1;
  transition: none;   /* 끌기 시작하면 바로 보인다 */
}
.swipe-wrap.swipe-open .swipe-under { pointer-events: auto; }
.swipe-under:active { background: #C1362A; }
.swipe-under svg { width: 18px; height: 18px; }
.swipe-target {
  position: relative;
  touch-action: pan-y;   /* 세로 스크롤은 브라우저에, 가로 끌기는 스크립트가 맡는다 */
}
.swipe-target.swipe-anim { transition: transform 0.25s ease; }

/* 진행 중인 게임 카드 (탭하면 바로 이어하기) */
.resume-card {
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.resume-card:active { transform: scale(0.98); }
.resume-card:hover, .resume-card:focus-visible { border-color: rgba(34, 49, 92, 0.3); }
.resume-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.resume-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-soft);
  flex-shrink: 0;
}
.resume-label svg { width: 13px; height: 13px; color: var(--coral); }
.resume-tag {
  align-self: flex-start;
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--navy);
  background: rgba(255, 201, 60, 0.42);
  padding: 3px 9px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resume-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.resume-main { font-size: 1.14rem; font-weight: 800; }
.resume-main em {
  font-style: normal;
  font-weight: 900;
  color: var(--coral);
}
.resume-count {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  flex-shrink: 0;
}
.resume-count strong { color: var(--navy); font-weight: 800; }
.resume-bar {
  height: 8px;
  background: rgba(34, 49, 92, 0.09);
  border-radius: 999px;
  overflow: hidden;
}
.resume-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* 버튼 영역 */
.start-buttons { display: flex; flex-direction: column; gap: 13px; }
.btn-cta { width: 100%; min-height: 56px; font-size: 1.12rem; }
.btn-outline {
  background: var(--white);
  color: var(--navy);
  border: 2px solid rgba(34, 49, 92, 0.35);
}
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }
.btn-sub { min-height: 50px; gap: 8px; font-size: 0.96rem; }
.btn-sub svg { width: 19px; height: 19px; flex-shrink: 0; }

/* ═══════════ 문제 카드 화면 ═══════════ */
#screen-game { gap: 14px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}
.progress-label {
  font-size: 1.05rem;
  color: var(--text-soft);
  font-weight: 600;
}
.progress-label strong { color: var(--navy); font-size: 1.2rem; }
.progress-sep { margin: 0 4px; }

.card-area {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
  perspective: 1000px;
}

.question-card {
  flex: 1;
  background: var(--white);
  border-radius: 26px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(34, 49, 92, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  padding: 28px 22px;
  position: relative;
  overflow: hidden;
}
.question-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--yellow) 0%, var(--coral) 50%, var(--mint) 100%);
}
/* 더미 색을 입은 주제 카드 */
.question-card.deck-green,
.question-card.deck-red,
.question-card.deck-keyword {
  background: var(--deck-soft);
  border-color: var(--deck-line);
}
.question-card.deck-green::before,
.question-card.deck-red::before,
.question-card.deck-keyword::before { background: var(--deck); }

/* 진행바도 카드 색을 따라간다 */
#screen-game.deck-green .progress-fill,
#screen-game.deck-red .progress-fill,
#screen-game.deck-keyword .progress-fill { background: var(--deck); }

.card-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}
.mode-tag {
  background: var(--deck-deep);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
}
.category-tag {
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
}

.question-text {
  font-family: var(--font-logo);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.4;
  white-space: pre-line;
}
.question-text.q-long { font-size: 1.85rem; }
.question-text.q-longer { font-size: 1.55rem; }

/* 제시어 모드 카드: 단어 하나를 크게 + 작은 안내 + 카테고리 대표 일러스트 */
.question-card.is-keyword { gap: 14px; }
.question-card.is-keyword .question-text {
  font-size: clamp(3rem, 15vw, 5rem);
  font-weight: 900;
  line-height: 1.2;
}
.keyword-guide {
  font-family: var(--font-logo);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-soft);
}
/* 큰 제시어와 함께 두므로 그림은 살짝 작게 */
.question-card.is-keyword .question-illust { width: min(40vw, 170px); }

.question-illust {
  width: min(46vw, 190px);
  height: auto;
  max-height: 26vh;
}

/* 카드 슬라이드 애니메이션 */
@keyframes slide-in-right {
  from { transform: translateX(60px) rotate(1.5deg); opacity: 0; }
  to   { transform: translateX(0) rotate(0); opacity: 1; }
}
@keyframes slide-in-left {
  from { transform: translateX(-60px) rotate(-1.5deg); opacity: 0; }
  to   { transform: translateX(0) rotate(0); opacity: 1; }
}
.question-card.anim-next { animation: slide-in-right 0.28s ease both; }
.question-card.anim-prev { animation: slide-in-left 0.28s ease both; }

@media (prefers-reduced-motion: reduce) {
  .question-card.anim-next, .question-card.anim-prev { animation: none; }
}

.game-footer { display: flex; flex-direction: column; gap: 14px; }
.progress-track {
  height: 6px;
  background: rgba(34, 49, 92, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.nav-buttons { display: flex; gap: 12px; }

/* ─────── 타이머 (추가 규칙) ───────
   모드 선택에서 켜야 보인다. 양옆 ±30초 버튼으로
   대기 중엔 설정 시간을, 진행 중엔 남은 시간을 조절.
   대기: 흰 버튼 → 진행: 노란 막대가 줄어드는 카운트다운
   → 마지막 10초: 코랄 → 종료: "타임 오버!" */
/* 경고 색: 평소엔 옐로, 마지막 10초엔 JS가 매초 노랑→빨강으로 갱신.
   상태바(timer-fill)·버튼 테두리·전체 화면 경고막이 모두 이 변수를 따라
   똑같은 색으로 함께 물든다 */
#screen-game { --hurry-rgb: 255, 201, 60; --hurry-peak: 1; }

.timer-row { display: flex; gap: 8px; }
.timer-row .timer-btn { flex: 1; min-width: 0; }
.timer-adj {
  flex: 0 0 auto;
  min-width: 56px;
  border-radius: 14px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-soft);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.timer-adj:active { transform: scale(0.94); }
.timer-adj:disabled { opacity: 0.35; }

.timer-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 14px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.15);
  color: var(--navy);
  font-size: 0.98rem;
  font-weight: 800;
  transition: transform 0.12s ease, border-color 0.15s ease,
    min-height 0.2s ease, box-shadow 0.2s ease;
}
.timer-btn:active { transform: scale(0.98); }
.timer-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 100%;
  background: rgba(var(--hurry-rgb, 255, 201, 60), 0.5);
  display: none;
  transition: width 0.2s linear, background-color 0.3s linear;
}
/* 카운트다운 중: 버튼이 커지고 숫자가 큼직해져 멀리서도 읽힌다 */
.timer-btn.is-run {
  min-height: 64px;
  border-color: rgba(var(--hurry-rgb, 245, 185, 15), 0.85);
  box-shadow: 0 4px 16px rgba(var(--hurry-rgb, 255, 201, 60), 0.4);
}
.timer-btn.is-run .timer-fill { display: block; }
.timer-btn.is-run .timer-body { gap: 10px; }
.timer-btn.is-run #timer-text {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
}
.timer-btn.is-run svg { width: 26px; height: 26px; }
.timer-btn.is-hurry { border-color: rgba(var(--hurry-rgb, 255, 123, 107), 0.9); }
/* 박자 동기화: 초가 바뀌는 순간마다 JS가 .beat를 다시 걸어준다.
   시계 아이콘은 카운트다운 내내, 숫자 두근거림은 마지막 10초에만 */
.timer-body.beat svg { animation: timer-tick 0.4s ease; }
@keyframes timer-tick {
  0% { transform: scale(1.15) rotate(-10deg); }
  60% { transform: rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}
.timer-btn.is-hurry .timer-body.beat { animation: timer-beat 0.45s ease-out; }
@keyframes timer-beat {
  0% { transform: scale(1.16); }
  100% { transform: scale(1); }
}
/* 일시정지: 크기·남은 시간은 그대로 두고 점선 테두리 + ▶ 로 "멈춤"을 알린다
   (is-run 클래스가 유지되므로 큰 숫자·막대는 그대로다) */
.timer-btn.is-paused {
  border-style: dashed;
  border-color: rgba(34, 49, 92, 0.35);
  box-shadow: none;
}
.timer-btn.is-paused #timer-text::before { content: "▶ "; font-size: 0.62em; }
.timer-btn.is-paused .timer-fill { opacity: 0.45; }

/* 일시정지 중에만 타이머 위에 떠서 나타나는 완전 리셋 칩.
   absolute라 나타나고 사라져도 주변 레이아웃이 전혀 움직이지 않는다 */
.timer-row { position: relative; }
.timer-reset {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  min-height: 36px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow);
  animation: reset-pop 0.2s ease;
}
@keyframes reset-pop {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.timer-reset:active { transform: translate(-50%, 0) scale(0.95); }
.timer-body {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.timer-btn svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--yellow-deep); }
.timer-btn.is-over svg { color: inherit; }
.timer-btn.is-over {
  background: var(--coral);
  border-color: var(--coral);
  color: var(--white);
  animation: timer-shake 0.5s ease;
}
@keyframes timer-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 마지막 10초: 화면 전체가 깜빡이는 경고
   색은 JS가 남은 시간에 따라 노랑 → 빨강으로 --hurry-rgb에 넣어주고,
   --hurry-peak로 갈수록 깜빡임도 진해진다.
   전체 화면을 균일하게 덮는 고정 오버레이 하나만 쓰므로
   앱 컬럼 경계(세로선)가 드러나지 않는다.
   (게임 화면이 아닐 때는 부모가 display:none이라 자동으로 숨는다) */
.timer-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30; /* 오버레이(40)·시트(50)·모달(60)·토스트(70)보다 아래 */
  display: none;
  opacity: 0;
  background:
    linear-gradient(rgba(var(--hurry-rgb), 0.16), rgba(var(--hurry-rgb), 0.16)),
    radial-gradient(ellipse at center,
      rgba(var(--hurry-rgb), 0) 42%, rgba(var(--hurry-rgb), 0.6) 100%);
}
#screen-game.is-hurry .timer-vignette {
  display: block;
  opacity: calc(var(--hurry-peak) * 0.25);
}
/* 초가 바뀌는 순간 JS가 .beat를 다시 걸어 밝게 번쩍였다가 잦아든다
   (0.9초에 끝나 다음 박자 전에 확실히 어두워진 뒤 다시 번쩍인다) */
#screen-game.is-hurry .timer-vignette.beat {
  animation: hurry-blink 0.9s ease-out both;
}
@keyframes hurry-blink {
  0% { opacity: var(--hurry-peak); }
  100% { opacity: calc(var(--hurry-peak) * 0.25); }
}

/* 타임 오버: 화면을 가득 덮는 큰 알림. 아무 곳이나 탭하면 닫힌다.
   브랜드 색(네이비 밤하늘 + 옐로)으로 무섭지 않게, 파티의 한 장면처럼 */
.timeup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80; /* 토스트(70)보다 위 — 화면을 확실히 덮는다 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  background: radial-gradient(ellipse at center,
    rgba(45, 62, 110, 0.94) 0%, rgba(26, 37, 71, 0.97) 100%);
  animation: timeup-in 0.25s ease;
}
@keyframes timeup-in { from { opacity: 0; } to { opacity: 1; } }

/* 밤하늘 반짝이: 동그라미와 네모별이 번갈아 반짝인다 */
.timeup-spark {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  animation: timeup-twinkle 1.8s ease-in-out infinite;
}
.timeup-spark.ts2,
.timeup-spark.ts4,
.timeup-spark.ts7 {
  border-radius: 0;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.timeup-spark.ts1 { top: 16%; left: 13%; width: 10px; height: 10px; background: var(--yellow); }
.timeup-spark.ts2 { top: 24%; right: 15%; width: 22px; height: 22px; background: var(--yellow); animation-delay: 0.3s; }
.timeup-spark.ts3 { top: 56%; left: 8%; width: 8px; height: 8px; background: var(--mint); animation-delay: 0.6s; }
.timeup-spark.ts4 { bottom: 18%; right: 11%; width: 18px; height: 18px; background: var(--mint); animation-delay: 0.9s; }
.timeup-spark.ts5 { bottom: 13%; left: 21%; width: 11px; height: 11px; background: var(--coral); animation-delay: 1.2s; }
.timeup-spark.ts6 { top: 11%; right: 36%; width: 7px; height: 7px; background: var(--white); animation-delay: 0.45s; }
.timeup-spark.ts7 { top: 42%; right: 6%; width: 14px; height: 14px; background: var(--yellow); animation-delay: 1.5s; }
@keyframes timeup-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.75) rotate(0); }
  50% { opacity: 1; transform: scale(1.2) rotate(20deg); }
}
.timeup-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--white);
  animation: timeup-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes timeup-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.timeup-icon {
  width: min(22vw, 96px);
  height: min(22vw, 96px);
  color: var(--yellow);
  animation: timeup-ring 0.5s ease 3;
}
@keyframes timeup-ring {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg); }
  75% { transform: rotate(14deg); }
}
.timeup-title {
  font-size: clamp(2.6rem, 12vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--yellow);
  text-shadow: 0 5px 22px rgba(0, 0, 0, 0.35);
}
.timeup-sub { font-size: clamp(1.05rem, 4.6vw, 1.4rem); font-weight: 800; color: var(--ivory); }
/* 하단 버튼: 다음 문제로(옐로) / 현재 문제로 돌아가기(투명)
   세로로 쌓아 각 버튼이 전체 폭을 써서 문구가 항상 한 줄로 나온다.
   버튼 밖 아무 곳이나 탭해도 닫힌다 */
.timeup-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
  width: min(320px, 100%);
}
.timeup-buttons .btn {
  width: 100%;
  min-height: 56px;
  font-size: 1.08rem;
  white-space: nowrap;
}
.timeup-ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: var(--white);
}

@media (prefers-reduced-motion: reduce) {
  .timer-btn.is-over { animation: none; }
  .timer-reset { animation: none; }
  .timer-body.beat svg,
  .timer-btn.is-hurry .timer-body.beat { animation: none; }
  #screen-game.is-hurry .timer-vignette,
  #screen-game.is-hurry .timer-vignette.beat { animation: none; opacity: 0.45; }
  .timeup-overlay, .timeup-box, .timeup-icon { animation: none; }
  .timeup-spark { animation: none; opacity: 0.6; }
}

/* ═══════════ 서브 화면 공통 헤더 ═══════════ */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 6px;
}
.sub-title { font-size: 1.15rem; font-weight: 800; }

/* ═══════════ 모드(카드 더미) 선택 ═══════════ */
#screen-mode { gap: 8px; padding-bottom: 0; }

/* 안내 문구와 카드를 한 덩어리로 묶어 화면 가운데에 놓는다.
   (justify-content: center 대신 위아래 auto 마진을 써야
    카드 3장이 화면보다 길어졌을 때도 위가 잘리지 않고 스크롤된다) */
.mode-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mode-main > :first-child { margin-top: auto; }
.mode-main > :last-child { margin-bottom: auto; }
.mode-hint {
  text-align: center;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--navy);
}
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mode-footer {
  flex-shrink: 0;
  padding: 12px 0 max(16px, env(safe-area-inset-bottom));
}

.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 2.5px solid rgba(34, 49, 92, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  padding: 18px 46px 18px 16px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mode-card:active { transform: scale(0.98); }
.mode-card.is-on { border-color: var(--deck); background: var(--deck-soft); }

/* 카드 더미 그림 */
.mode-pile {
  position: relative;
  flex-shrink: 0;
  width: 60px;
  height: 76px;
}
.pile-card {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--white);
  border: 2.5px solid var(--deck);
}
.pile-card:nth-child(1) { transform: rotate(-10deg) translate(-3px, 2px); }
.pile-card:nth-child(2) { transform: rotate(6deg) translate(3px, 0); }
.pile-card:nth-child(3) { background: var(--deck); }
.pile-card:nth-child(3)::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 900;
}

.mode-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mode-badge {
  align-self: flex-start;
  background: var(--deck-soft);
  color: var(--deck-deep);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
.mode-card.is-on .mode-badge { background: var(--white); }
.mode-name { font-family: var(--font-logo); font-size: 1.28rem; font-weight: 900; }
.mode-desc {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 600;
  line-height: 1.45;
}
.mode-desc em { font-style: normal; font-weight: 800; color: var(--deck-deep); }
.mode-count { margin-top: 3px; font-size: 0.78rem; font-weight: 700; color: var(--text-soft); }
.mode-count strong { color: var(--navy); font-weight: 900; }

.mode-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(34, 49, 92, 0.18);
  background: var(--white);
}
.mode-card.is-on .mode-check { background: var(--deck); border-color: var(--deck); }
.mode-card.is-on .mode-check::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--white);
  border-width: 0 2.8px 2.8px 0;
  transform: rotate(43deg);
}

/* ─────── 타이머 설정 (모드 선택 화면) ─────── */
.timer-setup {
  background: var(--white);
  border: 2.5px solid rgba(34, 49, 92, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.timer-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
}
.timer-setup-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #FFF1C7;
  border: 2px solid rgba(255, 201, 60, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.timer-setup-icon svg { width: 22px; height: 22px; }
.timer-setup-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.timer-setup-text strong { font-size: 1.02rem; font-weight: 800; }
.timer-setup-text span { font-size: 0.8rem; color: var(--text-soft); font-weight: 600; }

/* 토글 스위치 */
.switch {
  flex-shrink: 0;
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(34, 49, 92, 0.18);
  transition: background 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  transition: left 0.15s ease;
}
.timer-toggle.is-on .switch { background: var(--yellow); }
.timer-toggle.is-on .switch::after { left: 21px; }

/* 제한 시간 스테퍼 (토글이 켜져야 나타난다) */
.timer-length {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px 13px;
  border-top: 2px dashed rgba(34, 49, 92, 0.1);
}
.timer-length.is-off { display: none; }
.timer-length-label { font-size: 0.9rem; font-weight: 700; color: var(--text-soft); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--ivory);
  border: 2px solid rgba(34, 49, 92, 0.12);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:active { transform: scale(0.94); }
.stepper-btn:disabled { opacity: 0.35; }
.stepper-val {
  min-width: 76px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* 진행 카드·게임 방법에서 쓰는 모드 배지 */
.mode-chip {
  flex-shrink: 0;
  background: var(--deck-deep);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ═══════════ 문제 고르기 ═══════════ */
#screen-setup { gap: 12px; padding-bottom: 0; }

.setup-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--deck-soft);
  border: 2px solid var(--deck-line);
  border-radius: 14px;
  padding: 10px 12px;
}
.setup-mode-dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--deck);
}
.setup-mode-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.setup-mode-text strong { font-size: 0.98rem; font-weight: 800; color: var(--deck-deep); }
.setup-mode-rule { font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }

.setup-tabs {
  display: flex;
  gap: 4px;
  background: rgba(34, 49, 92, 0.07);
  border-radius: 15px;
  padding: 4px;
}
.setup-tab {
  flex: 1;
  min-height: 42px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-soft);
  transition: background 0.15s ease, color 0.15s ease;
}
.setup-tab.active {
  background: var(--white);
  color: var(--navy);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.setup-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.setup-hint {
  font-size: 0.84rem;
  color: var(--text-soft);
  font-weight: 600;
  padding: 0 2px;
}
.setup-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 카테고리 카드 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 2px 2px 14px;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 16px 12px 14px;
  opacity: 0.6;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cat-card:active { transform: scale(0.97); }
.cat-card.is-on, .cat-card.is-part { opacity: 1; }
.cat-card.is-on { border-color: var(--yellow); background: #FFFBF0; }
.cat-card.is-part { border-color: var(--mint); background: #F1FAF7; }
.cat-icon { width: min(20vw, 62px); height: auto; }
.cat-name { font-size: 1rem; font-weight: 800; text-align: center; }
.cat-count { font-size: 0.75rem; font-weight: 700; color: var(--text-soft); }
.cat-card.is-on .cat-count { color: var(--navy); }

.cat-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(34, 49, 92, 0.18);
  background: var(--white);
}
.cat-card.is-on .cat-check { background: var(--yellow); border-color: var(--yellow); }
.cat-card.is-on .cat-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--navy);
  border-width: 0 2.6px 2.6px 0;
  transform: rotate(43deg);
}
.cat-card.is-part .cat-check { background: var(--mint); border-color: var(--mint); }
.cat-card.is-part .cat-check::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 12px;
  border-top: 2.6px solid var(--navy);
}

/* 문제 직접 고르기 */
.pick-list { padding: 0 2px 14px; }
.pick-group { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.pick-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ivory);
  padding: 4px 2px 6px;
}
.pick-head-name { font-size: 0.98rem; font-weight: 800; }
.pick-head-count {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
}
.pick-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 12px 13px;
  min-height: 52px;
  text-align: left;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pick-item:active { transform: scale(0.98); }
.pick-item.is-on { opacity: 1; border-color: var(--yellow); background: #FFFBF0; }
.pick-box {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid rgba(34, 49, 92, 0.2);
  background: var(--white);
}
.pick-item.is-on .pick-box { background: var(--yellow); border-color: var(--yellow); }
.pick-item.is-on .pick-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--navy);
  border-width: 0 2.6px 2.6px 0;
  transform: rotate(43deg);
}
.pick-text { font-size: 0.92rem; font-weight: 600; line-height: 1.35; }

/* 고를 항목이 없을 때 (주로 제시어 목록 등록 전) */
.setup-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 36px 16px;
}
.setup-empty-img { width: min(34vw, 140px); height: auto; }
.setup-empty-title { font-size: 1.02rem; font-weight: 800; }
.setup-empty-desc {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: pre-line;
  line-height: 1.55;
}

/* 하단 선택 요약 + 시작 버튼 */
.setup-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(34, 49, 92, 0.1);
}
.setup-summary { display: flex; align-items: center; gap: 9px; }
.setup-chip {
  flex-shrink: 0;
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 999px;
}
.setup-chip strong { font-size: 0.95rem; font-weight: 900; margin-right: 1px; }
.setup-label {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════ 문제 목록 ═══════════ */
#screen-list { gap: 12px; padding-bottom: 0; }

/* 모드(카드 더미) 필터: 정확 · 의미 · 제시어 */
.deck-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.deck-filter-row::-webkit-scrollbar { display: none; }
.deck-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}
.deck-chip::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--deck);
  opacity: 0.5;
}
.deck-chip.active {
  background: var(--deck-soft);
  border-color: var(--deck);
  color: var(--deck-deep);
}
.deck-chip.active::before { opacity: 1; }

.question-list {
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.q-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 13px 14px;
  text-align: left;
  border: 2px solid transparent;
  min-height: 56px;
}
.q-item:active { transform: scale(0.98); }
.q-item-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(34, 49, 92, 0.08);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.q-item-text {
  flex: 1;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.35;
}
.q-item-cat {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(34, 49, 92, 0.06);
  padding: 3px 8px;
  border-radius: 999px;
}
.list-empty {
  text-align: center;
  color: var(--text-soft);
  padding: 40px 0;
  font-size: 0.95rem;
  white-space: pre-line;
}

/* ═══════════ 게임 방법 ═══════════ */
#screen-howto { gap: 8px; }
.howto-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

/* 준비물 배지 */
.ready-badge {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFF1C7;
  border: 2px solid rgba(255, 201, 60, 0.8);
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
}
.ready-badge svg { width: 17px; height: 17px; flex-shrink: 0; }

/* 3단계 진행 흐름 (타임라인) */
.flow {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: 0 4px;
}
.flow-step { display: flex; gap: 14px; }
.flow-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.flow-icon svg { width: 26px; height: 26px; }
.flow-line {
  flex: 1;
  min-height: 16px;
  border-left: 2px dashed rgba(34, 49, 92, 0.25);
  margin: 5px 0;
}
.flow-step:last-child .flow-line { display: none; }
.flow-content { padding: 1px 0 20px; }
.flow-step:last-child .flow-content { padding-bottom: 0; }
.flow-num {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--yellow-deep);
}
.flow-title {
  display: block;
  font-size: 1.12rem;
  font-weight: 800;
  margin-top: 2px;
}
.flow-desc {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-top: 4px;
  line-height: 1.55;
}

/* 점수 예시 카드 */
.score-card {
  background: #E7F6F0;
  border: 2px solid rgba(127, 216, 200, 0.8);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.score-title {
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 999px;
}
.score-papers { display: flex; gap: 7px; align-items: flex-end; }
.score-paper {
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.18);
  border-radius: 8px;
  padding: 9px 11px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.score-paper::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  border-bottom: 2px dashed rgba(34, 49, 92, 0.15);
}
.score-paper:nth-child(1) { transform: rotate(-5deg); }
.score-paper:nth-child(2) { transform: translateY(-3px); }
.score-paper:nth-child(3) { transform: rotate(5deg); }
.score-text { font-size: 0.95rem; line-height: 1.6; font-weight: 600; }
.score-text em {
  font-style: normal;
  font-weight: 800;
  color: var(--navy);
  background: rgba(255, 201, 60, 0.5);
  padding: 1px 6px;
  border-radius: 6px;
}

/* 두 가지 모드 안내 */
.mode-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.guide-title {
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 999px;
}
.mode-guide-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.mode-mini {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--deck-soft);
  border: 2px solid var(--deck-line);
  border-radius: 16px;
  padding: 13px 13px 15px;
}
.mode-mini-top { display: flex; align-items: center; gap: 6px; }
.mode-mini-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--deck);
}
.mode-mini-top strong { font-size: 1.02rem; font-weight: 800; color: var(--deck-deep); }
.mode-mini-deck { font-size: 0.72rem; font-weight: 700; color: var(--text-soft); }
.mode-mini p { margin-top: 3px; font-size: 0.84rem; font-weight: 600; line-height: 1.5; }
.mode-mini em { font-style: normal; font-weight: 800; color: var(--deck-deep); }

/* 추가 규칙 안내 */
.rules-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.rule-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  border-radius: 16px;
  padding: 14px 15px;
  box-shadow: var(--shadow-soft);
}
.rule-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #FFF1C7;
  border: 2px solid rgba(255, 201, 60, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.rule-icon svg { width: 24px; height: 24px; }
.rule-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rule-name { font-size: 1.02rem; font-weight: 800; }
.rule-desc {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  line-height: 1.55;
}
.rule-desc em {
  font-style: normal;
  font-weight: 800;
  color: var(--navy);
  background: rgba(255, 201, 60, 0.5);
  padding: 1px 6px;
  border-radius: 6px;
}
.rule-tip {
  align-self: flex-start;
  margin-top: 3px;
  background: #FFF1C7;
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}

/* 응원 문구 */
.howto-cheer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  padding: 2px 0 4px;
}
.cheer-spark { width: 18px; height: 18px; margin-bottom: 2px; }
.cheer-main { font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.cheer-sub { font-size: 0.85rem; color: var(--text-soft); font-weight: 600; }

/* 하단 시작 버튼 */
.howto-cta { padding: 6px 0 max(14px, env(safe-area-inset-bottom)); }

/* ═══════════ 게임 종료 ═══════════ */
#screen-end { justify-content: center; }
.end-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.end-illust { width: min(56vw, 220px); height: auto; }
.end-title { font-size: 1.9rem; font-weight: 900; margin-top: 6px; }
.end-sub { font-size: 1.1rem; color: var(--text-soft); font-weight: 600; line-height: 1.5; }
.end-buttons {
  margin-top: 22px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ═══════════ 오버레이 · 시트 · 모달 · 토스트 ═══════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 37, 71, 0.45);
  z-index: 40;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: min(var(--app-max), 620px);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(34, 49, 92, 0.2);
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 50;
  animation: sheet-up 0.25s ease;
}
@keyframes sheet-up {
  from { transform: translate(-50%, 40%); opacity: 0.5; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(34, 49, 92, 0.15);
  margin: 0 auto 10px;
}
.sheet-menu { list-style: none; }
.sheet-item {
  width: 100%;
  min-height: 52px;
  text-align: left;
  padding: 14px 8px;
  font-size: 1.02rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(34, 49, 92, 0.07);
}
.sheet-item:active { background: rgba(255, 201, 60, 0.15); border-radius: 12px; }
.sheet-item-danger { color: var(--coral); border-bottom: none; }
.sheet-close { width: 100%; margin-top: 8px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 37, 71, 0.45);
  animation: fade-in 0.2s ease;
}
.modal-box {
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px 22px 20px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.modal-title { font-size: 1.15rem; font-weight: 800; word-break: keep-all; }
.modal-message {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--text-soft);
}
.modal-buttons { display: flex; gap: 10px; margin-top: 20px; }
.modal-buttons .btn { flex: 1; }

/* 화면 정중앙에 띄워 하단 버튼을 가리지 않는다 */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--navy);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 70;
  white-space: nowrap;
  animation: toast-up 0.25s ease;
}
@keyframes toast-up {
  from { transform: translate(-50%, calc(-50% + 14px)); opacity: 0; }
  to   { transform: translate(-50%, -50%); opacity: 1; }
}

/* ============================================================
   참가자 디지털 답지
   ------------------------------------------------------------
   세로형 모바일(360px)에 맞춘 구성.
   질문 문구는 이 화면들에 절대 표시하지 않는다.
   ============================================================ */

/* 화면에는 안 보이지만 스크린 리더는 읽는 보조 문구 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 키보드 이동용 포커스 표시 (터치로 누를 때는 나타나지 않는다) */
.role-card:focus-visible,
.answer-resume:focus-visible,
.ans-score-btn:focus-visible,
.ans-memo-toggle:focus-visible,
.ans-input:focus-visible,
.ans-text-input:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

/* ───────── 시작 화면의 답지 카드 ───────── */
.answer-resume {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--white);
  border: 2.5px solid rgba(34, 49, 92, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}
.answer-resume:active { transform: scale(0.985); }
.answer-resume.is-done { border-color: rgba(255, 201, 60, 0.75); }
.answer-resume-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.answer-resume-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}
.answer-resume-label svg { width: 14px; height: 14px; color: var(--coral); }
.answer-resume-round {
  flex-shrink: 0;
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
.answer-resume-main {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.35;
}
.answer-resume-sub { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); }

/* ═══════════ 역할 고르기 ═══════════ */
#screen-role { gap: 8px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.role-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.role-main > :first-child { margin-top: auto; }
.role-main > :last-child { margin-bottom: auto; }
.role-list { display: flex; flex-direction: column; gap: 14px; }

.role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 2.5px solid rgba(34, 49, 92, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  padding: 18px 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.role-card:active { transform: scale(0.98); }
.role-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}
.role-icon svg { width: 27px; height: 27px; }
.role-host .role-icon { background: rgba(34, 49, 92, 0.09); color: var(--navy); }
.role-player .role-icon { background: rgba(255, 201, 60, 0.28); color: #8A6200; }
.role-host:active, .role-host:hover { border-color: rgba(34, 49, 92, 0.4); }
.role-player:active, .role-player:hover { border-color: var(--yellow-deep); }

.role-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.role-name { font-size: 1.14rem; font-weight: 900; color: var(--navy); }
.role-desc { font-size: 0.9rem; font-weight: 700; color: var(--coral); }
.role-note { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); line-height: 1.45; }
.role-arrow { flex-shrink: 0; color: rgba(34, 49, 92, 0.3); }
.role-arrow svg { width: 20px; height: 20px; display: block; }
/* 상단 일러스트 */
.role-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.role-illust {
  width: min(60%, 230px);
  display: block;
}

/* 하단 안내 카드 */
.role-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(127, 216, 200, 0.16);
  border: 2px dashed rgba(34, 49, 92, 0.18);
  border-radius: 16px;
  padding: 12px 16px;
}
.role-foot-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-soft);
}
.role-foot-icon svg { width: 20px; height: 20px; }
.role-foot p {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1.6;
}
.role-foot strong { font-weight: 800; color: var(--navy); }

/* 세로가 좁은 화면: 일러스트를 줄이거나 접어서 카드가 먼저 보이게 */
@media (max-height: 700px) {
  .role-illust { width: min(46%, 180px); }
}
@media (max-height: 620px) {
  .role-illust { display: none; }
}

/* ═══════════ 답지 화면 공통 ═══════════ */
#screen-ans-name,
#screen-ans-write,
#screen-ans-score,
#screen-ans-final,
#screen-ans-review { gap: 10px; padding-bottom: 0; }
#screen-ans-wait,
#screen-ans-round { gap: 10px; padding-bottom: 0; justify-content: center; }

/* 스크롤되는 본문 — 키보드가 올라와도 하단 버튼이 본문을 덮지 않는다 */
.ans-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 8px;
}

/* 하단 고정 버튼 영역 */
.ans-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 max(16px, env(safe-area-inset-bottom));
}
.ans-footer-line { border-top: 1px solid rgba(34, 49, 92, 0.1); }

/* 가운데 정렬 안내 화면 (제출 완료 · 라운드 결과)
   justify-content: center 대신 위아래 auto 마진을 써야
   내용이 화면보다 길어졌을 때도 위가 잘리지 않고 스크롤된다 */
.ans-center {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 20px 0;
}
.ans-center > :first-child { margin-top: auto; }
.ans-center > :last-child { margin-bottom: auto; }
.ans-center-title { font-size: 1.65rem; font-weight: 900; color: var(--navy); }
.ans-center-sub {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1.55;
}
.ans-stamp {
  width: 84px;
  height: 84px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(127, 216, 200, 0.25);
  color: #1E8C77;
  animation: ans-pop 0.35s ease;
}
.ans-stamp svg { width: 42px; height: 42px; }
@keyframes ans-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* 라운드 표시 알약 */
.ans-round-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 15px;
  border-radius: 999px;
}
.ans-round-chip strong { font-size: 0.95rem; font-weight: 900; }

/* 입력 필드 공통 */
.ans-field { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.ans-field-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-soft);
}
.ans-text-input {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2.5px solid rgba(34, 49, 92, 0.14);
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 1.05rem;   /* 16px 이상이라야 iOS에서 화면이 확대되지 않는다 */
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease;
}
.ans-text-input::placeholder { color: rgba(107, 115, 144, 0.55); font-weight: 600; }
.ans-text-input:focus { outline: none; border-color: var(--yellow-deep); }
.ans-text-input.is-error { border-color: var(--coral); }
.ans-text-input:disabled {
  background: rgba(34, 49, 92, 0.05);
  color: var(--text-soft);
  box-shadow: none;
}
.ans-error { font-size: 0.85rem; font-weight: 700; color: var(--coral); }
.ans-field-hint { font-size: 0.8rem; font-weight: 600; color: var(--text-soft); }

/* ───────── 이름 입력 화면 ───────── */
.ans-name-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 10px 0;
}
.ans-name-main > :first-child { margin-top: auto; }
.ans-name-main > :last-child { margin-bottom: auto; }
.ans-name-illust { width: min(42vw, 160px); height: auto; }
.ans-name-title { font-size: 1.5rem; font-weight: 900; color: var(--navy); }
.ans-name-sub { font-size: 0.98rem; font-weight: 600; color: var(--text-soft); }
.ans-name-main .ans-field { margin-top: 8px; text-align: left; }
.ans-name-note {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ───────── 답 작성 화면 ───────── */
/* 헤더에서 라운드를 항상 볼 수 있게 (본문의 중복 표시를 대신한다) */
.ans-round-label { display: inline-flex; align-items: baseline; gap: 6px; }
.ans-round-word {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.ans-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  padding-top: 4px;
}
.ans-owner { font-size: 1.28rem; font-weight: 800; color: var(--navy); }
.ans-owner strong { font-weight: 900; }
.ans-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(34, 49, 92, 0.1);
  overflow: hidden;
}
.ans-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--yellow);
  transition: width 0.3s ease;
}
/* 참가자 화면의 유일한 안내 문구 — 질문 내용은 들어가지 않는다 */
.ans-guide {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
  line-height: 1.55;
}

/* 질문 메모 (선택사항, 기본 접힘) */
.ans-memo { display: flex; flex-direction: column; gap: 8px; }
.ans-memo-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}
.ans-memo-toggle.is-open { color: var(--navy); border-color: rgba(34, 49, 92, 0.25); }
.ans-memo-toggle:active { transform: scale(0.97); }
.ans-memo-plus { font-size: 1.05rem; font-weight: 900; line-height: 1; }
.ans-memo-panel { display: flex; flex-direction: column; gap: 6px; }
.ans-memo-input { min-height: 50px; font-size: 1rem; font-weight: 600; }
.ans-memo-hint { font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }

/* 답 6개 입력칸 */
.ans-input-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ans-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ans-input-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(34, 49, 92, 0.08);
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
}
.ans-input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  padding: 13px 15px;
  border-radius: 16px;
  border: 2.5px solid rgba(34, 49, 92, 0.14);
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease;
}
.ans-input:focus { outline: none; border-color: var(--yellow-deep); }
.ans-input:disabled {
  background: rgba(34, 49, 92, 0.05);
  color: var(--text-soft);
  box-shadow: none;
}
.ans-input-row.is-dup .ans-input { border-color: var(--coral); }
.ans-input-row.is-dup .ans-input-num { background: rgba(255, 123, 107, 0.2); color: #B33B2C; }
.ans-dup-warn {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--coral);
}

/* ───────── 채점 화면 ───────── */
.ans-score-guide {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
  padding-top: 2px;
}
.ans-memo-view {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(34, 49, 92, 0.05);
  border-radius: 12px;
  padding: 9px 12px;
}
.ans-score-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ans-score-item { display: flex; }
.ans-score-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;          /* 손가락으로 누르기 충분한 크기 */
  padding: 12px 16px;
  border-radius: 18px;
  border: 2.5px solid rgba(34, 49, 92, 0.14);
  background: var(--white);
  box-shadow: var(--shadow-soft);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ans-score-btn:active { transform: scale(0.985); }
.ans-score-check {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2.5px solid rgba(34, 49, 92, 0.2);
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ans-score-check svg { width: 17px; height: 17px; }
.ans-score-text {
  flex: 1;
  min-width: 0;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.35;
}
/* 체크된 답: 배경색 + 아이콘 + 굵은 글씨로 확실히 구분 */
.ans-score-btn.is-on {
  background: rgba(255, 201, 60, 0.2);
  border-color: var(--yellow-deep);
}
.ans-score-btn.is-on .ans-score-check {
  background: var(--yellow);
  border-color: var(--yellow-deep);
  color: var(--navy);
}
.ans-score-btn.is-on .ans-score-text { font-weight: 900; }

.ans-score-item.is-empty {
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 2px dashed rgba(34, 49, 92, 0.16);
  background: rgba(34, 49, 92, 0.03);
}
.ans-score-item.is-empty .ans-score-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(34, 49, 92, 0.08);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-soft);
}
.ans-score-item.is-empty .ans-score-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
}

/* 하단 점수 표시 */
.ans-score-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px;
}
.ans-score-label { font-size: 0.92rem; font-weight: 700; color: var(--text-soft); }
.ans-score-total { font-family: var(--font-logo); font-size: 1rem; font-weight: 700; color: var(--navy); }
.ans-score-total strong {
  font-family: var(--font-logo);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--navy);
  margin-right: 2px;
}

/* ───────── 라운드 결과 ───────── */
.ans-result-cards { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.ans-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 2.5px solid rgba(34, 49, 92, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 16px 20px;
}
.ans-result-card.is-main { border-color: var(--yellow-deep); background: rgba(255, 201, 60, 0.16); }
.ans-result-label { font-size: 0.95rem; font-weight: 700; color: var(--text-soft); }
.ans-result-num { font-family: var(--font-logo); font-size: 1rem; font-weight: 700; color: var(--navy); }
.ans-result-num strong { font-family: var(--font-logo); font-size: 2.1rem; font-weight: 900; margin-right: 2px; }
.ans-result-card.is-main .ans-result-label { color: var(--navy); }

/* ───────── 최종 결과 ───────── */
.ans-final-body { align-items: center; text-align: center; gap: 8px; padding-top: 12px; }
.ans-final-illust { width: min(38vw, 150px); height: auto; }
.ans-final-title { font-size: 1.85rem; font-weight: 900; color: var(--navy); }
.ans-final-owner { font-size: 1rem; font-weight: 700; color: var(--text-soft); }
.ans-final-owner strong { color: var(--navy); font-weight: 900; }
.ans-final-score { font-family: var(--font-logo); font-size: 1.1rem; font-weight: 700; color: var(--navy); line-height: 1; }
.ans-final-score strong {
  font-family: var(--font-logo);
  font-size: 3.6rem;
  font-weight: 900;
  color: var(--navy);
  margin-right: 3px;
  text-shadow: 0 3px 0 rgba(255, 201, 60, 0.9);
}
.ans-final-rounds {
  list-style: none;
  width: 100%;
  margin-top: 12px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.ans-final-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(34, 49, 92, 0.08);
}
.ans-final-round:last-child { border-bottom: none; }
.ans-final-round-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-soft);
  letter-spacing: 0.04em;
}
.ans-final-round-score { font-size: 1.1rem; font-weight: 900; color: var(--navy); }
.ans-final-summary {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
  line-height: 1.55;
}
.ans-final-summary em {
  font-style: normal;
  font-weight: 900;
  color: var(--navy);
  background: linear-gradient(transparent 58%, rgba(255, 201, 60, 0.75) 58%);
  padding: 0 2px;
}
.ans-final-written { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }

/* ───────── 라운드별 답 다시 보기 ───────── */
.ans-review-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 max(20px, env(safe-area-inset-bottom));
}
.ans-review-card {
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.1);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 16px 16px 14px;
}
.ans-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(34, 49, 92, 0.08);
}
.ans-review-round { font-size: 1.02rem; font-weight: 900; color: var(--navy); letter-spacing: 0.03em; }
.ans-review-score {
  flex-shrink: 0;
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}
.ans-review-memo {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(34, 49, 92, 0.05);
  border-radius: 12px;
  padding: 9px 12px;
}
.ans-review-list { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.ans-review-item {
  /* 안에 있는 .sr-only(position:absolute)가 스크롤 영역 밖으로 빠져나가
     문서 전체를 늘리지 않도록 기준점을 여기로 잡는다 */
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 13px;
  background: rgba(34, 49, 92, 0.04);
}
.ans-review-item.is-on { background: rgba(255, 201, 60, 0.22); }
.ans-review-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(34, 49, 92, 0.18);
  color: var(--navy);
}
.ans-review-item.is-on .ans-review-mark {
  background: var(--yellow);
  border-color: var(--yellow-deep);
}
.ans-review-mark svg { width: 13px; height: 13px; }
.ans-review-text { flex: 1; min-width: 0; font-size: 0.98rem; font-weight: 600; color: var(--navy); }
.ans-review-item.is-on .ans-review-text { font-weight: 900; }
.ans-review-empty {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
}

/* 지난 기록을 열었을 때 맨 위에 붙는 요약 카드 */
.ans-review-sum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  border-color: var(--yellow-deep);
  background: rgba(255, 201, 60, 0.16);
}
.ans-review-sum-title { font-size: 1.25rem; font-weight: 900; color: var(--navy); word-break: keep-all; }
.ans-review-sum-owner { font-size: 1rem; font-weight: 700; color: var(--text-soft); }
.ans-review-sum-owner strong { color: var(--navy); font-weight: 900; }
.ans-review-sum-score { font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.ans-review-sum-score strong { font-size: 2.4rem; font-weight: 900; margin-right: 2px; }
.ans-review-sum-note { font-size: 0.86rem; font-weight: 600; color: var(--text-soft); }

/* ───────── 지난 게임 기록 ───────── */
.ans-history-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 max(20px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  position: relative;
}
.ans-history-stats {
  display: flex;
  gap: 8px;
}
.ans-history-stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.1);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 11px 6px 10px;
}
.ans-history-stat-label { font-size: 0.78rem; font-weight: 700; color: var(--text-soft); }
.ans-history-stat-num { font-size: 0.85rem; font-weight: 700; color: var(--navy); }
.ans-history-stat-num strong { font-size: 1.45rem; font-weight: 900; margin-right: 1px; }

.ans-history-list { display: flex; flex-direction: column; gap: 10px; }
.ans-history-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  border: 2px solid rgba(34, 49, 92, 0.1);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  padding: 13px 15px 12px;
  font-family: inherit;
  cursor: pointer;
}
.ans-history-card:active { transform: scale(0.985); }
.ans-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ans-history-when { font-size: 0.8rem; font-weight: 700; color: var(--text-soft); }
.ans-history-badge {
  flex-shrink: 0;
  background: var(--navy);
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
/* 중간에 멈춘 판은 완료된 판과 구분되게 흐린 배지로 */
.ans-history-badge.is-partial {
  background: rgba(34, 49, 92, 0.1);
  color: var(--text-soft);
}
.ans-history-main { font-size: 1.02rem; font-weight: 700; color: var(--text-soft); }
.ans-history-main strong { color: var(--navy); font-weight: 900; }
.ans-history-score {
  font-style: normal;
  font-weight: 900;
  color: var(--navy);
  background: linear-gradient(transparent 58%, rgba(255, 201, 60, 0.75) 58%);
  padding: 0 2px;
}
.ans-history-rounds { display: flex; flex-wrap: wrap; gap: 6px; }
.ans-history-chip {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--navy);
  background: rgba(34, 49, 92, 0.06);
  border-radius: 8px;
  padding: 3px 8px;
}
.ans-history-trash { display: inline-flex; align-items: center; }

.ans-history-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 20px 0;
}
.ans-history-illust { width: min(34vw, 130px); height: auto; margin-bottom: 4px; }
.ans-history-empty strong { font-size: 1.15rem; font-weight: 900; color: var(--navy); }
.ans-history-empty p {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1.55;
}
.ans-history-clear { margin-top: 2px; }

/* ───────── 한 화면에 담기 ─────────
   답 6개 · 채점 6줄이 스크롤 없이 들어오도록 세로 크기를 화면 높이에
   맞춰 줄인다. svh(브라우저 주소창이 보일 때의 높이)를 기준으로 삼아야
   주소창이 나타나도 잘리지 않는다.
   svh를 모르는 옛 브라우저에서는 이 블록이 통째로 무시되고
   위에서 정한 고정값(스크롤되는 기존 동작)으로 남는다.            */
/* 화면 높이를 확정해야 내용이 넘칠 때 본문만 스크롤된다.
   min-height만 두면 화면 자체가 늘어나 하단 버튼이 뷰포트 밖으로 밀린다. */
/* 안쪽 스크롤이 페이지로 번지면 당겨서 새로고침이 걸리거나 화면이 튄다.
   contain으로 막아 답지 화면에서는 페이지가 절대 움직이지 않게 한다. */
.ans-body, .ans-center, .ans-name-main, .ans-review-body, .role-main {
  overscroll-behavior: contain;
  position: relative;   /* 안쪽 absolute 요소가 스크롤 영역을 벗어나지 않게 */
}

/* 세로가 넉넉하지 않으면 메모의 설명 줄과 라벨을 접는다.
   펼침 버튼에 이미 "질문 메모"라고 쓰여 있어 뜻은 그대로 통하고,
   라벨은 화면에서만 감춰 스크린 리더용 이름은 남긴다. */
@media (max-height: 860px) {
  .ans-memo-hint { display: none; }
  #ans-memo-panel .ans-field-label {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ans-memo-input { padding-top: clamp(8px, calc(var(--vh1) * 1.5), 18px); padding-bottom: clamp(8px, calc(var(--vh1) * 1.5), 18px); }
}

#screen-ans-write { gap: clamp(4px, calc(var(--vh1) * 0.8), 12px); }
#screen-ans-write .ans-body { gap: clamp(8px, calc(var(--vh1) * 1.7), 22px); }
/* 태블릿처럼 세로가 남을 때는 가운데로 모은다.
   safe를 붙여야 내용이 넘칠 때 위가 잘려 못 보는 일이 없다. */
#screen-ans-write .ans-body,
#screen-ans-score .ans-body,
#screen-ans-final .ans-body { justify-content: safe center; }
#screen-ans-write .ans-footer { padding-top: clamp(8px, calc(var(--vh1) * 1.4), 16px); }

.ans-head { gap: clamp(5px, calc(var(--vh1) * 1.1), 14px); padding-top: 0; }
.ans-owner { font-size: clamp(1.02rem, calc(var(--vh1) * 3.1), 1.5rem); }
.ans-guide { font-size: clamp(0.88rem, calc(var(--vh1) * 2.5), 1.15rem); line-height: 1.45; }
.ans-memo-toggle { min-height: 0; padding: clamp(6px, calc(var(--vh1) * 1.1), 12px) 16px; }
.ans-memo-input { min-height: 0; padding: clamp(10px, calc(var(--vh1) * 1.8), 18px) 15px; }

.ans-input-list { gap: clamp(6px, calc(var(--vh1) * 1.2), 16px); }
/* 칸 높이는 min-height가 아니라 안쪽 여백이 정한다 — 둘 다 줄여야 실제로 낮아진다.
   상한을 넉넉히 둬서 태블릿에서는 별도 규칙 없이도 저절로 커진다. */
.ans-input { min-height: 0; padding: clamp(8px, calc(var(--vh1) * 1.6), 20px) 15px; }
.ans-input-num { width: clamp(30px, calc(var(--vh1) * 4.6), 44px); height: clamp(30px, calc(var(--vh1) * 4.6), 44px); }

#screen-ans-score { gap: clamp(4px, calc(var(--vh1) * 0.8), 12px); }
#screen-ans-score .ans-body { gap: clamp(8px, calc(var(--vh1) * 1.6), 20px); }
#screen-ans-score .ans-footer {
  padding-top: clamp(8px, calc(var(--vh1) * 1.4), 16px);
  gap: clamp(6px, calc(var(--vh1) * 1.2), 14px);
}
.ans-score-guide { font-size: clamp(0.9rem, calc(var(--vh1) * 2.5), 1.15rem); padding-top: 0; }
/* 질문 메모까지 있어도 6줄이 한 화면에 들어와야 한다 */
.ans-memo-view {
  padding: clamp(4px, calc(var(--vh1) * 0.9), 9px) 12px;
  font-size: clamp(0.78rem, calc(var(--vh1) * 2.2), 0.85rem);
}
/* 점수 줄은 숫자 한 줄 높이만 차지하게 (여기서 아낀 만큼 답 6줄이 들어온다) */
#screen-ans-score .ans-score-box { padding: 0 4px; }
.ans-score-total strong { line-height: 1.15; }
.ans-score-list { gap: clamp(6px, calc(var(--vh1) * 1.2), 16px); }
/* 줄 높이는 안쪽 여백과 체크 동그라미가 함께 정한다 (행 전체가 터치 영역) */
.ans-score-btn { min-height: 0; padding: clamp(7px, calc(var(--vh1) * 1.7), 20px) 16px; }
.ans-score-text { font-size: clamp(1.02rem, calc(var(--vh1) * 2.2), 1.2rem); }
.ans-score-check { width: clamp(25px, calc(var(--vh1) * 4.3), 38px); height: clamp(25px, calc(var(--vh1) * 4.3), 38px); }
.ans-score-item.is-empty { min-height: 0; padding: clamp(7px, calc(var(--vh1) * 1.5), 18px) 16px; }
.ans-score-item.is-empty .ans-score-num {
  width: clamp(25px, calc(var(--vh1) * 4.3), 38px);
  height: clamp(25px, calc(var(--vh1) * 4.3), 38px);
}
.ans-score-total strong { font-size: clamp(1.35rem, calc(var(--vh1) * 3.6), 1.9rem); }

/* 이름 화면도 캐릭터 그림을 줄여 한 화면에 맞춘다 */
.ans-name-illust { width: clamp(90px, calc(var(--vh1) * 17), 160px); }

@media (prefers-reduced-motion: reduce) {
  .ans-stamp { animation: none; }
  .ans-progress-fill { transition: none; }
}

/* 세로가 아주 짧은 기기: 진행바는 접는다 (헤더의 ROUND 1 / 3로 충분하다) */
@media (max-height: 700px) {
  .ans-progress { display: none; }
  .ans-head { gap: 4px; }
  .ans-memo { gap: 5px; }
  .ans-memo-panel { gap: 4px; }
  .ans-memo-toggle { padding: 5px 14px; font-size: 0.8rem; }
  .ans-guide { line-height: 1.35; }
  #screen-ans-write .ans-body { gap: clamp(7px, calc(var(--vh1) * 1.5), 22px); }
  .ans-input-list { gap: clamp(6px, calc(var(--vh1) * 1.1), 16px); }
}

/* ───────── 작은 화면 보정 ───────── */
@media (max-height: 640px) {
  .logo { font-size: 2.4rem; }
  .question-text { font-size: 1.75rem; }
  .question-text.q-long { font-size: 1.5rem; }
  .question-text.q-longer { font-size: 1.32rem; }
  .question-card.is-keyword .question-text { font-size: clamp(2.5rem, 11vw, 3.6rem); }
  .question-illust { max-height: 20vh; }

  /* 답지: 작성·채점 화면 크기는 위 svh clamp가 이미 줄여주므로
     여기서는 clamp가 닿지 않는 부분만 손본다 */
  .ans-stamp { width: 66px; height: 66px; }
  .ans-stamp svg { width: 34px; height: 34px; }
  .ans-center-title { font-size: 1.4rem; }
  .ans-final-illust { width: min(26vw, 104px); }
  .ans-final-title { font-size: 1.5rem; }
  .ans-final-score strong { font-size: 2.9rem; }
}

/* ============================================================
   반응형 — 태블릿 크기 · 가로 화면
   ------------------------------------------------------------
   1) 태블릿 세로 : 폭을 넓히고 글자·여백을 키운다
   2) 넓은 화면   : 목록을 여러 열로 배치
   3) 가로 화면   : 화면 구성 자체를 가로형으로 재배치
   4) 낮은 가로   : 휴대폰 가로처럼 높이가 부족할 때 압축
   순서를 바꾸면 뒤 규칙이 앞 규칙을 덮는 구조가 깨지므로 주의.
   ============================================================ */

/* ───────── 1) 태블릿 (세로 기준 크기 확대) ───────── */
@media (min-width: 700px) and (min-height: 620px) {
  :root { --app-max: 680px; --radius: 24px; }

  .screen { padding-left: 28px; padding-right: 28px; }

  .btn { min-height: 54px; font-size: 1.1rem; border-radius: 18px; }
  .btn-big { min-height: 60px; font-size: 1.18rem; }
  .btn-cta { min-height: 62px; font-size: 1.22rem; }
  .btn-sub { min-height: 56px; font-size: 1.04rem; }
  .btn-sub svg { width: 21px; height: 21px; }
  .icon-btn { width: 54px; height: 54px; border-radius: 16px; }
  .icon-btn svg { width: 25px; height: 25px; }
  .mini-btn { min-height: 38px; padding: 7px 15px; font-size: 0.86rem; }

  /* 시작 화면 */
  .logo { font-size: 3.4rem; }
  .tagline { font-size: 1.22rem; }
  .start-illust { width: min(40vw, 280px); max-height: clamp(200px, calc(var(--vh1) * 32), 300px); }
  .start-intro strong { font-size: 1.5rem; }
  .start-intro p { font-size: 1.06rem; }
  .resume-card { padding: 18px 20px; }
  .resume-main { font-size: 1.3rem; }
  .resume-label, .resume-tag { font-size: 0.86rem; }
  .resume-count { font-size: 0.96rem; }

  /* 문제 카드 */
  .progress-label { font-size: 1.2rem; }
  .progress-label strong { font-size: 1.42rem; }
  .question-card { border-radius: 30px; padding: 34px 30px; gap: 26px; }
  .category-tag { font-size: 1rem; padding: 8px 20px; }
  .question-text { font-size: 2.9rem; }
  .question-text.q-long { font-size: 2.4rem; }
  .question-text.q-longer { font-size: 2.05rem; }
  .keyword-guide { font-size: 1.12rem; }
  .question-illust { width: min(40vw, 260px); max-height: 30vh; }
  .timer-btn { min-height: 52px; font-size: 1.08rem; border-radius: 16px; }
  .timer-btn svg { width: 21px; height: 21px; }
  .timer-btn.is-run { min-height: 74px; }
  .timer-btn.is-run #timer-text { font-size: 2.4rem; }
  .timer-btn.is-run svg { width: 30px; height: 30px; }
  .timer-adj { min-width: 66px; font-size: 0.9rem; border-radius: 16px; }
  .timer-setup-text strong { font-size: 1.12rem; }
  .timer-setup-text span { font-size: 0.88rem; }
  .stepper-btn { width: 46px; height: 46px; }
  .stepper-val { font-size: 1.15rem; }
  .timer-length-label { font-size: 0.98rem; }

  /* 서브 화면 공통 */
  .sub-title { font-size: 1.3rem; }
  .deck-chip { min-height: 42px; padding: 8px 16px; font-size: 0.95rem; }
  .q-item { min-height: 62px; padding: 15px 16px; }
  .q-item-num { width: 38px; height: 38px; font-size: 0.92rem; }
  .q-item-text { font-size: 1.04rem; }
  .q-item-cat { font-size: 0.8rem; }

  /* 문제 고르기 */
  .setup-tab { min-height: 48px; font-size: 1.05rem; }
  .setup-hint { font-size: 0.95rem; }
  .category-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .cat-icon { width: min(16vw, 76px); }
  .cat-name { font-size: 1.08rem; }
  .cat-count { font-size: 0.82rem; }
  .cat-check { width: 25px; height: 25px; }
  .pick-item { min-height: 58px; padding: 14px 15px; }
  .pick-text { font-size: 1rem; }
  .pick-head-name { font-size: 1.08rem; }
  .pick-head-count { font-size: 0.85rem; }
  .setup-chip { font-size: 0.88rem; }
  .setup-label { font-size: 0.95rem; }

  /* 모드 선택 */
  .mode-hint { font-size: 1.05rem; }
  .mode-pile { width: 72px; height: 92px; }
  .mode-name { font-size: 1.45rem; }
  .mode-desc { font-size: 0.98rem; }
  .mode-badge, .mode-count { font-size: 0.85rem; }
  .setup-mode-text strong { font-size: 1.06rem; }
  .setup-mode-rule { font-size: 0.86rem; }
  .mode-tag { font-size: 0.92rem; padding: 7px 15px; }
  .mode-chip { font-size: 0.8rem; }

  /* 게임 방법 */
  .ready-badge { padding: 10px 20px; font-size: 1rem; }
  .mode-mini-top strong { font-size: 1.12rem; }
  .mode-mini p { font-size: 0.94rem; }
  .ready-badge svg { width: 19px; height: 19px; }
  .flow-icon { width: 56px; height: 56px; }
  .flow-icon svg { width: 30px; height: 30px; }
  .flow-title { font-size: 1.24rem; }
  .flow-desc { font-size: 1rem; }
  .score-paper { font-size: 0.95rem; }
  .score-text { font-size: 1.06rem; }
  .rule-icon { width: 48px; height: 48px; }
  .rule-icon svg { width: 27px; height: 27px; }
  .rule-name { font-size: 1.12rem; }
  .rule-desc { font-size: 0.95rem; }
  .rule-tip { font-size: 0.84rem; }
  .cheer-main { font-size: 1.18rem; }
  .cheer-sub { font-size: 0.95rem; }

  /* 종료 화면 */
  .end-illust { width: min(45vw, 300px); }
  .end-title { font-size: 2.3rem; }
  .end-sub { font-size: 1.25rem; }

  /* 시트 · 모달 · 토스트 */
  .sheet-item { min-height: 58px; font-size: 1.1rem; }
  .modal-box { max-width: 400px; padding: 30px 26px 24px; }
  .modal-title { font-size: 1.3rem; }
  .modal-message { font-size: 1rem; }
  .toast { font-size: 1rem; padding: 14px 24px; }
}

/* ───────── 2) 넓은 화면: 목록을 여러 열로 ───────── */
@media (min-width: 900px) and (min-height: 620px) {
  :root { --app-max: 880px; }

  .question-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-content: start;
  }
  .list-empty { grid-column: 1 / -1; }

  .pick-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 9px 10px;
    align-content: start;
  }
  .pick-head { grid-column: 1 / -1; }

  .category-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
}

/* ───────── 3) 가로 화면: 가로형 배치 ───────── */
@media (orientation: landscape) and (min-width: 620px) {
  :root { --app-max: 1100px; }

  /* 가로에서는 노치가 좌우에 생긴다 */
  .screen {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }

  /* ── 시작 화면: 브랜드 | 버튼 ── */
  #screen-start {
    flex-direction: row;
    align-items: center;
    gap: clamp(28px, 6vw, 80px);
  }
  /* 가로 배치에서는 세로 auto 마진이 정렬을 흔들지 않게 되돌린다 */
  .brand { flex: 1 1 0; min-width: 0; margin-top: 0; }
  .start-bottom { flex: 1 1 0; min-width: 0; max-width: 440px; margin-bottom: 0; }
  .start-illust { width: min(30vw, 300px); margin-top: 18px; }

  /* ── 문제 카드: 문제 | 그림 ── */
  #screen-game { gap: 12px; }
  .game-header { padding-top: 10px; }
  .question-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "tag  illust"
      "text illust";
    justify-items: start;
    align-items: center;
    text-align: left;
    gap: 14px clamp(20px, 4vw, 44px);
    padding: clamp(20px, 4vh, 34px) clamp(24px, 4vw, 40px);
  }
  .card-tags { grid-area: tag; align-self: start; justify-content: flex-start; }
  .question-text {
    grid-area: text;
    align-self: center;
    font-size: clamp(2rem, 4.4vw, 3.7rem);
  }
  .question-text.q-long { font-size: clamp(1.8rem, 3.8vw, 3.1rem); }
  .question-text.q-longer { font-size: clamp(1.5rem, 3.1vw, 2.5rem); }
  .question-illust {
    grid-area: illust;
    align-self: center;
    width: min(30vw, 300px);
    max-height: min(60vh, 320px);
  }

  /* 제시어 모드: 제시어 아래 안내문까지 넣은 3행 배치 */
  .question-card.is-keyword {
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "tag   illust"
      "text  illust"
      "guide illust";
  }
  .keyword-guide { grid-area: guide; align-self: start; }

  /* 진행바와 이동 버튼을 한 줄로 (타이머 | 진행바 | 버튼) */
  .game-footer { flex-direction: row; align-items: center; gap: clamp(14px, 3vw, 28px); }
  .timer-row { flex: 0 0 auto; }
  .timer-row .timer-btn { flex: 0 0 auto; min-width: clamp(120px, 13vw, 170px); }
  .timer-row .timer-btn.is-run { min-width: clamp(170px, 20vw, 240px); }
  .progress-track { flex: 1; }
  .nav-buttons { flex: 0 0 auto; }
  .nav-buttons .btn { flex: 0 0 auto; min-width: clamp(130px, 16vw, 190px); }

  /* ── 모드 선택: 두 더미를 나란히, 타이머 설정은 아래 가운데 ── */
  .mode-list { flex-direction: row; align-items: stretch; gap: clamp(14px, 3vw, 28px); }
  .mode-card { flex: 1 1 0; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 20px 22px; }
  .mode-pile { width: 66px; height: 84px; }
  .timer-setup { align-self: center; width: min(560px, 100%); }
  .mode-footer { display: flex; justify-content: center; }
  .mode-footer .btn { width: min(440px, 100%); }

  /* ── 문제 고르기 ── */
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pick-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px 10px;
    align-content: start;
  }
  .pick-head { grid-column: 1 / -1; }
  .setup-footer { flex-direction: row; align-items: center; gap: 20px; }
  .setup-summary { flex: 1; min-width: 0; }
  #btn-setup-start { width: auto; flex: 0 0 auto; min-width: clamp(200px, 26vw, 300px); }

  /* ── 문제 목록 ── */
  .question-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    align-content: start;
  }
  .list-empty { grid-column: 1 / -1; }

  /* ── 게임 방법: 3단계를 가로 타임라인으로 ── */
  .howto-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px clamp(20px, 4vw, 44px);
    align-content: start;
  }
  .ready-badge { grid-column: 1 / -1; }
  .flow {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: clamp(12px, 2.4vw, 26px);
  }
  .flow-step { flex: 1 1 0; flex-direction: column; gap: 0; }
  .flow-rail { flex-direction: row; align-items: center; width: 100%; }
  .flow-line {
    min-height: 0;
    border-left: none;
    border-top: 2px dashed rgba(34, 49, 92, 0.25);
    margin: 0 0 0 10px;
  }
  .flow-content { padding: 12px 0 0; }
  /* 점수 예시 | 모드 안내 를 나란히, 응원 문구는 아래 전체 폭 */
  /* 추가 규칙은 전체 폭에 두 카드를 나란히 */
  .rules-guide { grid-column: 1 / -1; }
  .rule-list { flex-direction: row; align-items: stretch; }
  .rule-card { flex: 1 1 0; min-width: 0; }
  .howto-cheer { grid-column: 1 / -1; align-self: center; }
  .howto-cta { display: flex; justify-content: center; }
  .howto-cta .btn { width: min(440px, 100%); }

  /* ── 종료 화면: 그림 | 문구 ── */
  .end-body {
    display: grid;
    grid-template-columns: auto minmax(0, 420px);
    grid-template-areas:
      "illust title"
      "illust sub"
      "illust buttons";
    justify-content: center;
    align-items: center;
    text-align: left;
    gap: 4px clamp(28px, 5vw, 60px);
  }
  .end-illust { grid-area: illust; width: min(34vw, 330px); }
  .end-title { grid-area: title; align-self: end; margin-top: 0; }
  .end-sub { grid-area: sub; align-self: start; }
  .end-buttons { grid-area: buttons; margin-top: 18px; }
}

/* ───────── 4) 가로인데 높이가 낮을 때 (휴대폰 가로) ───────── */
@media (orientation: landscape) and (min-width: 620px) and (max-height: 540px) {
  .logo { font-size: 2.2rem; }
  .tagline { margin-top: 6px; font-size: 0.95rem; }
  .start-illust { width: min(22vw, 150px); margin-top: 10px; }
  .start-intro strong { font-size: 1.15rem; }
  .start-buttons { gap: 10px; }
  .btn-big, .btn-cta { min-height: 50px; font-size: 1.02rem; }
  .btn-sub { min-height: 46px; }
  .icon-btn { width: 44px; height: 44px; }

  .mode-card { padding: 14px 16px 16px; gap: 9px; }
  .mode-pile { width: 48px; height: 62px; }
  .pile-card:nth-child(3)::after { font-size: 1.2rem; }
  .mode-name { font-size: 1.1rem; }
  .mode-desc { font-size: 0.8rem; }

  .question-card { padding: 16px 22px; border-radius: 22px; }
  /* 가로 모드는 카드가 낮으니 배지도 위로 붙이고 여백을 줄인다 */
  .question-card.has-custom { padding-top: 40px; }
  .custom-tag { top: 12px; right: 12px; }
  .question-text { font-size: clamp(1.6rem, 3.6vw, 2.4rem); }
  .question-text.q-long { font-size: clamp(1.4rem, 3.1vw, 2.1rem); }
  .question-text.q-longer { font-size: clamp(1.2rem, 2.7vw, 1.8rem); }
  .question-card.is-keyword .question-text { font-size: clamp(2.2rem, 5.5vw, 3.3rem); }
  .question-illust { width: min(24vw, 210px); max-height: 54vh; }
  /* 타임 오버 알림: 세로 공간이 부족하니 압축하고 버튼은 가로로 (넓어서 한 줄 유지) */
  .timeup-icon { width: 54px; height: 54px; }
  .timeup-title { font-size: 2.1rem; }
  .timeup-sub { font-size: 1rem; }
  .timeup-buttons { flex-direction: row; margin-top: 14px; width: min(460px, 100%); }
  .timeup-buttons .btn { flex: 1; min-height: 46px; font-size: 0.98rem; }

  .timer-btn { min-height: 42px; font-size: 0.9rem; }
  .timer-btn.is-run { min-height: 52px; }
  .timer-btn.is-run #timer-text { font-size: 1.5rem; }
  .timer-btn.is-run svg { width: 22px; height: 22px; }
  .timer-row .timer-btn { min-width: 112px; }
  .timer-btn svg { width: 17px; height: 17px; }
  .timer-adj { min-width: 46px; font-size: 0.72rem; }
  .timer-toggle { padding: 10px 14px; }
  .timer-length { padding: 8px 14px 10px; }
  .stepper-btn { width: 34px; height: 34px; }

  .rule-card { padding: 11px 12px; }
  .rule-icon { width: 36px; height: 36px; }
  .rule-icon svg { width: 21px; height: 21px; }
  .rule-name { font-size: 0.95rem; }
  .rule-desc { font-size: 0.8rem; }

  .flow-icon { width: 42px; height: 42px; }
  .flow-icon svg { width: 23px; height: 23px; }
  .flow-title { font-size: 1rem; }
  .flow-desc { font-size: 0.82rem; }
  .flow-content { padding-top: 8px; }
  .score-card { padding: 12px 14px 14px; gap: 9px; }

  .end-illust { width: min(24vw, 210px); }
  .end-title { font-size: 1.6rem; }
  .end-sub { font-size: 1rem; }
  .end-buttons { margin-top: 12px; gap: 9px; }

  .sheet-item { min-height: 46px; padding: 11px 8px; font-size: 0.98rem; }
}

/* ───────── 참가자 답지 · 반응형 보정 ─────────
   위의 기본 규칙들 뒤에 와야 덮어쓰기가 제대로 된다 */

/* 태블릿 세로
   ------------------------------------------------------------
   높이에 영향을 주는 값(min-height·안쪽 여백·동그라미 크기)은 여기서
   건드리지 않는다. 위의 svh clamp가 상한까지 알아서 키워주는데
   여기서 고정값으로 덮으면 화면을 넘겨 스크롤이 생긴다.
   글자 크기와 좌우 여백처럼 높이를 크게 흔들지 않는 것만 조정한다. */
@media (min-width: 700px) and (min-height: 620px) {
  .role-illust { width: min(52%, 270px); }
  .role-name { font-size: 1.28rem; }
  .role-desc { font-size: 0.98rem; }
  .role-note { font-size: 0.9rem; }
  .role-icon { width: 60px; height: 60px; }
  .role-icon svg { width: 31px; height: 31px; }
  .role-foot p { font-size: 0.92rem; }

  .ans-text-input { font-size: 1.14rem; }
  .ans-input { font-size: 1.14rem; padding-left: 18px; padding-right: 18px; }
  .ans-input-num { font-size: 1.05rem; }
  .ans-score-btn { padding-left: 18px; padding-right: 18px; }
  .ans-score-check svg { width: 19px; height: 19px; }
  .ans-center-title { font-size: 1.9rem; }
  .ans-center-sub { font-size: 1.12rem; }
  .ans-result-num strong { font-size: 2.4rem; }
  .ans-final-title { font-size: 2.2rem; }
  .ans-final-score strong { font-size: 4.2rem; }
  .ans-review-text { font-size: 1.08rem; }
}

/* 휴대폰 가로처럼 높이가 부족할 때: 안내 영역을 최대한 접는다 */
@media (orientation: landscape) and (min-width: 620px) and (max-height: 540px) {
  .ans-name-illust { display: none; }
  .ans-name-title { font-size: 1.25rem; }
  .ans-name-sub, .ans-name-note { font-size: 0.85rem; }

  .ans-head { gap: 6px; padding-top: 0; }
  .ans-owner { font-size: 1.05rem; }
  .ans-guide { font-size: 0.88rem; }
  .ans-input { min-height: 46px; font-size: 1rem; }
  .ans-input-list { gap: 7px; }

  .ans-stamp { width: 56px; height: 56px; }
  .ans-stamp svg { width: 28px; height: 28px; }
  .ans-center { gap: 10px; padding: 10px 0; }
  .ans-center-title { font-size: 1.3rem; }
  .ans-center-sub { font-size: 0.92rem; }

  .ans-result-card { padding: 12px 16px; }
  .ans-result-num strong { font-size: 1.7rem; }

  .ans-final-illust { display: none; }
  .ans-final-title { font-size: 1.4rem; }
  .ans-final-score strong { font-size: 2.6rem; }
  .ans-final-round { padding: 10px 16px; }
}

/* ───────── 답지 · 가로 화면 ─────────
   높이가 부족한 가로 모드에서는 6줄을 세로로 쌓을 수 없다.
   2열로 나눠 3줄로 만들면 스크롤 없이 들어온다. */
@media (orientation: landscape) and (max-height: 560px) {
  /* 문제 목록: 머리말 줄이 네 줄이라 세로가 부족하니 촘촘하게 */
  #screen-list { gap: 8px; }
  .cat-filter-row .cat-chip { min-height: 32px; padding: 6px 12px; font-size: 0.8rem; }
  .add-entry { min-height: 38px; font-size: 0.85rem; }

  .ans-input-list,
  .ans-score-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }

  .ans-head { gap: 4px; }
  .ans-owner { font-size: 1rem; }
  .ans-guide { font-size: 0.85rem; }
  .ans-memo-toggle { padding: 5px 14px; font-size: 0.8rem; }

  /* 2열이라 세로 여유가 생기므로 누르기 편한 높이를 지킨다 */
  .ans-input { padding-top: 9px; padding-bottom: 9px; }
  .ans-score-btn { padding-top: 9px; padding-bottom: 9px; }

  /* 이름 줄은 접고, 안내 문구는 줄바꿈을 풀어 한 줄로 (가로는 폭이 넓다) */
  .ans-owner { display: none; }
  .ans-guide br { display: none; }

  /* 하단을 한 줄로: 점수와 버튼을 나란히 놓아 높이를 절반으로 */
  .ans-footer { flex-direction: row; align-items: center; gap: 14px; }
  .ans-footer .btn-big { flex: 1; width: auto; }
  #screen-ans-score .ans-score-box { flex: 0 0 auto; padding: 0; }

  .ans-score-guide { font-size: 0.85rem; }
  .ans-memo-view { padding: 4px 10px; }

  /* 역할 고르기: 일러스트와 설명 한 줄을 접고 카드를 낮춘다 */
  .role-illust { display: none; }
  .role-card { padding: 12px 14px; gap: 12px; }
  .role-note { display: none; }
  .role-icon { width: 44px; height: 44px; }
  .role-icon svg { width: 23px; height: 23px; }
  .role-foot { padding: 9px 14px; }
  .role-foot-icon { width: 32px; height: 32px; }
  .role-foot p { font-size: 0.78rem; }
  .role-foot p br { display: none; }

  /* 결과 화면: 점수와 라운드 표만 남긴다 */
  .ans-final-body { gap: 4px; padding-top: 4px; }
  .ans-final-owner { font-size: 0.88rem; }
  .ans-final-score strong { font-size: 2.2rem; }
  .ans-final-rounds { margin-top: 6px; }
  .ans-final-round { padding: 7px 14px; }
  .ans-final-summary { margin-top: 6px; font-size: 0.85rem; }
  .ans-result-card { padding: 10px 16px; }
  .ans-result-num strong { font-size: 1.5rem; }
  .ans-center { gap: 8px; padding: 6px 0; }
}

/* ═══════════ 문제 등록 (커스텀) ═══════════ */
/* 문제 목록 화면의 등록 진입 버튼 */
.add-entry {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 14px;
  border: 2px dashed rgba(34, 49, 92, 0.28);
  background: rgba(255, 201, 60, 0.14);
  color: var(--navy);
  font-size: 0.92rem;
  font-weight: 800;
}
.add-entry:active { transform: scale(0.98); }
.add-entry svg {
  width: 17px;
  height: 17px;
  color: var(--yellow-deep);
}
.add-entry-note {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--white);
  border: 1px solid rgba(34, 49, 92, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
}

/* 등록 화면 */
#screen-add { gap: 10px; padding-bottom: 0; }
.add-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* 임시 저장 안내 */
.add-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FFF4D6;
  border: 2px solid rgba(245, 185, 15, 0.55);
  border-radius: 14px;
  padding: 12px 14px;
}
.add-notice svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--yellow-deep);
}
.add-notice p {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
}

.add-block { display: flex; flex-direction: column; gap: 9px; }
.add-label { font-size: 0.9rem; font-weight: 800; color: var(--navy); }
.add-deck-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-deck-chip.active {
  background: var(--deck-soft);
  border-color: var(--deck);
  color: var(--deck-deep);
}
.add-deck-chip.active::before { opacity: 1; }
.add-deck-hint {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-soft);
}

/* 카테고리 칩 */
.add-cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid rgba(34, 49, 92, 0.12);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}
.cat-chip:active { transform: scale(0.96); }
.cat-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.cat-chip-new {
  border-style: dashed;
  border-color: rgba(34, 49, 92, 0.28);
  background: rgba(255, 201, 60, 0.12);
  color: var(--navy);
}
.cat-chip-new.active {
  background: var(--yellow);
  border-style: solid;
  border-color: var(--yellow-deep);
  color: var(--navy);
}

/* 내가 등록한 문제 목록 */
.add-mine {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 2px dashed rgba(34, 49, 92, 0.12);
}
.add-mine-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 800;
  vertical-align: 2px;
}
.add-mine-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.add-mine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 10px 12px;
}
.add-mine-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--deck, var(--navy));
}
.add-mine-text {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: keep-all;
}
.add-mine-cat {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(34, 49, 92, 0.06);
  padding: 3px 8px;
  border-radius: 999px;
}
.add-mine-del {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(228, 75, 62, 0.1);
  color: #C1362A;
  font-size: 0.95rem;
  font-weight: 800;
}
.add-mine-del:active { transform: scale(0.9); }
.add-mine-empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.55;
  padding: 12px 0 4px;
  white-space: pre-line;
}

/* 직접 등록한 문제 표시 — 게임 카드 오른쪽 위
   카드는 가운데 정렬 flex라 흐름에서 빼내 모서리에 고정한다
   (카드 위쪽 8px 색 띠 바로 아래에 걸리도록 top을 잡는다) */
.custom-tag {
  position: absolute;
  top: 16px;
  right: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 28px);
  background: #FFF4D6;
  border: 2px solid var(--yellow-deep);
  color: #8A6300;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}
.custom-tag svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--yellow-deep);
}
/* 배지가 카드 내용 위에 겹쳐 앉지 않도록 위쪽 자리를 비워둔다
   (가로 모드 등 카드가 낮아졌을 때도 안전하게) */
.question-card.has-custom { padding-top: 52px; }

/* 직접 등록한 문제 표시 — 목록·고르기 화면의 별표 배지 */
.q-item-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 201, 60, 0.4);
  color: #8A6300;
  font-size: 0.74rem;
  font-weight: 800;
}

/* ═══════════ 문제 목록 · 카테고리 필터 ═══════════ */
.cat-filter-row {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.cat-filter-row::-webkit-scrollbar { display: none; }
.cat-filter-row .cat-chip { flex-shrink: 0; }

/* 목록 안의 스와이프 삭제 (직접 등록한 문제 전용) */
.q-swipe .swipe-under {
  border-radius: 14px;
  padding-right: 20px;
  font-size: 0.85rem;
}
.q-swipe .q-item { width: 100%; }

/* ═══════════ 문제 상세 팝업 ═══════════ */
.item-box {
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}
.item-custom {
  display: inline-flex;
  align-items: center;
  background: #FFF4D6;
  border: 2px solid var(--yellow-deep);
  color: #8A6300;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
}
.item-text {
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.45;
  word-break: keep-all;
  margin: 2px 0 4px;
}
.item-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.item-buttons .btn-big { min-height: 48px; font-size: 1rem; }
.btn-danger {
  background: var(--white);
  color: #C1362A;
  border: 2px solid rgba(228, 75, 62, 0.45);
}

/* 확인 팝업에서 줄바꿈을 살린다 (삭제 안내 등) */
.modal-message { white-space: pre-line; }

/* ═══════════ 등록 화면 · 수정 ═══════════ */
.add-mine-hint {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin-top: -2px;
}
/* 행 전체가 수정 버튼 */
.add-mine-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: none;
  padding: 0;
}
.add-mine-main:active { transform: scale(0.98); }
