:root {
  --bg: #f5f5f5;
  --fg: #1a1a1a;
  --accent: #0b6a4a;
  --muted: #666;
  --card: #fff;
  --err: #b00020;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0; }

button {
  font-size: 1rem;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #ddd; color: #222; }
button:disabled { opacity: 0.5; cursor: default; }

input[type=text] {
  font-size: 1rem;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
  width: 100%;
}

.row { display: flex; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--err); }
.center { text-align: center; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.folder-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #ddd;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .status {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  font-size: 0.7rem;
  padding: 2px 4px;
  color: #fff;
  background: rgba(0,0,0,0.55);
}
.thumb .status.uploaded { background: rgba(11,106,74,0.85); }

.diag {
  white-space: pre-wrap;
  word-break: break-word;
  background: #111;
  color: #6f6;
  font-size: 0.8rem;
  padding: 8px;
  border-radius: 8px;
  margin: 0;
  min-height: 1em;
  user-select: text;
}

/* Annotation editor */
.editor {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  touch-action: none;
}
.editor img { max-width: 100%; max-height: 60vh; display: block; user-select: none; }
.overlay-text {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 0 6px #000, 0 0 6px #000;
  padding: 0 2.5%;
  cursor: grab;
  touch-action: none;
  white-space: pre-wrap;
  word-break: break-word;
}
