:root {
    --rg-bg: #0f0c0a;
    --rg-bg2: #17110d;
    --rg-ink: #f2e3bd;
    --rg-muted: #bba98a;
    --rg-cream: #f6e6bf;
    --rg-red: #c4261b;
    --rg-red2: #8f1912;
    --rg-purple: #6a35a0;
    --rg-gold: #e0a82e;
    --rg-gold2: #f1cf7a;
    --rg-paper: #e9d6a6;
    --rg-paper-ink: #3a2a18;
    --rg-brush: 'Permanent Marker', 'Rock Salt', Impact, sans-serif;
    --rg-script: 'Caveat', 'Segoe Script', cursive;
    --rg-body: 'Lora', Georgia, 'Times New Roman', serif;
}

html { scroll-behavior: smooth; }
body { background: var(--rg-bg); color: var(--rg-ink); font-family: var(--rg-body); line-height: 1.65; }
a { color: var(--rg-gold2); }
a:hover { color: #fff; }
.rg-muted { color: var(--rg-muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- papier déchiré : le fond est sur ::before pour que le filtre ne déforme pas le texte */
.rg-parch { position: relative; isolation: isolate; color: var(--rg-paper-ink); }
.rg-parch::before {
    content: ''; position: absolute; inset: 0; z-index: -1; filter: url(#rg-rough);
    background:
        radial-gradient(ellipse at 15% 10%, #fff3cf55, transparent 55%),
        radial-gradient(ellipse at 90% 95%, #8a5f2a33, transparent 50%),
        linear-gradient(160deg, #f0dfb4, #dcc48e);
    box-shadow: inset 0 0 0 3px #b28a4a55, inset 0 0 40px #8a5f2a44;
}

/* ---- navigation */
.rg-top { background: #0b0907; border-bottom: 2px solid var(--rg-red2); }
.rg-nav { padding: .5rem 0; position: relative; z-index: 5; }
.rg-brand img { height: 52px; width: auto; display: block; filter: drop-shadow(0 2px 6px #000a); }
.rg-nav .nav-link { color: var(--rg-cream); font-family: var(--rg-brush); font-size: .95rem; letter-spacing: .06em; padding: .5rem .9rem; opacity: .85; }
.rg-nav .nav-link:hover, .rg-nav .nav-link.active { color: var(--rg-gold2); opacity: 1; }
.rg-nav .dropdown-menu { background: #17110d; border: 1px solid #5a3a1e; }
.rg-nav .dropdown-item { color: var(--rg-cream); }
.rg-nav .dropdown-item:hover { background: #2a1d14; color: var(--rg-gold2); }

.rg-btn, .rg-btn:focus {
    background: linear-gradient(#d83a2c, var(--rg-red2)); color: #fff1d2; border: 2px solid #f0b46a;
    font-family: var(--rg-brush); letter-spacing: .08em; text-transform: uppercase; font-size: .9rem;
    box-shadow: 0 4px 0 #4d0d09, 0 8px 22px #000a; transform: rotate(-.6deg);
}
.rg-btn:hover { filter: brightness(1.12); color: #fff; transform: rotate(0) translateY(-1px); }
.rg-btn-ghost {
    background: #0b0907cc; color: var(--rg-cream); border: 2px solid #8a6a3f;
    font-family: var(--rg-brush); letter-spacing: .08em; text-transform: uppercase; font-size: .9rem;
}
.rg-btn-ghost:hover { border-color: var(--rg-gold2); color: #fff; background: #1c1410; }
.rg-btn-lg { padding: .85rem 1.7rem; font-size: 1rem; }

/* ---- héros : l'écran de chargement du serveur */
.rg-hero { background: #0b0907; position: relative; }
.rg-hero::before {
    content: ''; display: block; background: var(--hero) center top / cover no-repeat; aspect-ratio: 1600 / 756; width: 100%; max-height: 100vh;
    -webkit-mask-image: linear-gradient(#000 88%, transparent); mask-image: linear-gradient(#000 88%, transparent);
}
.rg-hero .rg-nav { position: absolute; top: 0; left: 0; right: 0; background: linear-gradient(#000c, transparent); border: 0; }
.rg-hero-cta { position: absolute; left: 0; right: 0; bottom: 3%; padding: 0 1rem; text-align: center; }
.rg-hero-cta::before { content: ''; position: absolute; inset: -2.5rem 20% -1rem; z-index: -1; background: radial-gradient(ellipse at center, #0b0907d9 0, #0b0907a6 45%, transparent 72%); }
.rg-hero-line { font-family: var(--rg-script); font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 700; color: var(--rg-cream); margin: 0 0 1rem; text-shadow: 0 2px 12px #000; }
.rg-cta { display: flex; flex-wrap: wrap; gap: 1rem; }
.rg-hero .rg-cta { justify-content: center; }
.rg-online { margin: 1.2rem 0 0; color: var(--rg-muted); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; }
.rg-online .dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #6b5b45; margin-right: .4rem; }
.rg-online .dot.on { background: #6fe08b; box-shadow: 0 0 10px #6fe08b; }

/* ---- sections */
.rg-section { padding: 5.5rem 0; position: relative; }
.rg-section-alt { background: var(--rg-bg2); border-top: 2px solid #2a1812; border-bottom: 2px solid #2a1812; }
.rg-num { font-family: var(--rg-script); font-size: 1.5rem; font-weight: 700; color: var(--rg-red); margin: 0 0 .1rem; transform: rotate(-1.5deg); display: inline-block; }
.rg-h2 { font-family: var(--rg-brush); font-weight: 400; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; color: var(--rg-cream); margin: 0 0 1rem; text-shadow: 3px 3px 0 #000; }
.rg-h2 span { color: var(--rg-red); text-shadow: 3px 3px 0 #000; }
.rg-intro { max-width: 40rem; color: var(--rg-muted); font-size: 1.08rem; }
.rg-link { font-family: var(--rg-brush); letter-spacing: .08em; text-decoration: none; font-size: 1.1rem; }
.rg-script { font-family: var(--rg-script); font-weight: 700; font-size: 1.5rem; color: #8f1912; margin: 0; }

/* manifeste sur la scène de jeu */
.rg-manifest { text-align: center; padding: 7rem 0; background: linear-gradient(#0f0c0acc, #0f0c0aee), var(--scene) center / cover fixed; }
.rg-script-lg { font-size: clamp(1.9rem, 5vw, 3.4rem); color: var(--rg-cream); line-height: 1.25; text-shadow: 0 3px 14px #000; }
.rg-script-lg.rg-red { color: #ff5a44; }
.rg-manifest-text { max-width: 40rem; margin: 2rem auto 0; color: var(--rg-muted); font-size: 1.1rem; }

/* les trois camps */
.rg-faction { height: 100%; padding: 1.2rem 1.2rem 1.6rem; --accent: var(--rg-red); }
.rg-faction.f-purple { --accent: var(--rg-purple); }
.rg-faction.f-gold { --accent: var(--rg-gold); }
.rg-faction::before { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 40px #8a5f2a44; }
.rg-faction img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 20%; display: block; border: 3px solid #1a120b; box-shadow: 0 6px 18px #0006; }
.rg-faction-body { padding: 1rem .3rem 0; }
.rg-faction h3 { font-family: var(--rg-brush); font-weight: 400; font-size: 1.7rem; color: var(--accent); margin: 0 0 .4rem; text-shadow: 2px 2px 0 #0003; }
.rg-faction p { color: #4a3722; font-size: .98rem; margin-bottom: .6rem; }
.rg-faction .rg-script { color: var(--accent); filter: brightness(.85); }

/* affiches « recherché » */
.rg-wanted { text-align: center; padding: 1.6rem 1rem 1.4rem; height: 100%; }
.rg-wanted::before { opacity: .55; }
.rg-wanted.is-held::before { opacity: 1; }
.rg-wanted-top { font-family: var(--rg-brush); font-size: 1.35rem; letter-spacing: .12em; text-transform: uppercase; color: var(--rg-red2); margin: 0 0 .4rem; }
.rg-wanted-emblem { height: 74px; margin-bottom: .4rem; filter: drop-shadow(0 4px 4px #0004); }
.rg-wanted:not(.is-held) .rg-wanted-emblem { opacity: .35; filter: grayscale(1); }
.rg-wanted-name { font-family: var(--rg-brush); font-weight: 400; font-size: 1.7rem; margin: 0; color: #2b1c0e; word-break: break-word; }
.rg-wanted-name.is-empty { color: #8a7a60; font-size: 1.3rem; }
.rg-wanted-stars { margin: .1rem 0 .4rem; letter-spacing: .18em; font-size: 1.2rem; color: #b8a273; }
.rg-wanted-stars .on { color: #d28b0a; text-shadow: 0 1px 0 #6b4306; }
.rg-wanted-prime { margin: 0 0 .6rem; font-family: var(--rg-brush); font-size: 1.7rem; color: var(--rg-red2); }
.rg-wanted-prime small { display: block; font-family: var(--rg-body); font-size: .62rem; letter-spacing: .3em; text-transform: uppercase; color: #6b5a3e; }
.rg-wanted-prime i { font-style: normal; font-size: .85rem; letter-spacing: .1em; }
.rg-wanted-hint { color: #6b5a3e; font-size: .92rem; margin: 0 0 .6rem; }
.rg-wanted-range { font-family: var(--rg-script); font-size: 1.25rem; font-weight: 700; color: #5a4529; margin: 0; }

/* parure */
.rg-ogrine { height: 96px; filter: drop-shadow(0 8px 14px #000a); }
.rg-gear { display: grid; grid-template-columns: 170px 1fr; gap: 1.2rem; align-items: end; }
.rg-gear-char { width: 100%; filter: drop-shadow(0 12px 18px #000c); }
.rg-gear-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.rg-gear-items figure { margin: 0; text-align: center; background: #1b130d; border: 1px solid #4a3220; padding: .6rem .3rem .4rem; }
.rg-gear-items img { height: 62px; max-width: 100%; object-fit: contain; }
.rg-gear-items figcaption { font-family: var(--rg-script); font-size: 1.05rem; font-weight: 700; color: var(--rg-gold2); line-height: 1.1; margin-top: .3rem; }

/* piliers */
.rg-pillar { height: 100%; padding: 1.4rem 1rem; text-align: center; background: #120d0a; border: 1px solid #3a2616; border-top: 3px solid var(--rg-red2); }
.rg-pillar i { font-size: 1.9rem; color: var(--rg-gold); }
.rg-pillar h3 { font-family: var(--rg-brush); font-weight: 400; font-size: 1.15rem; color: var(--rg-cream); margin: .5rem 0 .3rem; }
.rg-pillar p { color: var(--rg-muted); font-size: .88rem; margin: 0; }

/* gazette */
.rg-post { display: block; text-decoration: none; padding: 1rem 1rem 1.3rem; height: 100%; color: var(--rg-paper-ink); }
.rg-post img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; margin-bottom: .8rem; border: 3px solid #1a120b; }
.rg-post-date { display: block; font-family: var(--rg-script); font-weight: 700; font-size: 1.15rem; color: var(--rg-red2); }
.rg-post h3 { margin: 0; font-family: var(--rg-brush); font-weight: 400; font-size: 1.25rem; color: #2b1c0e; }
.rg-post:hover { transform: rotate(-.6deg); }

/* appel final sur l'écran de chargement des Hors-la-loi */
.rg-final { padding: 8rem 0 7rem; text-align: center; background: linear-gradient(#0f0c0a, #0f0c0a55 35%, #0f0c0aaa), var(--final) center / cover; border-top: 2px solid var(--rg-red2); }
.rg-final-title { font-size: clamp(3rem, 9vw, 6rem); color: var(--rg-red); margin-bottom: 1.5rem; }

/* ---- pied de page */
.rg-footer { background: #0b0907; border-top: 2px solid var(--rg-red2); padding: 3rem 0 2rem; }
.rg-footer-logo { height: 90px; width: auto; }
.rg-footer-links a { color: var(--rg-muted); text-decoration: none; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; }
.rg-footer-links a:hover { color: var(--rg-gold2); }
.rg-rule { border-color: #2a1812; margin: 2rem 0 1rem; }
.social-links a { color: var(--rg-muted); }
.social-links a:hover { color: var(--rg-gold2); }

/* ---- pages intérieures */
.rg-main { padding: 2.5rem 0 4rem; min-height: 60vh; }
.rg-main .card { background: #17110d; border: 1px solid #5a3a1e; }
.rg-main .card-header { background: #221710; border-bottom: 1px solid #5a3a1e; font-family: var(--rg-brush); }
.rg-main h1, .rg-main h2, .rg-main h3 { font-family: var(--rg-brush); font-weight: 400; color: var(--rg-cream); }
.rg-main .btn-primary { background: linear-gradient(#d83a2c, var(--rg-red2)); border: 2px solid #f0b46a; color: #fff1d2; font-family: var(--rg-brush); letter-spacing: .06em; }
.rg-main .btn-primary:hover { filter: brightness(1.12); color: #fff; }
.rg-main .form-control, .rg-main .form-select { background: #120d0a; border-color: #5a3a1e; color: var(--rg-ink); }
.rg-main .form-control:focus { border-color: var(--rg-gold); box-shadow: 0 0 0 .2rem #e0a82e33; }
.rg-main .table { --bs-table-bg: transparent; --bs-table-color: var(--rg-ink); --bs-table-border-color: #3a2616; }

/* ---- apparition douce */
.rg-reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.rg-reveal.in { opacity: 1; transform: none; }
@media (max-width: 991px) {
    .rg-gear { grid-template-columns: 120px 1fr; }
    .rg-manifest { background-attachment: scroll; }
}
@media (max-width: 575px) {
    .rg-section { padding: 3.5rem 0; }
    .rg-hero-cta { position: relative; bottom: auto; padding: 1.5rem 1rem 2rem; }
    .rg-hero-cta::before { display: none; }
    .rg-hero::before { min-height: 38vh; background-size: cover; background-position: center top; }
    .rg-gear { grid-template-columns: 1fr; }
    .rg-gear-char { max-width: 150px; margin: 0 auto; }
    .rg-gear-items { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .rg-btn { transform: none; }
}

.rg-hero .rg-brand { visibility: hidden; }

/* ---- page des records */
.rg-records-head { margin-bottom: 2rem; }
.rg-records-head h1 { font-size: clamp(2rem, 5vw, 3rem); text-shadow: 3px 3px 0 #000; }
.rg-record { padding: 1.4rem 1.4rem 1.2rem; height: 100%; }
.rg-record h2 { font-family: var(--rg-brush); font-weight: 400; font-size: 1.35rem; color: #2b1c0e; margin: 0 0 .8rem; text-shadow: none; }
.rg-record h2 i { color: var(--rg-red2); margin-right: .35rem; }
.rg-record-list { list-style: none; margin: 0; padding: 0; }
.rg-record-list li { display: grid; grid-template-columns: 2rem 1fr auto; gap: .6rem; align-items: center; padding: .5rem 0; border-top: 1px dashed #b49a68; }
.rg-record-list li:first-child { border-top: 0; }
.rg-rank { font-family: var(--rg-brush); font-size: 1.2rem; color: var(--rg-red2); text-align: center; }
.rg-who b { font-family: var(--rg-brush); font-weight: 400; font-size: 1.05rem; color: #2b1c0e; display: block; }
.rg-who small { display: block; color: #6b5a3e; font-size: .78rem; }
.rg-val { font-family: var(--rg-script); font-weight: 700; font-size: 1.15rem; color: #5a4529; text-align: right; }
.rg-record-empty, .rg-record-sub { color: #6b5a3e; font-size: .92rem; margin: 0; }
.rg-hall::before { box-shadow: inset 0 0 0 3px var(--rg-gold), inset 0 0 40px #8a5f2a44; }

/* Wiki du serveur (pages générées par scripts/wiki_build.py) */
#wiki .card-body table { width: 100%; border-collapse: collapse; margin: 0 0 1.2rem; font-size: .95rem; }
#wiki .card-body th { text-align: left; padding: .5rem .7rem; background: #5a4529; color: #f6ead0; border-bottom: 2px solid #3d2e1a; }
#wiki .card-body td { padding: .5rem .7rem; border-bottom: 1px solid #c9b78e; vertical-align: top; }
#wiki .card-body tbody tr:nth-child(even) td { background: #00000008; }
#wiki .card-body code { padding: .1rem .35rem; border-radius: 4px; background: #5a452922; color: #3d2e1a; }
#wiki .card-body .wiki-note { margin: 0 0 1.2rem; padding: .7rem 1rem; border-left: 4px solid #a86a1c; background: #a86a1c1a; }
#wiki .card-body h2 { margin-top: 1.6rem; }
@media (max-width: 600px) { #wiki .card-body table { display: block; overflow-x: auto; } }
