:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --accent: #e08a3e;
  --accent-dark: #c56f27;
  --text: #33302b;
  --muted: #7a7368;
  --border: #e6e0d6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.nav-search input {
  padding: 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.85rem; width: 160px; background: var(--bg);
}
.search-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.search-form input { flex: 1; margin: 0; }

.logout-form button {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.4rem 0.8rem; cursor: pointer; color: var(--muted);
}

.ticker-wrap {
  background: var(--card); border-bottom: 1px solid var(--border);
  overflow: hidden; white-space: nowrap; padding: 0.5rem 0;
}
.ticker-track {
  display: inline-flex; width: max-content;
  animation: ticker-scroll 40s linear infinite;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-block; padding: 0 2rem; font-size: 0.86rem; color: var(--muted);
}
.ticker-item strong { color: var(--text); }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-wrap { overflow-x: auto; }
}

.page { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: var(--card); border-radius: 12px; padding: 2rem;
  width: 100%; max-width: 360px; box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.auth-card h1 { margin: 0 0 0.25rem; }
.tagline { color: var(--muted); margin-top: 0; margin-bottom: 1.5rem; }
.switch { margin-top: 1rem; text-align: center; color: var(--muted); }

.card {
  background: var(--card); border-radius: 12px; padding: 1.25rem;
  margin-bottom: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

form label {
  display: block; margin-bottom: 1rem; font-size: 0.9rem; color: var(--muted);
}
form input, form select, form textarea {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.55rem;
  border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; font-family: inherit;
}
form button {
  background: var(--accent); color: white; border: none; border-radius: 8px;
  padding: 0.6rem 1.2rem; font-size: 1rem; cursor: pointer;
}
form button:hover { background: var(--accent-dark); }
.error { color: #b23b3b; }

.danger-zone { border: 1px solid rgba(224, 86, 122, 0.4); }
.danger-zone h2 { margin-top: 0; color: #b23b3b; }
.danger-button {
  background: #b23b3b; color: white; border: none; border-radius: 8px;
  padding: 0.6rem 1.2rem; font-size: 1rem; cursor: pointer;
}
.danger-button:hover { background: #8f2e2e; }

.link-button {
  background: none; border: none; color: var(--accent-dark);
  padding: 0; font-size: inherit; font-weight: inherit; cursor: pointer; text-decoration: none;
}
.link-button:hover { text-decoration: underline; background: none; }
.danger-link { color: #b23b3b; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; }
.checkbox-label input { display: inline; width: auto; margin: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.85em; }
.checkbox-list {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin-top: 0.35rem; padding: 0.6rem;
  border: 1px solid var(--border); border-radius: 8px;
  max-height: 180px; overflow-y: auto;
}
.checkbox-list .checkbox-label { font-size: 0.92rem; color: var(--text); }
form h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

.list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.list-header h1 { margin: 0; font-size: 1.4rem; }
.new-animal-btn {
  background: var(--accent); color: white; border-radius: 8px;
  padding: 0.5rem 1rem; font-weight: 700; font-size: 0.92rem;
}
.new-animal-btn:hover { background: var(--accent-dark); text-decoration: none; }

.animal-list-item {
  display: flex; align-items: center; gap: 0.9rem;
  color: var(--text); transition: box-shadow .15s ease;
}
.animal-list-item:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.animal-list-item img.post-avatar { width: 48px; height: 48px; }
.animal-list-item strong { font-size: 1.05rem; }

.form-photo-preview {
  width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
  margin-top: 0.35rem; border: 2px solid var(--border);
}

.photo-position-frame {
  width: 180px; height: 180px; border-radius: 50%;
  overflow: hidden; position: relative;
  margin-top: 0.5rem; background: var(--bg);
  border: 2px solid var(--border);
  cursor: grab; touch-action: none;
  box-shadow: 0 0 0 4px rgba(224, 138, 62, 0.12);
}
.photo-position-frame.dragging { cursor: grabbing; }
.photo-position-frame img {
  width: 100%; height: 100%; object-fit: cover;
  user-select: none; pointer-events: none;
}

.post-form textarea { margin-bottom: 0.5rem; }
.post-form select { margin-bottom: 0.5rem; }
.inline-form {
  display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; flex-wrap: wrap;
}
.inline-form select { width: auto; margin: 0; }
.inline-form input[type=text] { flex: 1; margin: 0; }
.inline-form button { padding: 0.4rem 0.8rem; font-size: 0.9rem; }

.profile-header { display: flex; gap: 1.25rem; align-items: flex-start; }
.profile-photo {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--border); background: #fff;
}
.meta { color: var(--muted); margin: 0.2rem 0; font-size: 0.95rem; }
.bio { margin-top: 0.75rem; }

.post-author { display: flex; align-items: center; gap: 0.6rem; }
.post-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.post-content { margin: 0.6rem 0; }
.post-photo { width: 100%; border-radius: 8px; margin-bottom: 0.5rem; }
.post-stats { color: var(--muted); font-size: 0.9rem; }

.empty { text-align: center; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted); font-size: 0.84rem;
  margin-top: 2rem;
}
.footer-inner {
  width: min(640px, calc(100% - 2rem)); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.8rem;
}
.footer-links { display: flex; gap: 1.1rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem;
  border-radius: 999px; background: #e0567a; color: white;
  font-size: 0.72rem; font-weight: 700; line-height: 1;
}

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; cursor: zoom-out; padding: 2rem;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 90vw; max-height: 90vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
[data-lightbox] { cursor: zoom-in; }

.suggestion-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item .suggestion-info { flex: 1; }
.suggestion-item .suggestion-info strong { display: block; }
.suggestion-item .inline-form { margin-top: 0; }
a.suggestion-item { color: var(--text); }
a.suggestion-item:hover { text-decoration: none; }
a.suggestion-item:hover strong { text-decoration: underline; }
