/* Spotter viewer -- dark, photo-first UI. Plain CSS, no build step. */

:root {
  --bg: #121316;
  --panel: #1b1c21;
  --panel-2: #22242b;
  --border: #2e3038;
  --text: #e8e8ec;
  --muted: #9a9ca6;
  --accent: #f2b134;
  --accent-text: #1b1b1f;
  --danger: #e5484d;
  --ok: #46a758;
  --radius: 10px;
  --tile: 200px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.4; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

.logo {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%; vertical-align: -5px;
  background: radial-gradient(circle at 50% 40%, #1b1b1f 0 24%, transparent 26%),
              radial-gradient(ellipse at 50% 100%, #1b1b1f 0 40%, transparent 42%), var(--accent);
}

/* ---------- buttons ---------- */
button, .button {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; transition: background .12s, border-color .12s;
  display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
button:hover, .button:hover { background: #2a2d36; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 5px 12px; font-size: 13px; }
.segmented button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
input[type=search], input[type=text], select {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- start screen ---------- */
.start { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.start-card { max-width: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.start-card h1 { margin: 0 0 12px; font-size: 28px; }
.start-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.recent h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.recent ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent li button { width: 100%; justify-content: space-between; }
.message { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.message.error { border-color: var(--danger); }

/* ---------- layout ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.event-name { color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.save-status[data-state=saving] { color: var(--accent); border-color: var(--accent); }
.save-status[data-state=unsaved] { color: var(--danger); border-color: var(--danger); cursor: pointer; }
.save-status[data-state=readonly] { color: var(--muted); }
.banner {
  padding: 8px 14px; background: #3a2f12; border-bottom: 1px solid #5a4a1c; color: #ffd98a; font-size: 13px;
  display: flex; gap: 12px; align-items: center;
}
.banner button { margin-left: auto; }

/* ---------- people bar ---------- */
.people-panel { background: var(--panel); border-bottom: 1px solid var(--border); }
.people-tools { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; flex-wrap: wrap; }
.people-tools input[type=search] { width: 220px; }
.people-bar {
  display: flex; gap: 6px; padding: 8px 14px 10px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
.chip {
  flex: 0 0 auto; width: 92px; border: 2px solid transparent; border-radius: 12px; padding: 6px 4px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; position: relative;
  background: transparent; transition: background .12s, border-color .12s;
}
.chip:hover { background: var(--panel-2); }
.chip.selected { border-color: var(--accent); background: #2b2614; }
.chip .avatar {
  width: 64px; height: 64px; border-radius: 50%; background: var(--panel-2); overflow: hidden;
  display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 18px;
}
.chip .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chip .name { font-size: 12px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.chip .name.unnamed { color: var(--muted); font-style: italic; }
.chip .count {
  position: absolute; top: 2px; right: 6px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 6px; color: var(--muted);
}
.chip.selected .count { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.chip .edit {
  position: absolute; top: 2px; left: 6px; width: 20px; height: 20px; border-radius: 50%; padding: 0; justify-content: center;
  font-size: 11px; opacity: 0; background: var(--panel-2);
}
.chip:hover .edit, .chip.selected .edit, .chip:focus-within .edit { opacity: 1; }
.chip input.rename { width: 84px; font-size: 12px; padding: 2px 6px; text-align: center; }
.chip.no-people .avatar { font-size: 22px; }
.people-empty { color: var(--muted); padding: 12px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.pager { display: inline-flex; align-items: center; gap: 6px; }
.result-summary { font-weight: 600; }

/* ---------- grid (virtualised) ---------- */
.grid { flex: 1; overflow-y: auto; position: relative; outline: none; padding: 0 14px; }
.grid-spacer { position: relative; width: 100%; }
.grid-items { position: absolute; top: 0; left: 14px; right: 14px; }
.tile {
  position: absolute; width: var(--tile); height: var(--tile); border-radius: 8px; overflow: hidden;
  background: var(--panel-2); cursor: pointer; border: 1px solid transparent;
}
.tile:hover { border-color: var(--accent); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .15s; }
.tile img.ready { opacity: 1; }
.tile .caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: 11px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .15s;
}
.tile:hover .caption { opacity: 1; }
.tile .badge {
  position: absolute; top: 6px; right: 6px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff;
  border-radius: 999px; padding: 1px 7px;
}
.tile .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10px;
  color: var(--muted); font-size: 12px; gap: 4px;
}
.tile .placeholder .kind { font-size: 22px; }
.grid-empty { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 50; display: flex; flex-direction: column; }
.lb-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 16px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lb-placeholder { color: var(--muted); text-align: center; max-width: 420px; }
.lb-caption { display: flex; gap: 14px; align-items: center; padding: 10px 18px 16px; flex-wrap: wrap; }
.lb-people { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-people .pill { font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.lb-people .pill.selected { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.lb-button {
  position: absolute; z-index: 2; width: 44px; height: 44px; border-radius: 50%; padding: 0; justify-content: center;
  font-size: 26px; background: rgba(30,30,36,.8);
}
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }

/* ---------- dialogs & toasts ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 520px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 18px 0 0; flex-wrap: wrap; }
.merge-options { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.merge-options label { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.merge-options label:hover { background: var(--panel-2); }
.merge-options img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.error { border-color: var(--danger); }
.toast button { padding: 3px 10px; }

@media (max-width: 700px) {
  .event-name { display: none; }
  .people-tools input[type=search] { width: 140px; }
  .chip { width: 76px; }
  .chip .avatar { width: 52px; height: 52px; }
}

/* ---------- start screen: paths, no-manifest ---------- */
.open-form { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 6px; }
.open-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.open-form input[type=text] { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.no-manifest h2 { font-size: 18px; margin: 12px 0 8px; }
.no-manifest .contact { padding: 10px 12px; border-radius: 8px; background: #2b2614; border: 1px solid #5a4a1c; }
.recent li button .path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
button.danger { background: var(--danger); color: #fff; border-color: transparent; font-weight: 600; }

/* ---------- favorites ---------- */
.favorites-toggle[aria-pressed=true] { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.tile .heart {
  position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; border-radius: 50%; padding: 0; justify-content: center;
  font-size: 16px; line-height: 1; background: rgba(0,0,0,.55); border: 0; color: #fff; opacity: 0; transition: opacity .12s;
}
.tile:hover .heart, .tile .heart.on { opacity: 1; }
.tile .heart.on { color: #ff5c7a; }
.tile.favorite { border-color: rgba(255,92,122,.7); }
.lb-favorite.on { background: #ff5c7a; color: #fff; border-color: transparent; }

/* ---------- people bar: delete ---------- */
.chip .remove {
  position: absolute; bottom: 24px; right: 6px; width: 20px; height: 20px; border-radius: 50%; padding: 0; justify-content: center;
  font-size: 13px; opacity: 0; background: var(--panel-2);
}
.chip:hover .remove, .chip:focus-within .remove { opacity: 1; }
.chip .remove:hover { background: var(--danger); color: #fff; }

/* ---------- lightbox pills with remove ---------- */
.lb-people .pill { display: inline-flex; align-items: stretch; padding: 0; overflow: hidden; }
.lb-people .pill button { background: transparent; border: 0; border-radius: 0; padding: 2px 8px; font-size: 12px; color: inherit; }
.lb-people .pill .pill-remove { border-left: 1px solid var(--border); padding: 2px 7px; opacity: .6; }
.lb-people .pill .pill-remove:hover { opacity: 1; background: var(--danger); color: #fff; }
.lb-people .pill.selected .pill-remove { border-left-color: rgba(0,0,0,.2); }

/* ---------- export dialog ---------- */
fieldset.choice { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
fieldset.choice label { display: flex; gap: 8px; align-items: center; }
#export-dialog label.small { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
#export-dialog label.small input { width: 100%; }
.export-destinations { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.export-folder-row { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.export-folder-row label { display: flex; flex-direction: column; gap: 4px; }
.export-folder-row input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.export-folder-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- start screen: currently open folder ---------- */
.current-folder {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0 18px;
  padding: 12px 14px; border-radius: 10px; background: #2b2614; border: 1px solid #5a4a1c;
}
.current-folder .current-title { font-size: 14px; }
.current-folder strong { color: var(--accent); }
fieldset.choice label.disabled { opacity: .45; cursor: default; }

/* ---------- welcome page ---------- */
.welcome {
  min-height: 100%; overflow-y: auto; padding: 48px 24px 80px;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(242,177,52,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(106,169,255,.14), transparent 60%),
    var(--bg);
}
.welcome-inner { max-width: 880px; margin: 0 auto; }
.hero { text-align: center; animation: rise .7s ease both; }
.brand.big { justify-content: center; font-size: 22px; margin-bottom: 26px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--accent); margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.1; margin: 0 0 18px; letter-spacing: -.01em; }
.lead { font-size: 17px; color: var(--muted); max-width: 640px; margin: 0 auto; line-height: 1.55; }

.mock {
  margin: 40px auto 0; max-width: 620px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); animation: rise .8s .15s ease both;
}
.mock-bar { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.mock-chip {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--c) 30%, var(--panel-2)); color: var(--c); border: 2px solid transparent;
}
.mock-chip.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,177,52,.25); }
.mock-chip.more { background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; }
.mock-and { margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.mock-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; padding-top: 12px; }
.mock-grid i { display: block; aspect-ratio: 1; border-radius: 6px; background: var(--panel-2); opacity: .35; position: relative; }
.mock-grid i.hit { opacity: 1; background: linear-gradient(135deg, #3a3f4b, #262a33); border: 1px solid #3f4655; animation: pop .5s ease both; }
.mock-grid i.hit:nth-child(3) { animation-delay: .35s; } .mock-grid i.hit:nth-child(5) { animation-delay: .45s; }
.mock-grid i.hit:nth-child(8) { animation-delay: .55s; } .mock-grid i.hit:nth-child(10) { animation-delay: .65s; }
.mock-grid i.hit:nth-child(12) { animation-delay: .75s; } .mock-grid i.hit:nth-child(14) { animation-delay: .85s; }
.mock-grid i.fav::after { content: '♥'; position: absolute; top: 3px; left: 5px; color: #ff5c7a; font-size: 11px; }
.mock-caption { text-align: center; font-size: 12px; color: var(--muted); padding-top: 12px; }

.steps { margin-top: 56px; animation: rise .8s .25s ease both; }
.steps h2, .cta h2 { text-align: center; font-size: 24px; margin: 0 0 22px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; line-height: 1.5; }
.steps .num { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; display: grid; place-items: center; }

.features { margin-top: 48px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; animation: rise .7s ease both; }
.feature:nth-child(2) { animation-delay: .08s; } .feature:nth-child(3) { animation-delay: .16s; }
.feature:nth-child(4) { animation-delay: .24s; } .feature:nth-child(5) { animation-delay: .32s; } .feature:nth-child(6) { animation-delay: .4s; }
.feature .icon { font-size: 22px; }
.feature .icon.heart { color: #ff5c7a; }
.feature h3 { margin: 10px 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.cta { margin-top: 48px; text-align: center; padding-bottom: 96px; }
.steps li a { color: var(--accent); }
.steps li em { font-style: normal; color: var(--accent); }
.ready-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); pointer-events: none;
  background: linear-gradient(to top, rgba(18,19,22,.95) 40%, rgba(18,19,22,0));
}
.ready-dock .cta-ready { pointer-events: auto; }
.cta-ready {
  font-size: 22px; font-weight: 800; padding: 18px 40px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 0 0 0 rgba(242,177,52,.55), 0 14px 40px rgba(242,177,52,.25);
  animation: pulse 2.2s ease-out infinite; transition: transform .15s;
}
.cta-ready:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.06); }
.cta-ready .arrow { display: inline-block; transition: transform .2s; }
.cta-ready:hover .arrow { transform: translateX(6px); }
.cta-alt { margin: 22px 0 6px; }
.cta-alt a { color: var(--accent); }
.start-links { margin: 18px 0 0; }
.start-links a { color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: .2; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242,177,52,.55), 0 14px 40px rgba(242,177,52,.25); } 70% { box-shadow: 0 0 0 22px rgba(242,177,52,0), 0 14px 40px rgba(242,177,52,.25); } 100% { box-shadow: 0 0 0 0 rgba(242,177,52,0), 0 14px 40px rgba(242,177,52,.25); } }
@media (prefers-reduced-motion: reduce) { .welcome *, .welcome *::after { animation: none !important; transition: none !important; } }
@media (max-width: 600px) { .mock-grid { grid-template-columns: repeat(4, 1fr); } .mock-grid i:nth-child(n+9) { display: none; } }
.skip-intro { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; cursor: pointer; }
