/* ==========================================================================
   Ambrelune — thème fantasy sombre, responsive (mobile d'abord).
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #15111d;
  --bg-2: #1b1626;
  --panel: #211b2f;
  --panel-2: #2a2239;
  --line: #3a3050;
  --text: #ece6f5;
  --muted: #a99fbd;
  --gold: #e8b85a;
  --gold-2: #f4dfa6;
  --accent: #8f78c9;
  --ok: #5cc98a;
  --warn: #f0b04b;
  --danger: #e2675f;
  --r-common: #b9b4c3;
  --r-uncommon: #5cc98a;
  --r-rare: #5b9cf0;
  --r-epic: #b07af0;
  --r-legendary: #f0a43a;
  --radius: 14px;
  --shadow: 0 10px 30px rgb(0 0 0 / 35%);
  --font-title: 'Cinzel', Georgia, serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #2b2142 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-title); letter-spacing: .02em; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.lead { color: var(--muted); margin-bottom: 1rem; }
.warn { color: var(--warn); }
.eyebrow { text-transform: uppercase; font-size: .7rem; letter-spacing: .12em; color: var(--muted); margin: 0 0 .25rem; }
.inline { display: inline; }

/* ---------- Mise en page ---------- */
.shell { display: flex; min-height: 100vh; }

/* Menu latéral : colonne fixe sur ordinateur, tiroir coulissant sur mobile ; il défile s'il est trop long. */
.sidebar {
  display: flex; flex-direction: column; gap: 1.5rem; width: 260px; flex-shrink: 0;
  padding: 1.25rem 1rem; background: var(--bg-2); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #6b5a8e transparent;
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #6b5a8e; border-radius: 999px; border: 2px solid var(--bg-2); }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--gold); }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a { padding: .55rem .75rem; border-radius: 10px; color: var(--text); display: flex; align-items: center; gap: .35rem; }
.side-nav a:hover { background: var(--panel); text-decoration: none; }
.side-nav a.active { background: var(--panel-2); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.nav-group summary {
  list-style: none; cursor: pointer; padding: .55rem .75rem; border-radius: 10px; color: var(--text);
  display: flex; align-items: center; gap: .35rem;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '▸'; margin-left: auto; color: var(--muted); transition: transform .15s; }
.nav-group[open] summary::after { transform: rotate(90deg); }
.nav-group summary:hover { background: var(--panel); }
.nav-group summary.has-active { color: var(--gold-2); }
.nav-sub { display: flex; flex-direction: column; gap: .1rem; margin: .1rem 0 .3rem 1rem; padding-left: .5rem; border-left: 1px solid var(--line); }
.nav-sub a { padding: .4rem .6rem; font-size: .9rem; }
.nav-level { margin-left: auto; font-size: .72rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; }
.nav-sub a.active .nav-level { color: var(--gold-2); border-color: var(--gold); }
.side-soon { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .85rem; opacity: .7; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.nav-close, .nav-toggle { display: none; }
.nav-backdrop { display: none; }

/* Mobile : le menu devient un tiroir qui glisse depuis la gauche. */
@media (max-width: 899px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(86vw, 320px);
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow);
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / 55%); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .nav-toggle, .nav-close {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 1.2rem; cursor: pointer;
  }
  .side-nav a, .nav-group summary { padding: .7rem .8rem; } /* cibles plus grandes au doigt */
  .nav-sub a { padding: .6rem .7rem; font-size: .95rem; }
  .topbar { padding: .6rem .75rem; gap: .5rem; }
  .topbar-left { display: flex; align-items: center; gap: .5rem; min-width: 0; }
  .page-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .nav-backdrop { transition: none; } }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: rgb(21 17 29 / 88%); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.1rem; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.gold-pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .75rem; font-weight: 600; color: var(--gold-2); white-space: nowrap; }
.content { padding: 1rem; padding-bottom: 6rem; max-width: 1200px; width: 100%; margin: 0 auto; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgb(27 22 38 / 96%); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .55rem; font-size: .72rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; font-family: inherit; cursor: pointer; }
.bottom-nav a span, .bottom-nav button span { font-size: 1.4rem; line-height: 1.15; }
.bottom-nav a.active { color: var(--gold); }
.bottom-nav a:hover { text-decoration: none; }

.brand { font-family: var(--font-title); font-weight: 700; font-size: 1.25rem; color: var(--gold); display: inline-flex; align-items: center; gap: .4rem; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--gold-2); }
.brand-lg { font-size: 1.8rem; margin-bottom: .5rem; }

@media (min-width: 900px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
  .bottom-nav { display: none; }
  .content { padding: 1.5rem 2rem 3rem; }
  .topbar { padding: .9rem 2rem; }
}
@media (max-width: 520px) { .hide-sm { display: none; } }

/* ---------- Authentification ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem 1.5rem; box-shadow: var(--shadow); }
.auth-tagline { color: var(--muted); margin-bottom: 1.25rem; }

/* ---------- Panneaux et grilles ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.panel-highlight { border-color: var(--gold); background: linear-gradient(180deg, rgb(232 184 90 / 10%), transparent 70%), var(--panel); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .panel { margin-bottom: 0; } .grid-2 { margin-bottom: 1rem; } }
.cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Boutons et formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: .55rem 1rem; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: linear-gradient(180deg, #f0c56b, #d59f3c); color: #241a08; border-color: #c08c2e; }
.btn-primary:hover { filter: brightness(1.07); border-color: #c08c2e; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: .85rem; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.form { display: flex; flex-direction: column; gap: .85rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .9rem; }
.form small { color: var(--muted); font-weight: 400; }
input, select {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .7rem; min-height: 42px; width: 100%;
}
input:focus, select:focus, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-inline { display: grid; gap: .75rem; align-items: end; }
@media (min-width: 760px) { .form-inline { grid-template-columns: 2fr 1fr 1fr auto; } }
fieldset.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
fieldset.segmented legend { font-weight: 500; font-size: .9rem; margin-bottom: .3rem; }
fieldset.segmented label { flex-direction: row; align-items: center; gap: .35rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .75rem; cursor: pointer; }
fieldset.segmented input { width: auto; min-height: 0; }
.alert { padding: .65rem .85rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: rgb(226 103 95 / 15%); border: 1px solid var(--danger); }

.chip { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; color: var(--text); cursor: pointer; font-family: inherit; }
.chip.active { border-color: var(--gold); color: var(--gold-2); }
.quick-qty, .filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.filters { margin-bottom: 1rem; }

/* ---------- Barres ---------- */
.bar { position: relative; height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s linear; }
.bar-xp > span { background: linear-gradient(90deg, #7a62c0, #b49cf0); }
.bar-goal > span { background: linear-gradient(90deg, #c08c2e, var(--gold)); }
.bar-unit { height: 6px; }
.unit-row { display: flex; align-items: center; gap: .6rem; margin: .35rem 0; }
.unit-row .bar { flex: 1; margin: 0; }
.unit-time { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 4.5rem; text-align: right; }
.bar-unit > span { background: var(--ok); transition: none; }
.bar-lg { height: 20px; margin-bottom: 1rem; }
.bar-lg em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: .75rem; font-weight: 600; }

/* ---------- Tableau de bord ---------- */
.worker-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .85rem; display: flex; flex-direction: column; gap: .35rem; }
.worker-card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.worker-card h3 { margin: 0; }
.worker-card.state-working { border-left: 3px solid var(--ok); }
.worker-card.state-waiting { border-left: 3px solid var(--warn); }
.worker-task { font-weight: 600; margin: 0; }
.badge { font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge-working { color: var(--ok); }
.badge-waiting { color: var(--warn); }
.badge-idle { color: var(--muted); }
.badge-blocked { color: var(--danger); }

.prof-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.prof-list li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: center; }
.prof-list .bar { grid-column: 1 / -1; }
.prof-level { color: var(--gold-2); font-weight: 600; font-size: .85rem; }
.level-badge { font-family: var(--font); font-size: .75rem; background: var(--panel-2); border: 1px solid var(--gold); color: var(--gold-2); border-radius: 999px; padding: .1rem .55rem; vertical-align: middle; margin-left: .35rem; }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; font-size: .88rem; max-height: 420px; overflow: auto; }
.log li { padding: .4rem .6rem; border-radius: 8px; background: var(--bg-2); border-left: 3px solid var(--line); }
.log-time { color: var(--muted); font-size: .75rem; margin-right: .3rem; }
.log .log-level_up { border-left-color: var(--gold); }
.log .log-rare_find { border-left-color: var(--r-epic); }
.log .log-task_done, .log .log-queue_done { border-left-color: var(--ok); }
.log .log-task_blocked { border-left-color: var(--danger); }
.log-compact { margin-top: .75rem; }

.loot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.loot { display: flex; flex-direction: column; align-items: center; text-align: center; padding: .6rem .4rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.loot-icon { font-size: 1.6rem; }
.loot-qty { font-weight: 700; color: var(--gold-2); }
.loot-name { font-size: .75rem; color: var(--muted); }
.xp-line { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- Raretés ---------- */
.rarity-common { --rc: var(--r-common); }
.rarity-uncommon { --rc: var(--r-uncommon); }
.rarity-rare { --rc: var(--r-rare); }
.rarity-epic { --rc: var(--r-epic); }
.rarity-legendary { --rc: var(--r-legendary); }
.loot[class*='rarity-'], .resource-card, .item-row, .slot-card[class*='rarity-'] { border-color: color-mix(in srgb, var(--rc, var(--line)) 55%, var(--line)); }
.rarity-tag { font-family: var(--font); font-size: .7rem; color: var(--rc); border: 1px solid var(--rc); border-radius: 999px; padding: 0 .45rem; margin-left: .3rem; vertical-align: middle; }

/* ---------- Métiers et forge ---------- */
.resource-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.resource-card { display: grid; grid-template-columns: auto 1fr; gap: .4rem .75rem; align-items: start; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.resource-card .btn { grid-column: 1 / -1; }
.resource-card.locked { opacity: .55; }
.resource-icon { font-size: 1.8rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--bg-2); border-radius: 10px; border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 60%, transparent); }
.resource-body h3 { color: var(--rc, var(--text)); margin-bottom: .2rem; }
.ingredients { list-style: none; padding: 0; margin: 0 0 .3rem; font-size: .85rem; }
.ingredients .ok strong { color: var(--ok); }
.ingredients .missing strong { color: var(--danger); }

/* ---------- File d'attente ---------- */
.tabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; }
.tabs a { padding: .4rem .9rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.tabs a.active { border-color: var(--gold); color: var(--gold-2); }
.tabs a:hover { text-decoration: none; border-color: var(--accent); }
.tab-level { font-size: .72rem; color: var(--muted); margin-left: .2rem; }
.tabs a.active .tab-level { color: var(--gold-2); }
.mode-select { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.mode-select select { width: auto; min-height: 36px; padding: .3rem .6rem; }
.queue-state { font-weight: 600; }
.queue-state.state-working { color: var(--ok); }
.queue-state.state-waiting { color: var(--warn); }
.queue-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .5rem; }
.queue-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .7rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.queue-item.current { border-color: var(--ok); }
.queue-item.blocked { border-color: var(--danger); }
.queue-icon { font-size: 1.5rem; }
.queue-main p { margin: 0; }
.queue-main .bar { margin-top: .35rem; }
.queue-actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) {
  .queue-item { grid-template-columns: auto auto minmax(0, 1fr); }
  .queue-actions { grid-column: 1 / -1; justify-content: stretch; }
  .queue-actions .icon-btn { flex: 1; }
}
.queue-total { font-weight: 600; color: var(--gold-2); margin: .5rem 0 0; }

/* ---------- Inventaire ---------- */
.item-list { display: grid; gap: .5rem; }
/* Ligne d'objet : [icône] [nom + description] [quantité + vente].
   Sur mobile, le bloc quantité + vente passe sous le nom, sur toute la largeur. */
.item-row {
  display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; align-items: center;
  padding: .75rem .9rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.item-row.sold-out { opacity: .4; }
.item-icon {
  font-size: 1.6rem; width: 52px; height: 52px; display: grid; place-items: center;
  background: var(--bg-2); border-radius: 10px; border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 60%, transparent);
}
.item-main { min-width: 0; }
.item-main h3 { color: var(--rc, var(--text)); margin: 0 0 .15rem; }
.item-main p { margin: 0; }
.item-qty-block {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  min-width: 84px; padding: .35rem .7rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.item-qty { font-weight: 700; font-size: 1.35rem; line-height: 1.1; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.item-qty-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.item-side { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; }
.sell-form { display: flex; gap: .4rem; flex: 1; min-width: 0; justify-content: flex-end; }
.sell-form input { flex: 1; min-width: 56px; width: auto; min-height: 38px; padding: .3rem .5rem; }
.sell-form .btn { white-space: nowrap; flex-shrink: 0; }
.sell-none { flex: 1; text-align: right; }
@media (min-width: 760px) {
  .item-row { grid-template-columns: auto 1fr auto; }
  .item-side { grid-column: auto; }
  .sell-form { flex: none; }
  .sell-form input { flex: none; width: 100px; }
  .item-qty-block { min-width: 96px; }
  .sell-none { width: 200px; }
}

/* ---------- Personnage ---------- */
.hero-panel { display: flex; gap: 1rem; align-items: center; }
.portrait { font-size: 3rem; width: 84px; height: 84px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #3b2f57, #1c1628); border: 2px solid var(--gold); }
.slot-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.slot-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .85rem; display: flex; flex-direction: column; gap: .35rem; }
.slot-card h3 { color: var(--rc, var(--text)); }
.slot-card .form { flex-direction: row; gap: .4rem; margin-top: auto; }
.slot-card select { min-height: 36px; padding: .3rem .5rem; }

/* ---------- Fenêtre modale et notifications ---------- */
.dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 1.25rem; width: min(440px, calc(100vw - 2rem)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(8 6 12 / 70%); backdrop-filter: blur(2px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.estimate { color: var(--gold-2); font-size: .85rem; min-height: 1.2em; margin: 0; }
.toasts { position: fixed; z-index: 50; right: 1rem; bottom: 5rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(360px, calc(100vw - 2rem)); }
@media (min-width: 900px) { .toasts { bottom: 1.5rem; } }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: .65rem .9rem; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-rare { border-left-color: var(--r-epic); background: linear-gradient(90deg, rgb(176 122 240 / 18%), var(--panel-2) 60%); }
.alert-info { background: rgb(143 120 201 / 15%); border: 1px solid var(--accent); }

/* ---------- Actualisation en direct ---------- */
/* « +N » affiché devant un compteur qui augmente, sans décaler la mise en page. */
[data-live-stock] { position: relative; display: inline-block; }
[data-live-stock][data-gain]::before {
  content: attr(data-gain);
  position: absolute; right: 100%; top: 50%; margin-right: .4rem;
  font-size: .75em; font-weight: 700; color: var(--ok); white-space: nowrap; pointer-events: none;
  animation: gain-pop 1.6s ease-out forwards;
}
[data-live-stock].is-loss[data-gain]::before { color: var(--danger); }
/* Dans une phrase (« En stock : 12 »), le gain s'affiche après le nombre pour ne pas masquer le texte. */
.resource-card [data-live-stock][data-gain]::before { right: auto; left: 100%; margin: 0 0 0 .4rem; }
@keyframes gain-pop {
  0% { opacity: 0; transform: translateY(-20%); }
  15% { opacity: 1; transform: translateY(-50%); }
  100% { opacity: 0; transform: translateY(-140%); }
}
.log li.fresh { animation: fresh-log 2.5s ease-out; }
@keyframes fresh-log { from { background: rgb(232 184 90 / 25%); } to { background: var(--bg-2); } }
.bar-xp > span { transition: width .6s ease; }
@media (prefers-reduced-motion: reduce) {
  [data-live-stock][data-gain]::before { animation: none; transform: translateY(-50%); }
  .log li.fresh { animation: none; }
  .bar > span { transition: none; }
}

/* ---------- Exploration : carte du monde ---------- */
.combat-summary { display: flex; gap: 1.25rem; align-items: center; }
.combat-summary .combat-xp { flex: 1; min-width: 0; }
.combat-summary .bar-lg { margin-bottom: .5rem; }
.big-level { font-family: var(--font-title); font-size: 2.4rem; color: var(--gold); margin: 0; line-height: 1; text-align: center; }
.region-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.region-card {
  --diff: var(--line);
  display: flex; flex-direction: column; gap: .5rem; padding: 1rem; background: var(--panel);
  border: 1px solid var(--line); border-top: 3px solid var(--diff); border-radius: var(--radius);
}
.region-card .btn { margin-top: auto; }
.region-card.locked { opacity: .55; }
.region-head { display: flex; gap: .75rem; align-items: center; }
.region-head h2 { margin: 0; }
.region-head .badge { margin-left: auto; }
.region-icon { font-size: 2rem; width: 52px; height: 52px; display: grid; place-items: center; background: var(--bg-2); border-radius: 12px; flex-shrink: 0; }
.diff-easy { --diff: var(--r-uncommon); }
.diff-fair { --diff: var(--r-rare); }
.diff-risky { --diff: var(--warn); }
.diff-deadly { --diff: var(--danger); }
.diff-badge { color: var(--diff); }
.win-rate { margin: 0; }
.monster-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.monster-chips li { font-size: .8rem; padding: .2rem .55rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.monster-chips li.unknown { color: var(--muted); border-style: dashed; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.form label.check input { width: auto; min-height: 0; }

/* ---------- Bestiaire ---------- */
.bestiary-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.beast-card { display: flex; gap: .75rem; padding: .8rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.beast-card.unknown { opacity: .5; border-style: dashed; }
.beast-icon { font-size: 2rem; width: 52px; height: 52px; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-2); border-radius: 10px; }
.beast-body { min-width: 0; }
.beast-body h3 { margin-bottom: .2rem; }
.stat-line { font-variant-numeric: tabular-nums; }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
.gold-text { color: var(--gold-2); }

/* ---------- Rapports et statistiques ---------- */
.report-stats, .stat-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin: .5rem 0 .75rem; }
.report-stats > div, .stat-grid > div {
  display: flex; flex-direction: column; align-items: center; padding: .5rem; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px;
}
.report-num, .stat-value { font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat-icon { font-size: 1.2rem; }
.outcome-completed { color: var(--ok); }
.outcome-cancelled { color: var(--muted); }
.outcome-retreat_failed { color: var(--warn); }
@media (max-width: 600px) {
  .combat-summary { flex-direction: column; align-items: stretch; gap: .5rem; }
  .combat-summary .eyebrow { text-align: center; }
}

/* Saisie d'une durée : heures / minutes / secondes côte à côte */
.duration-input { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.form .duration-input label { font-size: .8rem; }
.form-duration { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .5rem; }
.form-duration:not(:has(.js-goal-duration:not([hidden]))) { display: none; }

/* ---------- Bloc « Expéditions » de la carte du monde ---------- */
.section-title { margin: 1.25rem 0 .75rem; }
.expedition-list { display: grid; gap: .6rem; }
.expedition-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
  padding: .75rem; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px;
}
.expedition-card.current { border-left-color: var(--ok); }
.expedition-main { min-width: 0; }
.expedition-main p { margin: 0; }
.expedition-main .bar { margin-top: .35rem; }
.expedition-actions { display: flex; flex-direction: column; gap: .35rem; }
@media (max-width: 600px) {
  .expedition-card { grid-template-columns: auto 1fr; }
  .expedition-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}

/* File d'attente : les expéditions se distinguent des récoltes et fabrications */
.queue-item.kind-expedition { border-left: 3px solid var(--r-epic); }
.kind-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--r-epic); margin-left: .35rem; }

/* Nourriture disponible (carte du monde, fenêtre d'expédition) */
.food-stock { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .85rem; }
.food-label { color: var(--muted); }
.food-chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .55rem; }
.dialog-food { margin-top: -.35rem; padding-left: 1.6rem; }

/* ---------- Équipement ---------- */
.equip-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1000px) { .equip-layout { grid-template-columns: 1.6fr 1fr; } .stats-panel { position: sticky; top: 4.5rem; } }
.equip-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.equip-slot {
  display: flex; gap: .7rem; align-items: center; text-align: left; width: 100%; cursor: pointer;
  padding: .7rem; background: var(--panel-2); color: var(--text); font: inherit;
  border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 60%, var(--line)); border-radius: 12px;
}
.equip-slot:hover { border-color: var(--accent); }
.equip-slot.empty { border-style: dashed; }
.equip-slot.empty .equip-name { color: var(--muted); font-weight: 500; }
.equip-slot-icon { font-size: 1.7rem; width: 50px; height: 50px; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-2); border-radius: 10px; }
.equip-slot-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.equip-slot-body .eyebrow { margin: 0; }
.equip-name { color: var(--rc, var(--text)); }
.equip-lines, .item-stats { color: var(--gold-2); }
.stats-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: .45rem .35rem; border-bottom: 1px solid var(--line); text-align: right; }
.stats-table th[scope="row"], .stats-table thead th:first-child { text-align: left; }
.stats-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.bonus-list { margin: 0 0 .75rem; padding-left: 1.1rem; color: var(--r-epic); }
.dialog-wide { width: min(560px, calc(100vw - 2rem)); }
.candidate-list { display: grid; gap: .5rem; max-height: 55vh; overflow: auto; }
.candidate { display: flex; gap: .7rem; padding: .7rem; background: var(--panel-2); border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 60%, var(--line)); border-radius: 12px; }
.candidate-body { flex: 1; min-width: 0; }
.stat-lines { list-style: none; margin: .2rem 0; padding: 0; font-size: .85rem; color: var(--gold-2); }
.diff { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font-size: .85rem; font-weight: 600; margin: .25rem 0; }
.candidate-actions { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .35rem; }
.equip-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Guide ---------- */
.guide-top { position: sticky; top: 3.6rem; z-index: 6; padding: .5rem 0 0; background: var(--bg); }
.guide-tabs { padding: .5rem 0; margin-bottom: .5rem; }
/* Recherche dans tout le guide (guide.js) */
.guide-search { position: relative; }
.guide-search input { width: 100%; font-size: 1rem; padding: .6rem .9rem; border-radius: 12px; }
.guide-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: min(60vh, 460px); overflow-y: auto; padding: .3rem;
  background: rgb(27 22 38 / 98%); border: 1px solid rgb(244 210 138 / 35%); border-radius: 12px; box-shadow: 0 14px 34px rgb(0 0 0 / 55%);
}
.guide-results[hidden] { display: none; }
.guide-result { display: flex; gap: .6rem; align-items: flex-start; width: 100%; padding: .5rem .6rem; border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.guide-result:hover, .guide-result.is-active { background: var(--panel-2); }
.guide-result-icon { flex: none; width: 1.6rem; text-align: center; font-size: 1.15rem; }
.guide-result-main { min-width: 0; display: flex; flex-direction: column; }
.guide-result-title { font-weight: 700; }
.guide-result-where { font-size: .72rem; color: var(--muted); }
.guide-result-snippet { font-size: .82rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.guide-results mark, .guide-section mark.guide-mark { background: rgb(232 184 90 / 35%); color: inherit; border-radius: 3px; padding: 0 .1em; }
.guide-results .guide-empty { padding: .7rem; margin: 0; }
.guide-flash { animation: guide-flash 2.2s ease-out; }
@keyframes guide-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 3px transparent; } }
.guide-section h3 { margin-top: 1rem; }
.guide-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.guide-grid article { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .85rem; }
.guide-grid article h3 { margin-top: 0; }
.guide-grid ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.guide-columns { margin: 0; }
.table-scroll { overflow-x: auto; }
.guide-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.guide-table th, .guide-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.guide-table td.small { white-space: normal; min-width: 180px; }
.guide-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.unlock-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.unlock-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.unlock-card summary { cursor: pointer; font-weight: 600; }
.unlock-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; font-size: .88rem; }
.unlock-list .level-badge { margin: 0 .35rem 0 0; }
.codex-filters { display: grid; gap: .5rem; margin-bottom: .75rem; }
@media (min-width: 760px) { .codex-filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: center; } }
.codex-filters .check { display: flex; align-items: center; gap: .4rem; }
.codex-filters .check input { width: auto; min-height: 0; }
.codex-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.codex-card { background: var(--panel-2); border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 55%, var(--line)); border-radius: 12px; padding: .8rem; display: flex; flex-direction: column; gap: .3rem; }
.codex-card header { display: flex; gap: .6rem; align-items: center; }
.codex-card header > div { flex: 1; min-width: 0; }
.codex-card h3 { margin: 0; color: var(--rc, var(--text)); }
.codex-card p { margin: 0; }
.codex-card .eyebrow { margin-top: .3rem; }
.codex-owned { font-weight: 700; color: var(--gold-2); white-space: nowrap; }
.codex-list { margin: 0; padding-left: 1.1rem; font-size: .82rem; display: grid; gap: .15rem; }
.guide-link { text-decoration: none; }

/* ---------- Domaine : quêtes, bâtiments, assistants ---------- */
.quest-grid, .building-grid, .people-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.quest-grid .panel, .building-grid .panel, .people-grid .panel { margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.quest-head { display: flex; gap: .75rem; align-items: center; }
.quest-head h3 { margin: 0; }
.quest-head p { margin: 0; }
.quest-card.status-completed { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.quest-card.status-locked { opacity: .6; }
.quest-card.status-claimed { opacity: .75; }
.quest-card .btn { margin-top: auto; }
.objectives { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.objectives li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; align-items: center; font-size: .9rem; }
.objectives li .bar { grid-column: 1 / -1; }
.objectives li.done > span:first-child { color: var(--ok); }
.rewards, .talent-list { margin: 0; padding-left: 1.1rem; font-size: .88rem; display: grid; gap: .15rem; }
.domain-summary { display: grid; gap: 1rem; grid-template-columns: auto 1fr; align-items: center; }
@media (max-width: 600px) { .domain-summary { grid-template-columns: 1fr; } }
.domain-summary .big-level { text-align: left; }
.construction-box .bar-lg { margin: .35rem 0 .5rem; }
.building-card.soon { opacity: .55; border-style: dashed; }
.building-card .btn { margin-top: auto; }
.portrait-sm { width: 52px; height: 52px; font-size: 1.8rem; }
.person-card .person-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.person-card.empty-slot { border-style: dashed; justify-content: center; text-align: center; }
.dashboard-quests { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.dashboard-quests li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .5rem; align-items: center; }
.dashboard-quests .bar { grid-column: 1 / -1; }
.tavern-summary { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.tavern-summary p { margin: 0 0 .35rem; }
.rare-text { color: var(--r-epic); }

/* ---------- Talents et spécialisations ---------- */
.check-list { list-style: none; padding: 0; margin: .25rem 0 .75rem; display: grid; gap: .25rem; font-size: .9rem; }
.check-list .ok { color: var(--ok); }
.codex-card.learned { border-color: var(--accent); }
.spec-list { display: grid; gap: .6rem; }
.spec-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.spec-card summary { cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tree { margin-top: .75rem; display: grid; gap: .75rem; }
.tree-branches { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tree-branch { border: 1px solid var(--line); border-radius: 12px; padding: .6rem; display: grid; gap: .45rem; align-content: start; min-width: 0; }
/* Branche non choisie : version compacte (nom des talents seulement). */
.tree-branch.other .node-body p, .tree-branch.other .node-ranks, .tree-branch.other .node-lock { display: none; }
.tree-branch.chosen { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tree-branch.other { opacity: .5; }
.branch-title { margin: 0; }
.tree-node { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; min-width: 0; gap: .5rem; align-items: center; padding: .45rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.tree-node.has-rank { border-color: var(--accent); }
.tree-node.locked { opacity: .6; }
.node-icon { font-size: 1.3rem; width: 34px; text-align: center; }
.node-body p { margin: .1rem 0; }
.node-ranks { display: inline-flex; gap: 3px; }
.pip { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--accent); }
.pip.on { background: var(--accent); }
.node-lock { grid-column: 2; grid-row: 2; margin-top: -.3rem; }
.tree-node.unlimited { border-style: dashed; }
.tree-node.unlimited.has-rank { border-color: var(--gold); }
.chip-max { border-color: var(--gold); color: var(--gold-2); font-weight: 600; }
.form-max { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ---------- Village : contrats, travaux manuels, mini-jeux ---------- */
.reputation-panel { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 700px) { .reputation-panel { grid-template-columns: minmax(220px, 1fr) 2fr; } }
.reputation-panel .big-level { text-align: left; font-size: 1.8rem; margin-bottom: .4rem; }
.reputation-panel .bar { margin: .3rem 0; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.contract-grid, .minigame-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 1rem; }
.contract-grid .panel, .minigame-grid .panel { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.contract-card.vacant { justify-content: center; border-style: dashed; min-height: 120px; }
.contract-ask { margin: 0; font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; }
.contract-ask .small { flex-basis: 100%; color: var(--muted); }
.contract-ask.ok .small strong { color: var(--ok); }
.contract-ask.missing .small strong { color: var(--danger); }
.contract-qty { font-weight: 700; color: var(--gold-2); }
.reward-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.contract-card .person-actions, .minigame .person-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.mg-track { position: relative; height: 34px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mg-zone { position: absolute; top: 0; bottom: 0; background: rgb(232 184 90 / 25%); border-left: 1px solid var(--gold); border-right: 1px solid var(--gold); display: grid; place-items: center; }
.mg-perfect { height: 100%; background: rgb(232 184 90 / 70%); }
.mg-cursor { position: absolute; top: 3px; bottom: 3px; width: 4px; margin-left: -2px; left: 0; background: var(--text); border-radius: 2px; box-shadow: 0 0 6px rgb(255 255 255 / 60%); }
.mg-result { min-height: 1.3em; margin: 0; font-weight: 600; }

.village-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
@media (min-width: 900px) { .grid-2 > div > .panel:last-child { margin-bottom: 0; } }
.rank-me td { background: rgb(232 184 90 / 10%); }
.mail-body { white-space: pre-wrap; word-break: break-all; font-family: inherit; font-size: .85rem; margin: 0; }

/* ---------- Enchantement ---------- */
.section-title { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
.enchant-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 1rem; }
.enchant-grid .panel { margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.rune-sockets { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.rune-sockets li { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.socket-form { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.socket-form select { max-width: 220px; }

/* ---------- Qualité des objets fabriqués ---------- */
.quality-tag { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; border: 1px solid currentColor; }
.q-1 { color: var(--r-uncommon); } .q-2 { color: var(--r-rare); } .q-3 { color: var(--r-epic); } .q-4 { color: var(--r-legendary); }
.q-5 { color: #ff6b8b; } .q-6 { color: #ff4fd8; }
.q-7 { color: #fff; background: linear-gradient(90deg, #ff6b6b, #f0a43a, #5cc98a, #5b9cf0, #b07af0); border-color: transparent; }
.log .log-masterwork { border-left-color: var(--r-legendary); }

.potion-stock { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }

/* ---------- Ferme ---------- */
.farm-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 1rem; }
.farm-grid .panel { margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.plant-form, .buy-seeds { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.buy-seeds input { width: 5rem; }
.farm-plot input[type='checkbox'], .potions-panel input[type='checkbox'] { width: auto; height: auto; }

/* ---------- Prestige : étoile numérotée ---------- */
.prestige-star { position: relative; display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; vertical-align: middle; flex-shrink: 0; }
.prestige-star::before { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.7em; line-height: 1; color: var(--gold); text-shadow: 0 0 4px rgb(232 184 90 / 50%); }
.prestige-star > span { position: relative; font-size: .62em; font-weight: 800; color: #2a1e08; font-family: var(--font-body, inherit); }
.prestige-panel { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

/* ---------- Succès et collection ---------- */
.progress-summary { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 700px) { .progress-summary { grid-template-columns: 200px 1fr; } }
.progress-summary .big-level { text-align: left; }
.achievement-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.achievement { display: flex; gap: .6rem; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.achievement.done { border-color: var(--gold); }
.achievement.todo { opacity: .85; }
.achievement-icon { font-size: 1.6rem; width: 2.2rem; text-align: center; flex-shrink: 0; }
.achievement p { margin: .15rem 0; }
.collection-grid { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.collection-entry { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .1rem; padding: .45rem .3rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.collection-entry.done { border-color: var(--rc, var(--gold)); }
.collection-entry.todo { opacity: .4; filter: grayscale(1); }
.collection-icon { font-size: 1.5rem; }
.milestones { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.milestone { display: flex; flex-direction: column; gap: .25rem; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.milestone.ready { border-color: var(--gold); }
.milestone.claimed { opacity: .6; }

.skill-tag { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); }
.skill-tag strong { color: var(--gold-2); }
.skill-tag .prestige-star { font-size: .8em; }

/* ---------- Boss de région, donjons et familiers ---------- */
.boss-box { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; padding: .6rem .75rem; background: var(--bg-2); display: flex; flex-direction: column; gap: .2rem; }
.boss-box p { margin: 0; }
.region-card .boss-box .btn { margin-top: .35rem; align-self: flex-start; }
.pet-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pet-card { display: flex; gap: .75rem; padding: .75rem; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--rc, var(--line)); border-radius: 10px; }
.pet-card p { margin: 0 0 .25rem; }
.pet-card .pet-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.pet-card select { width: 100%; }
.pet-icon { font-size: 2rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--panel); border-radius: 12px; flex-shrink: 0; }
.pet-tag a { color: inherit; }
.chip-highlight { border-color: var(--gold); }

/* ---------- Statistiques personnelles ---------- */
.stat-tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1rem; }
.stat-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-value { font-family: var(--font-title); font-size: 1.6rem; color: var(--gold); }
.stat-label { color: var(--muted); font-size: .85rem; }
.day-chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: .3rem; height: 160px; align-items: end; overflow-x: auto; }
.day-col { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 22px; }
.day-bars { flex: 1; width: 100%; display: flex; gap: 2px; align-items: flex-end; justify-content: center; }
.day-bar { width: 45%; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar-items, .legend-items { background: var(--r-rare); }
.bar-gold, .legend-gold { background: var(--gold); }
.day-label { font-size: .65rem; color: var(--muted); margin-top: .25rem; white-space: nowrap; }
.legend { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; vertical-align: middle; }
.mg-track { cursor: pointer; }
.mg-button { min-width: 9rem; }
.mg-button.mg-hitting { background: var(--gold); color: var(--bg); box-shadow: 0 0 0 3px rgba(232, 193, 106, .35); }

/* ---------- Événements et histoires ---------- */
.event-banner { display: block; margin-bottom: 1rem; padding: .6rem .9rem; border: 1px solid var(--gold); border-radius: var(--radius); background: var(--panel); color: var(--text); text-decoration: none; }
.event-banner:hover { background: var(--bg-2); }
.story-chapters { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.story-chapter p { margin: 0 0 .25rem; }
.story-text { font-style: italic; color: var(--muted); }
.badge-main { background: var(--gold); color: var(--bg); border-color: var(--gold); }

/* ---------- Plan du domaine ---------- */
.plan-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); }
@media (max-width: 860px) { .plan-layout { grid-template-columns: 1fr; } }
.domain-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; background: #2c3a24; padding: 6px; border-radius: 10px; }
.plan-cell { aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .06); border-radius: 6px; background: #3d5230; font-size: clamp(1rem, 3.2vw, 1.8rem); display: grid; place-items: center; cursor: pointer; padding: 0; line-height: 1; }
.plan-cell.kind-building { background: #5b4a35; }
.plan-cell.empty:hover, .domain-grid.placing .plan-cell.empty { background: #4a6339; }
.plan-cell.selected { outline: 3px solid var(--gold); outline-offset: -2px; }
.palette { display: flex; flex-direction: column; gap: .4rem; max-height: 420px; overflow-y: auto; }
.palette-item { display: flex; gap: .6rem; align-items: center; text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: .4rem; color: var(--text); cursor: pointer; }
.palette-item.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 193, 106, .35); }

/* ---------- Illustrations ---------- */
.region-art { display: block; width: calc(100% + 2rem); margin: -1rem -1rem .25rem; height: 120px; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.region-card.locked .region-art { filter: grayscale(.8) brightness(.7); }
.art-medallion { width: 44px; height: 44px; vertical-align: middle; margin-right: .4rem; }
.art-medallion.art-lg { width: 64px; height: 64px; margin: 0; }
.boss-line { display: flex; align-items: center; gap: .2rem; }
.portrait-art { object-fit: cover; padding: 0; background: none; }
img.portrait { border-radius: 50%; }
.avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; margin-right: .4rem; }
.nav-icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; color: var(--gold); }

/* ---------- Social ---------- */
.bundle-input { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: .5rem; }
@media (max-width: 600px) { .bundle-input { grid-template-columns: 1fr; } }
.chat { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.chat-line { margin: 0; padding: .4rem .6rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.chat-line.mine { align-self: flex-end; border-color: var(--gold); }
.bar-hp span { background: linear-gradient(90deg, #c1121f, #e85d04); }
/* Formulaire « en ligne » : les champs côte à côte (sans hériter de la colonne de .form). */
.form-inline { display: flex; flex-direction: row; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }

/* ==========================================================================
   Thème « Lune d'ambre » : polices, fond d'ambiance, cadres ornés, boutons brillants.
   (Surcharge le thème de base ci-dessus : à garder en fin de fichier.)
   ========================================================================== */
:root {
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Cinzel', Georgia, serif;
  --font-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --panel: rgb(33 25 50 / 88%);
  --panel-2: rgb(46 35 68 / 92%);
  --line: rgb(232 184 90 / 18%);
  --glow: 0 0 18px rgb(255 200 97 / 25%);
}
body {
  font-weight: 600;
  background:
    radial-gradient(900px 500px at 85% -10%, rgb(255 200 97 / 16%), transparent 60%),
    radial-gradient(1000px 700px at 0% 110%, rgb(120 70 170 / 22%), transparent 60%),
    url('/static/assets/ambiance.svg') center / cover fixed,
    linear-gradient(180deg, #160e24 0%, #120b1d 60%, #0d0816 100%) fixed;
}
h1, .page-title { font-family: var(--font-display); }
h2 { letter-spacing: .04em; }
.panel h2, .section-title, .page-title {
  background: linear-gradient(180deg, #fff1c9, #e8b85a 70%, #b98632);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-title { font-size: 1.35rem; text-shadow: none; }

/* Panneaux : verre sombre, filet doré en haut, coins éclairés. */
.panel, .region-card, .codex-card, .quest-card, .pet-card, .stat-tile, .auth-card {
  background: linear-gradient(180deg, rgb(52 39 78 / 92%), rgb(26 19 40 / 94%));
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgb(0 0 0 / 40%), inset 0 1px 0 rgb(255 230 170 / 10%);
  backdrop-filter: blur(4px);
  position: relative;
}
.panel::before, .region-card::before, .auth-card::before {
  content: ''; position: absolute; left: 12%; right: 12%; top: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #f4d28a, transparent); opacity: .7; pointer-events: none;
}
.panel-highlight { border-color: rgb(244 210 138 / 55%); box-shadow: 0 12px 30px rgb(0 0 0 / 40%), var(--glow); }
.region-card, .codex-card, .pet-card { transition: transform .15s ease, box-shadow .15s ease; }
.region-card:hover, .codex-card:hover, .pet-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgb(0 0 0 / 50%), var(--glow); }

/* Boutons brillants, arrondis. */
.btn {
  border-radius: 999px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(180deg, rgb(78 60 112), rgb(48 36 72)); border: 1px solid rgb(244 210 138 / 25%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 3px 10px rgb(0 0 0 / 35%);
  transition: transform .1s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(1.12); border-color: rgb(244 210 138 / 50%); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #ffe08f 0%, #f2b84b 45%, #d18d24 100%); color: #2a1904; border-color: #b97a1c;
  text-shadow: 0 1px 0 rgb(255 240 200 / 60%);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 45%), inset 0 -3px 0 rgb(120 70 10 / 35%), 0 4px 14px rgb(242 184 75 / 30%);
}
.btn-primary:hover { box-shadow: inset 0 2px 0 rgb(255 255 255 / 45%), inset 0 -3px 0 rgb(120 70 10 / 35%), 0 6px 20px rgb(242 184 75 / 45%); }
.btn-ghost { background: rgb(255 255 255 / 4%); box-shadow: none; }
.btn-green { background: linear-gradient(180deg, #9be37a, #4fae3e 55%, #2f7d28); color: #0e2408; border-color: #2c6e24; text-shadow: 0 1px 0 rgb(220 255 200 / 50%); }

/* Puces, badges, barres. */
.chip { background: linear-gradient(180deg, rgb(70 54 100), rgb(44 33 66)); border-color: rgb(244 210 138 / 20%); font-weight: 700; }
.chip.active { background: linear-gradient(180deg, #ffe08f, #e2a640); color: #2a1904; border-color: #b97a1c; }
.badge { background: rgb(0 0 0 / 25%); }
.badge-main { background: linear-gradient(180deg, #ffe08f, #e2a640); color: #2a1904; border-color: #b97a1c; }
.bar { background: rgb(0 0 0 / 35%); border-color: rgb(244 210 138 / 15%); }
.bar-goal > span { background: linear-gradient(90deg, #d18d24, #ffd27a); box-shadow: 0 0 8px rgb(255 210 122 / 50%); }

/* Menu et barre du haut : bois sombre et verre. */
.sidebar { background: linear-gradient(180deg, rgb(24 16 38 / 96%), rgb(15 10 25 / 97%)); border-right: 1px solid var(--line); }
.side-nav a.active, .nav-group summary.has-active { background: linear-gradient(90deg, rgb(242 184 75 / 22%), transparent); color: #ffe2a0; box-shadow: inset 3px 0 0 #f2b84b; }
.topbar { background: rgb(20 13 32 / 75%); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.gold-pill { background: linear-gradient(180deg, rgb(70 52 30), rgb(40 28 14)); border-color: rgb(242 184 75 / 45%); color: #ffe2a0; }
.brand { font-family: var(--font-display); background: linear-gradient(180deg, #fff1c9, #e8b85a 60%, #a8741f); -webkit-background-clip: text; background-clip: text; color: transparent; }
input, select, textarea { background: rgb(10 6 18 / 60%); border-color: rgb(244 210 138 / 20%); }

/* Lucioles discrètes (désactivées si l'utilisateur préfère moins d'animations). */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(2px 2px at 20% 30%, rgb(255 214 130 / 70%), transparent), radial-gradient(2px 2px at 75% 60%, rgb(255 214 130 / 60%), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgb(255 214 130 / 60%), transparent), radial-gradient(1.5px 1.5px at 88% 20%, rgb(255 214 130 / 50%), transparent);
  animation: fireflies 9s ease-in-out infinite alternate;
}
@keyframes fireflies { from { opacity: .35; transform: translateY(0); } to { opacity: .9; transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { body::after { animation: none; } }
.shell, .auth-shell, .public { position: relative; z-index: 1; }

/* ---------- Carte interactive du monde (page Carte du monde) ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.view-toggle { display: inline-flex; gap: .25rem; padding: .2rem; border-radius: 999px; background: rgb(0 0 0 / 25%); border: 1px solid var(--line); }
.view-toggle .chip { font-size: .85rem; padding: .3rem .9rem; }
.wmap {
  position: relative; overflow: hidden; height: min(72vh, 640px); min-height: 340px; margin-bottom: 1.5rem;
  border-radius: 16px; border: 2px solid rgb(244 210 138 / 45%); background: #10284a;
  box-shadow: 0 16px 40px rgb(0 0 0 / 45%), inset 0 0 0 1px rgb(0 0 0 / 40%);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none;
}
.wmap:focus-visible { border-color: var(--gold); }
.wmap.is-dragging { cursor: grabbing; }
.wmap:fullscreen { height: 100vh; border-radius: 0; border: 0; }
.wmap.is-expanded { position: fixed; inset: 0; z-index: 70; height: auto; border-radius: 0; margin: 0; }
.wmap-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; --inv: 1; }
@property --inv { syntax: '<number>'; inherits: true; initial-value: 1; }
.wmap-inner.is-smooth { transition: transform .3s ease, --inv .3s ease; }
.wmap-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wmap-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wmap-route path { fill: none; stroke: rgb(255 240 210 / 35%); stroke-width: 3; stroke-dasharray: 2 9; stroke-linecap: round; }
.wmap-route path.open { stroke: rgb(255 214 130 / 85%); }

/* Brouillard sur les régions verrouillées : nuages qui dérivent doucement. */
.wmap-fog {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 40%, rgb(250 240 225 / 96%) 0 22%, transparent 23%),
    radial-gradient(circle at 55% 30%, rgb(255 248 235 / 96%) 0 24%, transparent 25%),
    radial-gradient(circle at 72% 52%, rgb(245 232 215 / 96%) 0 22%, transparent 23%),
    radial-gradient(circle at 45% 62%, rgb(240 228 212 / 96%) 0 26%, transparent 27%),
    radial-gradient(circle at 22% 62%, rgb(236 222 205 / 94%) 0 18%, transparent 19%),
    radial-gradient(circle at 80% 30%, rgb(250 240 225 / 92%) 0 15%, transparent 16%),
    radial-gradient(ellipse at 50% 50%, rgb(230 215 200 / 85%) 0 45%, transparent 70%);
  filter: drop-shadow(0 6px 10px rgb(10 20 40 / 45%));
}
.wmap-fog.small { opacity: .95; }

/* Marqueurs : même taille à l'écran quel que soit le zoom (--inv = 1 / zoom). */
.wmap-pin {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; border: 0; background: none;
  transform: translate(-50%, -50%) scale(var(--inv)); cursor: pointer; color: inherit; font: inherit; z-index: 2;
}
.wmap-medal {
  width: 54px; height: 54px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  border: 3px solid #f2d48a; background: #2a1d3c; font-size: 1.6rem; font-weight: 800; color: #5b4a6e;
  box-shadow: 0 4px 12px rgb(0 0 0 / 55%), 0 0 0 2px rgb(0 0 0 / 35%); transition: transform .2s ease, box-shadow .2s ease;
}
.wmap-medal img { width: 100%; height: 100%; object-fit: cover; }
.wmap-pin.dungeon .wmap-medal { width: 42px; height: 42px; font-size: 1.25rem; border-color: #c9a3ff; }
.wmap-pin.locked .wmap-medal { background: radial-gradient(circle at 35% 30%, #ffffff, #c9c2cf 60%, #8f8696); border-color: #e8e1ec; color: #4b4252; }
.wmap-label {
  font-family: var(--font-title); font-weight: 800; font-size: .78rem; white-space: nowrap; padding: .12rem .5rem; border-radius: 6px;
  background: linear-gradient(180deg, #fff6df, #e7d3ad); color: #3b2610; border: 1px solid #9c7a43; box-shadow: 0 2px 6px rgb(0 0 0 / 45%);
}
.wmap-pin.locked .wmap-label { background: linear-gradient(180deg, #f3eff5, #d6cfdb); color: #4b4252; border-color: #8f8696; }
.wmap-pin:hover .wmap-medal, .wmap-pin:focus-visible .wmap-medal, .wmap-pin.is-open .wmap-medal { transform: scale(1.12); box-shadow: 0 0 0 3px rgb(255 214 130 / 60%), 0 6px 16px rgb(0 0 0 / 55%); }
.wmap-pin:focus-visible { outline: none; }
.wmap-heroes { position: absolute; top: -10px; right: -18px; display: flex; }
.wmap-heroes img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #7be07a; background: #1b1428; margin-left: -8px; box-shadow: 0 2px 6px rgb(0 0 0 / 50%); }

.wmap-controls { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.wmap-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid #b98f45; cursor: pointer; font-size: 1.1rem; font-weight: 800; line-height: 1;
  background: linear-gradient(180deg, #fff3d6, #e2c48a); color: #3b2610; box-shadow: 0 3px 8px rgb(0 0 0 / 45%);
}
.wmap-btn:hover { filter: brightness(1.08); }
.wmap-full { position: absolute; left: 12px; bottom: 12px; z-index: 3; }

.wmap-card {
  position: absolute; left: 12px; right: 60px; bottom: 12px; max-width: 420px; z-index: 4; cursor: auto; user-select: text;
  padding: .8rem 1rem; border-radius: 14px; background: rgb(22 15 36 / 94%); border: 1px solid rgb(244 210 138 / 45%);
  box-shadow: 0 12px 30px rgb(0 0 0 / 55%); backdrop-filter: blur(6px);
}
.wmap-card[hidden] { display: none; }
.wmap-card.at-top { top: 12px; bottom: auto; }
.wmap-card p { margin: .2rem 0; }
.wmap-card-title { padding-right: 1.6rem; font-size: 1.05rem; }
.wmap-card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.wmap-close { position: absolute; top: .4rem; right: .5rem; background: none; border: 0; color: var(--muted); font-size: 1rem; cursor: pointer; }
.wmap-card ~ .wmap-full { bottom: 12px; }
@media (max-width: 600px) {
  .wmap { height: 62vh; }
  .wmap-card { left: 8px; right: 8px; bottom: 56px; max-width: none; }
  .wmap-card.at-top { top: 8px; bottom: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .wmap-fog { animation: wmap-fog 9s ease-in-out infinite alternate; }
  .wmap-fog:nth-of-type(2n) { animation-duration: 12s; animation-direction: alternate-reverse; }
  .wmap-route path.open { animation: wmap-route 1.6s linear infinite; }
  .wmap-pin.has-heroes .wmap-heroes img { animation: wmap-bob 1.6s ease-in-out infinite alternate; }
  .wmap-card:not([hidden]) { animation: fx-toast-in .25s ease-out; }
}
@keyframes wmap-fog { from { transform: translate(-50%, -50%) scale(1); } to { transform: translate(-47%, -52%) scale(1.04); } }
@keyframes wmap-route { to { stroke-dashoffset: -22; } }
@keyframes wmap-bob { to { transform: translateY(-4px); } }
.region-grid[hidden], .wmap[hidden] { display: none; }

/* Portraits en grand (Mes assistants, Talents, Personnage) : visage visible, cadre à la couleur de la rareté. */
.portrait-banner {
  margin: -1rem -1rem .25rem; height: 200px; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 2px solid var(--rc, var(--gold)); background: radial-gradient(circle at 50% 35%, #3b2f57, #1c1628);
}
.portrait-banner img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; display: block; }
.portrait-lg { width: 128px; height: 128px; border-radius: 18px; border: 3px solid var(--rc, var(--gold)); object-position: 50% 25%; box-shadow: 0 8px 20px rgb(0 0 0 / 45%); }
img.portrait.portrait-lg { border-radius: 18px; }
.avatar { width: 34px; height: 34px; object-fit: cover; object-position: 50% 25%; border: 2px solid rgb(244 210 138 / 50%); }
@media (prefers-reduced-motion: no-preference) {
  .portrait-banner img { transition: transform .6s ease; }
  .person-card:hover .portrait-banner img { transform: scale(1.05); }
}
@media (max-width: 600px) { .portrait-banner { height: 170px; } .portrait-lg { width: 96px; height: 96px; } }
/* Portrait dessiné (carré, déjà cadré) : affiché en entier plutôt que recadré. */
.portrait-banner.is-drawn { display: grid; place-items: center; }
.portrait-banner.is-drawn img { width: 180px; height: 180px; object-fit: contain; }
@media (max-width: 600px) { .portrait-banner.is-drawn img { width: 150px; height: 150px; } }
img.portrait-lg.is-drawn { object-fit: contain; }
.quest-head:has(.portrait-lg) { margin-bottom: .75rem; align-items: flex-start; }

/* ---------- Carte du monde : nuages illustrés et éditeur (développement) ---------- */
.wmap-fog.cleared { display: none; }
/* Image de nuages déposée (art/site/fog.webp) : remplace les nuages dessinés. */
.wmap.has-fog-img .wmap-fog { background: var(--fog-img) center / 100% 100% no-repeat; border-radius: 0; filter: none; }
.wmap.has-fog-img.fog-screen .wmap-fog { mix-blend-mode: screen; }
.wmap.has-fog-img.fog-normal .wmap-fog { filter: drop-shadow(0 6px 10px rgb(10 20 40 / 40%)); }
.wmap-inner { isolation: isolate; }

.wmap-editbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: -.25rem 0 .5rem; }
.wmap.is-editing { cursor: default; border-color: #7fd0ff; }
.wmap.is-editing .wmap-fog { pointer-events: auto; cursor: move; outline: 2px dashed rgb(127 208 255 / 70%); outline-offset: -2px; animation: none; }
.wmap.is-editing .wmap-fog.cleared { display: block; opacity: .45; }
.wmap.is-editing .wmap-pin { cursor: move; }
.wmap.is-editing .is-selected { outline: 3px solid #ffd27a; outline-offset: 2px; }
.wmap.is-editing .wmap-pin.is-selected { outline: none; }
.wmap.is-editing .wmap-pin.is-selected .wmap-medal { box-shadow: 0 0 0 4px #ffd27a, 0 6px 16px rgb(0 0 0 / 55%); }
.wmap.hide-fogs .wmap-fog { opacity: 0 !important; pointer-events: none !important; }
.wmap-editor {
  position: absolute; top: 12px; right: 12px; width: min(330px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; z-index: 5;
  padding: .8rem 1rem; border-radius: 14px; background: rgb(16 22 40 / 95%); border: 1px solid #7fd0ff; box-shadow: 0 12px 30px rgb(0 0 0 / 55%); cursor: auto;
}
.wmap-editor[hidden] { display: none; }
.wmap-editor p { margin: .2rem 0; }
.wmap-editor label { display: block; margin: .35rem 0; }
.wmap-editor input[type='range'] { width: 100%; }
.wmap-editor-files { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .4rem; }
.wmap-editor-files input[type='file'] { display: block; max-width: 100%; margin-top: .2rem; }
.wmap-editor label.check { display: flex; gap: .45rem; align-items: center; }
.wmap-editor input[type='checkbox'] { width: 1rem; height: 1rem; flex: none; margin: 0; }
/* Modes de l'éditeur : le curseur dit ce que le glisser va faire. */
.wmap.is-editing[data-ed-mode='pan'] .wmap-pin, .wmap.is-editing[data-ed-mode='pan'] .wmap-fog { cursor: pointer; }
.wmap.is-editing[data-ed-mode='pins'] .wmap-fog { cursor: grab; }
.wmap.is-editing[data-ed-mode='fogs'] .wmap-pin { cursor: move; }
.wmap.is-editing[data-ed-mode='pins'] .wmap-fog { outline-color: rgb(127 208 255 / 30%); }
.wmap.is-editing .is-locked, .wmap.is-editing.is-panning, .wmap.is-editing.is-panning * { cursor: grab !important; }
.wmap.is-editing.is-panning.is-dragging, .wmap.is-editing.is-panning.is-dragging * { cursor: grabbing !important; }
.wmap.is-editing .wmap-fog.is-locked { outline-style: solid; outline-color: rgb(255 210 122 / 55%); }
.wmap.is-editing .wmap-pin.is-locked::after {
  content: '🔒'; position: absolute; top: -8px; left: -10px; font-size: .9rem; line-height: 1; padding: 2px; border-radius: 50%;
  background: #1c1628; border: 1px solid #ffd27a;
}
.wmap-editor-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.wmap-editor-head .wmap-card-title { padding: 0; }
.wmap-editor.is-collapsed { width: auto; }
.wmap-editor.is-collapsed .wmap-editor-body { display: none; }
.wmap-ed-modes { display: flex; gap: .3rem; margin: .4rem 0 .2rem; }
.wmap-ed-modes .btn { flex: 1; }
.wmap-editor select { width: 100%; margin-top: .2rem; }
.wmap-ed-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.wmap-ed-xy { display: flex; gap: .5rem; }
.wmap-ed-xy label { flex: 1; display: flex; align-items: center; gap: .35rem; }
.wmap-ed-xy input { width: 100%; min-width: 0; }
.wmap-editor-place { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .4rem; }
.wmap-editor input:disabled { opacity: .45; }

/* ---------- Fiche d'objet animée (item-card.js) ---------- */
.icard-dialog { padding: 0; border: 0; background: none; max-width: min(400px, calc(100vw - 24px)); width: 100%; overflow: visible; perspective: 1100px; }
.icard-dialog::backdrop { background: rgb(8 5 14 / 72%); backdrop-filter: blur(3px); }
.icard {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 30%; --rc: var(--r-common);
  position: relative; overflow: hidden; outline: none; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin;
  padding: 1rem 1.1rem .8rem; border-radius: 20px; color: var(--text);
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--rc) 26%, transparent), transparent 60%),
    linear-gradient(180deg, #2a1c36, #160f20 70%);
  border: 2px solid color-mix(in srgb, var(--rc) 70%, #fff3d6);
  box-shadow: 0 0 0 4px rgb(0 0 0 / 35%), 0 0 34px color-mix(in srgb, var(--rc) 55%, transparent), 0 24px 60px rgb(0 0 0 / 60%), inset 0 0 0 1px rgb(255 255 255 / 8%);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform .15s ease-out;
}
.icard-shine {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 0;
  background: radial-gradient(circle at var(--mx) var(--my), rgb(255 255 255 / 14%), transparent 45%);
}
.icard > *:not(.icard-shine) { position: relative; z-index: 1; }
.icard-head { display: flex; align-items: center; gap: .5rem; }
.icard-level { font-weight: 800; font-size: .78rem; padding: .1rem .55rem; border-radius: 999px; background: linear-gradient(180deg, #ffe08f, #e2a640); color: #2a1904; }
.icard-slot { margin-left: auto; font-family: var(--font-title); font-weight: 800; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .6rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--rc) 60%, #fff); }
.icard-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: rgb(0 0 0 / 35%); color: var(--text); cursor: pointer; }
.icard-name { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.15; margin: .5rem 0 .6rem; color: #fff3d6; text-shadow: 0 2px 8px rgb(0 0 0 / 60%); }
.icard-visual {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; margin-bottom: .7rem; border-radius: 14px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc) 35%, #3a2730), #1a1016 75%);
  border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); box-shadow: inset 0 0 30px rgb(0 0 0 / 55%);
}
.icard-visual img { width: 100%; height: 100%; object-fit: cover; }
.icard-emoji { font-size: 6.5rem; filter: drop-shadow(0 10px 18px rgb(0 0 0 / 55%)); transform: translateZ(40px); }
.icard-rarity { position: absolute; top: .55rem; left: .55rem; font-size: .7rem; font-weight: 800; padding: .1rem .5rem; border-radius: 999px; background: rgb(0 0 0 / 50%); color: var(--rc); border: 1px solid var(--rc); }
.icard-stats { list-style: none; margin: 0 0 .6rem; padding: .55rem .75rem; border-radius: 12px; background: rgb(0 0 0 / 28%); border: 1px solid color-mix(in srgb, var(--rc) 35%, var(--line)); display: grid; gap: .2rem; }
.icard-stats li { font-weight: 700; font-size: .92rem; }
.icard-stats li.is-good { color: #9be37a; }
.icard-stats li.is-bad { color: #ff8a7a; }
.icard-desc { margin-bottom: .6rem; padding: .5rem .75rem; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; background: rgb(0 0 0 / 20%); }
.icard-desc p { margin: 0; font-style: italic; font-size: .88rem; color: #e3d6f0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard-desc.is-open p { -webkit-line-clamp: unset; }
.icard-link { display: block; margin-left: auto; background: none; border: 0; color: var(--gold); font-weight: 700; font-size: .8rem; cursor: pointer; }
.icard-section { margin-bottom: .55rem; border-radius: 12px; background: rgb(0 0 0 / 25%); border: 1px solid var(--line); }
.icard-section > summary { cursor: pointer; padding: .45rem .7rem; font-weight: 800; font-size: .88rem; list-style-position: inside; }
.icard-section > :not(summary) { margin: 0 .7rem .5rem; }
.icard-count { float: right; color: var(--gold); }
.icard-set-desc { font-size: .8rem; color: #cfc2dd; }
.icard-muted { color: var(--muted); font-size: .78rem; }
.icard-pieces { list-style: none; padding: 0; display: grid; gap: .25rem; }
.icard-pieces button {
  width: 100%; display: grid; grid-template-columns: 1.6rem 1fr auto; grid-template-rows: auto auto; column-gap: .4rem; align-items: center; text-align: left;
  padding: .25rem .45rem; border-radius: 8px; border: 1px solid transparent; background: rgb(255 255 255 / 4%); color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem;
}
.icard-pieces button > span:first-child { grid-row: span 2; font-size: 1.1rem; filter: grayscale(.7); opacity: .7; }
.icard-piece-name { font-weight: 700; }
.icard-piece-slot { grid-column: 2; font-size: .7rem; opacity: .8; }
.icard-piece-state { grid-column: 3; grid-row: 1 / span 2; font-size: .7rem; }
.icard-pieces li.is-worn button { color: var(--text); border-color: rgb(155 227 122 / 45%); background: rgb(155 227 122 / 8%); }
.icard-pieces li.is-worn button > span:first-child { filter: none; opacity: 1; }
.icard-pieces li.is-worn .icard-piece-state { color: #9be37a; }
.icard-pieces li.is-current button { border-color: color-mix(in srgb, var(--rc) 70%, transparent); }
.icard-pieces button:hover { background: rgb(255 255 255 / 9%); }
.icard-tiers { list-style: none; padding: 0; display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.icard-tiers li.is-active { color: #ffe2a0; }
.icard-tiers li.is-active strong { color: #9be37a; }
.icard-list { padding-left: 1.1rem; font-size: .8rem; }
.icard-foot { display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: space-between; font-size: .8rem; color: var(--muted); padding-top: .5rem; border-top: 1px solid var(--line); }
[data-item-card] { cursor: pointer; }
.item-card-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.item-card-btn:hover { color: var(--gold-2); text-decoration: underline dotted; }
@media (prefers-reduced-motion: no-preference) {
  .icard-dialog[open] .icard { animation: icard-in .45s cubic-bezier(.2, 1.3, .4, 1); }
  .icard-emoji { animation: icard-float 3.2s ease-in-out infinite alternate; }
  .icard.rarity-legendary, .icard.rarity-epic { animation: icard-in .45s cubic-bezier(.2, 1.3, .4, 1), icard-glow 2.6s ease-in-out .45s infinite alternate; }
}
@keyframes icard-in { from { opacity: 0; transform: translateY(30px) rotateX(18deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes icard-float { from { transform: translateY(-4px) translateZ(40px); } to { transform: translateY(5px) translateZ(40px); } }
@keyframes icard-glow { from { box-shadow: 0 0 0 4px rgb(0 0 0 / 35%), 0 0 24px color-mix(in srgb, var(--rc) 45%, transparent), 0 24px 60px rgb(0 0 0 / 60%); } to { box-shadow: 0 0 0 4px rgb(0 0 0 / 35%), 0 0 46px color-mix(in srgb, var(--rc) 75%, transparent), 0 24px 60px rgb(0 0 0 / 60%); } }

/* Panoplies (page Équipement) */
.icard-open { background: none; border: 0; cursor: pointer; font-size: .9rem; padding: 0 .2rem; opacity: .75; }
.icard-open:hover { opacity: 1; transform: scale(1.15); }
.set-list { display: grid; gap: .6rem; }
.set-card { padding: .55rem .75rem; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.set-title { display: flex; align-items: center; gap: .4rem; margin: 0 0 .3rem; }
.set-count { margin-left: auto; font-weight: 800; color: var(--gold); }
.set-tiers { list-style: none; margin: 0; padding: 0; font-size: .82rem; color: var(--muted); display: grid; gap: .15rem; }
.set-tiers li.is-active { color: #ffe2a0; }
.set-tiers li.is-active strong { color: #9be37a; }
.set-tiers strong { display: inline-block; min-width: 1.4rem; }
.guide-grid > .guide-wide { grid-column: 1 / -1; }
.guide-wide .set-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* Boutons d'action toujours visibles en bas de la fiche (même quand elle défile). */
.icard > .icard-actions {
  display: flex; justify-content: flex-end; gap: .5rem; padding: .6rem 0 .2rem; margin-top: .5rem; border-top: 1px solid var(--line);
  position: sticky; bottom: -.8rem; z-index: 2; background: linear-gradient(180deg, rgb(22 15 32 / 92%), #160f20 45%);
}

/* Lien d'obtention / d'usage (fiche d'objet) et endroit atteint par un lien */
.icard-goto { color: inherit; text-decoration: none; display: inline; border-bottom: 1px dotted rgb(244 210 138 / 45%); }
.icard-goto:hover { color: var(--gold-2); border-bottom-color: var(--gold-2); }
.icard-goto span { color: var(--gold); font-weight: 800; }
.is-target { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: var(--radius); }
@media (prefers-reduced-motion: no-preference) { .is-target { animation: target-flash 1.6s ease-out 2; } }
@keyframes target-flash { 0%, 100% { outline-color: var(--gold); } 50% { outline-color: transparent; } }

/* ---------- Navigation : fil d'Ariane, pages voisines, raccourcis du tableau de bord ---------- */
.crumbs { margin: -.25rem 0 1rem; }
.crumbs-path { margin: 0 0 .45rem; font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.crumbs-path a { color: var(--muted); }
.crumbs-path a:hover { color: var(--gold-2); }
.crumbs-path strong { color: var(--text); }
.crumbs-path .nav-icon { width: 1em; height: 1em; vertical-align: -.12em; }
.crumbs-siblings { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
.crumb-chip {
  flex: none; display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .75rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  color: var(--text); text-decoration: none; background: rgb(255 255 255 / 5%); border: 1px solid var(--line); white-space: nowrap;
}
.crumb-chip:hover { border-color: rgb(244 210 138 / 50%); background: rgb(244 210 138 / 8%); }
.crumb-chip.active { background: linear-gradient(180deg, #ffe08f, #e2a640); color: #2a1904; border-color: #b97a1c; }
.crumb-chip .nav-level { font-size: .7rem; }
.shortcuts-grid { display: grid; gap: 1rem 1.5rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 800px) { .shortcuts-grid { grid-template-columns: 1fr; } }
.shortcuts-panel h2 { margin-top: 0; }
.todo-list { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.todo-tile {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 12px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: .9rem; background: var(--bg-2); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); transition: transform .15s ease, border-color .15s ease;
}
.todo-tile:hover { transform: translateY(-2px); border-color: rgb(244 210 138 / 45%); }
.todo-tile.tone-good { border-left-color: var(--ok); }
.todo-tile.tone-warn { border-left-color: #f2b84b; }
.todo-icon { font-size: 1.3rem; }
.todo-go { color: var(--gold); font-weight: 800; }
.recent-pages { display: flex; flex-wrap: wrap; gap: .4rem; }
.recent-chip { display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .75rem; border-radius: 999px; background: rgb(255 255 255 / 5%); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 700; }
.recent-chip:hover { border-color: rgb(244 210 138 / 50%); }
.crumbs-siblings { flex-wrap: wrap; overflow: visible; }
@media (max-width: 700px) { .crumbs-siblings { flex-wrap: nowrap; overflow-x: auto; } }

/* ---------- Barre latérale : sections, recherche, accès rapide, mode compact ---------- */
.sidebar { gap: .9rem; }
.side-nav { gap: .1rem; }
.nav-section {
  margin: .7rem .4rem .2rem; font-family: var(--font-title); font-size: .68rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: rgb(244 210 138 / 55%);
}
.nav-section[hidden] { display: none; }
.nav-group[hidden], .side-nav a[hidden] { display: none; }
.nav-count { margin-left: auto; font-size: .68rem; color: var(--muted); opacity: .7; }
.nav-group summary::after { margin-left: .35rem; }
.nav-group[open] .nav-count { opacity: 0; }
.nav-search {
  display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: 10px;
  background: rgb(10 6 18 / 55%); border: 1px solid rgb(244 210 138 / 18%);
}
.nav-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgb(242 184 75 / 18%); }
.nav-search input { flex: 1; min-width: 0; border: 0; background: none; padding: .2rem 0; color: var(--text); font: inherit; font-size: .9rem; outline: none; box-shadow: none; }
.nav-search input::-webkit-search-cancel-button { filter: invert(.7); }
.nav-kbd { font-size: .7rem; padding: 0 .35rem; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.nav-search:focus-within .nav-kbd { display: none; }
/* Accès rapide : 4 grandes cases sur deux colonnes. */
.nav-quick { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin-bottom: .2rem; }
.nav-quick a { flex-direction: column; align-items: flex-start; gap: .25rem; padding: .55rem .6rem; font-size: .82rem; font-weight: 700; background: rgb(255 255 255 / 4%); border: 1px solid var(--line); }
.nav-quick a .nav-icon { width: 1.35em; height: 1.35em; }
.nav-quick a.active { box-shadow: inset 0 -3px 0 #f2b84b; }
body.nav-filtering .nav-quick { display: flex; flex-direction: column; }
body.nav-filtering .nav-quick a { flex-direction: row; }
.nav-empty { margin: .5rem .4rem; }
/* Pied du menu : aide et informations, plus discrets. */
.nav-foot { display: flex; flex-direction: column; gap: .1rem; margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--line); }
.nav-foot a { padding: .4rem .75rem; border-radius: 10px; color: var(--muted); display: flex; align-items: center; gap: .35rem; font-size: .88rem; }
.nav-foot a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-foot a.active { color: var(--gold-2); }
.nav-compact-toggle {
  display: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgb(255 255 255 / 5%);
  color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1;
}
.nav-compact-toggle:hover { color: var(--gold-2); border-color: rgb(244 210 138 / 45%); }

@media (min-width: 900px) {
  .nav-compact-toggle { display: inline-grid; place-items: center; }
  /* Mode compact : une colonne d'icônes ; les noms apparaissent au survol (infobulle). */
  body.nav-compact .sidebar { width: 72px; padding: 1rem .5rem; align-items: center; }
  body.nav-compact .sidebar .nav-label,
  body.nav-compact .nav-search, body.nav-compact .nav-section, body.nav-compact .nav-count,
  body.nav-compact .nav-sub, body.nav-compact .nav-level, body.nav-compact .prestige-star { display: none !important; }
  body.nav-compact .sidebar-head { flex-direction: column; }
  body.nav-compact .nav-quick { grid-template-columns: 1fr; }
  body.nav-compact .side-nav a, body.nav-compact .nav-group summary, body.nav-compact .nav-foot a { justify-content: center; padding: .6rem; }
  body.nav-compact .nav-quick a { align-items: center; }
  body.nav-compact .nav-group summary::after { display: none; }
  body.nav-compact .nav-icon { width: 1.35em; height: 1.35em; }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
  .sidebar { transition: width .2s ease, padding .2s ease; }
}
@media (max-width: 899px) { .nav-kbd { display: none; } }

/* ---------- Éditeur de personnage ---------- */
.look-editor { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 760px) { .look-editor { grid-template-columns: 1fr; } }
.look-preview { position: sticky; top: 80px; display: grid; gap: .6rem; justify-items: center; }
.look-portrait {
  width: 100%; max-width: 260px; aspect-ratio: 1; padding: 10px; border-radius: 24px;
  background: radial-gradient(circle at 50% 35%, rgb(242 184 75 / 22%), transparent 70%), rgb(0 0 0 / 25%);
  border: 1px solid rgb(244 210 138 / 35%); box-shadow: 0 14px 34px rgb(0 0 0 / 45%);
}
.look-portrait img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 14px rgb(0 0 0 / 45%)); }
.look-preview-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
@media (max-width: 760px) { .look-preview { position: static; } .look-portrait { max-width: 200px; } }
.look-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.look-tab { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: rgb(255 255 255 / 5%); color: var(--text); font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.look-tab.active { background: linear-gradient(180deg, #ffe08f, #e2a640); color: #2a1904; border-color: #b97a1c; }
.look-page[hidden] { display: none; }
.look-field { border: 0; padding: 0; margin: 0 0 .9rem; }
.look-field legend { font-family: var(--font-title); font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: rgb(244 210 138 / 75%); margin-bottom: .35rem; }
.look-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.look-option { position: relative; cursor: pointer; }
.look-option input { position: absolute; opacity: 0; pointer-events: none; }
.look-chip { display: inline-block; padding: .35rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font-size: .85rem; font-weight: 700; }
.look-option:hover .look-chip { border-color: rgb(244 210 138 / 50%); }
.look-option input:checked + .look-chip { border-color: var(--gold); background: rgb(242 184 75 / 16%); color: #ffe2a0; box-shadow: 0 0 0 1px var(--gold) inset; }
.look-option input:focus-visible + .look-chip, .look-option input:focus-visible + .look-swatch { outline: 2px solid var(--gold); outline-offset: 2px; }
.look-swatch { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 2px solid rgb(255 255 255 / 18%); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 20%); }
.look-option input:checked + .look-swatch { border-color: #fff; box-shadow: 0 0 0 3px var(--gold), inset 0 -3px 0 rgb(0 0 0 / 20%); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.look-save-bar { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.portrait-edit { display: grid; gap: .5rem; justify-items: center; }
.auth-card .look-editor { grid-template-columns: 1fr; }
.auth-card .look-portrait { max-width: 180px; }
.auth-card .look-preview { position: static; }
.auth-card:has(.look-editor) { max-width: 760px; }
@media (min-width: 761px) { .auth-card .look-editor { grid-template-columns: 200px minmax(0, 1fr); } }

/* Ingrédient d'une recette : lien vers l'endroit où l'obtenir */
.ing-link { color: inherit; text-decoration: none; border-bottom: 1px dotted rgb(244 210 138 / 45%); }
.ing-link:hover { color: var(--gold-2); border-bottom-color: var(--gold-2); }

/* Inventaire : objets uniques regroupés */
.unique-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.unique-count { font-weight: 800; color: var(--gold); }
.unique-actions { margin-left: auto; display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* Fabrication en chaîne (fenêtre Programmer) */
.chain-box { margin: .2rem 0 .6rem; }
.chain-steps { margin: .5rem 0 0; padding-left: 1.3rem; display: grid; gap: .15rem; color: var(--muted); }
.chain-steps li.is-final { color: #ffe2a0; font-weight: 700; }

.equip-intro { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.equip-intro .lead { margin: 0; flex: 1 1 360px; }

/* Inventaire : recherche, tri, filtre */
.inv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .75rem; }
.inv-search { flex: 1 1 240px; display: flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 10px; background: rgb(10 6 18 / 55%); border: 1px solid rgb(244 210 138 / 18%); }
.inv-search:focus-within { border-color: var(--gold); }
.inv-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; outline: none; box-shadow: none; padding: .15rem 0; }
.inv-sort { display: inline-flex; align-items: center; gap: .4rem; }
.inv-sort select { padding: .3rem .5rem; }
.item-row.is-filtered-out { display: none; }
section.is-search-empty { display: none; }
.inv-tools label.check { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.inv-tools input[type='checkbox'] { width: 1rem; height: 1rem; flex: none; margin: 0; }
.inv-sort { white-space: nowrap; }

/* Files : glisser-déposer et modèles */
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; padding: 0 .2rem; touch-action: none; user-select: none; align-self: center; }
.drag-handle:hover { color: var(--gold-2); }
.queue-item.is-dragging { opacity: .75; outline: 2px dashed var(--gold); outline-offset: 2px; cursor: grabbing; }
.tpl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.tpl-bar select { max-width: 260px; }
.autosell { display: inline-flex; align-items: center; gap: .3rem; margin-top: .25rem; color: var(--muted); }
.autosell input[type='checkbox'] { width: .95rem; height: .95rem; margin: 0; }
.item-side .autosell { justify-content: flex-end; }
.autosell-list { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 .75rem; }

/* Défis */
.challenge-list { display: grid; gap: .5rem; }
.challenge { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .6rem .8rem; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.challenge.is-done { border-color: rgb(155 227 122 / 55%); box-shadow: 0 0 0 1px rgb(155 227 122 / 25%) inset; }
.challenge.is-claimed { opacity: .6; }
.challenge-icon { font-size: 1.6rem; }
.challenge-main p { margin: .1rem 0; }
.challenge-label { color: var(--text); font-weight: 700; text-decoration: none; }
.challenge-label:hover { color: var(--gold-2); }
.challenge-bonus { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; padding: .55rem .8rem; border-radius: 12px; border: 1px dashed rgb(244 210 138 / 40%); }
.challenge-bonus.is-done { border-style: solid; border-color: var(--gold); background: rgb(242 184 75 / 8%); }
.challenge-bonus.is-claimed { opacity: .6; }

/* Garde-robe : cosmétiques à débloquer */
.look-option.is-wardrobe .look-chip { border-style: dashed; border-color: rgb(244 210 138 / 55%); }
.look-option.is-wardrobe .look-chip::before { content: '✨ '; }
.look-option.is-locked { cursor: not-allowed; opacity: .45; }
.look-option.is-locked .look-chip::before { content: '🔒 '; }
.look-option.is-locked .look-swatch { filter: grayscale(.8); }
.look-option.is-locked .look-swatch::after { content: '🔒'; display: grid; place-items: center; height: 100%; font-size: .8rem; }
.price-chart svg { width: 100%; height: auto; max-height: 240px; color: var(--muted); }
.fill-form { display: inline-flex; gap: .3rem; align-items: center; }
.fill-form input { width: 90px; }
.panel-head > .form-inline { flex: 1 1 420px; justify-content: flex-end; }
.panel-head > .form-inline input[type='search'] { flex: 1 1 180px; min-width: 0; max-width: 280px; }
.panel-head > .form-inline select { flex: 0 1 200px; width: auto; }
.panel-head > .form-inline .btn { flex: none; }

/* Musique de fond */
.music-ctrl { display: inline-flex; align-items: center; gap: .3rem; }
.music-toggle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgb(255 255 255 / 5%); cursor: pointer; font-size: 1rem; }
.music-toggle:hover { border-color: rgb(244 210 138 / 50%); }
.music-volume { width: 0; opacity: 0; transition: width .2s ease, opacity .2s ease; accent-color: var(--gold); }
body.music-on .music-ctrl:hover .music-volume, body.music-on .music-volume:focus { width: 80px; opacity: 1; }
@media (max-width: 899px) { .music-volume { display: none; } }

/* Raccourcis clavier (« ? ») */
.shortcuts-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: .75rem 0 1rem; align-items: center; }
.shortcuts-list dt { white-space: nowrap; color: var(--muted); font-size: .85rem; }
.shortcuts-list dd { margin: 0; }
kbd { display: inline-block; min-width: 1.5em; padding: .05rem .4rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: rgb(255 255 255 / 6%); font: 600 .8rem/1.4 ui-monospace, monospace; text-align: center; color: var(--text); }

/* Maîtrise de chasse (bestiaire) */
.hunt-legend { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.hunt-chip { display: inline-block; padding: .05rem .5rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; white-space: nowrap; }
.hunt-chip.hunt-on { border-color: rgb(244 210 138 / 55%); color: var(--gold); background: rgb(244 210 138 / 8%); }
.hunt-line { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .25rem 0; }
.hunt-bar { flex: 0 0 90px; height: 6px; border-radius: 3px; background: rgb(255 255 255 / 8%); overflow: hidden; }
.hunt-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #c9a24a, #f4d28a); }
.shortcut-hint { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 90; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .9rem; max-width: min(720px, calc(100vw - 2rem)); padding: .6rem .9rem; border: 1px solid rgb(244 210 138 / 45%); border-radius: 12px; background: rgb(21 17 29 / 95%); box-shadow: var(--shadow); font-size: .82rem; }
.shortcut-hint[hidden] { display: none; }
.shortcut-hint kbd { margin-right: .15rem; }

/* ---------- Administration (/admin) ---------- */
.badge-admin { color: #7fd0ff; }
a.admin-pill { text-decoration: none; padding: .3rem .6rem; font-size: .75rem; }
.admin-stats { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.admin-search { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.admin-search input, .admin-search select { width: auto; min-width: 10rem; }
.admin-table tr.is-suspended td { opacity: .6; }
.admin-tools { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.admin-tool { display: flex; flex-direction: column; gap: .45rem; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.admin-tool h3 { margin: 0; font-size: 1rem; }
.admin-tool p { margin: 0; }
.admin-tool .btn { align-self: flex-start; margin-top: auto; }
.admin-danger { border-color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.admin-facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.admin-facts dt { color: var(--muted); }
.admin-facts dd { margin: 0; }
.admin-log { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; max-height: 360px; overflow: auto; }
.admin-link { width: 100%; margin-top: .5rem; font-family: monospace; font-size: .8rem; }
@media (min-width: 900px) { .admin-cols { grid-template-columns: 1fr 1fr; } }

/* ---------- Bulle de discussion flottante (chat.js) ---------- */
.chat-widget { position: fixed; right: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 55; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; pointer-events: none; }
.chat-widget > * { pointer-events: auto; }
@media (min-width: 900px) { .chat-widget { right: 1.5rem; bottom: 1.5rem; } }
/* Les messages éphémères passent au-dessus de la bulle. */
.toasts { bottom: calc(9rem + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .toasts { bottom: 6rem; } }
.chat-fab {
  position: relative; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold); cursor: pointer; font-size: 1.55rem; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #3a2d52, #1f1830); color: var(--text); box-shadow: 0 8px 22px rgb(0 0 0 / 50%), 0 0 0 4px rgb(232 184 90 / 12%);
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-widget.is-open .chat-fab { border-color: var(--accent); }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; border: 2px solid var(--bg); font-family: var(--font);
}
.chat-badge[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .chat-fab.has-unread { animation: chat-pulse 2.4s ease-in-out infinite; }
  .chat-panel:not([hidden]) { animation: chat-in .18s ease-out; }
  .chat-peek:not([hidden]) { animation: chat-in .2s ease-out; }
}
@keyframes chat-pulse { 0%, 100% { box-shadow: 0 8px 22px rgb(0 0 0 / 50%), 0 0 0 4px rgb(232 184 90 / 12%); } 50% { box-shadow: 0 8px 22px rgb(0 0 0 / 50%), 0 0 0 9px rgb(232 184 90 / 22%); } }
@keyframes chat-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-peek {
  max-width: min(300px, calc(100vw - 2rem)); padding: .55rem .8rem; border-radius: 12px 12px 4px 12px; cursor: pointer; font-size: .85rem;
  background: rgb(33 27 47 / 97%); border: 1px solid var(--gold); box-shadow: var(--shadow);
}
.chat-peek[hidden] { display: none; }

.chat-panel {
  width: min(370px, calc(100vw - 2rem)); height: min(540px, calc(100vh - 9rem)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: rgb(27 22 38 / 98%); border: 1px solid rgb(244 210 138 / 35%); box-shadow: 0 18px 44px rgb(0 0 0 / 60%);
}
.chat-panel[hidden] { display: none; }
@media (max-width: 520px) { .chat-panel { height: calc(100vh - 11rem); } }
.chat-head { display: flex; align-items: center; gap: .35rem; padding: .55rem .6rem .55rem .9rem; border-bottom: 1px solid var(--line); background: rgb(42 34 57 / 70%); }
.chat-title { flex: 1; margin: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title a { color: inherit; }
.chat-icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; text-decoration: none; }
.chat-icon-btn:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.chat-icon-btn[hidden] { display: none; }
.chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-list, .chat-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-list[hidden], .chat-thread[hidden] { display: none; }
.chat-threads { list-style: none; margin: 0; padding: .3rem; flex: 1; overflow-y: auto; }
.chat-thread-btn {
  width: 100%; display: flex; align-items: center; gap: .6rem; padding: .5rem .55rem; border: 0; border-radius: 10px; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.chat-thread-btn:hover, .chat-thread-btn:focus-visible { background: var(--panel-2); outline: none; }
.chat-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--gold); color: var(--gold-2); font-weight: 800; }
.chat-thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-thread-main > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-count { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; }
.chat-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.chat-empty { padding: .8rem; margin: 0; }
.chat-trades { margin: 0; padding: .2rem .9rem .4rem; }
.chat-trades[hidden] { display: none; }
.chat-new, .chat-compose { display: flex; gap: .4rem; align-items: flex-end; padding: .55rem; border-top: 1px solid var(--line); }
.chat-new input { flex: 1; min-width: 0; }
.chat-compose textarea { flex: 1; min-width: 0; resize: none; font: inherit; min-height: 38px; max-height: 120px; line-height: 1.35; }
.chat-compose .btn { min-height: 38px; }
.chat-messages { flex: 1; overflow-y: auto; padding: .6rem; display: flex; flex-direction: column; gap: .35rem; }
.chat-msg {
  align-self: flex-start; max-width: 85%; padding: .4rem .6rem; border-radius: 12px 12px 12px 4px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: .9rem; overflow-wrap: anywhere; white-space: pre-wrap;
}
.chat-msg.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: rgb(232 184 90 / 14%); border-color: rgb(232 184 90 / 45%); }
.chat-from { display: block; font-size: .75rem; color: var(--gold-2); }
.chat-time { display: block; margin-top: .1rem; font-size: .68rem; color: var(--muted); text-align: right; }
/* Discussion générale et temps réel */
.chat-fab.has-general::after { content: ''; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg); }
.chat-live { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chat-live.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
button.chat-from { padding: 0; border: 0; background: none; font: inherit; font-size: .75rem; font-weight: 700; color: var(--gold-2); cursor: pointer; text-align: left; }
button.chat-from:hover { text-decoration: underline; }
.chat-del { margin-right: .4rem; padding: 0; border: 0; background: none; cursor: pointer; font-size: .75rem; opacity: .55; }
.chat-del:hover { opacity: 1; }
/* Signalements (admin) et bouton « signaler » de la bulle */
.admin-reports { display: grid; gap: .6rem; }
.admin-report { padding: .7rem .85rem; border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: 10px; background: var(--panel-2); }
.admin-report p { margin: .15rem 0; }
.admin-quote { margin: .35rem 0; padding: .4rem .6rem; border-radius: 8px; background: var(--bg-2); overflow-wrap: anywhere; }
.chat-report { margin-right: .4rem; padding: 0; border: 0; background: none; cursor: pointer; font-size: .72rem; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .chat-report, .chat-report:focus-visible { opacity: .6; }
.chat-report:hover { opacity: 1 !important; }
@media (hover: none) { .chat-report { opacity: .45; } }
.chat-reports-link { margin: 0; padding: .2rem .9rem .4rem; }

/* Enchantement : l'en-tête d'une carte ouvre la fiche de l'objet. */
.enchant-head { cursor: pointer; border-radius: 10px; }
.enchant-head:hover .enchant-name, .enchant-head:focus-visible .enchant-name { color: var(--gold-2); text-decoration: underline dotted; }
.enchant-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Résultat de recherche du guide : visible sous la barre collante (en-tête + recherche + rubriques). */
.guide-section article, .guide-section details.unlock-card, .codex-card { scroll-margin-top: 13rem; }
@media (max-width: 700px) { .guide-section article, .guide-section details.unlock-card, .codex-card { scroll-margin-top: 16rem; } }

/* ---------- Cercle d'Ambre ---------- */
.name-amber {
  background: linear-gradient(90deg, #ffd77a, #f0a43a 45%, #ffe9a8 60%, #e8b85a); -webkit-background-clip: text; background-clip: text;
  color: transparent !important; font-weight: 800; text-shadow: none;
}
.name-amber::after { content: ' 🌙'; -webkit-text-fill-color: initial; color: initial; font-size: .85em; }
.amber-text { color: #f4c86a; }
.badge-amber { color: #f4c86a; border-color: #e8b85a; background: rgb(232 184 90 / 10%); }
a.amber-pill { text-decoration: none; padding: .3rem .6rem; font-size: .75rem; }
.amber-frame { border-color: #f0b84a !important; box-shadow: 0 0 0 3px rgb(240 184 74 / 35%), 0 0 18px rgb(240 184 74 / 45%) !important; }

/* Comptoir d'Ambre (/shop) */
.amber-hero { display: flex; align-items: center; gap: 1.5rem; background: radial-gradient(circle at 85% 30%, rgb(240 184 74 / 22%), transparent 55%), var(--panel); border-color: rgb(240 184 74 / 45%); }
.amber-hero-text { flex: 1; }
.amber-title { font-size: 1.8rem; margin: .2rem 0 .5rem; background: linear-gradient(90deg, #ffd77a, #f0a43a, #ffe9a8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.amber-moon { font-size: 5rem; filter: drop-shadow(0 0 24px rgb(240 184 74 / 60%)); }
@media (max-width: 600px) { .amber-moon { display: none; } }
.amber-status { margin-bottom: 0; }
.amber-perks { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: .75rem; }
.amber-perks > div { padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.amber-perks > div > span { display: block; font-size: 1.5rem; margin-bottom: .25rem; }
.amber-perks p { margin: .25rem 0 0; }
.amber-claims { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.amber-claim { display: flex; flex-direction: column; gap: .4rem; padding: .8rem; border: 1px solid rgb(240 184 74 / 40%); border-radius: 12px; background: var(--panel-2); }
.amber-claim h3 { margin: 0; font-size: 1rem; }
.amber-claim p { margin: 0; }
.amber-claim .btn { align-self: flex-start; margin-top: auto; }
.amber-buy { display: grid; gap: .8rem; max-width: 640px; }
.amber-offers { border: 0; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.amber-offer { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border: 2px solid var(--line); border-radius: 14px; background: var(--panel-2); cursor: pointer; }
.amber-offer:has(input:checked) { border-color: #f0b84a; box-shadow: 0 0 0 3px rgb(240 184 74 / 20%); }
.amber-offer input { position: absolute; top: .9rem; right: .9rem; width: auto; min-height: 0; }
.amber-offer-label { font-family: var(--font-title); font-weight: 800; }
.amber-offer-price { font-size: 1.6rem; font-weight: 800; color: #f4c86a; }
.amber-offer.is-best::before { content: 'Le meilleur choix'; position: absolute; top: -.7rem; left: .9rem; padding: 0 .5rem; border-radius: 999px; background: #f0b84a; color: #2a1d0a; font-size: .7rem; font-weight: 800; }
.amber-buy label.check { display: flex; gap: .5rem; align-items: flex-start; }
.amber-buy label.check input { width: 1rem; height: 1rem; flex: none; margin-top: .2rem; min-height: 0; }

/* ---------- Composeur d'échange (trade.js) ---------- */
.trade-dialog { width: min(980px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); padding: 1rem 1.1rem; }
.trade-form { display: grid; gap: .7rem; }
.trade-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.trade-head h3 { margin: 0; flex: 1; }
.trade-modes { display: flex; gap: .35rem; }
.trade-to { display: flex; flex-direction: column; gap: .25rem; }
.trade-friends-quick { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: -.3rem; }
.trade-friends-quick .chip { display: inline-flex; align-items: center; gap: .35rem; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); flex: none; }
.trade-cols { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
.trade-dialog.is-gift .trade-cols { grid-template-columns: 1fr; }
.trade-dialog.is-gift [data-side="request"] { display: none; }
@media (max-width: 720px) { .trade-cols { grid-template-columns: 1fr; } }
.trade-side { display: flex; flex-direction: column; gap: .5rem; min-width: 0; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.trade-side[data-side="offer"] { border-color: rgb(232 184 90 / 40%); }
.trade-side[data-side="request"] { border-color: rgb(127 208 255 / 35%); }
.trade-side h4 { margin: 0; font-size: .95rem; }
.trade-selected { display: grid; gap: .3rem; }
.trade-line { display: flex; align-items: center; gap: .45rem; padding: .3rem .45rem; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--rc, var(--line)); }
.trade-line input[type='number'] { width: 5.5rem; min-height: 0; padding: .2rem .4rem; }
.trade-line .trade-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-gold { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.trade-gold input { width: 8rem; }
.trade-pick { display: flex; flex-wrap: wrap; gap: .3rem; max-height: 210px; overflow-y: auto; align-content: flex-start; }
.trade-item { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; border-radius: 999px; border: 1px solid var(--line); border-left: 3px solid var(--rc, var(--line)); background: var(--bg-2); color: inherit; font: inherit; font-size: .82rem; cursor: pointer; }
.trade-item:hover { border-color: var(--gold); }
.trade-item-qty { color: var(--muted); font-size: .75rem; }
.trade-summary { margin: 0; padding: .5rem .7rem; border-radius: 9px; background: var(--bg-2); }
.trade-empty { margin: 0; }

/* ---------- Amis et échanges (pages /friends, /trades) ---------- */
.friend-add { display: flex; gap: .5rem; flex-wrap: wrap; }
.friend-add input { flex: 1; min-width: 200px; }
.friend-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.friend-card { display: flex; flex-direction: column; gap: .5rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.friend-card.is-online { border-color: rgb(92 201 138 / 50%); }
.friend-main { display: flex; flex-direction: column; gap: .1rem; }
.friend-status { font-size: .72rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.friend-card.is-online .friend-status { color: var(--ok); }
.friend-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.trade-toolbar { justify-content: flex-start; }
.trade-cards { display: grid; gap: .7rem; }
.trade-card { padding: .8rem .9rem; border: 1px solid rgb(127 208 255 / 35%); border-radius: 12px; background: var(--panel-2); }
.trade-card.is-out { border-color: rgb(232 184 90 / 35%); }
.trade-card p { margin: .15rem 0; }
.trade-card-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: start; margin: .4rem 0; }
@media (max-width: 640px) { .trade-card-sides { grid-template-columns: 1fr; } .trade-arrow { transform: rotate(90deg); justify-self: center; } }
.trade-card-sides > div { display: flex; flex-wrap: wrap; gap: .3rem; align-content: flex-start; }
.trade-card-sides .eyebrow { flex-basis: 100%; margin: 0; }
.trade-arrow { font-size: 1.4rem; color: var(--muted); align-self: center; }
.trade-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--rc, var(--gold)); font-size: .85rem; }

/* Bulle : amis */
.chat-section { padding: .45rem .6rem .15rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chat-section a { text-transform: none; letter-spacing: 0; font-weight: 600; margin-left: .3rem; }
.chat-friend { display: flex; align-items: center; }
.chat-friend .chat-thread-btn { flex: 1; min-width: 0; }
.chat-avatar { position: relative; }
.chat-online { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--bg); width: 10px; height: 10px; }
.chat-title-trade { display: inline-grid; width: 26px; height: 26px; vertical-align: middle; font-size: .85rem; }
.chat-friends-link { margin: 0; padding: .2rem .9rem .4rem; }
.chat-friends-link[hidden] { display: none; }
