/* css/mobile.css  —  가로 모드 휴대폰 전용 배치 (v46 · v47: 오른쪽 버튼 레일 · 구매 목록 버튼 · 아일랜드 쪽만 여백 · v48: iOS 크롬 화면 채우기)
   적용 조건은 index.html 의 <link media> — (orientation: landscape) and (max-height: 520px) and (pointer: coarse).
   PC·태블릿에서는 이 파일이 적용되지 않는다. 세로 모드 휴대폰은 지금처럼 회전 안내(#rotate-overlay)가 덮는다.
   로드 순서 6/6: 앞의 다섯 파일을 덮어쓴다(theme.css 뒤). 같은 조건을 js/config.js 의 MOBILE_LAYOUT_MQ 가 쓴다(2D 카메라 여백).

   화면 구성 — 상단바 없음 · 왼쪽 목록 1열 · 오른쪽 견적 패널 없음 · 캔버스가 나머지를 모두 쓴다.
   버튼은 모두 오른쪽 한 줄(레일)에 세로로 붙는다:
     [목록 1열] [로고                    Menu ]
     [        ] [                    구매 목록 ]  ← 금액 버튼(누르면 구매 목록)
     [        ] [ 캔버스                  2D  ]
     [        ] [                         3D  ]
     [        ] [                        Undo ]
     [        ] [                       Reset ]

   로고 · Menu 버튼 · 메뉴 패널의 모양은 css/mobile-chrome.css(세로 화면과 같이 쓴다). 여기선 가로 배치(위치)만.

   화면 가장자리(아이폰 아일랜드·안드로이드 펀치홀) — index.html viewport-fit=cover + 아래 --m-safe-l/r.
   js/main.js updateEdgeClasses 가 <html> 에 클래스를 붙인다:
     island-l / island-r : 페이지가 화면 전체 폭을 쓸 때. iOS 는 가로 모드 양쪽에 같은 여백(약 59px)을 알려 주지만
                           아일랜드는 한쪽에만 있다 → 그쪽만 그만큼 띄우고 반대쪽은 둥근 모서리만 살짝 피한다.
     edge-fill           : 아이폰 브라우저가 viewport-fit=cover 를 무시하고 양옆을 비워 둘 때(iOS 크롬 가로 모드 등).
                           그 여백은 페이지 밖이 아니라 스크롤 영역의 여백이라, 페이지를 화면 긴 변만큼 넓히고 그만큼
                           옆으로 스크롤하면 양옆까지 페이지가 덮는다. fixed 요소의 좌표계는 여전히 브라우저가 비워 둔
                           안쪽이라 화면 끝에 닿지 못한다 → 오른쪽 레일·메뉴는 문서(body) 기준 absolute 로 바꿔 화면 끝에
                           붙이고(아일랜드가 오른쪽이면 그만큼 띄움), 로고·토스트처럼 fixed 로 남는 것은 --m-fix-dx 로 맞춘다.
     edge-boxed          : 위와 같지만 아이폰이 아닐 때(안드로이드 펀치홀 쪽은 시스템이 비워서 채울 수 없다) → 페이지 안 여백 0.
     (클래스 없음)        : 방향을 모를 때 — 알려 준 여백을 양쪽 다 쓴다. */

:root {
  --sim-header-h: 0px;                                            /* 상단바가 없다 — base.css 의 #app 높이 계산 기준 */
  --m-safe-l: env(safe-area-inset-left);                          /* 왼쪽 목록 안쪽 여백(문서 왼쪽 끝 기준) */
  --m-safe-r: env(safe-area-inset-right);                         /* 오른쪽 레일 바깥 여백(레일 기준 상자의 오른쪽 끝 = 보통 화면 끝) */
  --m-page-w: 100vw;                                              /* 문서 폭 — edge-fill 이면 JS 가 화면 긴 변(px)으로 */
  --m-fix-dx: 0px;                                                /* fixed 좌표계가 문서 왼쪽에서 떨어진 만큼 — edge-fill 이면 브라우저 여백 폭 */
  --m-strip-w: 88px;                                              /* 왼쪽 목록 폭(가장자리 여백 제외) */
  --m-top: calc(8px + env(safe-area-inset-top));
  --m-bottom: calc(10px + env(safe-area-inset-bottom));            /* 홈 바 */
  --m-rail-bottom: 8px;                                           /* 오른쪽 레일 맨 아래 버튼과 화면 아래 끝 — 홈 바 자리까지 써서 위쪽 금액 버튼과 겹치지 않게 */
  --m-rail-w: 84px;                                               /* 오른쪽 레일 버튼 폭(금액 ₩000,000 이 한 줄에 들어가는 폭) */
  --m-btn-h: 36px;                                                /* 레일 버튼 한 칸 높이 */
}
@media (max-height: 350px) { :root { --m-btn-h: 32px; } }         /* 브라우저 툴바로 높이가 더 줄면 레일 버튼을 낮춘다 */
/* 위 값들로 계산하는 변수는 body 에 둔다 — html 클래스가 바꾼 값을 다시 계산하게 */
body {
  --m-left: calc(var(--m-strip-w) + var(--m-safe-l));              /* 캔버스가 시작하는 문서 x */
  --m-cx: calc(var(--m-left) + (var(--m-page-w) - var(--m-left)) / 2 - var(--m-fix-dx));   /* 캔버스 가운데(fixed 좌표) */
  --m-right: calc(10px + var(--m-safe-r));                         /* 오른쪽 레일과 화면 끝 사이 */
}
html.edge-boxed { --m-safe-l: 0px; --m-safe-r: 0px; }
html.edge-fill, html.edge-fill body { width: var(--m-page-w); }   /* 문서를 화면 긴 변만큼 — 스크롤은 main.js updateEdgeClasses */
html.edge-fill .buy-modal { position: absolute; inset: 0; }      /* 구매 목록의 어두운 막도 문서(body) 기준 — fixed 로는 오른쪽 빈칸까지 닿지 않았다 */
html.edge-fill body { position: relative; }                       /* 아래 absolute 요소의 기준 = 화면 양끝까지 넓힌 문서 */
html.edge-fill #m-top, html.edge-fill #m-menu.is-open,
html.edge-fill #float-view, html.edge-fill #float-actions { position: absolute; }   /* fixed 로는 화면 끝에 닿지 않는다(위 주석) */
html.island-l   { --m-safe-r: 0px; }                               /* 아일랜드 반대쪽 — 화면 끝에서 10px(둥근 모서리 안쪽) */
html.island-r   { --m-safe-l: min(env(safe-area-inset-left), 12px); }

html, body { overscroll-behavior: none; touch-action: manipulation; }   /* 당겨서 새로고침·두 번 탭 확대 방지 */

/* ── 상단바 → 로고 · 메뉴 · 금액 ── */
#site-header { display: none; }

#m-logo {
  position: fixed; z-index: 300;
  top: calc(var(--m-top) + 4px); left: calc(var(--m-left) - var(--m-fix-dx) + 12px);
  display: block; line-height: 0;
}

/* 오른쪽 위: Menu, 그 바로 아래 금액(구매 목록) 버튼 */
#m-top {
  position: fixed; z-index: 300;
  top: var(--m-top); right: var(--m-right);
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}

/* 금액 버튼 — 구매하기와 같은 브랜드 빨강. 위 작은 글자 "구매 목록 ›"(i18n buyTitle)로 누르면 목록이 열린다는 걸 보인다 */
#m-price {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: var(--m-rail-w); padding: 6px 8px 7px;
  background: var(--red); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.14), 0 1px 4px rgba(0,0,0,.08);
  font-family: var(--font); white-space: nowrap;
}
#m-price.is-empty { display: none; }
#m-price:active { background: #d44848; }
.m-price-lbl { font-size: 10px; letter-spacing: .04em; opacity: .92; }
.m-price-lbl::after { content: ' ›'; }
.m-price-v { font-size: 14px; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }

/* ── 배치 — 목록 1열 + 캔버스, 오른쪽 견적 패널 없음 ── */
#app {
  grid-template-columns: var(--m-left) 1fr;
  height: 100vh;
  height: 100dvh;                                                  /* 주소창이 접혔다 펴져도 아래가 잘리지 않게 */
}
#right { display: none; }                                          /* 금액은 #m-price, 구매·공유·언어는 금액 버튼(구매 목록)·메뉴로 옮겼다 */

/* ── 왼쪽 목록 1열 ── */
#left {
  padding-left: var(--m-safe-l);
  overscroll-behavior: contain;
  touch-action: pan-y;                                             /* 세로로 밀면 목록 스크롤, 가로로 밀면 카드 끌기(drag-drop.js initTouchDrag) */
  scrollbar-width: none;
}
#left::-webkit-scrollbar { display: none; }
.sec { padding: 10px 8px; }
.sec-label { font-size: 9px; letter-spacing: .14em; margin-bottom: 6px; }
.sec-label::after { display: none; }

/* v49: 벽 크기 입력은 폰에서 뺀다(첫 번째 .sec = Wall). 값은 기본 5 × 2.5 m 그대로 */
#left > .sec:first-child { display: none; }
.preset-card img { -webkit-user-drag: none; pointer-events: none; }  /* 아이폰 길게 누르기 이미지 메뉴 대신 카드 끌기 */
.preset-card { -webkit-touch-callout: none; }

/* 벽 크기: W·H 를 두 줄로. 글자 16px — 아이폰은 그보다 작은 입력칸을 누르면 화면을 확대해 버린다 */
.space-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 3px; }
.space-sep, .space-hint { display: none; }
.space-inp { width: 100%; min-width: 0; font-size: 16px; padding: 3px 5px; }
.wall-help { font-size: 9px; line-height: 1.35; margin-top: 5px; color: rgba(255,255,255,.4); }

/* 프리셋 · 색상: 1열 */
.preset-list { grid-template-columns: 1fr; gap: 6px; }
.preset-card-label { font-size: 10px; padding: 4px 2px; }
.sw-group-label { font-size: 9px; letter-spacing: .1em; }
.sw-card-list { grid-template-columns: 1fr; gap: 4px; }
.sw-card { aspect-ratio: 2 / 1; }
.sw-card-label { font-size: 10px; }

/* 제품(Units): 썸네일 + 이름·치수 두 줄. 끌 수 없는 카드(AUTO·준비 중)와 그런 분류의 머리글은 숨긴다 */
.mod-list { gap: 4px; }
.cat-divider { font-size: 9px; letter-spacing: .12em; margin: 8px 0 4px; }
.cat-divider--inert, .cat-empty, .mod-card--auto { display: none; }
.mod-card {
  flex-direction: column; align-items: stretch; gap: 3px;
  padding: 5px 3px 6px; text-align: center;
  border-color: rgba(255,255,255,.08);
  -webkit-touch-callout: none; -webkit-user-select: none;
}
.mod-icon { width: 100%; height: 46px; }
.mod-icon img { width: 46px; height: 46px; -webkit-user-drag: none; pointer-events: none; }
.mod-info { width: 100%; }
.mod-name { font-size: 10px; }
.mod-dim  { font-size: 9px; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 캔버스 ── */
#three-wrap { touch-action: none; }                                /* 손가락이 화면 확대·스크롤로 새지 않게 — 3D 회전·2D 이동/확대는 JS 가 받는다 */
#cam-hint { display: none; }                                       /* "Drag to rotate · Scroll to zoom" — 마우스 안내라 폰에선 뺀다 */

/* ── 오른쪽 레일 아래쪽: 2D / 3D, 그 아래 Undo / Reset — 같은 폭·같은 높이의 세로 버튼 ── */
#float-view {
  top: auto; left: auto; transform: none;
  right: var(--m-right);
  bottom: calc(var(--m-rail-bottom) + 2 * var(--m-btn-h) + 10px); /* Undo·Reset(두 칸 + 테두리 2px) 위 8px */
  width: var(--m-rail-w);
  flex-direction: column; align-items: stretch;
}
.vtab {
  height: var(--m-btn-h); padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; letter-spacing: .08em;
  border-right: none; border-bottom: 1px solid rgba(255,255,255,.1);
}
.vtab:last-child { border-bottom: none; }

#float-actions {
  top: auto; left: auto; transform: none;
  right: var(--m-right); bottom: var(--m-rail-bottom);
  width: var(--m-rail-w);
  flex-direction: column; align-items: stretch; gap: 0; padding: 0;
  background: var(--accent); border-color: rgba(255,255,255,.12);
  overflow: hidden;
}
#float-actions .btn,
#float-actions .btn:hover {
  height: var(--m-btn-h); padding: 0 4px;
  border: none; border-bottom: 1px solid rgba(255,255,255,.1);
  background: transparent; color: rgba(255,255,255,.75);
  font-size: 10px; letter-spacing: .08em;
}
#float-actions .btn:last-child { border-bottom: none; }
#float-actions .btn:active { background: rgba(255,255,255,.08); color: #fff; }

/* 벽 탭(코너): 캔버스 위 가운데 */
#wall-tabs { top: var(--m-top); left: var(--m-cx); }
.wtab { padding: 7px 12px; }

/* 토스트: 캔버스 아래 가운데. 숨김 위치(translateY)도 같이 키운다 — 기본값은 bottom 18px 기준이라 여기선 화면 안에 남는다 */
#toast { left: var(--m-cx); bottom: calc(var(--m-bottom) + 50px); transform: translateX(-50%) translateY(calc(100% + var(--m-bottom) + 60px)); font-size: 12px; padding: 7px 16px; max-width: min(420px, calc(100vw - 32px)); }   /* v57: 긴 알림은 줄 바꿈(이전 nowrap) */
#toast.on { transform: translateX(-50%) translateY(0); }

/* 구매 목록(금액 버튼으로 연다): 낮은 화면에 맞게 촘촘히 */
.buy-modal { padding: 10px; }
.buy-card { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); padding: 14px 16px 12px; }
.buy-title { font-size: 14px; }
.buy-rows { margin-top: 8px; }
.buy-row { padding: 7px 0; }
.buy-actions { margin-top: 10px; }
.buy-actions .btn { padding: 9px; }
