:root {
  --ink: #12141a;
  --panel: #1c2030;
  --panel-2: #252b3d;
  --line: #343b52;
  --text: #e8e6df;
  --muted: #9aa3b5;
  --amber: #e8a838;
  --amber-dim: #b87a18;
  --mint: #5ec4a0;
  --coral: #e07a5f;
  --warn: #f0c674;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font-brand: "Archivo Black", system-ui, sans-serif;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--ink);
  line-height: 1.45;
}

.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(232, 168, 56, 0.18), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(94, 196, 160, 0.10), transparent 50%),
    linear-gradient(165deg, #0e1016 0%, #171b28 45%, #10131c 100%);
}
.bg::after {
  content: "";
  position: absolute; inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.4rem 1.4rem 0.6rem;
  animation: rise 0.55s ease both;
}
.brand {
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 40px rgba(232, 168, 56, 0.25);
}
.tag {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 28rem;
}
.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.auth-bar { display: flex; align-items: center; gap: 0.6rem; padding-top: 0.3rem; }
.auth-user { display: flex; align-items: center; gap: 0.6rem; }
.auth-email { color: var(--muted); font-size: 0.85rem; }
.ghost.small { padding: 0.45rem 0.8rem; font-size: 0.82rem; }

.auth-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 16, 0.65);
  backdrop-filter: blur(3px);
}
.auth-modal[hidden] { display: none; }
.auth-card {
  position: relative;
  width: min(22rem, 92vw);
  padding: 1.6rem 1.4rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card h3 {
  margin: 0 0 1rem;
  font-family: var(--font-brand);
  color: var(--amber);
}
.auth-x {
  position: absolute; top: 0.6rem; right: 0.7rem;
  background: transparent; border: none; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.auth-x:hover { color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 0.8rem; }
.auth-actions { display: flex; align-items: center; gap: 0.7rem; }

.save-box {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.save-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: end; }

.cartas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 1rem;
}
.field.narrow-lista { flex: 0 0 12rem; }

.modes {
  display: flex;
  gap: 0.35rem;
  margin-top: 1.1rem;
}
.mode {
  font: 600 0.88rem var(--font);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.mode:hover { color: var(--text); border-color: var(--amber-dim); }
.mode.on {
  color: #1a1205;
  background: linear-gradient(180deg, #f0c05a, var(--amber));
  border-color: transparent;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.2rem 1.4rem 3rem;
}

.search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: end;
  padding: 1rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.65s ease 0.05s both;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 7rem;
}
.field.grow { flex: 1 1 14rem; }
.field.narrow { flex: 0 0 5.5rem; }
.field.set-field { flex: 1 1 11rem; position: relative; z-index: 5; }
.set-wrap { position: relative; width: 100%; }
.set-drop {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  background: var(--ink);
  border: 1px solid var(--amber-dim);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 40;
}
.set-drop button {
  display: block;
  width: 100%;
  text-align: left;
  font: 500 0.9rem var(--font);
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}
.set-drop button:last-child { border-bottom: none; }
.set-drop button:hover { background: var(--panel-2); color: var(--amber); }
.set-drop .code { font-family: var(--mono); color: var(--amber); margin-right: 0.45rem; }
.set-drop .name { color: var(--muted); font-size: 0.82rem; }
.field span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.field input, .field select {
  font: 500 1rem var(--font);
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 168, 56, 0.18);
}
.go {
  font-family: var(--font-brand);
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: #1a1205;
  background: linear-gradient(180deg, #f0c05a, var(--amber));
  border: none;
  border-radius: 10px;
  padding: 0.78rem 1.35rem;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
.go:hover { filter: brightness(1.06); transform: translateY(-1px); }
.go:disabled { opacity: 0.55; cursor: wait; transform: none; }

.opts {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin: 0.8rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  animation: rise 0.7s ease 0.1s both;
}
.opts label { display: flex; gap: 0.4rem; align-items: center; cursor: pointer; }

.status {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 1rem;
}
.status.err { color: #ffb4a8; border-color: #6b3a32; background: #2a1816; }
.status.ok { color: var(--mint); }

.versions {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.4s ease both;
}
.versions h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-brand);
  font-size: 1.05rem;
  color: var(--amber);
}
.versions p {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.ver-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ver-btn {
  display: grid;
  grid-template-columns: 7rem 4.5rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  text-align: left;
  font: 500 0.92rem var(--font);
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ver-btn:hover {
  border-color: var(--amber);
  background: var(--panel-2);
}
.ver-btn .code { font-family: var(--mono); color: var(--amber); font-weight: 600; }
.ver-btn .usd { font-family: var(--mono); color: #7eb8ff; }
.ver-btn .meta { color: var(--muted); font-size: 0.82rem; }
.ver-btn .tags { font-size: 0.72rem; color: var(--mint); }
@media (max-width: 640px) {
  .ver-btn { grid-template-columns: 1fr 1fr; }
  .ver-btn .meta { grid-column: 1 / -1; }
}
.vintage {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  animation: rise 0.4s ease both;
}
.vintage strong { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.55rem; }
.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--text);
}
button.chip.btn {
  cursor: pointer;
  font: 600 0.78rem var(--mono);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
button.chip.btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}
button.chip.btn.on {
  background: linear-gradient(180deg, #f0c05a, var(--amber));
  color: #1a1205;
  border-color: transparent;
}

.ident {
  margin-bottom: 1.1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.45s ease both;
}
.ident h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-brand);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.ident .meta { color: var(--muted); font-size: 0.92rem; }
.ident .meta b { color: var(--amber); font-weight: 600; }
.notas {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--muted);
}
.notas li::before { content: "! "; color: var(--amber-dim); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
  animation: rise 0.5s ease both;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 10rem;
  transition: border-color 0.2s, transform 0.2s;
}
.panel:hover { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); transform: translateY(-2px); }
.panel .src {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.panel .price {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--mint);
  line-height: 1.1;
}
.panel .price.usd { color: #7eb8ff; }
.panel .price.muted { color: var(--muted); font-size: 1.1rem; }
.panel .sub {
  font-size: 0.85rem;
  color: var(--muted);
}
.panel .sub + .sub { margin-top: -0.15rem; }
.panel a {
  margin-top: auto;
  color: var(--amber);
  font-size: 0.82rem;
  text-decoration: none;
}
.panel a:hover { text-decoration: underline; }
.panel .empty { color: var(--coral); font-size: 0.9rem; }

.batch-form {
  padding: 1rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
.batch-form textarea {
  font: 500 0.95rem var(--mono);
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  width: 100%;
  resize: vertical;
  min-height: 10rem;
  outline: none;
  line-height: 1.5;
}
.batch-form textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 168, 56, 0.18);
}
.foto-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: end;
  margin-bottom: 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px dashed var(--line);
}
.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-top: 0.85rem;
}
.batch-opts { margin: 0; flex: 1 1 auto; }
.hint {
  margin: 0.75rem 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.ghost {
  font: 600 0.88rem var(--font);
  color: var(--amber);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}
.ghost:hover { border-color: var(--amber); }
.batch-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  animation: rise 0.4s ease both;
}
.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.batch-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.batch-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  vertical-align: top;
}
.batch-table tr:last-child td { border-bottom: none; }
.batch-table tr.ok:hover { background: var(--panel-2); }
.batch-table tr.bad td { color: var(--coral); }
.batch-table tr.need td { color: var(--warn); }
.batch-table .mono { font-family: var(--mono); }
.batch-table .brl { color: var(--mint); font-family: var(--mono); font-weight: 600; }
.batch-table .usd { color: #7eb8ff; font-family: var(--mono); }
.batch-table .tiny {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.batch-table button.pick {
  font: 500 0.78rem var(--mono);
  color: var(--amber);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  margin: 0.15rem 0.25rem 0 0;
  cursor: pointer;
}
.batch-table button.pick:hover { border-color: var(--amber); }

.foot {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.4rem 2rem;
  color: #5c6578;
  font-size: 0.78rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .search { padding: 0.85rem; }
  .go { width: 100%; }
  .field.narrow { flex: 1 1 45%; }
}
