/* Moss & Memory: shared tokens for setup, review, and recovery. */
:root {
  color-scheme: light;
  --ivory: #f7f6ee;
  --forest: #24483f;
  --sage: #a4b591;
  --caramel: #d59b65;
  --surface: #fffef9;
  --surface-soft: #f0f1e8;
  --surface-green: #e7ecdf;
  --border: #dce1d2;
  --border-strong: #bcc9b4;
  --muted: #607165;
  --danger: #8c3929;
  --danger-bg: #fff0e8;
  --focus: #9a622d;
  --shadow: 0 4px 20px #24483f06, 0 1px 3px #24483f04;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --round: ui-rounded, 'Arial Rounded MT Bold', 'Trebuchet MS', var(--sans);
  font: 15px/1.55 var(--sans);
  color: var(--forest);
  background: var(--ivory);
  accent-color: var(--forest);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: 32px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 11px; font-weight: 550; }
button:hover:not(:disabled) { background: var(--surface-green); border-color: var(--border-strong); }
button:disabled { cursor: not-allowed; opacity: .48; }
button, select, input { transition: background-color .15s, border-color .15s; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: #dce5cf; color: var(--forest); }
a { color: var(--forest); text-underline-offset: 3px; }
p { color: var(--muted); }
.skip-link { position: fixed; top: 10px; left: 10px; padding: 10px 16px; border-radius: 6px; background: var(--forest); color: var(--surface); z-index: 10; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: sticky; top: 0; z-index: 5; min-height: 62px; display: flex; align-items: center; gap: 22px; padding: 8px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 7px; color: var(--forest); font: 800 24px/1 var(--round); letter-spacing: -1.2px; text-decoration: none; flex-shrink: 0; }
.brand img { display: block; object-fit: contain; }
.site-header h1 { font: 400 23px/1.2 var(--serif); letter-spacing: -.6px; border-left: 1px solid var(--border); padding-left: 22px; margin: 0; }
.local { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; background: #577c54; border-radius: 50%; flex-shrink: 0; }
.workspace { display: grid; grid-template-columns: 282px minmax(0, 1fr); flex: 1; width: 100%; min-width: 0; align-items: start; scroll-margin-top: 12px; }
.setup { min-width: 0; background: var(--surface); border-right: 1px solid var(--border); align-self: stretch; }
.setup-content { position: sticky; top: 62px; padding: 18px; max-height: calc(100dvh - 62px); overflow: auto; }
.eyebrow { font-size: 10px; line-height: 1.5; letter-spacing: 1.5px; font-weight: 650; color: var(--muted); }
.setup-caption { margin-bottom: 17px; }
.panel { margin: 0 0 17px; padding-bottom: 17px; border-bottom: 1px solid var(--border); min-width: 0; }
.panel:last-of-type { border: 0; margin-bottom: 10px; padding-bottom: 0; }
.panel-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.step { display: grid; place-items: center; height: 24px; width: 24px; flex-shrink: 0; background: var(--surface-green); border-radius: 7px; font-size: 11px; font-weight: 650; }
.panel-heading h2 { font: 650 13px/1.3 var(--sans); margin: 0; }
.panel-caption { font-size: 10px; color: var(--muted); margin-left: auto; }
.device { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.device strong { display: block; font-size: 12px; font-weight: 600; }
.device span:not(.dot) { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.dot { width: 7px; height: 7px; background: #a5ad9b; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.dot.connected { background: #527d4e; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.panel:has(.dot.connected) #connect, .panel:not(:has(.dot.connected)) #disconnect { display: none; }
#connect { color: var(--surface); background: var(--forest); border-color: var(--forest); }
.hint { font-size: 11px; line-height: 1.65; margin: 8px 0 0; }
.capture-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; }
select { width: 100%; min-width: 0; min-height: 33px; border: 1px solid var(--border); background: var(--ivory); border-radius: 6px; padding: 5px 7px; font-size: 12px; color: var(--forest); }
select:hover, input:hover { border-color: var(--border-strong); }
.expected-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0; color: var(--muted); font-size: 11px; }
.expected-field input { width: 58px; min-height: 30px; padding: 4px 6px; border: 1px solid var(--border); background: var(--ivory); border-radius: 6px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 12px; }
input[type=checkbox] { width: 15px; height: 15px; margin: 0; flex-shrink: 0; }
.primary { width: 100%; background: var(--forest); color: var(--surface); border-color: var(--forest); min-height: 39px; padding: 9px 12px; font-size: 12px; }
.primary:hover:not(:disabled) { background: #335c4b; border-color: #335c4b; color: var(--surface); }
.primary:disabled { background: #e1e6d9; border-color: #d9e0d0; color: #657461; opacity: 1; }
#scan { margin-top: 14px; }
#stop { width: 100%; margin-top: 6px; color: var(--danger); border-color: #e8c7b8; background: var(--danger-bg); }
#stop:disabled { display: none; }
.advanced-settings { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.advanced-settings .field { margin-top: 12px; }
summary { cursor: pointer; font-size: 11px; color: var(--muted); }
.footnote { font-size: 10px; margin: 18px 0 2px; color: var(--muted); }
.folder-name { font-size: 12px; padding: 8px 9px; margin-bottom: 8px; background: var(--ivory); border: 1px solid var(--border); border-radius: 6px; overflow-wrap: anywhere; }
#choose-folder { width: 100%; }
.results { min-width: 0; }
.results-heading { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 16px 20px 10px; }
.collection-name { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; min-width: 0; }
.results-heading h2 { font: 600 18px/1.3 var(--sans); letter-spacing: -.4px; margin: 0; }
#photo-count { color: var(--muted); font-size: 11px; }
.results-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#run-state { font-size: 10px; color: var(--muted); }
#message { font-size: 11px; margin: 0 20px 12px; color: var(--muted); overflow-wrap: anywhere; }
#message.error { color: var(--danger); background: var(--danger-bg); padding: 10px 12px; border: 1px solid #edd2bd; border-radius: 6px; }
#gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; padding: 0 20px 20px; align-content: start; }
.empty { grid-column: 1 / -1; min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 50px 12px; }
.empty img { object-fit: contain; }
.empty h3 { font: 400 25px/1.3 var(--serif); margin: 15px 0 8px; letter-spacing: -.4px; }
.empty p { font-size: 12px; margin: 0; }
.site-footer { padding: 7px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; background: var(--surface); }
.footer-tagline { margin-left: auto; }
.review-recovery { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.recovery-status { font-size: 11px; margin: 0; overflow-wrap: anywhere; }
.recovery-status.error { color: var(--danger); font-weight: 600; }
#diagnostics { padding: 7px 20px; background: var(--surface); border-top: 1px solid var(--border); }
#diagnostics summary { font-size: 10px; }
pre { background: var(--forest); color: #e0e8d7; padding: 15px; border-radius: 7px; max-height: 280px; overflow: auto; font: 11px/1.65 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 1800px) { #gallery { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); } }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 254px minmax(0, 1fr); }
  .site-header h1 { font-size: 20px; }
  .local { font-size: 10px; }
  #gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .results-heading { flex-wrap: wrap; }
}
@media (max-width: 850px) {
  .site-header { padding-inline: 14px; gap: 14px; }
  .site-header h1 { padding-left: 14px; font-size: 18px; }
  .local { display: none; }
  .workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .setup-content { padding-inline: 14px; }
}
@media (max-width: 620px) {
  .site-header { gap: 10px; }
  .brand { font-size: 21px; }
  .brand img { width: 34px; height: 34px; }
  .site-header h1 { font-size: 15px; }
  .workspace { grid-template-columns: 1fr; }
  .setup { border-right: 0; border-bottom: 1px solid var(--border); }
  .setup-content { position: static; max-height: none; overflow: visible; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
  .setup-caption { grid-column: 1 / -1; margin-bottom: 0; }
  .panel { margin: 0; padding-bottom: 12px; }
  .capture-panel, .footnote { grid-column: 1 / -1; }
  .footnote { margin: 0; }
  .results-heading { padding-inline: 14px; }
  #message { margin-inline: 14px; }
  #gallery { padding-inline: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .site-footer, #diagnostics { padding-inline: 14px; }
}
@media (max-width: 380px) { #gallery { grid-template-columns: 1fr; } .setup-content { grid-template-columns: 1fr; } }
@media (pointer: coarse) { button { min-height: 40px; } input, select { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
