/* ==========================================================================
   mmostream — styles propres au jeu, posés sur HanamiUI.
   HanamiUI (static/vendor/hanami) fournit tokens, composants et thèmes ;
   ce fichier n'ajoute que ce qui est spécifique au RPG (objets, raretés,
   emplacements, duels…) et n'utilise que des variables --hn-*.
   ========================================================================== */

[hidden] { display: none !important; }

body { min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; width: 100%; padding-block: var(--hn-space-8) var(--hn-space-16); --hn-stack-gap: var(--hn-space-6); }
.site-footer { border-top: 1px solid var(--hn-color-border); padding-block: var(--hn-space-5); color: var(--hn-color-text-muted); font-size: var(--hn-text-sm); }
.site-footer .hn-container { display: flex; justify-content: space-between; gap: var(--hn-space-3); flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- barre de navigation ---------- */
.nav-gold { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hn-color-warning-text); font-size: var(--hn-text-sm); }
.user-chip { display: inline-flex; align-items: center; gap: var(--hn-space-2); color: var(--hn-color-text); text-decoration: none; }
.user-chip__text { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip__text strong { font-size: var(--hn-text-sm); }
.user-chip__text small { color: var(--hn-color-text-muted); font-size: var(--hn-text-xs); }
.hn-menu form { display: contents; }

/* Menu « Monde » de la barre de navigation : <details> natif, fermé par défaut. */
.nav-more { position: relative; }
.nav-more summary { list-style: none; cursor: pointer; gap: .25rem; user-select: none; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary hn-icon { font-size: .9em; transition: transform var(--hn-duration-normal) var(--hn-ease-bloom); }
.nav-more details[open] summary hn-icon { transform: rotate(180deg); }
.nav-more summary[data-current] { color: var(--hn-color-primary-text); font-weight: var(--hn-weight-bold); }
.nav-more details[open] summary { color: var(--hn-color-text); }
.nav-more__menu { position: absolute; top: calc(100% + var(--hn-space-2)); left: 0; z-index: 40; }
.nav-more__menu .hn-menu-item[aria-current=page] { color: var(--hn-color-primary-text); font-weight: var(--hn-weight-bold); }
@media (prefers-reduced-motion: reduce) { .nav-more summary hn-icon { transition: none; } }

/* Bouton Twitch (variante HanamiUI via ses variables locales). */
.hn-btn--twitch {
  --hn-btn-bg: #9146ff;
  --hn-btn-bg-hover: #7f35f2;
  --hn-btn-bg-active: #6b26d9;
  --hn-btn-color: #fff;
  --hn-btn-shadow-hover: 0 8px 28px -6px #9146ff99;
}

/* Onglets sous forme de liens (classement, codex). */
.hn-btn-group > .hn-btn[aria-current=page] {
  --hn-btn-bg: var(--hn-color-primary-soft);
  --hn-btn-color: var(--hn-color-primary-text);
  --hn-btn-border: var(--hn-color-primary-border);
  z-index: 1;
}
.tabs-row { display: flex; gap: var(--hn-space-3); align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* Cartes : en-tête aligné, tableaux sans double bordure. */
.hn-card__header { align-items: center; flex-wrap: wrap; }
.hn-card__header > .card-meta { flex: none; color: var(--hn-color-text-muted); font-size: var(--hn-text-sm); }
.hn-card .hn-table-wrap { border: 0; border-radius: 0; background: transparent; }
.hn-table tr.row-me td { background: var(--hn-color-primary-soft); }
.hn-table form { display: inline; }
.rank { width: 2.5rem; color: var(--hn-color-text-muted); }
.rank-1 { color: var(--hn-color-warning-text); font-weight: 700; }
.rank-2, .rank-3 { color: var(--hn-color-text); font-weight: 700; }

.page-head { --hn-stack-gap: var(--hn-space-2); }
.page-head > p { max-width: 72ch; margin: 0; }
.layout-main { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: var(--hn-space-6); align-items: start; }
.layout-main > * { min-width: 0; }

/* ---------- accueil ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: var(--hn-space-10); align-items: center; padding-block: var(--hn-space-4) var(--hn-space-2); }
.hero h1 { max-width: 22ch; margin: 0; }
.hero__stats { display: grid; gap: var(--hn-space-3); margin: 0; }
.hero__stats .hn-surface { padding: var(--hn-space-3) var(--hn-space-4); }
.hero__stats dt { color: var(--hn-color-text-muted); font-size: var(--hn-text-sm); }
.hero__stats dd { margin: 0; font-family: var(--hn-font-display); font-size: var(--hn-text-2xl); font-weight: 700; }
.step-n { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; margin-bottom: var(--hn-space-2); border-radius: var(--hn-radius-full); background: var(--hn-color-primary-soft); color: var(--hn-color-primary-text); font-weight: 700; font-size: var(--hn-text-sm); }

/* ---------- profil / personnage ---------- */
.profile-head { display: flex; align-items: center; gap: var(--hn-space-5); flex-wrap: wrap; }
.profile-head__main { flex: 1 1 16rem; min-width: 0; }
.profile-head__main h1 { margin: 0 0 var(--hn-space-2); display: flex; align-items: center; gap: var(--hn-space-2); flex-wrap: wrap; }
.xp-label { display: flex; justify-content: space-between; font-size: var(--hn-text-sm); margin-bottom: var(--hn-space-1-5); }
.kpis { display: flex; flex-wrap: wrap; gap: var(--hn-space-6); margin: 0; }
.kpis dt { font-size: var(--hn-text-xs); color: var(--hn-color-text-muted); text-transform: uppercase; letter-spacing: .06em; }
.kpis dd { margin: 0; font-family: var(--hn-font-display); font-size: var(--hn-text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.kpis--compact { gap: var(--hn-space-5); }
.kpis--compact dd { font-size: var(--hn-text-xl); }
.kpi-gs { color: var(--hn-color-primary-text); }
.stat-list { margin: 0; }
.stat-list div { display: flex; justify-content: space-between; padding: var(--hn-space-2) 0; border-bottom: 1px solid var(--hn-color-border); }
.stat-list div:last-child { border-bottom: 0; }
.stat-list dt { color: var(--hn-color-text-muted); }
.stat-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- raretés & univers ---------- */
/* La teinte est mélangée à la couleur du texte : lisible en thème clair et sombre. */
[data-rarity] { --rc-base: var(--hn-sumi-500); --rc: color-mix(in oklch, var(--rc-base) 70%, var(--hn-color-text)); }
[data-rarity="rare"] { --rc-base: var(--hn-ai-500); }
[data-rarity="epic"] { --rc-base: var(--hn-fuji-500); }
[data-rarity="legendary"] { --rc-base: var(--hn-kin-500); }
[data-rarity="mythic"] { --rc-base: var(--hn-beni-500); }
.rarity { color: var(--rc, var(--hn-color-text-muted)); font-weight: 700; }

.hn-badge.u-badge { height: 1.125rem; padding: 0 .4rem; font-size: var(--hn-text-xs); font-weight: 700;
  --hn-badge-bg: color-mix(in oklch, var(--u) 16%, transparent);
  --hn-badge-color: color-mix(in oklch, var(--u) 65%, var(--hn-color-text)); }
.u-lol { --u: var(--hn-ai-500); }
.u-stream { --u: var(--hn-fuji-500); }
.u-minecraft { --u: var(--hn-matcha-500); }
.u-dofus { --u: var(--hn-kin-500); }

/* Silhouettes d'emplacement (SVG en masque, teintées par la rareté) : repli quand un objet
   n'a pas d'illustration, et marqueur des emplacements libres. */
.glyph { display: inline-block; width: 1.3em; height: 1.3em; background: currentColor; -webkit-mask: var(--g) center / contain no-repeat; mask: var(--g) center / contain no-repeat; flex: none; }
.glyph-weapon { --g: url(/static/icons/weapon.svg); }
.glyph-head { --g: url(/static/icons/head.svg); }
.glyph-chest { --g: url(/static/icons/chest.svg); }
.glyph-legs { --g: url(/static/icons/legs.svg); }
.glyph-boots { --g: url(/static/icons/boots.svg); }
.glyph-amulet { --g: url(/static/icons/amulet.svg); }
.glyph-ring { --g: url(/static/icons/ring.svg); }
.glyph-trinket { --g: url(/static/icons/trinket.svg); }
.glyph-chestbox { --g: url(/static/icons/chestbox.svg); }
.glyph-xl { width: 2.75rem; height: 2.75rem; }

/* ---------- carte d'objet ---------- */
/* Illustrations : static/art (style « Shippō », voir docs/art-direction.md). La vignette
   fournit le cadre et la teinte de rareté ; --art règle son côté (illustration = côté − .5rem). */
.item {
  --art: 3.5rem;
  display: grid; grid-template-columns: var(--art) minmax(0, 1fr) auto; gap: var(--hn-space-3); align-items: center;
  padding: var(--hn-space-2-5, .625rem) var(--hn-space-3); min-width: 0;
  border: 1px solid var(--hn-color-border); border-left: 3px solid var(--rc, var(--hn-color-border));
  border-radius: var(--hn-radius-lg); background: var(--hn-color-surface-raised);
  transition: border-color var(--hn-duration-fast), box-shadow var(--hn-duration-fast);
}
.item:hover { box-shadow: var(--hn-shadow-sm); }
.item-icon {
  position: relative; display: grid; place-items: center; width: var(--art, 3.5rem); height: var(--art, 3.5rem);
  border-radius: var(--hn-radius-md); color: var(--rc);
  background:
    radial-gradient(circle at 50% 42%, color-mix(in oklch, var(--rc-base) 24%, transparent), transparent 72%),
    color-mix(in oklch, var(--rc-base) 10%, transparent);
  border: 1px solid color-mix(in oklch, var(--rc-base) 45%, transparent);
}
[data-rarity="legendary"] > .item-icon, [data-rarity="mythic"] > .item-icon {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--rc-base) 22%, transparent), 0 0 .75rem -.125rem color-mix(in oklch, var(--rc-base) 55%, transparent);
}
.item-icon .glyph { width: 46%; height: 46%; }
.item-icon img { display: block; width: calc(var(--art, 3.5rem) - .5rem); height: calc(var(--art, 3.5rem) - .5rem); object-fit: contain; }
.ilvl { position: absolute; right: -.4rem; bottom: -.4rem; min-width: 1.25rem; height: 1.125rem; padding: 0 .25rem; display: grid; place-items: center;
  border-radius: var(--hn-radius-full); background: var(--hn-color-bg); border: 1px solid var(--hn-color-border-strong);
  font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hn-color-text); }
.item-body { min-width: 0; }
.item-name { font-weight: 700; color: var(--rc, var(--hn-color-text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; font-size: var(--hn-text-xs); color: var(--hn-color-text-muted); }
.item-stats { display: flex; flex-wrap: wrap; gap: .125rem .625rem; margin-top: .25rem; font-size: var(--hn-text-xs); font-variant-numeric: tabular-nums; color: var(--hn-color-text); }
.item-tier { padding: 0 .3rem; border-radius: var(--hn-radius-sm); background: color-mix(in oklch, var(--rc-base) 16%, transparent); font-variant-numeric: tabular-nums; }
.item-unique { font-weight: 700; color: var(--rc); letter-spacing: .02em; }
.item-passive { margin: .3rem 0 0; padding-left: 1rem; font-size: var(--hn-text-xs); color: var(--hn-color-text); }
.item-passive li::marker { color: var(--rc, var(--hn-color-text-muted)); }
.item-desc { margin: .25rem 0 0; font-size: var(--hn-text-sm); color: var(--hn-color-text-muted); font-style: italic; }
.item-gs { text-align: right; line-height: 1.1; }
.item-gs small { display: block; font-size: .65rem; letter-spacing: .06em; color: var(--hn-color-text-muted); }
.item-gs strong { font-size: var(--hn-text-lg); font-variant-numeric: tabular-nums; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--hn-space-3); }
.item-wrap { display: flex; flex-direction: column; gap: var(--hn-space-1-5); min-width: 0; }
.item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--hn-space-1-5); }
.codex-item { --art: 5rem; grid-template-columns: var(--art) minmax(0, 1fr); align-items: start; }
.codex-item.is-disabled { opacity: .5; }

/* Emplacements équipés. */
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--hn-space-3); }
.slot { display: flex; flex-direction: column; gap: var(--hn-space-1-5); min-width: 0; }
.slot-label { font-size: var(--hn-text-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--hn-color-text-muted); }
.slot-empty { display: flex; align-items: center; gap: var(--hn-space-3); height: 4.5rem; padding: 0 var(--hn-space-4);
  border: 1px dashed var(--hn-color-border-strong); border-radius: var(--hn-radius-lg); color: var(--hn-color-text-subtle); font-size: var(--hn-text-sm); }
.slot-empty .glyph { width: 1.4rem; height: 1.4rem; opacity: .6; }
.slot-action { display: flex; justify-content: flex-end; }

/* Butin : le coffre ouvert, puis l'objet avec son illustration en grand. */
.loot-row { display: flex; gap: var(--hn-space-4); align-items: center; flex-wrap: wrap; }
.loot-row .item { --art: 6.5rem; flex: 1 1 20rem; }
.loot-chest { display: flex; flex-direction: column; align-items: center; gap: var(--hn-space-1); margin: 0; flex: none;
  font-size: var(--hn-text-xs); color: var(--hn-color-text-muted); }
.loot-chest .chest-art { width: 4.5rem; height: 4.5rem; }

/* Coffres. */
.chest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--hn-space-2); }
.chest { display: flex; align-items: center; gap: var(--hn-space-3); padding: var(--hn-space-2) var(--hn-space-3);
  border: 1px solid var(--hn-color-border); border-radius: var(--hn-radius-lg); background: var(--hn-color-surface-raised); }
.chest .glyph { width: 1.6rem; height: 1.6rem; }
.chest-art { display: block; width: 2.75rem; height: 2.75rem; flex: none; object-fit: contain; }
.shop-offer .chest-art { width: 6rem; height: 6rem; }
.chest-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.chest-text small { color: var(--hn-color-text-muted); }
[data-tier="0"] .glyph-chestbox { color: color-mix(in oklch, var(--hn-kin-700) 70%, var(--hn-color-text)); }
[data-tier="1"] .glyph-chestbox { color: color-mix(in oklch, var(--hn-sumi-400) 70%, var(--hn-color-text)); }
[data-tier="2"] .glyph-chestbox { color: color-mix(in oklch, var(--hn-kin-500) 80%, var(--hn-color-text)); }
[data-tier="3"] .glyph-chestbox { color: color-mix(in oklch, var(--hn-beni-500) 80%, var(--hn-color-text)); }
.shop-offer .hn-card__body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--hn-space-2); }
.price { margin: var(--hn-space-1) 0 var(--hn-space-3); font-family: var(--hn-font-display); font-size: var(--hn-text-3xl); font-weight: 700; color: var(--hn-color-warning-text); font-variant-numeric: tabular-nums; }
.price small { font-family: var(--hn-font-body); font-size: var(--hn-text-md); font-weight: 400; color: var(--hn-color-text-muted); }

/* ---------- fil d'activité ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: baseline; gap: var(--hn-space-3); padding: var(--hn-space-2) 0; border-bottom: 1px solid var(--hn-color-border); font-size: var(--hn-text-sm); }
.feed li:last-child { border-bottom: 0; }
.feed hn-icon { flex: none; align-self: center; color: var(--hn-color-text-subtle); }
.feed .feed-level_up hn-icon, .feed .feed-join hn-icon { color: var(--hn-color-success-text); }
.feed .feed-loot hn-icon { color: color-mix(in oklch, var(--hn-kin-500) 80%, var(--hn-color-text)); }
.feed .feed-duel hn-icon { color: var(--hn-color-primary-text); }
.feed .feed-sub hn-icon, .feed .feed-gift hn-icon, .feed .feed-raid hn-icon, .feed .feed-bits hn-icon { color: color-mix(in oklch, var(--hn-fuji-500) 80%, var(--hn-color-text)); }
.feed-text { flex: 1; min-width: 0; }
.feed-text a { font-weight: 700; color: var(--hn-color-text); }
.feed time { white-space: nowrap; color: var(--hn-color-text-muted); font-size: var(--hn-text-xs); }

/* ---------- arène & duels ---------- */
.chance { font-weight: 700; }
.chance-good { color: var(--hn-color-success-text); }
.chance-bad { color: var(--hn-color-danger-text); }
.duel-list { list-style: none; margin: 0; padding: 0; }
.duel-list li { display: flex; align-items: center; gap: var(--hn-space-3); padding: var(--hn-space-2) 0; border-bottom: 1px solid var(--hn-color-border); font-size: var(--hn-text-sm); }
.duel-list li:last-child { border-bottom: 0; }
.duel-list li > span:nth-child(2) { flex: 1; min-width: 0; }
.result { flex: none; }

.duel-fighters { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--hn-space-6); align-items: center; }
.fighter { display: flex; flex-direction: column; gap: var(--hn-space-1-5); min-width: 0; }
.fighter--right { text-align: right; }
.fighter--right .hn-progress { transform: scaleX(-1); }
.fighter-name { font-family: var(--hn-font-display); font-size: var(--hn-text-xl); font-weight: 700; color: var(--hn-color-text); }
.fighter-win .fighter-name::after { content: " ★"; color: var(--hn-color-warning-text); }
.vs { font-family: var(--hn-font-display); font-weight: 800; letter-spacing: .1em; color: var(--hn-color-text-subtle); }
.hp-text { font-size: var(--hn-text-xs); color: var(--hn-color-text-muted); font-variant-numeric: tabular-nums; }
.duel-log { list-style: none; margin: 0; padding: 0; max-height: 26rem; overflow-y: auto; border: 1px solid var(--hn-color-border); border-radius: var(--hn-radius-lg); }
.duel-log li { padding: var(--hn-space-2) var(--hn-space-3); font-size: var(--hn-text-sm); border-bottom: 1px solid var(--hn-color-border); border-left: 3px solid transparent; }
.duel-log li:last-child { border-bottom: 0; }
.duel-log .actor-0 { border-left-color: var(--hn-ai-500); }
.duel-log .actor-1 { border-left-color: var(--hn-sakura-500); }
.duel-log .log-crit { font-weight: 700; }
.duel-log .log-dodge { color: var(--hn-color-text-muted); font-style: italic; }

/* ---------- admin ---------- */
.admin-content { --hn-stack-gap: var(--hn-space-6); padding-bottom: var(--hn-space-12); }
.kpi-card .hn-card__body { display: flex; flex-direction: column; gap: var(--hn-space-1); }
.kpi-card strong { font-family: var(--hn-font-display); font-size: var(--hn-text-3xl); font-variant-numeric: tabular-nums; }
button.hn-sidebar-item { width: 100%; border: 0; background: none; font: inherit; text-align: start; cursor: pointer; }
.hn-sidebar form { display: contents; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout-main, .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .slot-grid { grid-template-columns: minmax(0, 1fr); }
  .codex-item { --art: 4.5rem; }
  .loot-row .item { --art: 5rem; }
  .loot-chest { flex-direction: row; gap: var(--hn-space-3); flex: 1 1 100%; }
  .loot-chest .chest-art { width: 3.5rem; height: 3.5rem; }
  .duel-fighters { grid-template-columns: minmax(0, 1fr); }
  .fighter--right { text-align: left; }
  .fighter--right .hn-progress { transform: none; }
  .vs { display: none; }
}

/* Ajustements de composants HanamiUI dans le contexte du jeu. */
.hn-card__header .hn-select { width: auto; }
.kpi-card--text strong { font-size: var(--hn-text-xl); }
.hn-card__header > .hn-card__title { flex: 1 1 10rem; }

/* ---------- admin : onglets des réglages ---------- */
.settings-tabs { flex-wrap: wrap; row-gap: var(--hn-space-2); }
.settings-grid > .hn-field { min-width: 0; }
.settings-grid .hn-input { min-width: 0; width: 100%; }
.settings-grid .hn-hint { overflow-wrap: anywhere; }

/* Panoplies portées (fiche personnage, Forge) : templates/forge/_sets.html. */
.set-progress { display: flex; flex-direction: column; gap: var(--hn-space-4); margin: 0; padding: 0; list-style: none; }
.set-progress__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hn-space-2); margin: 0 0 var(--hn-space-1-5); }
.set-progress__tiers { display: flex; flex-direction: column; gap: var(--hn-space-1); margin: 0 0 var(--hn-space-1-5); padding: 0; list-style: none; font-size: var(--hn-text-sm); color: var(--hn-color-text-muted); }
.set-progress__tiers li { display: flex; align-items: flex-start; gap: var(--hn-space-1-5); }
.set-progress__tiers li hn-icon { flex: none; margin-top: .15em; }
.set-progress__tiers li.is-reached { color: var(--hn-color-text); }
.set-progress__tiers li.is-reached hn-icon { color: var(--hn-color-success-text, var(--hn-color-text)); }
.set-progress__line { display: flex; align-items: flex-start; gap: var(--hn-space-1-5); margin: var(--hn-space-1) 0 0; font-size: var(--hn-text-sm); }

/* ---------- accueil : emblèmes et bonus du live ---------- */
.home-emblems { display: flex; flex-wrap: wrap; gap: var(--hn-space-2); }
.home-emblem { display: inline-flex; border-radius: var(--hn-radius-md); transition: transform var(--hn-duration-normal) var(--hn-ease-bloom); }
.home-emblem:hover, .home-emblem:focus-visible { transform: translateY(-2px); }
.home-live { list-style: none; margin: 0 0 var(--hn-space-3); padding: 0; display: grid; gap: var(--hn-space-3); }
.home-live li { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: var(--hn-space-3); align-items: start; }
.home-live hn-icon { color: var(--hn-color-primary-text); margin-top: .15em; }
@media (prefers-reduced-motion: reduce) { .home-emblem { transition: none; } .home-emblem:hover, .home-emblem:focus-visible { transform: none; } }
