:root {
  --bg: #faf7f2; --fg: #1b1a18; --muted: #77726a; --card: #fff; --line: #e6e0d6;
  --keep: #1f8a4c; --keep-fg: #fff; --not: #9a968f; --accent: #2b6cb0;
  --radius: 14px; --gap: 6px; --tap: 56px;
  --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);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211; --fg: #f2eee8; --muted: #9b958c; --card: #1f1d1b; --line: #33302c;
    --keep: #3ecf7a; --keep-fg: #06210f; --not: #77726a; --accent: #6fa8e6;
  }
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: light dark; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.4 system-ui, -apple-system, sans-serif;
  overscroll-behavior-y: none; overflow-x: hidden;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
}
button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
img { display: block; max-width: 100%; }

.b-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }

.b-tile {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0;
  border: 0; border-radius: var(--radius); overflow: hidden; background: var(--card);
  transition: transform .1s;
}
.b-tile:active { transform: scale(.96); }
.b-tile img { width: 100%; height: 100%; object-fit: cover; }
.b-tile.is-keep { box-shadow: inset 0 0 0 3px var(--keep); }
.b-tile.is-keep::after { /* ring over the image */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 3px var(--keep); pointer-events: none;
}
.b-tile.is-not img { filter: grayscale(1); opacity: .35; }
.b-badge {
  position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; z-index: 1;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--not); color: #fff;
}
.b-tile.is-keep .b-badge { background: var(--keep); color: var(--keep-fg); }
.b-badge svg { width: 16px; height: 16px; }
.b-count {
  position: absolute; right: 6px; top: 6px; z-index: 1; min-width: 22px; padding: 1px 7px;
  border-radius: 999px; background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 18px; text-align: center;
}

.b-lock { min-height: 100vh; display: grid; place-items: center; font-size: 64px; }

.b-btn {
  min-height: var(--tap); padding: 0 20px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 600;
}
.b-btn:active { opacity: .8; }
