/* 새롭게 분류하기 팝업(auto-sort.js). 폰 홈 위에 뜬다. 색은 theme.css 의 변수를 쓴다. */
.as-layer {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #0000008c;
}
.as-layer[hidden] { display: none; }
body.as-open { overflow: hidden; }

.as-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -12px 40px #0000006b;
}
.as-panel svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.as-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.as-title { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.as-title svg { width: 22px; height: 22px; }
.as-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}
.as-icon svg { width: 19px; height: 19px; }

.as-body { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }

.as-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.as-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-dim, var(--ink));
  font: inherit;
  font-weight: 700;
}
.as-seg svg { width: 18px; height: 18px; }
.as-seg[aria-checked="true"] { border-color: var(--info); color: var(--ink); box-shadow: 0 0 0 1px var(--info); }
.as-seg:disabled { opacity: .55; }

.as-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.as-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.as-filter svg { flex: 0 0 18px; width: 18px; height: 18px; }
.as-filter span { flex: 1; min-width: 0; }
.as-filter input { width: 20px; height: 20px; margin: 0; accent-color: var(--info); }

.as-status { display: grid; gap: 8px; }
/* ① 폰에서 분류 · ② 올리기 막대 */
.as-meter { display: flex; align-items: center; gap: 8px; }
.as-meter svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted, var(--ink)); }
.as-meter .as-bar { flex: 1; }
.as-meter span { min-width: 84px; color: var(--muted, var(--ink)); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
/* 머리의 오프라인 표시(서버에 닿지 않음) */
.as-net { display: grid; place-items: center; margin-left: auto; color: var(--muted, var(--ink)); }
.as-net svg { width: 20px; height: 20px; }
.as-bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--fill, #0002); }
.as-bar i { display: block; width: 0; height: 100%; background: var(--info); transition: width .3s ease; }
/* 분류 시간: 경과 · 속도 · 남은 시간 */
.as-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.as-metrics span { display: grid; grid-template-columns: 16px 1fr; grid-template-rows: auto auto; column-gap: 5px; align-items: center; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; }
.as-metrics svg { grid-row: 1 / 3; width: 16px; height: 16px; color: var(--muted, var(--ink)); }
.as-metrics small { color: var(--muted, var(--ink)); font-size: 11px; }
.as-metrics b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-line { min-height: 18px; margin: 0; color: var(--muted, var(--ink)); font-size: 12px; }
.as-line.is-error { color: var(--danger, #c33); }
.as-bg { margin: 2px 0 0; color: var(--muted, var(--ink)); font-size: 11px; opacity: .85; }
.as-kind { margin: 0 0 2px; color: var(--ink); font-size: 12px; font-weight: 600; }
.as-capture { margin: 2px 0 0; color: var(--muted, var(--ink)); font-size: 11px; opacity: .85; }
.as-person { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; color: var(--muted, var(--ink)); font-size: 11px; }
.as-person[hidden] { display: none; }
.as-person span { flex: 1; min-width: 0; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-person button { flex: none; padding: 3px 9px; border: 1px solid var(--line, rgba(0,0,0,.15)); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; }
.as-person button[hidden] { display: none; }

.as-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--info);
  color: #fff;
  font: inherit;
  font-weight: 800;
}
.as-start svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.as-start svg.as-stroke { fill: none; stroke: currentColor; stroke-width: 1.9; }
/* 보관함에 올리기(누를 때만, auto-sort.js uploadNow) — 분류 단추 아래 덜 눈에 띄게 */
.as-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
.as-upload[hidden] { display: none; }
.as-upload svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.as-meter[hidden] { display: none; }

/* 처음 한 번 묻는 안내(auto-sort.js askOnce)와 저절로 분류를 마친 알림(toast) */
.as-ask .as-panel { gap: 10px; }
.as-ask-title { font-size: 18px; line-height: 1.4; }
.as-ask-text { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.as-ask .as-start { margin-top: 6px; }
.as-ask-later { height: 44px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; }
.as-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 2400;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 32px), 480px);
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  text-align: left;
  transform: translateX(-50%);
  box-shadow: 0 8px 28px #00000059;
}
.as-toast span { flex: 1; }
.as-toast b { color: var(--info); }

.as-days { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.as-days button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
}
.as-days button span:first-of-type { flex: 1; }
.as-count { color: var(--muted, var(--ink)); font-size: 12px; font-weight: 600; }
.as-days svg { flex: 0 0 16px; width: 16px; height: 16px; }

/* 상단바 분류 아이콘(library-mobile.js IsleSortIcon): 검정 정사각형 박스 + 굵은 흰 화살표(2026-10-11 사용자).
   평소엔 화살표 하나가 가운데 멈춰 있고, 분류가 도는 동안에는 화살표가 3초에 걸쳐 끝까지 내려간 뒤 사라진다(두 개가 엇갈려 이어짐).
   어두운 화면에서는 박스를 밝게, 화살표를 어둡게 뒤집는다. */
.isle-sort-icon .sort-box { fill: #111; stroke: none; }
.isle-sort-icon .sort-arrow { stroke: #fff; stroke-width: 3.2; fill: none; }
.isle-sort-icon .sort-arrow-2 { display: none; }
[data-theme="dark"] .isle-sort-icon .sort-box { fill: #f4f4f6; }
[data-theme="dark"] .isle-sort-icon .sort-arrow { stroke: #111; }
#mobileAutoSortBtn.is-running .sort-arrow-2 { display: inline; animation-delay: -1.5s; }
#mobileAutoSortBtn.is-running .sort-arrow { animation: as-arrow-drop 3s cubic-bezier(.4, 0, .6, 1) infinite; }
/* 화살표는 박스 위에서 들어와 끝까지 내려간 뒤(박스 밖으로 잘려) 사라진다. 중간에 흐려지지 않는다. */
@keyframes as-arrow-drop {
  from { transform: translateY(-16px); }
  to { transform: translateY(16px); }
}
@media (prefers-reduced-motion: reduce) {
  #mobileAutoSortBtn.is-running .sort-arrow { animation: none; }
  #mobileAutoSortBtn.is-running .sort-arrow-2 { display: none; }
}

/* 오프라인 보관함(auto-sort.js renderOfflineLibrary): 서버에 닿지 않을 때 폰에서 분류한 날짜 카드 */
/* 오프라인 보관함 카드(수백 장)는 배치·그리기를 이 상자 안에 가둔다. 안 가두면 리딩룸 넘김 시계가 한 장 넘어갈 때마다(3D 판이 생길 때)
   브라우저가 이 카드들까지 다시 따져 화면이 0.47초씩 멈췄다(2026-09-27 아이폰 13, 카드 505장: 가두면 0.12초 — 온라인과 같음). */
.as-offline { display: grid; gap: 10px; margin-bottom: 12px; contain: layout paint; }
.as-offline-head { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted, var(--ink)); font-size: 12px; font-weight: 700; }
.as-offline-head svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.as-offline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.as-offline-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2, var(--surface));
  color: #fff;
  text-align: left;
}
.as-offline-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.as-offline-card::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, #000000a6); }
.as-offline-date { position: absolute; left: 12px; bottom: 30px; z-index: 1; font-size: 17px; font-weight: 800; }
.as-offline-count { position: absolute; left: 12px; bottom: 12px; z-index: 1; font-size: 12px; opacity: .85; }
.as-offline-more { min-height: 44px; border: 1px solid var(--line-strong, #383842); border-radius: 999px; background: var(--surface, transparent); color: var(--ink); font: inherit; font-weight: 700; }
.as-offline-empty { margin: 0; color: var(--muted, var(--ink)); font-size: 13px; }

/* 폰 날짜 카드(app.js deviceDayCard): 보관함 날짜 카드와 같은 모양(휴대폰 표시는 2026-10-13 뺌) */
.device-day-card .golden-photo { position: relative; }

/* 오류 보고하기(! 단추)로 작업 로그를 복사하면 창 가운데 아래에 1.5초 뜨는 한 줄(auto-sort.js flash) */
.as-panel { position: relative; }
.as-flash {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
  padding: 10px 16px; border-radius: 999px; background: rgba(20, 20, 24, .88); color: #fff;
  font-size: 14px; font-weight: 700; white-space: nowrap; pointer-events: none;
}

/* 닫기는 항상 왼쪽 위(모든 닫기 통일, 2026-10-11) */
.as-icon[data-as="close"] { order: -1; }

/* 배터리 측정 칸(battery-meter.js, 앱에서만, 2026-10-13 사용자): 무엇을 잴지 고르고 시작·끝, 최근 결과 세 줄 */
.as-battery { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); flex-shrink: 0; }
.as-bm-title { margin: 0; color: var(--ink); font-size: 13px; font-weight: 800; }
.as-bm-kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.as-bm-kinds button { height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink-dim, var(--ink)); font: inherit; font-size: 12px; font-weight: 700; }
.as-bm-kinds button[aria-checked="true"] { border-color: var(--info); color: var(--ink); box-shadow: 0 0 0 1px var(--info); }
.as-bm-btn { height: 40px; border: 1px solid var(--info); border-radius: 12px; background: transparent; color: var(--info); font: inherit; font-size: 13px; font-weight: 800; }
.as-bm-btn:disabled { opacity: .55; }
.as-bm-live { display: grid; gap: 2px; font-size: 12px; color: var(--muted, var(--ink)); }
.as-bm-live b { color: var(--ink); font-size: 13px; }
.as-bm-warn { margin: 0; color: var(--danger, #c33); font-size: 12px; }
.as-bm-log { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; color: var(--muted, var(--ink)); font-size: 11px; line-height: 1.4; }
