/* OpenTCG — sistema visual (derivado del rediseño del PC, estilo cardcluster) */
@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --sunk: #e9edf3;
  --border: #dfe3ea;
  --text: #171b23;
  --body: #333b47;
  --muted: #56606f;
  --faint: #78818f;
  --accent: #3b5bda;
  --accent-deep: #2f49bd;
  --accent-wash: #e8ecfb;
  --green: #2f9e44;
  --red: #d64562;
  --gold: #9a5b18;
  --shadow: 0 1px 2px rgba(23, 27, 35, .04), 0 6px 20px rgba(23, 27, 35, .06);
  --font: "Archivo", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1219; --surface: #181c25; --surface-2: #1e2430; --sunk: #12151d;
    --border: #2a3140; --text: #e7eaf1; --body: #c2c8d4; --muted: #97a0b0; --faint: #6f7888;
    --accent: #6f8bff; --accent-deep: #8aa0ff; --accent-wash: #1e2740;
    --green: #58b568; --red: #f0788f; --gold: #e6b45b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1219; --surface: #181c25; --surface-2: #1e2430; --sunk: #12151d;
  --border: #2a3140; --text: #e7eaf1; --body: #c2c8d4; --muted: #97a0b0; --faint: #6f7888;
  --accent: #6f8bff; --accent-deep: #8aa0ff; --accent-wash: #1e2740;
  --green: #58b568; --red: #f0788f; --gold: #e6b45b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
small { color: var(--faint); }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ---------- barra superior ---------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text);
  font-size: 1.05rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.glyph { width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(140deg, var(--accent), #9b6cff); }
.topnav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.topnav a, .topnav button {
  color: var(--muted); font: inherit; font-size: .92rem; padding: 7px 12px;
  border-radius: 8px; border: 0; background: transparent; cursor: pointer;
}
.topnav a:hover, .topnav button:hover { background: var(--sunk); color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--accent); background: var(--accent-wash); }

/* ---------- contenido ---------- */
main.wrap { padding-top: 30px; padding-bottom: 80px; }
.sub { color: var(--muted); margin-top: -.2em; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .label { font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 1.7rem; font-weight: 700; color: var(--text); font-family: var(--font); }
.stat .value.accent { color: var(--accent); }
.stat .value.green { color: var(--green); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: .72rem; padding: 3px 8px; border-radius: 6px;
  background: var(--sunk); color: var(--muted); border: 1px solid var(--border);
}

/* ---------- botones / formularios ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--sunk); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 7px; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent-wash); border-color: var(--accent); }
form.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
form.inline label { margin: 0; }
form.inline > div { flex: 1; min-width: 160px; }

.notice { padding: 10px 14px; border-radius: 9px; font-size: .9rem; margin-bottom: 16px; }
.notice.err { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--border)); }
.notice.ok { background: color-mix(in srgb, var(--green) 12%, var(--surface)); color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--border)); }

/* ---------- listas de amigos ---------- */
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.row-item:last-child { border-bottom: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem;
}
.row-item .who { flex: 1; min-width: 0; }
.row-item .who b { color: var(--text); }
.share-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle {
  display: inline-flex; align-items: center; gap: 5px; font-size: .78rem;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.toggle.on { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.toggle input { display: none; }

/* ---------- rejilla de cartas ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0; }
.toolbar input[type=text] { max-width: 280px; }
.toolbar select { max-width: 170px; }
.cardgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px;
}
.cardgrid figure { margin: 0; position: relative; }
.cardgrid img {
  width: 100%; aspect-ratio: 59 / 86; object-fit: cover; border-radius: 8px;
  background: var(--sunk); border: 1px solid var(--border); display: block;
}
.cardgrid figcaption { font-size: .74rem; color: var(--muted); margin-top: 5px; line-height: 1.3; }
.cardgrid .qty {
  position: absolute; top: 6px; right: 6px; background: rgba(8, 10, 14, .82); color: #fff;
  font-family: var(--mono); font-size: .72rem; font-weight: 700; padding: 2px 6px; border-radius: 6px;
}
.cardgrid .px { color: var(--green); font-family: var(--mono); }
.empty { text-align: center; color: var(--faint); padding: 60px 0; }

.landing { text-align: center; padding: 70px 0 30px; }
.landing .glyph { width: 46px; height: 46px; margin: 0 auto 18px; border-radius: 12px; }
.landing h1 { font-size: 2.3rem; }
.landing .cta { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.auth-box { max-width: 400px; margin: 40px auto; }
