/* ============================================================
   덕플라이 (#/duckfly)
     · 데스크톱: 왼쪽에 내 정보, 오른쪽에 최대 480px 게임 화면
     · 모바일  : 게임을 위에 세로로 크게, 내 정보는 그 아래로
     · 게임 안에서 손가락을 끌어 조작하므로 게임 칸의 스크롤은 막는다
   ============================================================ */

/* 데스크톱에서는 화면 스크롤을 막고, 모바일에서는 내 정보를 보려면 내려야 하므로 푼다 */
@media (min-width: 981px) {
  body.df-noscroll { overflow: hidden; overscroll-behavior: none; }
  /* 화면은 잠그되 왼쪽 카드가 잘리지 않게 이 칸만 따로 굴린다 */
  .df-left {
    max-height: calc(100dvh - 190px);
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }
}
@supports not (height: 100dvh) {
  @media (min-width: 981px) { .df-left { max-height: calc(100vh - 190px); } }
}

.df-page {
  padding: 10px 12px 16px;
  max-width: 1000px;
  margin: 0 auto;
}

.df-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.df-back { flex: 0 0 auto; white-space: nowrap; }
.df-title { min-width: 0; line-height: 1.35; }
.df-title b { display: block; font-size: 16px; color: var(--tx); }
.df-title small { display: block; font-size: 11px; color: var(--tx-sub); }

/* 좌: 내 정보 / 우: 게임 */
.df-grid {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.df-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.df-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  color: var(--tx);
  margin-bottom: 10px;
}

/* 배경음악 버튼 */
.df-bgm {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: #f4f8ff;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
}
.df-bgm:hover { background: #e8f1ff; }
.df-bgm.is-off { color: var(--tx-sub); background: #f2f4f8; }

/* ---------- 내 정보 ---------- */
.df-me-top { display: flex; align-items: center; gap: 12px; }
.df-me-avatar { flex: 0 0 auto; }
.df-me-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--tx);
  line-height: 1.4;
  min-width: 0;
  word-break: break-all;
}
.df-me-role {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--tx-sub);
}
.df-me-points {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f8ff;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.df-me-plabel { font-size: 12px; font-weight: 800; color: var(--tx-sub); }
.df-me-points b { font-size: 17px; font-weight: 900; color: var(--blue); white-space: nowrap; }
.df-me-points b i { font-style: normal; }
.df-me-points b small { font-size: 11px; }

.df-me-btns { display: flex; gap: 8px; margin-top: 10px; }
.df-btn {
  flex: 1 1 0;
  border-radius: 11px;
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  border: 1px solid var(--card-border);
  white-space: nowrap;
}
.df-btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.df-btn-blue:hover { filter: brightness(1.06); }
.df-btn-ghost { background: #fff; color: var(--tx); }
.df-btn-ghost:hover { background: #f4f8ff; }

/* ---------- DC포인트 적립 ---------- */
.df-earn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--card-border);
}
.df-earn-row:last-of-type { border-bottom: 0; }
.df-earn-k { font-size: 12px; font-weight: 800; color: var(--tx-sub); }
.df-earn-row b { font-size: 14px; font-weight: 900; color: var(--tx); }
.df-earn-row b.is-ok { color: #2f9e44; }

.df-earn-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--tx-sub);
}
.df-earn-note.is-ok { color: #2f9e44; font-weight: 800; }
.df-earn-note.is-warn { color: #e8590c; font-weight: 800; }
.df-retry { width: 100%; margin-top: 10px; flex: none; }

/* ---------- 게임 안내 ---------- */
.df-guide-row {
  padding: 7px 0;
  border-bottom: 1px dashed var(--card-border);
}
.df-guide-row:last-child { border-bottom: 0; }
.df-guide-row b { display: block; font-size: 12.5px; font-weight: 900; color: var(--tx); }
.df-guide-row span { display: block; font-size: 11px; color: var(--tx-sub); line-height: 1.55; margin-top: 2px; }

/* ---------- 게임 화면 ---------- */
.df-stage { display: flex; justify-content: center; min-width: 0; }

/* 세로 9:16 비율을 유지하되 화면 높이를 넘지 않게 한다 */
.df-frame-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 9 / 16;
  max-height: calc(100dvh - 190px);
  border-radius: 14px;
  overflow: hidden;
  background: #082b4a;
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(15, 47, 98, .18);
}
@supports not (height: 100dvh) {
  .df-frame-box { max-height: calc(100vh - 190px); }
}

.df-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  touch-action: none;      /* 게임 안 터치 드래그가 페이지 스크롤로 새지 않게 */
}

.df-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #cfe4ff;
  z-index: 2;
  pointer-events: none;
}

.df-blocked {
  width: 100%;
  max-width: 480px;
  padding: 40px 20px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--tx);
}
.df-blocked b { display: block; font-size: 16px; margin-bottom: 8px; }
.df-blocked p { font-size: 13px; color: var(--tx-sub); margin: 0; }

/* ============================================================
   태블릿 — 내 정보를 게임 아래 두 칸으로
   ============================================================ */
@media (max-width: 980px) {
  .df-grid { grid-template-columns: 1fr; }
  .df-stage { order: 1; }
  .df-left { order: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .df-guide { grid-column: 1 / -1; }
  .df-frame-box { max-height: calc(100dvh - 230px); }
  @supports not (height: 100dvh) {
    .df-frame-box { max-height: calc(100vh - 230px); }
  }
}

/* ============================================================
   모바일 — 게임을 세로로 크게, 내 정보는 그 아래
   ============================================================ */
@media (max-width: 767px) {
  .df-page { padding: 6px 8px 20px; }   /* 하단 네비 자리는 body 가 이미 비워둔다 */
  .df-bar { margin-bottom: 6px; gap: 8px; }
  .df-title small { display: none; }
  .df-left { grid-template-columns: 1fr; }
  .df-frame-box {
    border-radius: 12px;
    /* 상단 헤더 + 되돌아가기 줄 + 하단 네비게이션 만큼만 빼고 나머지를 다 쓴다 */
    max-height: calc(100dvh - 168px);
  }
  @supports not (height: 100dvh) {
    .df-frame-box { max-height: calc(100vh - 168px); }
  }
}
