:root {
  --bg: #0b0b0b;
  --surface: #171514;
  --line: #2c2826;
  --text: #f6f1ec;
  --muted: #b3aaa2;
  --accent: #ff9152;
  --danger: #ff8080;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
header { padding-top: 28px; padding-bottom: 20px; text-align: center; }
header img { display: block; width: 112px; height: 112px; margin: 0 auto 14px; border-radius: 12px; }
h1 { margin: 0 0 8px; font-size: 1.75rem; line-height: 1.2; color: var(--accent); }
.welcome { margin: 0 auto; max-width: 46ch; color: var(--muted); }

button, .button {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.primary { border-color: var(--accent); background: var(--accent); color: #1a0d05; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, .button:focus-visible, input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.link { min-height: 44px; border: 0; background: none; color: var(--muted); font-weight: 400; text-decoration: underline; }

input:not([type=file]), textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming in on focus */
}
textarea { resize: vertical; }
input::placeholder { color: var(--muted); }

.search {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.admin-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.admin-bar button { flex: 1 1 auto; }
.suggest-open { margin-top: 14px; }
.count { margin: 8px 0 0; font-size: .875rem; color: var(--muted); }

ol { margin: 0; padding: 0; list-style: none; }
#list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 400;
  text-align: left;
}
.row-text { min-width: 0; overflow-wrap: anywhere; }
.name { display: block; font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
.note { display: block; margin: 3px 0 0; font-size: .9rem; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.row-actions button { min-height: 38px; padding: 4px 12px; font-size: .875rem; }

.thumb {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .8);
  color: var(--text);
  font-size: .75rem;
}
.empty, .message { padding: 32px 0; text-align: center; color: var(--muted); }
footer { padding-top: 24px; padding-bottom: max(16px, env(safe-area-inset-bottom)); text-align: center; font-size: .875rem; color: var(--muted); }
footer p { margin: 0; }

dialog {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .75); }
h3 { margin: 0 0 14px; font-size: 1.25rem; color: var(--accent); }
label:not(.button), .label { display: block; margin: 12px 0 4px; font-size: .9rem; font-weight: 600; }
.hint { margin: 4px 0 0; font-size: .8rem; color: var(--muted); text-align: right; }
.error { margin: 12px 0 0; color: var(--danger); font-size: .9rem; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 8px; }
.photo-grid:empty { display: none; }
.photo-tile { position: relative; aspect-ratio: 1; }
.photo-tile img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-tile button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-height: 32px;
  width: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, .8);
}
#photo-input:focus-visible ~ .hint { color: var(--accent); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.close { position: absolute; top: 8px; right: 8px; z-index: 1; width: 44px; padding: 0; font-size: 1.4rem; background: rgba(0, 0, 0, .8); }
.strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 8px; }
.strip img {
  flex: 0 0 100%;
  width: 100%;
  max-height: 40dvh;
  object-fit: contain;
  scroll-snap-align: center;
}
.photo-hint { margin: 6px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }
.photo-hint:empty { display: none; }
#dram h3 { margin: 12px 44px 0 0; }
#dram .note { margin-bottom: 14px; }
.wide { width: 100%; margin-top: 14px; }
.status { margin: 12px 0 0; }
.status:empty { display: none; }
.ratings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ratings button { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: .85rem; line-height: 1.2; }
.ratings span { font-size: 1.5rem; }
.ratings [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

#log h3, #members h3 { margin-right: 44px; }
.people { margin: 8px 0 0; padding: 0; list-style: none; }
.people:empty { display: none; }
.people li { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.people li:last-child { border-bottom: 0; }
.people .name { font-size: .95rem; }
.empty-note { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }

@media (min-width: 600px) {
  .thumb { width: 120px; height: 120px; }
  .name { font-size: 1.125rem; }
}
/* Stays reachable when a long list of names scrolls the pop-up. */
#dram .close, #suggestions .close, #log .close, #members .close { position: sticky; top: 0; float: right; margin: 0 0 -44px; }

.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; border: 0; }
.types legend { padding: 0; margin: 0 0 4px; }
label.type-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem;
  cursor: pointer;
}
.type-option input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.type-option:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.type-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.suggestion-text { display: block; margin: 4px 0; }
.suggestion-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggestion-photos img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
#suggestions h3 { margin-right: 44px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 2;
  transform: translateX(-50%);
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  white-space: nowrap;
}
