/* 넓은 화면(768px 이상) 정렬 정리. 모바일(767px 이하)에는 규칙이 없습니다. 마지막에 불러와 앞선 데스크톱 규칙을 덮습니다. */
/* --desktop-fab-gutter: 1200px 이상에서 글쓰기 버튼이 있는 화면의 본문 오른쪽 버튼 자리(앱 오른쪽 끝 32px + '＋ 등록' 약 92px + 간격 16px). 머리글에는 적용하지 않습니다. */
:root{--desktop-content-max:1040px;--desktop-fab-gutter:140px}

@media(min-width:768px){
 /* 사이드바: 낮은 창에서 아래 글이 화면 밖으로 잘리지 않게 안에서 스크롤, 단어 중간 줄바꿈 없음 */
 .rail{overflow-y:auto;overscroll-behavior:contain;word-break:keep-all}
 /* 홈 글쓰기 버튼: 52px 정원, '＋' 아이콘을 원 정중앙에('등록' 글자는 화면에서 숨김) */
 #main[data-route=home] .write{width:52px;min-width:52px;height:52px;min-height:52px;padding:0;justify-content:center;align-items:center}
 /* 홈 '처음엔 여기부터'는 본문 왼쪽 선에 맞춘 전체 폭 */
 #main[data-route=home]>.home-first-action{max-width:none;margin-inline:0}
 /* 홈 나눔 카드: 사진 칸은 카드 폭 전체(높이 240px 상한), 그림은 칸을 채우고 가로 가운데(그림이 아래쪽에 있어 세로는 조금 아래 기준으로 잘라 그림자까지 보이게) */
 #main[data-route=home] .dg-product-art{width:100%}
 #main[data-route=home] .dg-product-art>svg{position:absolute;left:0;top:50%;width:100%;height:auto;transform:translateY(-57%)}
 /* 나의 하루 카드 아래로 튀어나온 말풍선 꼬리는 넓은 화면에서 숨김(한이는 카드 안 오른쪽 아래) */
 .dg-personal-top .dg-daily:after{display:none}
 /* 입국 준비 첫 화면: 머리 영역은 본문 전체 폭, 제목 한 줄과 오른쪽 작은 버튼. 아래 흐름은 720px로 본문 왼쪽 선에 */
 .prep-root{margin-left:0}
 .prep-root:has(>.prep-start){max-width:none}
 .prep-start{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:24px;align-items:center}
 .prep-start>*{grid-column:1/-1;max-width:720px}
 .prep-start>.prep-kicker,.prep-start>h1,.prep-start>p{grid-column:1;max-width:none}
 .prep-start>h1 br{display:none}
 .prep-start>.prep-primary{grid-column:2;grid-row:2/span 2;align-self:center;width:auto;min-height:44px;padding:10px 18px;font-size:var(--text-control);max-width:none}
}

/* 사이드바 보조 문구는 창 높이가 낮으면 숨김(메뉴와 겹치거나 잘리지 않게) */
@media(min-width:1200px) and (max-height:760px){.rail-note,.rail>small{display:none}}

/* 홈 2열(1100px 이상): 게시판 바로가기·첫 행동 카드는 두 열 전체, 두 열 머리는 같은 높이에서 시작 */
@media(min-width:1100px){
 .workspace:not(:has(.context.is-detail)) #main[data-route=home]>.home-interest-topics,
 .workspace:not(:has(.context.is-detail)) #main[data-route=home]>.home-first-action{grid-column:1/-1}
 .workspace:not(:has(.context.is-detail)) #main[data-route=home]>.dg-section{margin-top:var(--space-section)}
 .workspace:not(:has(.context.is-detail)) #main[data-route=home]>.secondary.full{grid-column:1/-1;justify-self:center;width:min(100%,480px)}
}

/* 1200px 이상: 머리글과 본문을 같은 최대 폭으로 가운데 둠(지도 제외). 글쓰기 버튼이 있는 화면만 본문 오른쪽이 버튼 자리보다 좁아지지 않음 */
@media(min-width:1200px){
 .app:not(.map-route)>header,.app>main:not(.map-main){padding-inline:max(32px,calc((100% - var(--desktop-content-max))/2))}
 .app>main:not(.map-main):has(.write){padding-right:max(var(--desktop-fab-gutter),calc((100% - var(--desktop-content-max))/2))}
}

/* 768~1199px(iPad 세로·가로): 본문 폭은 그대로 두고 글쓰기 버튼을 왼쪽 메뉴 칸(76px) 아래에 고정. 메뉴처럼 아이콘 위·'등록' 글자 아래(홈은 52px 정원) */
@media(min-width:768px) and (max-width:1199px){
 .workspace .app .write,.workspace:has(.context.is-detail) .write{left:8px;right:auto;bottom:24px;margin:0}
 .workspace .app .write:has(.write-label){width:60px;min-width:60px;height:62px;min-height:62px;padding:6px 2px;flex-direction:column;justify-content:center;gap:2px;border-radius:var(--radius-card)}
 .workspace .app #main[data-route=home] .write{left:12px;width:52px;min-width:52px;height:52px;min-height:52px;padding:0;border-radius:50%}
 /* 낮은 창(820×500·가로 iPhone 852×393)에서 메뉴가 글쓰기 버튼 밑으로 겹치지 않게: 버튼 자리(아래 24+62+8px)를 비우고 메뉴는 그 위에서 안쪽 스크롤 */
 .workspace:has(.app .write) .rail{padding-bottom:94px}
 .workspace:has(.app .write) .rail nav{flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
}
@media(min-width:768px) and (max-width:1199px) and (max-height:600px){.workspace:has(.app .write) .rail nav{margin-top:16px}}
