:root {
  --bg: #f4f1eb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #657084;
  --line: #dce1e8;
  --soft: #f7f8fa;
  --brand: #116b63;
  --brand-dark: #0b514b;
  --accent: #d86245;
  --gold: #b7862f;
  --shadow: 0 16px 44px rgba(23, 32, 51, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.hero { background: var(--ink); color: #fff; }
.hero-inner { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 38px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.eyebrow, .section-kicker, .dialog-kicker { margin: 0 0 8px; color: #8fd3ca; font-size: .78rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 5.2rem); line-height: .94; letter-spacing: -.045em; }
.hero-copy { max-width: 690px; margin: 18px 0 0; color: #d7dce5; font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.55; }
.catalog-status { flex: 0 0 auto; min-width: 155px; padding: 16px 18px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; background: rgba(255,255,255,.07); }
.catalog-status strong { display: block; font-size: 1.8rem; line-height: 1; }
.catalog-status span, .catalog-status small { display: block; margin-top: 5px; color: #d7dce5; font-size: .78rem; }
.catalog-status small { color: #9ba6b9; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.finder { margin-top: -14px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.finder-heading, .results-toolbar { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.finder-heading h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); }
.section-kicker { color: var(--brand); }
.text-button { padding: 8px 0; border: 0; background: none; color: var(--brand); cursor: pointer; font-weight: 850; }
.text-button:hover { color: var(--brand-dark); text-decoration: underline; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 26px; }
.quick-group, .filter-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.quick-group legend, .filter-group legend { width: 100%; margin-bottom: 10px; color: var(--ink); font-weight: 900; }
.quick-group legend > span { display: inline-grid; place-items: center; width: 25px; height: 25px; margin-right: 6px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .75rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice, .secondary-button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); cursor: pointer; font-weight: 800; }
.choice:hover, .secondary-button:hover { border-color: #b4bdca; background: #fff; }
.choice.active { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(17,107,99,.18); }

.mood-group { margin-top: 22px; }
.mood-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 9px; }
.mood { min-height: 84px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; text-align: left; }
.mood strong, .mood small { display: block; }
.mood strong { font-size: .92rem; }
.mood small { margin-top: 5px; color: var(--muted); font-size: .73rem; line-height: 1.3; }
.mood:hover { border-color: #aeb8c7; background: var(--soft); }
.mood.active { border-color: var(--brand); background: #e9f5f3; box-shadow: inset 0 0 0 1px var(--brand); }
.mood.active strong { color: var(--brand-dark); }

.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.search-box input { width: 100%; min-height: 48px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.search-box input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(17,107,99,.18); outline-offset: 2px; }
.secondary-button { min-height: 48px; background: #fff; }

.advanced { margin-top: 18px; padding: 18px; border-radius: 14px; background: #f7f8fa; }
.advanced-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: .79rem; font-weight: 850; }
.field select, .sort select { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.filter-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.filter-group legend small { margin-left: 6px; color: var(--muted); font-weight: 500; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 12px; }
.check-grid label { display: flex; align-items: center; gap: 7px; min-height: 30px; font-size: .88rem; }
.check-grid input { width: 16px; height: 16px; accent-color: var(--brand); }

.results-section { padding: 30px 0 52px; }
.results-toolbar { align-items: end; margin-bottom: 16px; }
.result-count { margin: 0; font-size: 1.22rem; font-weight: 900; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.active-filters:empty { display: none; }
.active-filters span { padding: 5px 9px; border-radius: 999px; background: #e4e9ef; color: #4f5a6c; font-size: .73rem; font-weight: 800; }
.sort { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; font-weight: 850; }
.sort select { width: 175px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 16px; }

.game-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 8px 24px rgba(23,32,51,.055); transition: transform .18s ease, box-shadow .18s ease; }
.game-card:hover { transform: translateY(-2px); box-shadow: 0 13px 30px rgba(23,32,51,.10); }
.card-hitbox { position: absolute; inset: 0; z-index: 3; border: 0; background: transparent; cursor: pointer; }
.cover, .dialog-cover { display: grid; place-items: center; overflow: hidden; background: #eceff3; }
.cover { height: 190px; padding: 14px; }
.cover img, .dialog-cover img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.cover-title { max-width: 14ch; color: var(--ink); font-size: 1.35rem; font-weight: 950; text-align: center; }
.card-body { display: grid; gap: 10px; padding: 14px; }
.match-reason { margin: -2px 0 0; color: var(--brand); font-size: .76rem; font-weight: 900; }
.game-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.2; overflow-wrap: anywhere; }
.card-stats { display: flex; flex-wrap: wrap; gap: 5px 10px; color: var(--muted); font-size: .74rem; }
.card-stats strong { color: var(--ink); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 5px 7px; border-radius: 999px; background: #eaf4f2; color: var(--brand-dark); font-size: .7rem; font-weight: 850; }
.summary { min-height: 36px; margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.card-bottom { display: flex; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid #edf0f4; color: var(--muted); font-size: .72rem; font-weight: 800; }
.card-bottom span:last-child { color: var(--brand); }

.empty { padding: 58px 20px; border: 1px dashed #c6ccd5; border-radius: 16px; background: rgba(255,255,255,.55); text-align: center; }
.empty h2 { margin: 0; }
.empty p { margin: 8px 0 18px; color: var(--muted); }

.footer { width: min(1180px, calc(100% - 32px)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 0 36px; border-top: 1px solid #d5d9df; color: var(--muted); font-size: .82rem; }
.footer > div span { margin-left: 7px; }
.footer a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 800; }
.bgg-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #ff5100; color: #fff; font-size: .72rem; font-weight: 950; }

.game-dialog { width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; overflow: auto; box-shadow: 0 28px 100px rgba(0,0,0,.35); }
.game-dialog::backdrop { background: rgba(15,20,31,.65); backdrop-filter: blur(2px); }
.dialog-close { position: fixed; z-index: 5; width: 40px; height: 40px; margin: 12px 0 0 -52px; border: 0; border-radius: 50%; background: rgba(255,255,255,.95); cursor: pointer; font-size: 1.3rem; font-weight: 900; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.dialog-layout { display: grid; grid-template-columns: minmax(250px, 330px) 1fr; min-height: 500px; }
.dialog-cover { padding: 28px; background: #eef1f4; }
.dialog-info { display: grid; align-content: start; gap: 15px; padding: 30px; }
.dialog-kicker { color: var(--brand); margin-bottom: -7px; }
.dialog-info h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1; letter-spacing: -.025em; }
.dialog-summary { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.dialog-stats div { padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.dialog-stats strong, .dialog-stats span { display: block; }
.dialog-stats strong { font-size: .9rem; }
.dialog-stats span { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.info-block strong { font-size: .82rem; }
.info-block p, .bgg-description p { margin: 5px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.bgg-description { padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bgg-description summary { cursor: pointer; color: var(--muted); font-size: .82rem; font-weight: 800; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 15px; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 900; text-decoration: none; }
.primary-button:hover { background: var(--brand-dark); }

@media (max-width: 980px) {
  .mood-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 720px) {
  .hero-inner { align-items: start; flex-direction: column; padding-top: 34px; }
  .catalog-status { min-width: 0; width: 100%; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; }
  .catalog-status small { grid-column: 1 / -1; }
  .finder { padding: 18px; }
  .quick-grid, .advanced-grid, .filter-columns { grid-template-columns: 1fr; }
  .mood-grid { grid-template-columns: repeat(2, 1fr); }
  .search-row { grid-template-columns: 1fr; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .sort { justify-content: space-between; width: 100%; }
  .sort select { width: 58%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cover { height: 155px; padding: 10px; }
  .card-body { padding: 11px; gap: 8px; }
  .card-stats { display: grid; gap: 2px; }
  .summary { display: none; }
  .dialog-layout { grid-template-columns: 1fr; }
  .dialog-cover { height: 260px; padding: 20px; }
  .dialog-info { padding: 22px; }
  .dialog-close { position: fixed; right: 24px; top: 24px; margin: 0; }
  .dialog-stats { grid-template-columns: repeat(2, 1fr); }
  .footer { align-items: start; flex-direction: column; }
}

@media (max-width: 420px) {
  main, .hero-inner, .footer { width: min(100% - 20px, 1180px); }
  .finder { padding: 14px; border-radius: 14px; }
  .finder-heading { align-items: center; }
  .choice-row { gap: 6px; }
  .choice { min-height: 40px; padding: 0 11px; }
  .mood-grid { gap: 7px; }
  .mood { min-height: 76px; padding: 10px; }
  .grid { gap: 8px; }
  .game-card { border-radius: 13px; }
  .cover { height: 135px; }
  .game-card h3 { font-size: .96rem; }
  .tag { font-size: .64rem; }
  .card-bottom { font-size: .66rem; }
}

/* Administración privada */
.admin-page { min-height: 100dvh; background: var(--ink); }
.admin-shell { width: min(620px, calc(100% - 28px)); margin: 0 auto; padding: 48px 0; }
.admin-back { display: inline-block; margin-bottom: 18px; color: #cdd4df; font-weight: 800; text-decoration: none; }
.admin-card { padding: clamp(22px, 5vw, 38px); border-radius: 20px; background: #fff; box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.admin-card h1 { color: var(--ink); font-size: clamp(2rem, 7vw, 3.2rem); }
.admin-intro { color: var(--muted); line-height: 1.6; }
.admin-current { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0; }
.admin-current div { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.admin-current strong, .admin-current span { display: block; }
.admin-current strong { font-size: 1.25rem; }
.admin-current span { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.admin-form { display: grid; gap: 13px; }
.admin-form input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.admin-update { border: 0; cursor: pointer; }
.admin-update:disabled { opacity: .65; cursor: wait; }
.admin-message { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: #eef1f5; color: var(--ink); font-size: .88rem; line-height: 1.45; }
.admin-message.success { background: #e6f4ef; color: #0d5b45; }
.admin-message.error { background: #fae9e6; color: #8a3829; }
.admin-note { margin: 16px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
@media (max-width: 520px) { .admin-current { grid-template-columns: 1fr; } }
