:root {
  --bg: #0f0f0f;
  --card: #171717;
  --text: #ffffff;
  --muted: #b3b3b3;
  --primary: #4f8cff;
  --primary-contrast: #000;
  --border: #2a2a2a;
  --focus: #9ec1ff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }

.container { width: min(960px, 92%); margin: 1.5rem auto 4rem; }


.app-header, .app-footer { text-align: center; padding: 1rem; }
.app-header { border-bottom: 1px solid var(--border); }
.app-footer { border-top: 1px solid var(--border); color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-top: 1rem; }
/* Make profile card visually distinct slightly */
.profile-card { border-color: #333; }

.field { display: grid; gap: 0.35rem; margin-block: 0.75rem; }
label { font-weight: 600; }
input[type="text"], input[type="search"], input[type="email"], textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: #111;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
}
input[type="text"]:focus, input[type="search"]:focus, input[type="email"]:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Tame browser autofill to match dark theme */
input[type="text"]:-webkit-autofill,
input[type="search"]:-webkit-autofill,
input[type="email"]:-webkit-autofill,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #111 inset;
  transition: background-color 9999s ease-in-out 0s;
}
/* Firefox */
input[type="text"]:-moz-autofill,
input[type="search"]:-moz-autofill,
input[type="email"]:-moz-autofill,
textarea:-moz-autofill {
  -moz-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #111 inset;
  caret-color: var(--text);
}
.hint { color: var(--muted); font-size: 0.9rem; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.btn { appearance: none; border: 1px solid var(--border); background: #111; color: var(--text); padding: 0.6rem 0.9rem; border-radius: 10px; cursor: pointer; }
.btn:hover { background: #151515; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn.danger:hover { filter: brightness(1.05); }

.list-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.list-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.list-item { display: grid; gap: 0.25rem; padding: 0.75rem; border: 1px solid var(--border); border-left: 4px solid var(--accent, transparent); border-radius: 10px; background: #121212; }
.no-accents .list-item { border-left-color: transparent !important; }
.item-title { font-weight: 700; }
.item-meta { color: var(--muted); font-size: 0.95rem; }
.item-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }

/* Scan preview */
.scan-preview-wrap { margin-top: 0.5rem; }
.scan-preview-wrap img { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 10px; background: #111; }
#scan-status { margin-top: 0.5rem; }

/* What's New dialog minor spacing */
#whats-new .actions { justify-content: flex-end; }

@media (pointer: coarse) { .btn { padding: 0.8rem 1rem; } }

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
