:root { --bg: #111; --bar: #1c1c1e; --fg: #f2f2f7; --muted: #8e8e93; --accent: #0a84ff; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 15px/1.4 -apple-system, system-ui, sans-serif; overscroll-behavior: none; }
button, .pick { font: inherit; color: var(--fg); background: #2c2c2e; border: 0; border-radius: 8px;
  padding: 8px 12px; min-height: 40px; cursor: pointer; }
button:disabled { opacity: .4; }
button.on { background: var(--accent); }

#start { max-width: 420px; margin: 0 auto; padding: 48px 16px; display: grid; gap: 12px; }
#start h1 { margin: 0 0 4px; font-size: 24px; }
.hint { color: var(--muted); margin: 0 0 8px; }
.pick { display: block; text-align: center; }
.pick input { display: none; }
.count { color: var(--muted); text-align: center; margin-top: -6px; }
#start-go { background: var(--accent); }

#viewer { position: fixed; inset: 0; display: flex; flex-direction: column; }
#panes { flex: 1; display: flex; min-height: 0; gap: 2px; background: #000; }
.pane { position: relative; flex: 1; overflow: hidden; background: var(--bg);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pane img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.pane .ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.labels { position: absolute; left: 8px; top: 8px; right: 8px; z-index: 3; display: flex; gap: 6px;
  align-items: center; pointer-events: none; }
.filename, .overlay-badge { padding: 3px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.filename { background: rgba(0,0,0,.55); color: #fff; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.overlay-badge { background: var(--accent); color: #fff; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

#toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--bar); }
#toolbar .group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#counter { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }

#list { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bar-h, 56px) + 8px); max-height: 60vh; overflow: auto;
  background: var(--bar); border-radius: 12px; padding: 8px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; z-index: 10; }
.list-item { text-align: left; display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; min-width: 0; }
.list-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-item .thumb { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #3a3a3c; }
.list-item .thumb.none { visibility: hidden; }
.list-item.current { outline: 2px solid var(--accent); }
.list-item.has-memo .label::after { content: ' ✎'; color: #ff3b30; }

.color { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid #48484a; }
.color.on { background: var(--c); border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.range { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.range input { width: 90px; }

#settings-panel { position: fixed; right: 8px; bottom: calc(var(--bar-h, 56px) + 8px); z-index: 10; background: var(--bar);
  border-radius: 12px; padding: 12px 16px; }
#settings-panel label { display: grid; gap: 8px; }
button.primary { background: var(--accent); }

.pick.primary { background: var(--accent); }
details.separate { display: grid; gap: 12px; }
details.separate summary { color: var(--muted); cursor: pointer; text-align: center; padding: 6px; }
details.separate[open] { display: grid; gap: 12px; }
#panes { cursor: grab; }
#panes:active { cursor: grabbing; }
#panes.mouse-draw { cursor: crosshair; }

#align-panel { position: fixed; left: 8px; bottom: calc(var(--bar-h, 56px) + 8px); z-index: 10; background: var(--bar);
  border-radius: 12px; padding: 12px 16px; max-width: calc(100% - 16px); }
#align-panel p { margin: 0 0 8px; }
#align-panel .row { display: flex; gap: 6px; flex-wrap: wrap; }
#align-btn.warn { background: #ff9f0a; color: #000; }
#pick-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--accent); color: #fff; padding: 8px 8px 8px 16px; border-radius: 12px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#pick-banner.wrong { background: #ff453a; }
#pick-banner button { background: rgba(255,255,255,.2); }
.pick-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid #fff; background: var(--accent); z-index: 4; pointer-events: none; }

#drive-open { min-height: 48px; }
#start .or { color: var(--muted); text-align: center; margin: 12px 0 0; border-top: 1px solid #2c2c2e; padding-top: 16px; }

#viewer { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#panes { touch-action: none; }
#tool-toast { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); z-index: 30;
  background: rgba(0,0,0,.75); color: #fff; font-size: 20px; padding: 12px 24px; border-radius: 12px; pointer-events: none; }

/* Netlify에서 열면 오른쪽 아래 배지 자리를 비워 둔다 */
.host-badge #toolbar { padding-right: 190px; }
