/* Safe area for iPhone (including Dynamic Island) */
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
.safe-top { padding-top: env(safe-area-inset-top, 0); }
.pt-safe-top { padding-top: env(safe-area-inset-top, 0); }

/* Image grid */
.img-card { position: relative; aspect-ratio: 1; border-radius: .75rem; overflow: hidden; }
.img-card img { width: 100%; height: 100%; object-fit: cover; }
.img-card .check { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.img-card.selected .check { background: #3b82f6; border-color: #3b82f6; }
.img-card .status-dot { position: absolute; bottom: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; }

/* Completed image: green border */
.img-card.completed { border: 2px solid #22c55e; }
/* Recycled image: red tint */
.img-card.recycled { opacity: 0.6; border: 2px solid #ef4444; }
.img-card.recycled::after { content: '回收'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(239,68,68,.8); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; }

/* Tab bar */
.tab-btn { color: #6b7280; transition: color .2s; }
.tab-btn.active { color: #3b82f6; }

/* Toast */
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 100; animation: toastIn .3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Loading overlay */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spinner { width: 40px; height: 40px; border: 3px solid #374151; border-top-color: #3b82f6; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar hide */
::-webkit-scrollbar { display: none; }
html { -ms-overflow-style: none; scrollbar-width: none; }

/* Canvas crosshair */
#canvas.crosshair { cursor: crosshair; }
#page-annotate { padding-bottom: 240px; }
#annotateToolbar {
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  max-height: 45vh;
  overflow-y: auto;
  padding-bottom: 8px;
}
.toolbar-row { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 430px) {
  .toolbar-row button { padding: 6px 8px !important; font-size: 11px !important; line-height: 1.1; }
}

/* Task card */
.task-card { background: #1f2937; border-radius: .75rem; padding: 12px; }
.task-card .thumb { width: 60px; height: 60px; border-radius: .5rem; object-fit: cover; }
