/**
 * 바닥 시트 - 아래에서 올라오는 창. 동작은 bottom-sheet.js, 규칙 claude_common/ui/bottom-sheet.md
 *
 *  - 휴대폰(767px 이하): 화면 아래에 붙어 올라온다. 위 모서리만 둥글게, 아래는 안전 영역만큼 여백. X 없음 - 끌어내리기·바깥·뒤로 가기(2026-10-29)
 *    처음엔 내용만큼(화면 60%까지), 시트 안 아무 곳이나 끌어 올리면 90%까지(sheet-drag.js)
 *  - PC(768px 이상): 가운데 창, 최대 500px(.is-wide 640px)
 *  - 메뉴 시트(.bottom-sheet-item 줄) · 고치기 시트(.bottom-sheet-title + form.bottom-sheet-body) · 넓은 시트(.is-wide)
 *  - [data-sheet-custom]: 화면 스크립트가 직접 다루는 시트 - 열고 닫는 움직임·끌어내리기·쓰던 내용 확인을 붙이지 않는다
 */
dialog.bottom-sheet {
  /* 색 - 테마 파일(themes/*.css)의 공통 변수에 잇는다 */
  --sheet-bg: var(--uk-surface);
  --sheet-text: var(--uk-fg);
  --sheet-muted: var(--uk-muted);
  --sheet-line: var(--uk-border);
  --sheet-line-soft: var(--uk-line);
  --sheet-soft: var(--uk-head);
  --sheet-danger: var(--uk-danger);
  --sheet-w: 100%;
  box-sizing: border-box; /* 높이는 여백까지 - 끌기(sheet-drag.js)가 재는 높이와 정하는 높이가 같게 */
  margin: auto auto 0;
  width: 100%;
  max-width: var(--sheet-w);
  max-height: calc(100dvh - 40px - var(--kb, 0px)); /* 위에 40px 여백 - 화면 끝에 붙지 않게 */
  margin-bottom: var(--kb, 0px); /* 휴대폰 자판 높이만큼 올린다 - 자판이 화면을 줄이지 않는 브라우저(아이폰 사파리)용, bottom-sheet.js가 잰다 */
  overflow-y: auto;
  overscroll-behavior: contain; /* 시트 안에서만 스크롤 - 뒤 화면까지 같이 밀리지 않게 */
  border: 0;
  border-radius: var(--uk-r-lg) var(--uk-r-lg) 0 0;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: var(--sheet-bg);
  color: var(--sheet-text);
}
/* 뒤 막 - 테마의 --uk-scrim */
dialog.bottom-sheet::backdrop { background: var(--uk-scrim); }
html:has(dialog.bottom-sheet:modal) { overflow: hidden; } /* 버튼 아래 창(.is-anchor, PC)은 뒤를 막지 않아 잠그지 않는다 */
dialog.bottom-sheet form, dialog.bottom-sheet a, dialog.bottom-sheet > button { display: block; }
/* 고치기 시트 - 칸과 칸, 칸과 버튼 줄 사이 12px (2026-10-05 "입력하는 곳과 버튼 사이 간격이 없어") */
dialog.bottom-sheet form.bottom-sheet-body { display: flex; flex-direction: column; gap: 12px; }
/* 고치기 시트의 버튼 줄 - 시트 바닥에 붙어 늘 보인다. 칸이 많아 시트 안이 스크롤돼도 [저장]이 밀려나지 않게(2026-10-05 "화면보다 크면 안 된다") */
.bottom-sheet-actions { position: sticky; bottom: calc(-8px - env(safe-area-inset-bottom)); z-index: 1; display: flex; gap: 8px; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--sheet-bg); border-top: 1px solid var(--sheet-line-soft); }
.bottom-sheet-actions > * { flex: 1 1 0; }

.bottom-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--sheet-line); margin: 4px auto 8px; }
.bottom-sheet-title { text-align: center; font-weight: 700; padding: 6px 44px 12px; } /* 양옆 44px - 오른쪽 위 X 자리 */
.bottom-sheet-body { padding: 8px 16px 16px; }
.bottom-sheet-item { width: 100%; display: block; padding: 14px 16px; background: none; border: 0; border-top: 1px solid var(--sheet-line-soft); font: inherit; font-size: 15px; text-align: center; cursor: pointer; color: var(--sheet-text); text-decoration: none; }
.bottom-sheet-item:hover { background: var(--sheet-soft); color: var(--sheet-text); }
.bottom-sheet-item.is-danger { color: var(--sheet-danger); font-weight: 600; }

/* 오른쪽 위 X - bottom-sheet.js(React는 Sheet)가 붙인다(직접 쓰지 않는다). PC 가운데 창에서만 보인다 - 휴대폰 바닥 시트는 X 없음(2026-10-29) */
dialog.bottom-sheet > .bottom-sheet-x { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex !important; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--sheet-muted); cursor: pointer; }
dialog.bottom-sheet > .bottom-sheet-x:hover { background: var(--sheet-soft); color: var(--sheet-text); }

/* 열고 닫을 때 움직임 - 휴대폰은 아래에서 올라오고 내려가며 닫힌다(0.22초), PC는 살짝 커지며 나타난다.
   닫힐 때 움직임은 브라우저가 지원할 때만(못 하면 바로 사라진다) */
dialog.bottom-sheet:not([data-sheet-custom]) { transition: transform .22s ease, opacity .22s ease, height .22s ease, max-height .22s ease, overlay .22s allow-discrete, display .22s allow-discrete; }
dialog.bottom-sheet:not([data-sheet-custom]):not([open]) { transform: translateY(100%); }
@starting-style { dialog.bottom-sheet:not([data-sheet-custom])[open] { transform: translateY(100%); } }
dialog.bottom-sheet::backdrop { transition: background-color .22s ease, overlay .22s allow-discrete, display .22s allow-discrete; }
dialog.bottom-sheet:not([open])::backdrop { background-color: transparent; }
@starting-style { dialog.bottom-sheet[open]::backdrop { background-color: transparent; } }
dialog.bottom-sheet.is-dragging { transition: none; user-select: none; }

/* 휴대폰 - 처음 높이는 화면 60%까지(긴 시트는 끌어 올려 90%), X 없음, 끌기는 시트 안 아무 곳이나(sheet-drag.js) */
@media (max-width: 767px) {
  dialog.bottom-sheet:not([data-sheet-custom]) { max-height: min(60dvh, calc(100dvh - 40px - var(--kb, 0px))); }
  dialog.bottom-sheet > .bottom-sheet-x { display: none !important; }
  .bottom-sheet-title { padding-left: 16px; padding-right: 16px; }
  dialog.bottom-sheet:not([data-sheet-custom]) .bottom-sheet-grip { cursor: grab; }
}

@media (min-width: 768px) {
  dialog.bottom-sheet { margin: auto; width: calc(100vw - 48px); max-width: 500px; max-height: calc(100dvh - 80px); border-radius: var(--uk-r-md); }
  dialog.bottom-sheet.is-wide { max-width: 640px; }
  dialog.bottom-sheet:not([data-sheet-custom]):not([open]) { transform: scale(.96); opacity: 0; }
  @starting-style { dialog.bottom-sheet:not([data-sheet-custom])[open] { transform: scale(.96); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { dialog.bottom-sheet, dialog.bottom-sheet::backdrop { transition: none; } }

/* 버튼 아래 창(.is-anchor) - PC에서 1~2칸 입력을 연 버튼 바로 아래에 띄운다(2026-10-05). 뒤를 막지 않고 X·Esc로 닫는다.
   자리는 bottom-sheet.js가 잡는다(top·left). 휴대폰은 위의 보통 바닥 시트 그대로 */
@media (min-width: 768px) {
  dialog.bottom-sheet.is-anchor:not(:modal) {
    position: fixed; inset: auto; margin: 0; z-index: var(--z-system, 4000);
    width: min(360px, calc(100vw - 16px)); max-width: none; max-height: min(60vh, 480px);
    padding: 6px 0 2px; border-radius: var(--uk-r-md); box-shadow: var(--uk-up-lg);
  }
  dialog.bottom-sheet.is-anchor:not(:modal) .bottom-sheet-grip { display: none; }
  dialog.bottom-sheet.is-anchor:not(:modal) .bottom-sheet-title { text-align: left; padding: 8px 44px 4px 16px; font-size: 14px; }
  dialog.bottom-sheet.is-anchor:not(:modal) > .bottom-sheet-x { top: 4px; right: 4px; width: 32px; height: 32px; }
  dialog.bottom-sheet.is-anchor:not(:modal) .bottom-sheet-body { padding: 8px 16px 14px; }
}

/* 메뉴 컴포넌트(.is-menu, bottom-sheet.js window.sheetMenu) - 동작 목록 하나로(2026-10-29).
   휴대폰 = 보통 바닥 시트(머리는 고른 것 이름 - 작게), PC = 누른 자리·단추 아래 작은 메뉴: X 없음, 줄은 왼쪽 맞춤 */
dialog.bottom-sheet.is-menu .bottom-sheet-title { font-size: 13px; font-weight: 600; color: var(--sheet-muted); padding-top: 0; padding-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.bottom-sheet.is-menu .bottom-sheet-item:disabled { opacity: .4; cursor: default; background: none; }
dialog.bottom-sheet.is-menu .bottom-sheet-sep { margin: 0; border: 0; border-top: 1px solid var(--sheet-line); }
@media (min-width: 768px) {
  dialog.bottom-sheet.is-menu:not(:modal) { width: auto; min-width: 200px; max-width: 320px; padding: 4px 0; }
  dialog.bottom-sheet.is-menu:not(:modal) > .bottom-sheet-x { display: none !important; }
  dialog.bottom-sheet.is-menu:not(:modal) .bottom-sheet-title { padding: 6px 14px 6px; text-align: left; font-size: 12.5px; }
  dialog.bottom-sheet.is-menu:not(:modal) .bottom-sheet-item { padding: 8px 14px; border-top: 0; text-align: left; font-size: 14px; }
  dialog.bottom-sheet.is-menu:not(:modal) .bottom-sheet-sep { margin: 4px 0; }
}
