/* ZUZ Arcade 공통 틀 (MGW-DEV-007, 요구사항 v03)
   화면 3개: 시작 페이지(home.css) / 게임 화면(이 파일 .game-page) / 결과 화면(이 파일 .rs, common/ranking.js)
   - 스크롤 없는 풀사이즈: 세로·가로 어느 방향이든 한 화면(100dvh) 안
   - 게임 화면: 게임 요소(판·점수) + 아주 작은 ZUZ 로고 + 뒤로가기 아이콘 + 플레이 수만 (광고 없음)
     세로 화면: 위 줄(뒤로·점수·버튼) / 판 / 아래 작은 줄(플레이 수·로고)
     가로 화면: 왼쪽 띠(뒤로·로고) / 판 / 오른쪽 띠(점수·버튼·플레이 수)
   - 판 크기 --size: 남는 공간에서 판 비율(--aspect = 높이/폭)을 지키는 최대 크기
   - 광고: 결과 화면 맨 아래 작은 띠 하나만 (MGW-DEV-008, .rs-ad, common/ads.js). 시작·게임 화면에는 없다
   외부 폰트·이미지 없음. */
:root {
  --cf-ink: #1d2540;
  --cf-muted: #5f6987;
  --cf-accent: #3f6fe0;
  --cf-accent-ink: #2a52c0;  /* 밝은 바탕 위 파란 글자 (4.5:1 이상) */
  --cf-line: #d9deea;
  --cf-bg: #f3f5fa;
  --cf-font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --cf-safe-y: calc(env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  --cf-safe-x: calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
  /* 세로 화면 판 밖 높이: 위 줄 44 + 아래 줄 20 + 판 위아래 간격 8+8 */
  --bar-h: 44px;
  --foot-h: 20px;
  --rail-w: 76px;
  --extra-h: 0px;        /* 판 아래 게임 고유 줄(행성 순서 막대 등) */
  --aspect: 1;           /* 판 높이 / 폭 */
  --main-w: calc(100vw - 16px - var(--cf-safe-x));
  --main-h: calc(100vh - var(--bar-h) - var(--foot-h) - 16px - var(--cf-safe-y));
  --main-h: calc(100dvh - var(--bar-h) - var(--foot-h) - 16px - var(--cf-safe-y));
}
@media (orientation: landscape) {
  :root {
    --main-w: calc(100vw - 2 * var(--rail-w) - 16px - var(--cf-safe-x));
    --main-h: calc(100vh - 16px - var(--cf-safe-y));
    --main-h: calc(100dvh - 16px - var(--cf-safe-y));
  }
}

/* ---------- 게임 화면 ---------- */
.game-page {
  --size: min(var(--main-w), (var(--main-h) - var(--extra-h)) / var(--aspect));
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--bar-h) minmax(0, 1fr) var(--foot-h);
  grid-template-areas: "bar" "main" "foot";
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing: border-box;
  background: var(--cf-bg);
  color: var(--cf-ink);
  font-family: var(--cf-font);
}
.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 6px;
  width: var(--size);
  min-width: min(100%, 300px);
  max-width: 100%;
  margin: 0 auto;
}
.hud { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.play-area {
  grid-area: main;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 8px 0;
}
.foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--size);
  min-width: min(100%, 300px);
  max-width: 100%;
  margin: 0 auto;
  height: var(--foot-h);
}

/* 아이콘 버튼 (누르는 범위 44×44) */
.ibtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--cf-ink);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.ibtn:hover { background: rgba(29, 37, 64, 0.07); }
.ibtn:focus-visible { outline: 3px solid var(--cf-accent); outline-offset: -3px; }
.ibtn:disabled { opacity: 0.4; cursor: default; }
.ibtn[hidden] { display: none; }
.back { margin-left: -8px; }
.act { margin-left: auto; margin-right: -8px; }

/* 점수: 숫자만 크게, 최고점은 작은 트로피 + 숫자 */
.score { margin: 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; line-height: 1; }
.best { display: inline-flex; align-items: center; gap: 3px; margin: 0; font-size: 13px; font-weight: 700; color: var(--cf-muted); font-variant-numeric: tabular-nums; line-height: 1; }
.best svg { width: 14px; height: 14px; }
.plays { display: inline-flex; align-items: center; gap: 3px; margin: 0; font-size: 11px; font-weight: 700; color: var(--cf-muted); font-variant-numeric: tabular-nums; line-height: 1; }
.plays[hidden] { display: none; }
.logo { display: block; width: auto; height: 11px; opacity: 0.55; }
.foot .logo { margin-left: auto; }

/* 가로 화면: 왼쪽 띠(뒤로·로고) / 판 / 오른쪽 띠(점수·버튼·플레이 수) */
@media (orientation: landscape) {
  .game-page {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "back main hud" ". main ." "logo main plays";
  }
  .bar, .foot { display: contents; }
  .back { grid-area: back; margin: 6px 0 0; justify-self: center; }
  .hud { grid-area: hud; flex-direction: column; align-items: center; gap: 10px; padding-top: 10px; }
  .act { order: -1; margin: 0; }
  .plays { grid-area: plays; justify-self: center; margin-bottom: 10px; }
  .foot .logo { grid-area: logo; justify-self: center; margin: 0 0 12px; }
  .score { font-size: 22px; }
}

/* ---------- 공통 아이콘 세트 줄 (MGW-DEV-030, 다솜 DSN-004 set.css 5~6) ----------
   게임 화면 맨 위에 세트 줄(header.tb, 48, 시작 페이지와 같은 폭·자리) + 그 아래 게임 줄(.bar, 44, 판 폭: 점수·Best·버튼).
   ‹ 는 세트 줄 왼쪽(.tb-back). 세트 칸 모양은 top.css, 마크업은 common/zuz-set.js. */
:root { --set-h: 48px; }
.game-page {
  --main-h: calc(100dvh - var(--set-h) - var(--bar-h) - var(--foot-h) - 16px - var(--cf-safe-y));
  grid-template-rows: var(--set-h) var(--bar-h) minmax(0, 1fr) var(--foot-h);
  grid-template-areas: "set" "bar" "main" "foot";
}
.game-page > .tb { grid-area: set; }
@media (orientation: landscape) {
  .game-page { --main-h: calc(100dvh - var(--set-h) - 16px - var(--cf-safe-y)); }
}
/* 가로 + 높이 ≥ 480 (PC 등): 세로와 같게 맨 위 세트 줄, 그 아래는 띠 구조(판 · 오른쪽 띠) */
@media (orientation: landscape) and (min-height: 480px) {
  .game-page {
    grid-template-rows: var(--set-h) auto minmax(0, 1fr) auto;
    grid-template-areas: "set set set" ". main hud" ". main ." "logo main plays";
  }
}
/* 낮은 가로(높이 < 480): 세트를 왼쪽 띠(76)에 세로로. 순서는 위 → 아래로 같음. 라벨 없음, Sign in = 사람 그림 */
@media (orientation: landscape) and (max-height: 479.98px) {
  .game-page {
    --main-h: calc(100dvh - 16px - var(--cf-safe-y));
    grid-template-rows: auto minmax(0, 1fr) auto;      /* 위 4줄 규칙을 가로 3줄로 되돌림(안 하면 판이 2px 넘침 — DSN-004) */
    grid-template-areas: "set main hud" "set main ." "logo main plays";
  }
  .game-page > .tb { flex-direction: column; justify-content: flex-start; gap: 8px; width: auto; height: auto; margin: 0; padding-top: 6px; }
  .game-page > .tb .tb-back { margin: 0; }
  .game-page > .tb .tb-r { flex-direction: column; }
  .game-page > .tb .tb-btn { padding: 0; }
  .game-page > .tb .tb-lb { display: none; }
  .game-page > .tb .tb-btn.signin { padding: 0; }
  .game-page > .tb .tb-btn.signin svg { display: block; }
  .game-page > .tb .tb-btn.signin .tb-lb { display: none; }
  .game-page > .tb .snd-pop { top: auto; right: auto; left: calc(100% + 6px); bottom: 0; }
}
/* 높이 < 340 (568×320): 로고를 오른쪽 띠 아래(플레이 수 아래)로 — 왼쪽 띠 넘침 방지 */
@media (orientation: landscape) and (max-height: 339.98px) {
  .game-page { grid-template-areas: "set main hud" "set main ." "set main plays"; }
  /* MGW-DEV-032(DSN-006 plaza.css 2): Plaza 칸이 더해져 6칸 — 왼쪽 띠 위 여백 6 → 4, ‹ 와 세트 사이 8 → 0 (4 + 44 + 264 = 312 ≤ 320) */
  .game-page > .tb { gap: 0; padding-top: 4px; }
  .game-page .plays { margin-bottom: 28px; }
  .game-page .foot .logo { grid-area: plays; align-self: end; justify-self: center; margin: 0 0 10px; }
}

/* 판 위 아이콘 (시작·계속·새 판) */
.board-cover {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-radius: inherit;
  background: rgba(20, 26, 44, 0.55);
}
.board-cover.show { display: flex; }
.board-cover.ready { background: rgba(20, 26, 44, 0.25); }
.cover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffd56b;
  color: var(--cf-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.cover-btn.sub { width: 56px; height: 56px; background: #fff; }
.cover-btn svg { width: 34px; height: 34px; }
.cover-btn.sub svg { width: 26px; height: 26px; }
.cover-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.cover-btn[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 결과 화면 / 랭킹 보기 (common/ranking.js) ---------- */
html.rs-open, html.rs-open body { overflow: hidden; }
.rs {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--cf-bg);
  color: var(--cf-ink);
  font-family: var(--cf-font);
  animation: rs-in 200ms ease-out;
}
.rs > * { width: min(100% - 16px, 460px); }
.rs-head { flex: none; display: flex; align-items: center; gap: 10px; height: 52px; }
.rs-game { font-size: 13px; font-weight: 700; color: var(--cf-muted); }
.rs-score { flex: 1 1 auto; text-align: center; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.rs-score[hidden] { display: block; visibility: hidden; }
.rs-logo { width: auto; height: 11px; opacity: 0.55; }
/* MGW-DEV-028 (다솜 DSN-003 5장): 가운데 묶음(.rs-mid) = 최고 기록 · 칩 · 지급 줄 · Ranking 제목 · 표.
   결과 화면은 남는 높이가 있으면 묶음을 세로 가운데에(빈 칸이 광고 띠 쪽으로 몰리지 않음). 랭킹 보기는 표가 남는 높이를 다 쓴다 */
.rs-mid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-result .rs-mid { justify-content: center; }
.rs-side { display: contents; }
.rs-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; }
.rs-result .rs-list { flex: 0 1 auto; }
.rs-result.rs-measure .rs-list { flex: 1 1 auto; align-self: stretch; max-height: none; }   /* rowsFit 이 잴 때만 */
.rs-title { flex: none; height: 20px; padding: 0 12px; font-size: 13px; font-weight: 800; line-height: 20px; color: var(--cf-muted); }
.rs-best { flex: none; display: flex; align-items: center; justify-content: center; gap: 5px; height: 22px; font-size: 13px; font-weight: 700; color: var(--cf-muted); font-variant-numeric: tabular-nums; }
.rs-best svg { width: 16px; height: 16px; flex: none; }
.rs-best.new { color: var(--cf-accent-ink); font-size: 15px; font-weight: 800; }
.rs-chips { flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.rs-chips .chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: 16px; background: #fff; box-shadow: 0 2px 8px rgba(29, 37, 64, 0.07); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-chips .chip svg { width: 16px; height: 16px; flex: none; }
.rs-chips .chip.pending { visibility: hidden; }
.rs-chips .rs-perf-ball { padding: 0 8px; }
.rs-chips .chip .rs-star { width: 14px; height: 14px; margin-left: -2px; }   /* MGW-DEV-031 Bricks 다 깸 별 (DSN-005 2.8) */
.rs-tile { display: block; width: 18px; height: 18px; border-radius: 5px; background: #5a5fe0; }
.rs-snk { position: relative; display: block; width: 18px; height: 18px; }
.rs-snk i { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: #3fc1ae; }
.rs-snk i:nth-child(1) { left: 0; top: 11px; background: #1f8f86; }
.rs-snk i:nth-child(2) { left: 6px; top: 11px; }
.rs-snk i:nth-child(3) { left: 11px; top: 5px; background: #8ef0dc; }
.rs-ball { display: block; width: 18px; height: 18px; border-radius: 50%; background: #8f98ad; }
.rs-row {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.rs-row:nth-child(odd) { background: #e9edf6; }
.rs-rank { text-align: center; font-weight: 800; color: var(--cf-muted); }
.rs-row:nth-child(-n+3) .rs-rank { color: var(--cf-accent-ink); }
.rs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rs-val { text-align: right; font-weight: 800; }
.rs-sep { height: 22px; text-align: center; line-height: 22px; color: var(--cf-muted); }
.rs-me, .rs-row.rs-hi, .rs-row.rs-mine { background: #fff1c7 !important; box-shadow: inset 0 0 0 2px #f5b041; }
.rs-me { height: 52px; }
.rs-me .rs-rank { color: var(--cf-ink) !important; }
.rs-form { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rs-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 8px;
  border: 0;
  border-bottom: 2px solid #f5b041;
  border-radius: 6px 6px 0 0;
  background: #fff;
  color: var(--cf-ink);
  font: inherit;
  font-size: 16px;     /* 16px 미만이면 iOS가 화면을 확대한다 */
  font-weight: 700;
  caret-color: var(--cf-accent);
  user-select: text;
  -webkit-user-select: text;
}
.rs-input::placeholder { color: #9aa3b8; font-weight: 600; opacity: 1; }
.rs-input:focus { outline: none; border-bottom-color: var(--cf-accent); }
/* 등록 버튼: 글자 Save (MGW-DEV-028) */
.rs-ok {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--cf-accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.rs-ok:disabled { opacity: 0.5; cursor: default; }
.rs-ok:focus-visible { outline: 3px solid var(--cf-ink); outline-offset: 2px; }
.rs-shake { animation: rs-shake 360ms ease-in-out; }
.rs-turnstile { flex: none; }
.rs-turnstile[hidden] { display: none; }
.rs-foot { flex: none; display: flex; align-items: center; justify-content: center; gap: 28px; height: 72px; }
.rs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--cf-ink);
  box-shadow: 0 4px 14px rgba(29, 37, 64, 0.14);
  cursor: pointer;
  text-decoration: none;
}
.rs-again { background: var(--cf-accent); color: #fff; }
.rs-btn svg { width: 26px; height: 26px; }
.rs-btn:focus-visible { outline: 3px solid var(--cf-ink); outline-offset: 3px; }

/* 지급 줄 (MGW-DEV-020 H6, DSN-001 2장 → MGW-DEV-028 DSN-003 5장): 칩 아래·Ranking 위, 흰 칸 48px.
   [원소 칸 28 · 재료 이름 · 잔량 + ng · 이번 양 +184B(초록)].
   결과 화면이 열릴 때부터 자리를 잡는다(응답이 늦어도 화면이 밀리지 않음). 서버 응답 값으로만 그린다(common/ranking.js grantRow).
   상태(data-state): wait 응답 전 / grant 받음(연출) / cap 이번 양 0 / out 로그인 안 함 / fail 실패·지연 = 빈 칸 */
.gr {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 28px auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  height: 48px;
  padding: 0 14px;
  box-sizing: border-box;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(29, 37, 64, 0.07);
  color: #000;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
.gr-nm { font-size: 14px; font-weight: 700; color: var(--cf-ink); white-space: nowrap; }
.gr[data-state="out"] .gr-nm, .gr[data-state="out"] .gr-total, .gr[data-state="out"] .gr-add { visibility: hidden; }
.gr-slot { position: relative; width: 28px; height: 28px; }
.gr-cell { display: block; width: 28px; height: 28px; transition: opacity 80ms ease-out; }
.gr-cell svg { display: block; width: 28px; height: 28px; }
.gr[data-state="wait"] .gr-cell,
.gr[data-state="out"] .gr-cell,
.gr[data-state="fail"] .gr-cell { opacity: 0.35; }
/* MGW-DEV-021: 서버가 지급을 껐음 → 줄을 감춤(자리는 남겨 랭킹 표가 움직이지 않게) */
.gr[data-state="off"] { visibility: hidden; pointer-events: none; }
/* 로그인 안 함: 줄 전체가 /account/ 링크 — 흐린 원소 칸 + "Sign in to collect Copper" + › (사람 배지 없앰, DSN-003 5장) */
.gr-hit {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 14px 0 52px; border-radius: 14px;
  color: var(--cf-accent-ink); text-decoration: none;
}
.gr-lk { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.gr-hit svg { flex: none; width: 18px; height: 18px; }
.gr-hit:focus-visible { outline: 3px solid #000; outline-offset: 2px; }
.gr-total { min-width: 0; overflow: hidden; white-space: nowrap; text-align: right; font-size: 15px; font-weight: 800; letter-spacing: -0.2px; }
.gr-total small { margin-left: 3px; font-size: 11px; font-weight: 700; color: #5f6987; }
.gr-add { font-size: 14px; font-weight: 800; color: #1e7d4f; white-space: nowrap; opacity: 0; }
.gr-add.on { opacity: 1; animation: gr-add-in 160ms ease-out both; }
/* 떨어지는 조각: 바깥(.gr-p)은 낙하, 안(.gr-p i)은 착지 찌그러짐·흡수. 입력을 막지 않는다 */
.gr-fx { position: absolute; left: 14px; top: 10px; width: 28px; height: 28px; pointer-events: none; }
.gr-p {
  position: absolute; left: calc(50% - 6px + var(--dx, 0px)); top: 8px; width: 12px; height: 12px;
  animation: gr-fall 340ms cubic-bezier(0.5, 0, 0.9, 0.4) var(--d, 0ms) both;
}
.gr-p i { display: block; width: 12px; height: 12px; transform-origin: 50% 100%;
  animation: gr-absorb 180ms ease-out calc(var(--d, 0ms) + 340ms) both; }
.gr-p svg { display: block; width: 12px; height: 12px; }
.gr-cell.bump { animation: gr-bump 180ms ease-out both; }
/* 누르면 정확한 값 2초 */
.gr-tip {
  position: absolute; left: 8px; bottom: calc(100% + 2px); z-index: 2;
  padding: 6px 8px; border-radius: 6px; background: #000; color: #fff;
  font-size: 12px; line-height: 1; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 120ms ease-out;
}
.gr-tip.on { opacity: 1; }
.gr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes gr-fall { 0% { transform: translateY(-34px); opacity: 0; } 18% { opacity: 1; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes gr-absorb { 0% { transform: scale(1, 1); opacity: 1; } 40% { transform: scale(1.18, 0.72); opacity: 1; } 100% { transform: scale(0.5, 0.5); opacity: 0; } }
@keyframes gr-bump { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes gr-add-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .gr *, .gr-add.on { animation: none !important; transition: none !important; }
}

/* 광고 띠 (결과 화면에만, common/ads.js): 맨 아래 50px 줄. 화면 위에 떠서 덮지 않는다(레이아웃 안의 줄).
   실수 클릭 방지: 처음으로·다시 하기 버튼 아래 끝과 띠 사이 40px 이상(아래 줄 안 여백 8 + 위 여백 32),
   이름 입력 칸·확인 버튼은 그 위 표 안이라 더 멀다. */
.rs > .rs-ad {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  margin-top: 32px;
  overflow: hidden;
}
/* 구글 광고를 넣을 때(ads.js가 .rs-ad-g를 붙임): 버튼과 64px 이상 (QA-006 L1). 표가 그만큼 줄어 스크롤 0은 유지된다 */
.rs > .rs-ad.rs-ad-g { margin-top: 56px; }
.rs-house { display: block; height: 50px; border-radius: 6px; overflow: hidden; }
.rs-house img { display: block; width: auto; height: 50px; }
.rs-house:focus-visible { outline: 3px solid var(--cf-accent); outline-offset: -3px; }

/* 낮은 가로 화면: 위 줄·아래 줄을 줄인다 */
@media (max-height: 420px) {
  .rs-head { height: 40px; }
  .rs-score { font-size: 22px; }
  .rs-foot { height: 56px; }
  .rs-btn { width: 48px; height: 48px; }
  .rs > .rs-ad { margin-top: 36px; }   /* 버튼 아래 여백이 4px로 줄어 40px를 맞춘다 */
  .rs > .rs-ad.rs-ad-g { margin-top: 60px; }   /* 구글 광고: 64px */
}
/* 낮은 가로 화면(667×375 등, MGW-DEV-028): 가운데 묶음을 두 칸으로 — 왼쪽 272px(최고 기록·칩·지급 줄, 재료 이름 숨김) | 오른쪽 랭킹(제목 숨김).
   남의 줄 3 + ⋯ + 내 줄을 지킨다(구글 광고 64px 때도 내 줄 보임) */
@media (orientation: landscape) and (max-height: 480px) {
  .rs-result > .rs-head, .rs-result > .rs-mid, .rs-result > .rs-foot { width: min(100% - 16px, 640px); }
  .rs-result .rs-mid { display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); column-gap: 14px; padding: 4px 0; }
  .rs-result .rs-side { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 0; }
  .rs-result .rs-list { align-self: center; max-height: 100%; }
  .rs-result .rs-best { justify-content: flex-start; padding-left: 4px; }
  .rs-result .rs-chips { justify-content: flex-start; }
  .rs-result .rs-title { display: none; }
  .rs-result .gr { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .rs-result .gr-nm { display: none; }
}

@keyframes rs-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rs-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .rs, .rs-shake { animation: none; } }
