:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #121212;
  --panel: #1c1c1f;
  --border: #333336;
  --text: #f5f5f5;
  --muted: #a3a3a8;
  --accent: #ff7a1a;
  --marker: #ffb020;
  --marker-active: #ff7a1a;
  --link-marker: #4d7cff;
  --ok: #22c55e;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

/* Elements like .card-form set their own `display`, which — at equal
   specificity — beats the browser's default [hidden] { display: none }
   since author rules win over the user-agent stylesheet. Without this,
   toggling the `hidden` attribute on a flex/grid element silently does
   nothing, e.g. the login/signup form tabs. */
[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

a:visited {
  color: var(--accent);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  padding: 20px 16px 40px;
}

.app-header {
  max-width: 1100px;
  margin: 0 auto 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.atlas {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 760px) {
  .atlas {
    grid-template-columns: 1fr;
  }
}

.photo-frame {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  line-height: 0;
}

.photo-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.hotspot {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--marker);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}

.hotspot:hover,
.hotspot:focus-visible {
  transform: scale(1.15);
}

.hotspot.active {
  background: var(--marker-active);
  transform: scale(1.2);
}

.hotspot.pending {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
  pointer-events: none;
}

.hotspot.link {
  background: var(--link-marker);
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  font-size: 0.9rem;
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.hotspot.search-hit {
  animation: search-pulse 1.8s ease-in-out;
}

@keyframes search-pulse {
  0% { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35); transform: scale(1); }
  30% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0.4); transform: scale(1.35); }
  100% { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35); transform: scale(1); }
}

.flag-control {
  margin-top: 10px;
}

.flag-control textarea {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin: 4px 0 8px;
}

.videos-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.videos-section h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.video-item {
  margin-bottom: 14px;
}

.video-item p {
  margin: 0 0 6px;
  font-size: 0.85rem;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.mode-toggle button {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.mode-toggle button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.notes-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.notes-section h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
}

.notes-disclaimer {
  color: var(--muted);
  font-size: 0.72rem;
  margin: 0 0 10px;
  line-height: 1.4;
}

.note-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.note-item p {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.basis-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: auto;
}

.note-author {
  color: var(--muted);
  font-size: 0.75rem;
}

.vote-btn {
  font-size: 0.72rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
}

.vote-btn.confirm.active {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.vote-btn.dispute.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.25); }
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.suggestions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.suggestion-item {
  text-align: left;
  border: none;
  border-radius: 0;
  background: var(--panel);
  padding: 6px 8px;
  font-size: 0.85rem;
}

.suggestion-item:hover {
  background: var(--bg);
}

.suggestion-item span {
  color: var(--muted);
  font-size: 0.75rem;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.card h3 {
  margin: 20px 0 8px;
  font-size: 1rem;
}

.legal-content p,
.legal-content ul {
  line-height: 1.5;
  margin: 0 0 10px;
}

.legal-content ul {
  padding-left: 20px;
}

.legal-content li {
  margin-bottom: 6px;
}

.page > section > h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.gallery-card img,
.gallery-card-placeholder {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.gallery-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--bg);
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-tab {
  border-radius: 999px;
}

.view-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -4px 0 0;
}

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-list a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.match-list a:hover {
  border-color: var(--accent);
}

select {
  font: inherit;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.gallery-card-body {
  padding: 10px 12px;
}

.gallery-card-title {
  font-weight: 600;
}

.gallery-card-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.info-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 160px;
}

.info-placeholder {
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.info-panel h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.info-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 6px 12px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.card-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-form h2 {
  margin: 0;
}

.card-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  position: relative;
}

.card-form input,
.card-form textarea {
  font: inherit;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row label {
  flex: 1;
  min-width: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-error {
  color: #dc2626;
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.disclaimer {
  max-width: 1100px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 4px;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.activity-feed li {
  font-size: 0.9rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.activity-feed li:last-child {
  border-bottom: none;
}

.activity-feed a {
  color: var(--accent);
  text-decoration: none;
}

.activity-label {
  font-weight: 600;
}

.activity-time {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 4px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-nav {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

#lang-switcher {
  font-size: 0.8rem;
  padding: 4px 6px;
}

.community-nav-link {
  font-size: 0.85rem;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  cursor: default;
}

.chat-messages {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.chat-message {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-author {
  font-weight: 600;
  text-decoration: none;
}

.chat-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.chat-message-head .chat-delete {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
}

.chat-text {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  font: inherit;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}

.auth-nav button.ghost {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.gallery-card-author {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 4px;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.mode-tab {
  flex: 1;
  border-radius: 999px;
}

.mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  text-transform: none;
  font-size: 0.95rem;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-tile {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

.browse-atlas-link {
  font-weight: 700;
  font-size: 1.375rem;
}

@media (max-width: 420px) {
  .browse-atlas-link {
    font-size: 1.05rem;
  }
}
