/* ============================================================
   덕스마인드 (DUCK'S MIND) — 실시간 그림 퀴즈
   시안 규격: 연한 하늘색 배경 · 흰 카드 · 파란 주요 버튼 · 노란 포인트
   PC: 좌 참가자 / 중앙 그림판 / 우 정답 채팅 · 모바일: 세로 재배치
   ============================================================ */
.dm-page { max-width: 1400px; margin: 14px auto 20px; padding: 0 14px; }

/* ---------- 제목 카드 (시안 상단) ---------- */
.dm-hero { display: flex; align-items: center; gap: 14px; padding: 16px 22px; margin-bottom: 12px; }
.dm-hero-ico { width: 52px; height: 52px; border-radius: 14px; background: #fff3d6;
  display: flex; align-items: center; justify-content: center; font-size: 26px; flex: none; }
.dm-hero-tx { flex: 1 1 auto; min-width: 0; }
.dm-hero-title { font-size: 22px; font-weight: 900; color: var(--blue); letter-spacing: .04em; }
.dm-hero-desc { margin: 3px 0 0; font-size: 12.5px; font-weight: 700; color: var(--tx-sub); }
.dm-hero-btns { display: flex; gap: 8px; flex: none; }

/* ---------- 상태 줄 (라운드 · 출제자 · 제시어 · 남은 시간) ---------- */
.dm-status { display: flex; align-items: center; gap: 18px; padding: 12px 22px 16px; margin-bottom: 12px; position: relative; }
.dm-st-round { font-size: 15px; font-weight: 900; color: var(--tx); white-space: nowrap; }
.dm-st-drawer { font-size: 13px; font-weight: 800; color: var(--tx-sub); white-space: nowrap; }
.dm-st-word { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 800; color: var(--tx-sub); min-width: 0; flex-wrap: wrap; }
.dm-cell { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #b9cdec;
  font-size: 14px; font-weight: 900; color: var(--tx); background: #f4f8ff; }
.dm-cell.is-open { border-color: var(--blue); background: #e3edff; }
.dm-cell.is-space { border: 0; background: none; width: 10px; }
.dm-st-time { font-size: 20px; font-weight: 900; color: #e05252; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dm-st-time-label { font-size: 12.5px; font-weight: 700; color: var(--tx-sub); margin-right: 6px; }
.dm-st-bar { position: absolute; left: 22px; right: 22px; bottom: 6px; height: 6px;
  border-radius: 4px; background: #e8eef8; overflow: hidden; }
.dm-st-bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px;
  transform-origin: left; transition: width .5s linear; }

/* ---------- 본판 3단 ---------- */
.dm-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 290px; gap: 12px; align-items: start; }

/* 참가자 */
.dm-players .gg-card-title { display: flex; justify-content: space-between; align-items: center; }
.dm-pl-count { font-size: 12px; font-weight: 800; color: var(--tx-sub); }
.dm-pl-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid #eef3fb; }
.dm-pl-row:last-child { border-bottom: 0; }
.dm-pl-info { flex: 1 1 auto; min-width: 0; }
.dm-pl-name { font-size: 13.5px; font-weight: 900; color: var(--tx);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-pl-sub { font-size: 11.5px; font-weight: 700; color: var(--tx-sub); }
.dm-pl-sub.is-draw { color: #e8a20c; }
.dm-pl-sub.is-solved { color: #1f9254; }
.dm-pl-score { font-size: 13px; font-weight: 900; color: var(--blue); font-variant-numeric: tabular-nums; }
.dm-pl-row.is-off { opacity: .45; }

/* 그림판 */
.dm-boardcard { padding: 14px 16px 12px; }
.dm-board-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.dm-board-msg { flex: 1 1 auto; font-size: 13px; font-weight: 800; color: var(--tx-sub); min-width: 120px; }
/* ---------- 그림 도구 막대 (2026-08-25 · 윈도우 그림판식) ----------
   [도구: 연필·직선·사각형·원·삼각형·채우기·지우개] [굵기] [색판] [전체 지우기]
   한 줄이 좁으면 자동으로 접히고, 색판은 12칸 격자라 두 줄로 가지런히 놓인다. */
.dm-tools { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap;
  width: 100%; padding: 7px 8px; border: 1px solid #dde7f4; border-radius: 12px; background: #f7fafe; }
/* ⚠ display:flex 가 hidden 속성(UA 의 display:none)보다 세다 — 명시해야 «맞히는 사람» 에게 도구가 안 보인다 */
.dm-tools[hidden] { display: none; }
.dm-tool-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dm-tool { border: 1px solid #d7e2f2; background: #fff; color: var(--tx); font-weight: 800;
  font-size: 12px; border-radius: 9px; padding: 5px 10px; cursor: pointer; }
.dm-tool.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
/* 도구 버튼 — 아이콘 위 / 이름 아래 (작게) */
.dm-shape { display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; width: 46px; padding: 4px 2px; line-height: 1.05; }
.dm-shape i { font-style: normal; font-size: 15px; }
.dm-shape b { font-size: 10px; font-weight: 800; }
/* 되돌리기 · 전체 지우기 — 그리기 도구와 헷갈리지 않게 오른쪽 끝에 따로 묶는다 */
.dm-acts { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.dm-undo { background: #eef4ff; border-color: #cfdff8; color: #2a5fbf; white-space: nowrap; }
.dm-undo:disabled { opacity: .45; cursor: default; }
.dm-clear { background: #fff1f1; border-color: #f3c9c9; color: #b23c3c; white-space: nowrap; }
.dm-widths { display: flex; align-items: center; gap: 4px; }
.dm-width { width: 26px; height: 26px; border-radius: 8px; border: 1px solid #d7e2f2; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.dm-width i { display: block; border-radius: 50%; background: var(--tx); }
.dm-width.is-on { border-color: var(--blue); background: #e3edff; }
/* 색판 — 12칸 격자 (색이 늘어도 줄만 늘어난다) */
.dm-palette { display: grid; grid-template-columns: repeat(12, 20px); gap: 4px; }
.dm-color { width: 20px; height: 20px; border-radius: 6px; border: 1px solid rgba(0,0,0,.16); cursor: pointer;
  padding: 0; }
.dm-color.is-on { box-shadow: 0 0 0 2px var(--blue); border-color: #fff; }
.dm-canvas-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3;
  border: 1px solid #dde7f4; border-radius: 10px; overflow: hidden; background: #fff; }
.dm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.dm-canvas.is-drawer { cursor: crosshair; }
.dm-canvas.is-drawer.is-fill { cursor: copy; }
.dm-board-note { margin: 10px 0 2px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--tx-sub); }
/* 그림판 위에 겹치는 안내 (제시어 고르는 중 · 라운드 결과) */
.dm-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; background: rgba(255,255,255,.94);
  text-align: center; padding: 16px; z-index: 3; }
/* ⚠ display:flex 가 hidden 속성(UA 의 display:none)보다 세다 — 숨김을 명시해야 캔버스를 안 가린다 */
.dm-overlay[hidden] { display: none; }

/* 라운드 시작 차례 알림 — 그림을 막지 않게 위쪽 띠로 잠깐 떴다 사라진다 */
.dm-turn-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  max-width: 92%; padding: 10px 22px; border-radius: 999px;
  background: #ffffff; border: 2px solid #bcd2f5; color: var(--tx);
  font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 8px 22px rgba(37, 110, 235, .18);
  z-index: 4; pointer-events: none;
  animation: dm-turn-in .3s ease-out, dm-turn-out .4s ease-in 2.8s forwards;
}
/*  내 차례 — 크고 확실하게 (파란 바탕 + 살짝 두근거림) */
.dm-turn-banner.is-me {
  background: var(--blue); border-color: var(--blue); color: #fff;
  font-size: 17px; padding: 13px 28px;
  animation: dm-turn-in .3s ease-out, dm-turn-pulse 1.1s ease-in-out .3s 2, dm-turn-out .4s ease-in 2.8s forwards;
}
@keyframes dm-turn-in { from { opacity: 0; transform: translateX(-50%) translateY(-14px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes dm-turn-out { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
@keyframes dm-turn-pulse { 50% { transform: translateX(-50%) scale(1.06); } }
@media (max-width: 900px) {
  .dm-turn-banner { font-size: 13px; padding: 8px 16px; }
  .dm-turn-banner.is-me { font-size: 14.5px; padding: 10px 20px; }
}
.dm-overlay b { font-size: 20px; color: var(--tx); }
.dm-overlay p { margin: 0; font-size: 13px; font-weight: 700; color: var(--tx-sub); }
.dm-ov-word { font-size: 26px; font-weight: 900; color: var(--blue); }
.dm-cand { display: flex; flex-direction: column; gap: 8px; width: min(260px, 90%); }
.dm-cand button { padding: 12px; border-radius: 12px; border: 1px solid #d7e2f2; background: #f4f8ff;
  font-size: 16px; font-weight: 900; color: var(--tx); cursor: pointer; }
.dm-cand button:hover { background: #e3edff; border-color: var(--blue); }

/* 정답 채팅 */
.dm-chatcard { display: flex; flex-direction: column; min-height: 420px; }
.dm-chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dm-chat-tip { background: #eaf2ff; border-radius: 10px; padding: 10px 12px; font-size: 12px;
  font-weight: 700; color: #4a6ca8; line-height: 1.6; margin-bottom: 8px; }
.dm-chat-list { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; min-height: 200px; max-height: 430px; }
.dm-chat-line { display: flex; gap: 10px; padding: 5px 2px; font-size: 13px; line-height: 1.5; }
.dm-chat-nick { font-weight: 900; color: var(--blue); flex: none; max-width: 88px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-chat-text { color: var(--tx); font-weight: 600; word-break: break-all; }
.dm-chat-line.is-sys .dm-chat-text { color: var(--tx-sub); font-weight: 700; }
.dm-chat-line.is-solve .dm-chat-text { color: #1f9254; font-weight: 900; }
.dm-chat-line.is-hidden .dm-chat-text { color: #a3aec2; }
.dm-chat-form { display: flex; gap: 8px; margin-top: 10px; }
.dm-chat-input { flex: 1 1 auto; min-width: 0; border: 1px solid #d7e2f2; background: #f6f9ff;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--tx); }
.dm-chat-input:focus { outline: 2px solid #bcd2f5; }
.dm-chat-input:disabled { opacity: .6; }

/* ---------- 로비 ---------- */
.dm-lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.dm-lobby-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.dm-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.dm-room { border: 1px solid #e3edf9; border-radius: 14px; padding: 14px; background: #fbfdff;
  display: flex; flex-direction: column; gap: 8px; }
.dm-room-title { font-size: 14.5px; font-weight: 900; color: var(--tx);
  display: flex; align-items: center; gap: 6px; }
.dm-room-sub { font-size: 12px; font-weight: 700; color: var(--tx-sub); display: flex; gap: 10px; }
.dm-room-state { font-weight: 900; }
.dm-room-state.is-playing { color: #e8a20c; }
.dm-room-state.is-waiting { color: #1f9254; }
.dm-room-foot { display: flex; justify-content: flex-end; }
.dm-none { text-align: center; color: var(--tx-sub); font-weight: 700; font-size: 13px; padding: 34px 0; }

/* ---------- 대기방 ---------- */
.dm-wait-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 12px; align-items: start; }
.dm-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dm-seat { border: 1px solid #e3edf9; border-radius: 14px; padding: 14px 10px; background: #fbfdff;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.dm-seat.is-empty { border-style: dashed; color: #b9c5d8; font-weight: 800; font-size: 12.5px;
  justify-content: center; min-height: 132px; }
.dm-seat-name { font-size: 13.5px; font-weight: 900; color: var(--tx); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-seat-tag { font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.dm-seat-tag.is-leader { background: #fff3d6; color: #b9700a; }
.dm-seat-tag.is-ready { background: #e2f6ea; color: #1f9254; }
.dm-seat-tag.is-wait { background: #eef2f9; color: var(--tx-sub); }
.dm-seat-tag.is-watch { background: #e9e9f9; color: #6a6ac2; }
.dm-seat-kick { border: 0; background: none; color: #e05252; font-size: 11.5px; font-weight: 800; cursor: pointer; }
.dm-wait-btns { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.dm-wait-btns .gg-btn { width: auto; min-width: 170px; padding: 12px 30px;
  font-size: 15px; font-weight: 900; border-radius: 12px; }
.dm-wait-btns .dm-wait-note { align-self: stretch; text-align: center; }
.dm-wait-note { font-size: 12px; font-weight: 700; color: var(--tx-sub); line-height: 1.7; }

/* ---------- 결과 ---------- */
.dm-podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; padding: 12px 0 4px; }
.dm-pod { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dm-pod-no { font-weight: 900; color: var(--tx-sub); }
.dm-pod-1 .dm-pod-no { color: #e8a20c; font-size: 18px; }
.dm-pod-name { font-weight: 900; color: var(--tx); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dm-pod-score { font-weight: 900; color: var(--blue); }
.dm-result-rows { margin-top: 10px; }
.dm-result-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid #eef3fb; font-size: 13px; }
.dm-result-row b { color: var(--tx); }
.dm-result-row small { color: var(--tx-sub); font-weight: 700; }
.dm-result-btns { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.dm-result-btns .gg-btn { min-width: 150px; padding: 12px 26px;
  font-size: 15px; font-weight: 900; border-radius: 12px; }

/* ---------- 방 만들기 팝업 ---------- */
.dm-form label { display: block; font-size: 12.5px; font-weight: 800; color: var(--tx-sub); margin: 10px 0 4px; }
.dm-form input[type="text"], .dm-form input[type="password"], .dm-form select {
  width: 100%; box-sizing: border-box; border: 1px solid #d7e2f2; background: #f6f9ff;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--tx); }
.dm-form .dm-form-row { display: flex; gap: 10px; }
.dm-form .dm-form-row > div { flex: 1; }
.dm-form-check { display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; font-weight: 800; color: var(--tx); cursor: pointer; }
.dm-form-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- 모바일 (세로 재배치 — 그림판과 채팅이 «한 화면에» 같이 보이게) ---------- */
@media (max-width: 900px) {
  .dm-page { margin: 8px auto 12px; padding: 0 8px; }
  /* minmax(0,1fr): 그림판 폭 계산이 칸을 밀어 화면 밖으로 넘치지 않게 */
  .dm-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dm-wait-grid { grid-template-columns: 1fr; }
  .dm-hero { padding: 9px 12px; gap: 10px; margin-bottom: 8px; }
  .dm-hero-title { font-size: 16px; }
  .dm-hero-desc { display: none; }
  .dm-hero-ico { width: 36px; height: 36px; font-size: 19px; border-radius: 10px; }
  .dm-status { flex-wrap: wrap; gap: 6px 12px; padding: 10px 12px 14px; margin-bottom: 8px; }
  .dm-st-round { font-size: 13.5px; }
  .dm-st-word { order: 3; width: 100%; justify-content: flex-start; }
  .dm-cell { width: 22px; height: 22px; font-size: 12.5px; }
  .dm-st-time { margin-left: auto; font-size: 17px; }
  /* 참가자는 가로 원형 아바타 줄로 (시안) */
  .dm-players { order: 1; padding: 8px 12px; }
  .dm-players .dm-pl-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
  .dm-pl-row { flex-direction: column; gap: 4px; border-bottom: 0; flex: none; width: 60px; padding: 2px; }
  .dm-pl-info { text-align: center; width: 100%; }
  .dm-pl-name { font-size: 11.5px; max-width: 60px; }
  .dm-pl-sub { display: none; }
  .dm-pl-score { font-size: 11px; }
  /* 그림판 — 4:3 비율을 지키면서 화면 높이의 36% 안으로 (폭이 자동으로 줄어든다) */
  .dm-boardcard { order: 2; padding: 10px 10px 8px; }
  .dm-canvas-wrap { width: min(100%, calc(26vh * 4 / 3)); width: min(100%, calc(26dvh * 4 / 3)); margin: 0 auto; }
  .dm-board-top { margin-bottom: 6px; gap: 6px; }
  .dm-board-note { display: none; }
  /* 도구 막대 — 이름은 숨기고 아이콘만, 색판은 촘촘히 (딱 두 줄로 담기게) */
  .dm-tools { gap: 5px; padding: 5px 6px; border-radius: 10px; }
  .dm-tool-group { gap: 3px; }
  .dm-shape { width: 31px; padding: 4px 0; }
  .dm-shape b { display: none; }
  .dm-shape i { font-size: 15px; }
  .dm-tool { font-size: 11px; padding: 4px 8px; border-radius: 8px; }
  .dm-width { width: 22px; height: 22px; border-radius: 7px; }
  .dm-widths { gap: 3px; }
  .dm-palette { grid-template-columns: repeat(12, 1fr); gap: 3px; flex: 1 1 190px; }
  .dm-color { width: 100%; height: 17px; border-radius: 5px; }
  .dm-acts { margin-left: 0; align-self: center; gap: 4px; }
  .dm-acts .dm-tool { padding: 4px 6px; font-size: 10.5px; }
  .dm-palette { flex: 1 1 176px; }
  /* 위쪽 카드들도 한 단씩 낮춰 «그림 + 채팅» 이 함께 보이게 */
  .dm-hero { padding: 7px 12px; margin-bottom: 6px; }
  .dm-status { padding: 8px 12px 12px; margin-bottom: 6px; }
  .dm-players { padding: 6px 12px; }
  .dm-boardcard { padding: 8px 10px 6px; }
  /* 채팅 — 그림판 바로 아래에 축소 없이 (목록만 짧게) */
  .dm-chatcard { order: 3; min-height: 0; padding: 10px 12px; }
  .dm-chat-tip { display: none; }
  .dm-chat-list { max-height: 13vh; max-height: 13dvh; min-height: 60px; }
  .dm-players .gg-card-title, .dm-chatcard .gg-card-title { margin-bottom: 4px; font-size: 14px; }
}

/* ---------- 모바일 «가로모드» (2026-08-25)
   폰을 눕히면 세로 공간이 거의 없다 — 세로 재배치를 풀고 PC처럼
   «참가자 | 그림판 | 정답 채팅» 세 칸으로 눕혀서 그림과 채팅을 나란히 본다.
   그림판은 폭이 아니라 «남은 높이» 로 크기를 잡는다 (4:3 유지).
   (가로 + 높이 620px 이하 = 손에 든 폰. 태블릿 가로는 해당 없음) ---------- */
@media (orientation: landscape) and (max-height: 620px) and (max-width: 1180px) {
  .dm-page { margin: 4px auto 6px; padding: 0 8px; }
  .dm-grid { grid-template-columns: 124px minmax(0, 1fr) minmax(190px, 250px); gap: 8px; align-items: start; }
  /* 제목·상태 줄은 최소로 (나가기 버튼과 남은 시간은 남긴다) */
  .dm-hero { padding: 3px 10px; margin-bottom: 4px; gap: 8px; }
  .dm-hero-ico { display: none; }
  .dm-hero-title { font-size: 13px; }
  .dm-hero .gg-btn { padding: 3px 10px; font-size: 11px; }
  .dm-status { padding: 4px 10px 8px; margin-bottom: 4px; gap: 3px 10px; }
  .dm-st-round { font-size: 12px; }
  .dm-st-drawer { font-size: 11.5px; }
  .dm-st-word { order: 0; width: auto; }
  .dm-st-time { font-size: 14px; margin-left: auto; }
  .dm-cell { width: 19px; height: 19px; font-size: 11.5px; }
  /* 참가자 — 왼쪽 세로 목록 (세로모드의 «가로 줄» 배치를 되돌린다) */
  .dm-players { order: 0; padding: 6px 8px; }
  .dm-players .gg-card-title { margin-bottom: 2px; font-size: 12px; }
  .dm-players .dm-pl-list { display: block; overflow-x: visible; overflow-y: auto;
    max-height: 30vh; max-height: 30dvh; overscroll-behavior: contain; padding-bottom: 0; }
  .dm-pl-row { flex-direction: row; width: auto; gap: 6px; padding: 3px 2px;
    border-bottom: 1px solid #eef3fb; }
  .dm-pl-info { text-align: left; width: auto; }
  .dm-pl-name { font-size: 11.5px; max-width: none; }
  .dm-pl-sub { display: none; }
  .dm-pl-score { font-size: 11px; }
  /* 그림판 — 가운데. 가로모드는 «높이» 가 귀하니 도구를 그림 왼쪽 세로 칸으로 옮긴다
     (그림판 프로그램처럼 — 그만큼 그림이 커진다) */
  .dm-boardcard { order: 0; padding: 6px;
    display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 6px; align-items: start; }
  /* 도구가 없는 사람(맞히는 쪽)은 그림이 칸을 다 쓴다 */
  .dm-boardcard:has(#dm-tools[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .dm-board-top { margin: 0; display: block; }
  .dm-board-top:has(#dm-tools:not([hidden])) .dm-board-msg { display: none; }
  .dm-canvas-wrap { width: min(100%, calc(55vh * 4 / 3)); width: min(100%, calc(55dvh * 4 / 3)); margin: 0 auto; }
  .dm-board-note { display: none; }
  .dm-tools { width: 100%; gap: 4px; padding: 4px; }
  .dm-tool-group { gap: 3px; }
  .dm-shape { width: 29px; }
  .dm-widths { gap: 3px; }
  .dm-width { width: 22px; height: 22px; }
  .dm-palette { grid-template-columns: repeat(8, 1fr); gap: 3px; flex: 1 1 100%; }
  .dm-color { width: 100%; height: 14px; }
  .dm-acts { margin: 0; width: 100%; flex-direction: column; gap: 3px; }
  .dm-acts .dm-tool { width: 100%; font-size: 10.5px; padding: 3px 4px; }
  /* 정답 채팅 — 오른쪽 */
  .dm-chatcard { order: 0; min-height: 0; padding: 6px 8px; }
  .dm-chat-tip { display: none; }
  .dm-chat-head small { display: none; }
  .dm-chat-list { min-height: 56px; max-height: 26vh; max-height: 26dvh; }
  .dm-chat-form { margin-top: 6px; }
}

/* ============================================================
   최근 게임 기록 팝업 (2026-08-18)
   · 목록만 팝업 안에서 스크롤 · 그림은 800×600 비율 그대로 축소 표시
   ============================================================ */
.dmh-back {
  position: fixed; inset: 0; z-index: 12500;
  background: rgba(15, 35, 75, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dmh-card {
  width: 560px; max-width: 100%; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 20px; padding: 18px 18px 14px;
  box-shadow: 0 20px 50px rgba(20, 45, 90, .3);
  display: flex; flex-direction: column; min-height: 0;
}
.dmh-head { position: relative; display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; padding-right: 30px; }
.dmh-head > b { font-size: 16px; color: var(--tx); }
.dmh-head small { font-size: 11.5px; font-weight: 700; color: var(--tx-sub); }
.dmh-x {
  position: absolute; top: -4px; right: -4px; width: 30px; height: 30px;
  border: none; background: none; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 20px; font-weight: 800; color: var(--tx-sub); line-height: 1;
}
.dmh-x:hover { background: #f2f7fc; color: var(--tx); }
.dmh-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; padding-right: 3px;
}
.dmh-game { border: 1px solid var(--card-border, #e6ecf5); border-radius: 14px; overflow: hidden; flex-shrink: 0; }
.dmh-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; padding: 10px 12px; border: none; background: #f7fafd;
  cursor: pointer; font-family: inherit; text-align: left;
}
.dmh-row:hover { background: #eef5fd; }
.dmh-time { font-size: 12.5px; font-weight: 900; color: var(--blue); }
.dmh-players { font-size: 12px; font-weight: 800; color: var(--tx); word-break: break-all; line-height: 1.5; }
.dmh-meta { font-size: 11px; font-weight: 700; color: var(--tx-sub); }
.dmh-rounds { display: flex; flex-direction: column; gap: 14px; padding: 12px; background: #fff; }
.dmh-round-h { font-size: 12.5px; font-weight: 800; color: var(--tx); margin-bottom: 6px; }
.dmh-round-h .dmh-word { color: var(--blue); }
.dmh-round-h small { color: var(--tx-sub); }
.dmh-cv { width: 100%; height: auto; border: 1px solid #e6ecf5; border-radius: 10px; background: #fff; display: block; }
.dmh-empty { margin: 8px 0; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--tx-sub); }
