:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #121a2b;
  --surface-2: #172136;
  --ink: #f6f1e8;
  --muted: #aeb8c7;
  --line: rgba(255, 255, 255, 0.14);
  --gold: #f7c667;
  --coral: #f26d5b;
  --aqua: #67d7c4;
  --green: #9ccf6b;
  --violet: #b896ff;
  --danger: #e45252;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: rgba(9, 14, 27, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex;
  justify-content: space-between;
  left: 0;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  background:
    linear-gradient(135deg, var(--coral), var(--gold) 45%, var(--aqua));
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(247, 198, 103, 0.55);
  height: 34px;
  width: 34px;
}

.brand-logo {
  height: 38px;
  max-width: 160px;
  object-fit: contain;
  width: auto;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

nav {
  display: flex;
  gap: clamp(12px, 2vw, 28px);
}

nav a {
  color: var(--muted);
  font-size: 14px;
}

nav a:hover {
  color: var(--ink);
}

.hero {
  align-items: flex-end;
  display: flex;
  min-height: 92vh;
  overflow: hidden;
  padding: 130px clamp(22px, 6vw, 86px) 72px;
  position: relative;
}

.hero-bg {
  background:
    linear-gradient(180deg, rgba(11, 16, 32, 0.22), rgba(11, 16, 32, 0.9)),
    radial-gradient(circle at 18% 42%, rgba(242, 109, 91, 0.35), transparent 22%),
    radial-gradient(circle at 72% 35%, rgba(103, 215, 196, 0.28), transparent 24%),
    url("data:image/svg+xml,%3Csvg width='1600' height='900' viewBox='0 0 1600 900' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1600' height='900' fill='%2309111f'/%3E%3Cg fill='none' stroke='%233e526b' stroke-width='2' opacity='.55'%3E%3Cpath d='M54 456c118-58 210-42 318-20 115 23 226 39 372-12 161-57 269-62 416-12 119 40 217 55 386-19'/%3E%3Cpath d='M128 548c151-28 240-4 342 26 122 36 216 58 371 2 160-58 276-37 410 16 105 41 203 67 324 30'/%3E%3Cpath d='M182 347c111-66 227-92 342-71 155 27 221 116 381 83 149-31 203-129 368-108 93 12 164 55 260 50'/%3E%3Cpath d='M328 690c139-63 266-28 394 9 141 41 236 36 356-33 114-66 216-80 361-46'/%3E%3C/g%3E%3Cg fill='%23f7c667'%3E%3Ccircle cx='346' cy='431' r='4'/%3E%3Ccircle cx='734' cy='411' r='5'/%3E%3Ccircle cx='1027' cy='387' r='4'/%3E%3Ccircle cx='1215' cy='557' r='5'/%3E%3Ccircle cx='544' cy='278' r='3'/%3E%3C/g%3E%3Cg fill='%2367d7c4' opacity='.75'%3E%3Ccircle cx='459' cy='570' r='3'/%3E%3Ccircle cx='892' cy='585' r='4'/%3E%3Ccircle cx='1310' cy='292' r='3'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  inset: 0;
  position: absolute;
  transform: scale(1.02);
}

.hero-copy {
  max-width: 760px;
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(48px, 8vw, 104px);
  line-height: 0.95;
  margin-bottom: 22px;
  max-width: 900px;
}

.hero-copy p:not(.eyebrow) {
  color: #e8edf4;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.5;
  max-width: 690px;
}

.hero-actions,
.form-actions,
.review-actions,
.filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.chip,
.text-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.button {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
}

.button.primary {
  background: var(--gold);
  color: #231608;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.button.danger {
  background: rgba(228, 82, 82, 0.18);
  color: #ffd5d5;
}

.map-section,
.submit-section,
.archive-section,
.admin-section {
  padding: 64px clamp(18px, 4vw, 56px);
}

.admin-page {
  padding-top: 92px;
}

.admin-intro {
  color: var(--muted);
  line-height: 1.5;
  max-width: 680px;
}

.map-toolbar,
.section-heading,
.admin-layout {
  margin: 0 auto 22px;
  max-width: 1280px;
}

.map-toolbar {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

h2 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
  margin-bottom: 8px;
}

.map-toolbar p,
.section-heading p:not(.eyebrow) {
  color: var(--muted);
}

.chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  min-height: 38px;
  padding: 0 14px;
}

.chip.active {
  background: rgba(247, 198, 103, 0.18);
  border-color: rgba(247, 198, 103, 0.55);
  color: var(--ink);
}

.map-shell {
  aspect-ratio: 1400 / 760;
  background: linear-gradient(180deg, #101a2a, #07101e);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  margin: 0 auto;
  max-width: 1280px;
  overflow: hidden;
  position: relative;
}

#worldMap {
  display: block;
  height: 100%;
  touch-action: none;
  width: 100%;
}

.map-controls {
  display: grid;
  gap: 8px;
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 4;
}

.map-control {
  background: rgba(10, 15, 26, 0.82);
  border: 1px solid var(--line);
  position: static;
}

.map-control.reset {
  border-radius: 999px;
  font-size: 12px;
  width: 46px;
}

.map-hint {
  background: rgba(10, 15, 26, 0.76);
  border: 1px solid var(--line);
  border-radius: 999px;
  bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  left: 16px;
  padding: 9px 13px;
  position: absolute;
}

.story-panel {
  background: rgba(13, 19, 31, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-rows: 220px 1fr;
  max-height: calc(100vh - 44px);
  max-width: 420px;
  overflow-y: auto;
  position: fixed;
  right: 22px;
  top: 92px;
  width: min(420px, calc(100vw - 44px));
  z-index: 40;
}

.story-panel.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.story-panel > img {
  height: 220px;
  object-fit: cover;
  width: 100%;
}

.icon-button {
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 900;
  height: 34px;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  z-index: 8;
}

.story-body {
  padding: 18px;
}

.emotion {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  padding: 6px 10px;
  text-transform: uppercase;
}

.emotion.nostalgia {
  background: rgba(242, 109, 91, 0.18);
  color: #ffb3aa;
}

.emotion.pertenencia {
  background: rgba(156, 207, 107, 0.18);
  color: #c8ee9f;
}

.emotion.asombro {
  background: rgba(103, 215, 196, 0.18);
  color: #a9f4ea;
}

.emotion.futuro {
  background: rgba(184, 150, 255, 0.2);
  color: #d9c8ff;
}

blockquote {
  border-left: 3px solid var(--gold);
  color: #eef4fb;
  line-height: 1.55;
  margin: 18px 0;
  padding-left: 14px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
}

.trace-form {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 980px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
}

input,
select,
textarea {
  background: #0e1728;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 46px;
  padding: 11px 12px;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.file-drop {
  align-items: center;
  border: 1px dashed rgba(247, 198, 103, 0.55);
  border-radius: 8px;
  justify-items: center;
  min-height: 134px;
  padding: 20px;
  text-align: center;
}

.file-drop input {
  inline-size: min(100%, 330px);
}

.file-drop span {
  color: var(--ink);
  font-size: 18px;
}

.file-drop small,
.consent span,
#formStatus {
  color: var(--muted);
}

.consent {
  align-items: start;
  display: flex;
  gap: 10px;
}

.consent input {
  min-height: auto;
  margin-top: 4px;
}

.archive-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1280px;
}

.trace-card,
.review-item,
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trace-card {
  overflow: hidden;
}

.trace-card img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}

.trace-card div {
  padding: 16px;
}

.trace-card p,
.review-item p {
  color: var(--muted);
  line-height: 1.5;
}

.text-button {
  background: transparent;
  color: var(--gold);
  font-weight: 800;
  padding: 0;
}

.admin-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 220px 1fr;
}

.admin-login {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 420px) auto 1fr;
  margin: 0 auto 18px;
  max-width: 1280px;
}

.admin-login p {
  color: var(--muted);
  margin: 0;
}

.metric {
  align-content: center;
  display: grid;
  min-height: 150px;
  padding: 24px;
  text-align: center;
}

.metric strong {
  color: var(--gold);
  font-size: 58px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
}

.metric .text-button {
  margin-top: 18px;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 120px 1fr auto;
  padding: 12px;
}

.review-item img {
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  width: 120px;
}

.review-item h3 {
  margin-bottom: 5px;
}

.review-item small {
  color: var(--muted);
}

.status-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
  padding: 5px 9px;
  text-transform: uppercase;
}

.status-badge.pending {
  background: rgba(247, 198, 103, 0.16);
  color: var(--gold);
}

.status-badge.approved {
  background: rgba(156, 207, 107, 0.18);
  color: #c8ee9f;
}

.edit-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.edit-form label {
  font-size: 12px;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
  min-height: 40px;
}

.empty-state {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #080d18;
  padding: 24px clamp(18px, 4vw, 56px);
}

.footer-inner {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1280px;
}

.footer-inner p {
  color: var(--muted);
  margin: 0;
}

.footer-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-logo-link {
  align-items: center;
  display: inline-flex;
  min-height: 38px;
}

.footer-logo {
  max-height: 36px;
  max-width: 150px;
  object-fit: contain;
}

.footer-logo-fallback {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 8px 12px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    position: absolute;
  }

  nav {
    overflow-x: auto;
    padding-bottom: 4px;
    width: 100%;
  }

  .map-toolbar,
  .admin-layout {
    display: grid;
  }

  .story-panel {
    bottom: 12px;
    grid-template-rows: 150px 1fr;
    left: 12px;
    max-height: min(78vh, 560px);
    max-width: none;
    right: 12px;
    top: auto;
    width: auto;
  }

  .story-panel > img {
    height: 150px;
  }

  .trace-form,
  .archive-grid,
  .admin-layout,
  .admin-login {
    grid-template-columns: 1fr;
  }

  .review-item {
    grid-template-columns: 92px 1fr;
  }

  .review-item img {
    width: 92px;
  }

  .review-actions {
    grid-column: 1 / -1;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: 86vh;
    padding-top: 180px;
  }

  h1 {
    font-size: 44px;
  }

  .map-section,
  .submit-section,
  .archive-section,
  .admin-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .map-hint {
    display: none;
  }

  .button {
    width: 100%;
  }
}
