:root {
  --bg: #f2f8fd;
  --card: #ffffff;
  --text: #17171a;
  --muted: #6b6b73;
  --line: #e4e4e0;
  --accent: #38bdf8; /* 하늘색 강조 */
  --accent-2: #2563eb;
  --accent-grad: linear-gradient(135deg, #3fb6f2 0%, #2b7de9 100%);
  --accent-text: #ffffff;
  --glow: 0 0 12px rgb(56 189 248 / .45); /* 테두리 네온 */
  --grad-border: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 45%, #2563eb 100%);
  --page-glow: radial-gradient(120% 50% at 50% -10%, rgb(56 189 248 / .10), transparent 60%);
  --ok: #2fbf71;
  --warn: #ff9f0a;
  --danger: #e5484d;
  --radius: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b16;
    --card: #0f1828;
    --text: #eef4ff;
    --muted: #8b9ab3;
    --line: #1c2a42;
    --page-glow: radial-gradient(120% 50% at 50% -10%, rgb(56 189 248 / .08), transparent 60%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #070b16;
    --card: #0f1828;
    --text: #eef4ff;
    --muted: #8b9ab3;
    --line: #1c2a42;
    --page-glow: radial-gradient(120% 50% at 50% -10%, rgb(56 189 248 / .08), transparent 60%);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
code { font-size: .9em; background: color-mix(in srgb, var(--text) 8%, transparent); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }

/* ---------- 일반 화면 ---------- */
.page {
  min-height: 100%;
  padding: calc(20px + var(--safe-t)) calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
  max-width: 560px;
  margin: 0 auto;
}
.center {
  min-height: calc(100dvh - 60px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px;
}
.center h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.center p { margin: 0; line-height: 1.6; }
.logo { width: 88px; height: 88px; filter: drop-shadow(0 8px 18px rgb(37 99 235 / .22)); }
.logo img { width: 100%; height: 100%; border-radius: 24px; display: block; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 14px; font-weight: 700; font-size: 16px; text-decoration: none;
}
.btn.primary { background: var(--accent-2); color: var(--accent-text); min-width: 260px; margin-top: 10px; }
.btn.primary:active { transform: scale(.98); box-shadow: none; }
.btn.ghost { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.btn.small { height: 40px; padding: 0 14px; font-size: 14px; font-weight: 600; border-radius: 11px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--text) 15%, transparent); border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pick-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.pick-head h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.02em; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 2px 10px; letter-spacing: .02em; }
.camp-card {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 15px; margin-bottom: 10px; font-size: 17px; line-height: 1.35;
}
.camp-card b { letter-spacing: -.01em; }
.camp-card.current { border: 1.5px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad-border) border-box; box-shadow: var(--glow); }
.camp-time { font-size: 13px; font-weight: 700; color: var(--accent-text); background: var(--accent-2); align-self: flex-start; padding: 2px 8px; border-radius: 7px; }
.empty { padding: 22px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); line-height: 1.6; }
.search {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); padding: 0 14px; font-size: 16px; outline: none;
}
.search:focus { border-color: var(--muted); }
.list { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-height: 46vh; overflow-y: auto; }
.list-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.list-item:last-child { border-bottom: 0; }
.list-item:active, .camp-card:active { opacity: .7; }
.settings { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.row > span { display: flex; flex-direction: column; gap: 3px; line-height: 1.45; }
.row.buttons { justify-content: flex-start; gap: 8px; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

.spin-sm { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgb(56 189 248 / .3); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* ---------- 찍은 사진 시트 ---------- */
.sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 20; display: flex; align-items: flex-end; }
.sheet-card {
  width: 100%; max-height: 80dvh; overflow-y: auto; background: var(--bg); color: var(--text);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + var(--safe-b));
}
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-head b { flex: 1; font-size: 17px; }
.sheet-head a { color: var(--text); opacity: .75; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.shot { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
.shot img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.shot span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgb(0 0 0 / .6); color: #fff; }
.shot.done span { background: var(--ok); }
.shot.error span { background: var(--warn); color: #1a1000; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 150px); transform: translateX(-50%);
  background: rgb(30 30 34 / .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30;
  max-width: calc(100vw - 32px);
}

/* ---------- 홈 ---------- */
/* 위(교육·회차)와 아래(찍기 버튼)는 제자리, 가운데 분류만 스크롤 */
.home {
  height: 100dvh; min-height: 0; padding-bottom: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.home > .home-head, .home > #home-camp { flex: none; }
.home > #home-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin: 0 -16px; padding: 4px 16px calc(104px + var(--safe-b));
  /* 위아래 끝이 부드럽게 사라지도록 */
  scrollbar-width: none;
}
.home > #home-body::-webkit-scrollbar { display: none; }
.home-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.brand {
  font-size: 22px; font-weight: 800; letter-spacing: -.03em;
  color: var(--accent-2);
}
.sync-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 19px;
  font-size: 14px; font-weight: 600; background: color-mix(in srgb, var(--text) 7%, transparent);
}
.sync-btn.busy svg { animation: spin 1s linear infinite; }
.camp-hero {
  display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad-border) border-box;
  border-radius: 20px; padding: 16px; margin-bottom: 8px;
}
.empty-hero { align-items: center; text-align: center; padding: 26px 16px; gap: 8px; }
.empty-hero .btn.primary { min-width: 200px; margin-top: 6px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 12px; font-weight: 700; background: var(--accent-2); color: var(--accent-text); padding: 3px 9px; border-radius: 8px; }
.link-btn { font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; }
.hero-name { font-size: 19px; line-height: 1.35; letter-spacing: -.02em; }
.section-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-row .section-title { margin-bottom: 10px; flex: none; }
.path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  min-height: 92px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.cat-tile.on { border: 1.5px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad-border) border-box; box-shadow: var(--glow); }
.cat-tile:active { transform: scale(.98); }
.cat-ico { font-size: 26px; line-height: 1; }
.cat-name { font-size: 15px; font-weight: 700; line-height: 1.3; word-break: keep-all; }
.cat-count { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700; color: var(--muted); }
.cat-tile.add { border-style: dashed; background: transparent; color: var(--muted); justify-content: center; align-items: center; }
.cat-tile.add .cat-ico { font-size: 22px; }
.upload-card {
  margin-top: 14px; padding: 13px 15px; border-radius: 14px; background: color-mix(in srgb, var(--text) 5%, transparent);
  display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45;
}
.up-line { display: flex; align-items: center; gap: 8px; }
.upload-card .spin-sm { border-color: color-mix(in srgb, var(--text) 20%, transparent); border-top-color: var(--text); flex: none; }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.home-foot {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(14px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 65%, transparent); display: flex; justify-content: center;
}
.btn.wide { width: 100%; max-width: 528px; min-width: 0; margin: 0; }
.btn:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip { padding: 8px 12px; border-radius: 999px; font-size: 14px; background: color-mix(in srgb, var(--text) 7%, transparent); }
#add-form .search { margin-top: 10px; }

.recent { display: flex; gap: 6px; overflow-x: auto; margin-top: 14px; scrollbar-width: none; }
.recent::-webkit-scrollbar { display: none; }
.recent-shot { flex: none; position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: #000; }
.recent-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-shot::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); border: 2px solid #fff; }
.recent-shot.done::after { background: var(--ok); }

/* 회차 버튼 (셀렉트 박스 대신) */
.session-btn {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 11px 14px; border-radius: 13px;
  background: var(--bg); border: 1px solid var(--line); text-align: left;
}
.session-btn b { font-size: 16px; }
.session-more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.session-btn:active { opacity: .7; }
.sheet-desc { margin: -6px 0 12px; }
.session-list { display: flex; flex-direction: column; gap: 6px; }
.sr-group { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 2px 2px; }
.session-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
}
.session-row.on { border: 1.5px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad-border) border-box; box-shadow: var(--glow); }
.session-row.past { opacity: .8; }
.sr-date { display: flex; flex-direction: column; align-items: center; width: 44px; flex: none; line-height: 1.15; }
.sr-date b { font-size: 20px; }
.sr-date span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sr-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sr-main b { font-size: 16px; }
.session-row .badge { flex: none; }

/* 해·달 토글 */
.head-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  position: relative; width: 62px; height: 34px; border-radius: 17px; flex: none; overflow: hidden;
  background: #9fdcfb; box-shadow: inset 0 1px 3px rgb(0 0 0 / .12);
  transition: background .35s, box-shadow .35s;
}
.theme-toggle .stars { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.theme-toggle .stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px #bfe9ff; }
.theme-toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: #f59e0b;
  box-shadow: 0 2px 6px rgb(0 0 0 / .2);
  transition: transform .35s cubic-bezier(.4,1.4,.6,1), background .35s, color .35s, box-shadow .35s;
}
.theme-toggle .knob svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle {
  background: #1b2a4d; box-shadow: inset 0 1px 3px rgb(0 0 0 / .4);
}
:root[data-theme="dark"] .theme-toggle .stars { opacity: 1; }
:root[data-theme="dark"] .theme-toggle .knob {
  transform: translateX(28px); background: #e8f1ff; color: #3b82f6; box-shadow: 0 2px 6px rgb(0 0 0 / .4);
}
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.theme-toggle:active .knob { width: 32px; }
:root[data-theme="dark"] .brand { color: #7cc4ff; }


/* ---------- 앱 안 16:9 카메라 (아이폰 카메라 배치) ---------- */
body[data-screen="camera"] { background: #000; overflow: hidden; }
.camera {
  position: fixed; inset: 0; color: #fff; background: #000;
  display: grid; grid-template-rows: auto 1fr;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  user-select: none; -webkit-user-select: none;
  --ios-yellow: #5ac8fa; /* 강조색: 노란색 대신 하늘색 */
}
.cam-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 14px; min-height: 46px; }
.cam-back { display: inline-flex; align-items: center; gap: 4px; max-width: 74vw; font-size: 15px; font-weight: 600; color: #fff; }
.cam-back #cam-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev-l { font-size: 26px; line-height: 1; margin-top: -3px; }
.up-status { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: rgb(255 255 255 / .8); white-space: nowrap; }
.up-status.busy { color: var(--ios-yellow); }
.spin-sm { border-color: rgb(255 214 10 / .3); border-top-color: var(--ios-yellow); }
.stage { position: relative; display: grid; place-items: start center; min-height: 0; overflow: hidden; }
.frame { position: relative; overflow: hidden; background: #111; touch-action: none; }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: center; }
.grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgb(255 255 255 / .3) calc(33.33% - .5px), rgb(255 255 255 / .3) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgb(255 255 255 / .3) calc(66.66% - .5px), rgb(255 255 255 / .3) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgb(255 255 255 / .3) calc(33.33% - .5px), rgb(255 255 255 / .3) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgb(255 255 255 / .3) calc(66.66% - .5px), rgb(255 255 255 / .3) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.focus-ring { position: absolute; width: 70px; height: 70px; margin: -35px 0 0 -35px; border: 1.5px solid var(--ios-yellow); pointer-events: none; animation: focus .8s ease-out forwards; }
@keyframes focus { 0% { transform: scale(1.5); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.flash { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .16s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.cam-error { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; line-height: 1.6; background: #111; font-size: 15px; }
.cam-error .btn { margin-top: 12px; }
.level i, .level b { background: rgb(255 255 255 / .9); }
.level.ok i, .level.ok b { background: var(--ios-yellow); }
/* 아래 반투명 판: 줌 · 모드(분류) · 썸네일·셔터·전환 */
.cam-panel {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 0 calc(10px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cam-panel .cat-tabs, .cam-panel .cam-row { background: transparent; }
.cam-panel::before { content: ""; position: absolute; inset: 52px 0 0; background: rgb(0 0 0 / .55); z-index: -1; }
.zoom-chips { display: flex; gap: 6px; align-items: center; padding: 4px; border-radius: 999px; background: rgb(0 0 0 / .32); margin-bottom: 6px; }
.zoom-chips button { width: 34px; height: 34px; border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; background: rgb(30 30 30 / .55); transition: transform .15s; }
.zoom-chips button.on { color: var(--ios-yellow); transform: scale(1.12); }
.cat-tabs { display: flex; gap: 22px; overflow-x: auto; max-width: 100%; padding: 2px 40vw; scrollbar-width: none; scroll-snap-type: x mandatory; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex: none; scroll-snap-align: center; font-size: 14px; font-weight: 600; letter-spacing: .02em; color: rgb(255 255 255 / .85); white-space: nowrap; padding: 4px 0; }
.cat-tab.on { color: var(--ios-yellow); }
.cam-row { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 28px 4px; }
.thumb { justify-self: start; width: 48px; height: 48px; border-radius: 8px; overflow: hidden; position: relative; background: rgb(255 255 255 / .1); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-count { position: absolute; right: 3px; top: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgb(0 0 0 / .6); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; background: transparent; }
.shutter span { width: 62px; height: 62px; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active span { transform: scale(.88); }
.round { justify-self: end; width: 48px; height: 48px; border-radius: 50%; background: rgb(255 255 255 / .16); display: grid; place-items: center; color: #fff; }
@media (orientation: landscape) and (max-height: 600px) {
  .camera { grid-template-rows: 1fr; padding-bottom: 0; }
  .cam-top { position: absolute; top: var(--safe-t); left: var(--safe-l); z-index: 2; }
  .stage { place-items: center start; }
  .cam-panel { left: auto; top: 0; width: 150px; flex-direction: row-reverse; justify-content: center; padding: 0 calc(10px + var(--safe-r)) 0 0; }
  .cam-panel::before { inset: 0 0 0 0; }
  .zoom-chips { flex-direction: column; }
  .cat-tabs { flex-direction: column; padding: 30vh 0; max-height: 100vh; overflow-y: auto; scroll-snap-type: y mandatory; gap: 14px; }
  .cam-row { grid-template-columns: auto; grid-template-rows: 1fr auto 1fr; height: 100%; width: auto; padding: 20px 0; justify-items: center; }
  .thumb { grid-row: 3; justify-self: center; align-self: end; }
  .shutter { grid-row: 2; }
  .round { grid-row: 1; justify-self: center; align-self: start; }
}

/* ---------- 분류 폴더 (아이폰 사진 앱처럼) ---------- */
.hint { font-weight: 500; font-size: 11px; color: var(--muted); margin-left: 6px; }
.folder {
  position: fixed; inset: 0; z-index: 25; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; padding: var(--safe-t) 0 0;
  --ios-blue: #0a84ff;
}
.folder-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 0; flex: none; }
.ios-back { display: inline-flex; align-items: center; gap: 2px; font-size: 17px; color: var(--ios-blue, #0a84ff); padding: 6px 4px; }
.ios-back .chev-l { font-size: 30px; margin-top: -4px; }
.ios-back.light { color: #fff; }
.pill-btn { font-size: 15px; font-weight: 600; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.folder-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 16px 10px; flex: none; }
.folder-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; align-content: start; padding-bottom: calc(80px + var(--safe-b)); }
.folder-grid .empty { grid-column: 1 / -1; margin: 30px 16px; text-align: center; background: none; border: 0; }
.folder-count { grid-column: 1 / -1; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); padding: 14px 0; }
.f-shot { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--line); }
.f-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.f-shot.picked img { opacity: .75; }
.f-check {
  position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid #fff; background: rgb(0 0 0 / .15); box-shadow: 0 0 2px rgb(0 0 0 / .4);
  color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.f-shot.picked .f-check { background: var(--ios-blue, #0a84ff); }
.g-tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgb(0 0 0 / .55); color: #fff; }
.ios-toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  padding: 8px 8px calc(8px + var(--safe-b)); background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid var(--line);
}
.ios-toolbar span { text-align: center; font-size: 15px; font-weight: 600; }
.tool-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ios-blue, #0a84ff); justify-self: center; }
.tool-btn:disabled { color: var(--muted); opacity: .5; }
.ios-toolbar.dark { position: static; background: #000; border-top: 0; color: #fff; --ios-blue: #0a84ff; }
.move-item { flex-direction: row; justify-content: space-between; align-items: center; }
#move-sheet { z-index: 45; }

/* ---------- 크게 보기 ---------- */
.viewer { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; display: flex; flex-direction: column; padding: var(--safe-t) 0 0; }
.viewer-top { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; padding: 4px 8px; transition: opacity .2s; }
.viewer-titles { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.viewer-titles b { font-size: 15px; }
.viewer-titles span { font-size: 12px; opacity: .7; }
.viewer.bare .viewer-top, .viewer.bare .ios-toolbar { opacity: 0; pointer-events: none; }
.viewer .ios-toolbar { transition: opacity .2s; }
.viewer-stage { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; will-change: transform; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; font-size: 34px; color: #fff; background: rgb(0 0 0 / .25); border-radius: 12px; }
.v-nav.prev { left: 8px; }
.v-nav.next { right: 8px; }
.v-nav:disabled { opacity: 0; pointer-events: none; }
@media (hover: none) { .v-nav { display: none; } }

/* 동작 시트 (아이폰 삭제 확인) */
.action-sheet { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; justify-content: center; }
.as-card { width: 100%; max-width: 520px; padding: 0 8px calc(8px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; }
.as-group { background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; overflow: hidden; }
.as-msg { margin: 0; padding: 14px 16px; text-align: center; font-size: 13px; color: var(--muted); border-bottom: 0.5px solid var(--line); }
.as-btn { width: 100%; height: 56px; font-size: 19px; color: #0a84ff; background: color-mix(in srgb, var(--card) 94%, transparent); border-radius: 14px; }
.as-group .as-btn { border-radius: 0; }
.as-btn.danger { color: #ff3b30; }
.as-btn.cancel { font-weight: 600; }

/* 수평선 (아이폰 카메라처럼): 기울면 흰 선, 딱 맞으면 노란 한 줄 */
.level { position: absolute; left: 50%; top: 50%; width: 46%; height: 2px; display: flex; align-items: center; gap: 10px; pointer-events: none; transition: transform .06s linear; }
.level i { flex: 1; height: 1.5px; background: rgb(255 255 255 / .85); }
.level b { width: 34%; height: 1.5px; background: rgb(255 255 255 / .85); }
.level.ok i, .level.ok b { background: #5ac8fa; }
.level.ok { gap: 0; }
/* 폰을 옆으로 들면 아이콘을 돌림 */
.camera .zoom-chips button, .camera .thumb, .camera .round svg, .camera .shutter { transition: transform .25s; }
.camera[data-orient="left"] .zoom-chips button, .camera[data-orient="left"] .thumb, .camera[data-orient="left"] .round svg { transform: rotate(90deg); }
.camera[data-orient="right"] .zoom-chips button, .camera[data-orient="right"] .thumb, .camera[data-orient="right"] .round svg { transform: rotate(-90deg); }
.thumb.pop { animation: pop .28s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.camera[data-orient="left"] .thumb.pop, .camera[data-orient="right"] .thumb.pop { animation: none; }


/* 줌 다이얼 (단추 위에서 옆으로 밀면, 아이폰처럼) */
.zoom-dial { position: relative; width: 100%; height: 64px; overflow: hidden; margin-bottom: -6px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent); mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent); }
.zoom-strip { position: absolute; left: 50%; top: 26px; height: 30px; will-change: transform; }
.zoom-strip i { position: absolute; top: 0; width: 1px; height: 8px; background: rgb(255 255 255 / .6); }
.zoom-strip i.major { height: 14px; background: #fff; }
.zoom-strip span { position: absolute; top: 16px; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #fff; }
.zoom-mark { position: absolute; left: 50%; top: 20px; width: 2px; height: 22px; margin-left: -1px; background: var(--ios-yellow); border-radius: 1px; }
.zoom-read { position: absolute; left: 50%; top: 0; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: var(--ios-yellow); }
#zoom-read { position: absolute; left: 50%; top: 0; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: var(--ios-yellow); }
.zoom-chips { touch-action: none; }

.cat-tab { transition: color .15s; }

.viewer .ios-toolbar { grid-template-columns: 1fr 1fr 1fr; }
.viewer-stage img.turning { transition: transform .3s; }
.viewer.busy .viewer-stage::after { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .3); border-top-color: #fff; animation: spin .8s linear infinite; }
