/* ============================================================
   Dungeon Master — web oficial · tema fantasía oscura
   ============================================================ */
:root {
    --bg: #14100c;
    --bg-soft: #1b150f;
    --panel: rgba(255, 255, 255, 0.045);
    --panel-2: rgba(255, 255, 255, 0.07);
    --border: rgba(216, 178, 90, 0.18);
    --border-strong: rgba(216, 178, 90, 0.4);
    --text: #ece3d2;
    --muted: #a99a82;
    --gold: #e6c068;
    --ember: #e2752e;
    --purple: #8a6bd1;
    --grad: linear-gradient(135deg, var(--gold), var(--ember));
    --radius: 16px;
    --maxw: 1180px;
    --nav-h: 64px;
    --shadow: 0 22px 50px -24px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* asegura que el atributo hidden oculte (modal, cartas filtradas) */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 14px); }
body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: '';
    position: fixed; inset: 0; z-index: -1;
    background:
        radial-gradient(55vw 55vw at 85% -10%, rgba(226, 117, 46, 0.13), transparent 60%),
        radial-gradient(50vw 50vw at -10% 30%, rgba(138, 107, 209, 0.12), transparent 60%),
        var(--bg);
}
h1, h2, h3, .dm-brand span { font-family: 'Cinzel', serif; line-height: 1.12; letter-spacing: 0.5px; }
a { color: var(--gold); text-decoration: none; }
.ember { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Buttons ---------- */
.dm-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 999px; font-weight: 700; font-size: 0.95rem; border: 1px solid transparent; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s, background .2s; }
.dm-btn-primary { background: var(--grad); color: #1c1206; box-shadow: 0 12px 28px -12px rgba(226, 117, 46, .75); }
.dm-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -14px rgba(226, 117, 46, .9); }
.dm-btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border-strong); }
.dm-btn-ghost:hover { transform: translateY(-2px); border-color: var(--gold); }

/* ---------- Navbar ---------- */
.dm-nav { position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 1000; display: flex; align-items: center; gap: 16px; padding: 0 clamp(16px, 4vw, 36px); background: rgba(20, 16, 12, .8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.dm-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); margin-right: auto; }
.dm-brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dm-nav-links { display: flex; gap: 4px; }
.dm-nav-links a { color: var(--muted); font-weight: 500; padding: 8px 14px; border-radius: 10px; transition: color .2s, background .2s; }
.dm-nav-links a:hover, .dm-nav-links a.active { color: var(--text); background: var(--panel); }
.dm-back { color: var(--muted); font-weight: 600; font-size: .9rem; }
.dm-back:hover { color: var(--gold); }

/* ---------- Hero ---------- */
.dm-hero { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: calc(var(--nav-h) + 40px) clamp(20px, 5vw, 40px) 60px; overflow: hidden; }
.dm-hero-bg { position: absolute; inset: 0; z-index: -1; background: linear-gradient(rgba(20,16,12,.62), rgba(20,16,12,.93)), url('../assets/cards/D6.png') center 20%/cover no-repeat; filter: saturate(1.05); animation: heroZoom 24s ease-in-out infinite alternate; }
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.12); } }
.dm-hero-inner { max-width: 760px; }
.dm-eyebrow { display: inline-block; text-transform: uppercase; letter-spacing: 2px; font-size: .76rem; font-weight: 600; color: var(--gold); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 16px; background: rgba(20,16,12,.5); margin: 0 0 18px; }
.dm-hero h1 { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(3rem, 11vw, 6.5rem); margin: 0 0 18px; letter-spacing: 3px; text-shadow: 0 6px 30px rgba(0,0,0,.6); }
.dm-lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: #ddd2bf; max-width: 620px; margin: 0 auto 30px; }
.dm-lead strong { color: var(--gold); }
.dm-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 40px; }
.dm-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 14px 34px; justify-content: center; padding: 0; margin: 0; }
.dm-stats li { display: flex; flex-direction: column; }
.dm-stats strong { font-family: 'Cinzel', serif; font-size: 2rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dm-stats span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; }
.dm-scroll { position: absolute; bottom: 18px; font-size: 1.6rem; color: var(--gold); animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(8px);} }

/* ---------- Sections ---------- */
.dm-section { max-width: var(--maxw); margin: 0 auto; padding: clamp(60px, 9vw, 110px) clamp(20px, 5vw, 40px); }
.dm-head { text-align: center; margin-bottom: 46px; }
.dm-kicker { display: block; color: var(--ember); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: .8rem; margin-bottom: 8px; }
.dm-head h2 { font-size: clamp(2rem, 5vw, 3rem); margin: 0; }
.dm-sub { color: var(--muted); max-width: 620px; margin: 12px auto 0; }

/* ---------- Rules ---------- */
.dm-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.dm-rule { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: transform .25s, border-color .25s, box-shadow .25s; }
.dm-rule:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.dm-rule-ico { font-size: 1.9rem; display: block; margin-bottom: 10px; }
.dm-rule h3 { margin: 0 0 8px; font-size: 1.2rem; color: var(--gold); }
.dm-rule p { margin: 0; color: #cfc4af; font-size: .96rem; }
.dm-rule strong { color: var(--text); }

.dm-turn { margin-top: 40px; text-align: center; }
.dm-turn h3 { font-size: 1.3rem; color: var(--gold); margin-bottom: 20px; }
.dm-turn-flow { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 0; margin: 0; }
.dm-turn-flow li { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 24px; font-weight: 700; display: flex; flex-direction: column; align-items: center; min-width: 200px; }
.dm-turn-flow li span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #1c1206; margin-bottom: 8px; }
.dm-turn-flow li small { font-weight: 400; color: var(--muted); margin-top: 4px; font-size: .8rem; }
.dm-turn-flow li:not(:last-child)::after { content: '→'; position: absolute; right: -16px; top: 50%; transform: translateY(-50%); color: var(--ember); font-weight: 700; }

.dm-victory { margin-top: 44px; text-align: center; }
.dm-victory h3 { font-size: 1.2rem; color: var(--gold); margin-bottom: 16px; }
.dm-victory table { margin: 0 auto; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dm-victory th, .dm-victory td { padding: 12px 26px; border-bottom: 1px solid var(--border); }
.dm-victory th { background: var(--panel-2); color: var(--gold); font-family: 'Cinzel', serif; }
.dm-victory tr:last-child td { border-bottom: none; }

/* ---------- Resources ---------- */
.dm-res-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.dm-res-group { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.dm-res-group h3 { margin: 0 0 14px; font-size: 1.05rem; color: var(--gold); }
.dm-res { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.dm-res-chip { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.dm-res b { font-weight: 600; }
.dm-res small { color: var(--muted); margin-left: auto; font-size: .8rem; }

/* ---------- Expansions ---------- */
.dm-exps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.dm-exp { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; position: relative; transition: transform .25s, border-color .25s; }
.dm-exp:hover { transform: translateY(-5px); border-color: var(--border-strong); }
.dm-exp h3 { margin: 0 0 10px; font-size: 1.12rem; }
.dm-exp p { margin: 0; color: #cfc4af; font-size: .92rem; }
.dm-exp .dm-tag { display: inline-block; margin-top: 14px; font-size: .78rem; color: var(--muted); background: var(--panel-2); padding: 4px 10px; border-radius: 999px; }
.dm-exp.e1 { border-left: 3px solid #e2752e; } .dm-exp.e2 { border-left: 3px solid #50b45f; }
.dm-exp.e3 { border-left: 3px solid #82888f; } .dm-exp.e4 { border-left: 3px solid #dc48aa; }
.dm-exp.e0 { border-left: 3px solid var(--gold); }

/* ---------- Cards browser ---------- */
.dm-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-bottom: 32px; }
.dm-filters input, .dm-filters select { background: var(--panel); border: 1px solid var(--border-strong); color: var(--text); border-radius: 10px; padding: 11px 14px; font-size: .95rem; font-family: inherit; }
.dm-filters input#search { min-width: 280px; flex: 1; max-width: 420px; }
.dm-filters input:focus, .dm-filters select:focus { outline: none; border-color: var(--gold); }
.dm-count { color: var(--muted); font-size: .9rem; }

.dm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.dm-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .22s, border-color .22s, box-shadow .22s; }
.dm-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.dm-card-img { position: relative; aspect-ratio: 3/4; background: #0d0a07; }
.dm-card[data-type="Mazmorra"] .dm-card-img { aspect-ratio: 4/3; }
.dm-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dm-pts { position: absolute; top: 8px; right: 8px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #1c1206; font-weight: 800; font-size: .9rem; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.dm-cost { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 80%; }
.dm-pill { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: .72rem; box-shadow: 0 2px 6px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.18); }
.dm-card-body { padding: 12px 14px; }
.dm-card-body h4 { margin: 0 0 4px; font-size: .98rem; font-family: 'Cinzel', serif; }
.dm-card-body .dm-card-type { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }
.dm-empty { text-align: center; color: var(--muted); padding: 40px; }

/* ---------- Modal ---------- */
.dm-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(8,6,4,.85); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dm-modal-box { background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 20px; max-width: 860px; width: 100%; max-height: 90vh; overflow: auto; display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 0; position: relative; box-shadow: var(--shadow); }
.dm-modal-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dm-modal-info { padding: 30px; }
.dm-modal-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 1rem; cursor: pointer; z-index: 3; }
.dm-modal-close:hover { background: rgba(0,0,0,.85); }
.dm-modal-code { color: var(--ember); font-weight: 700; letter-spacing: 1px; font-size: .85rem; }
.dm-modal-info h3 { font-family: 'Cinzel', serif; font-size: 1.7rem; margin: 6px 0 4px; }
.dm-modal-meta { color: var(--muted); margin: 0 0 18px; text-transform: uppercase; font-size: .8rem; letter-spacing: 1px; }
.dm-modal-stats { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 18px; }
.dm-modal-stats .lbl { color: var(--muted); font-size: .8rem; display: block; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.dm-modal-stats .dm-cost { position: static; }
.dm-modal-stats .dm-pts { position: static; }
.dm-modal-effect { color: #ddd2bf; font-size: 1.02rem; line-height: 1.7; border-top: 1px solid var(--border); padding-top: 16px; }

/* ---------- Back to top ---------- */
.dm-totop { position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--grad); color: #1c1206; font-size: 1.2rem; font-weight: 800; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .3s, transform .3s; z-index: 900; }
.dm-totop.show { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- Footer ---------- */
.dm-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 30px clamp(20px, 5vw, 40px); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.dm-footer p { margin: 0; color: var(--muted); }
.dm-footer strong { color: var(--gold); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .dm-nav-links { display: none; }
    .dm-modal-box { grid-template-columns: 1fr; }
    .dm-modal-box img { max-height: 50vh; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .dm-hero-bg, .dm-scroll { animation: none; }
}
