:root {
  color-scheme: dark;
  --ink: #eee4cf;
  --ink-soft: #c7baa2;
  --muted: #c7baa2;
  --night: #0d0b0a;
  --night-2: #15110f;
  --panel: rgba(30, 24, 20, 0.94);
  --panel-light: #2a211b;
  --line: rgba(218, 185, 121, 0.22);
  --gold: #d0a24b;
  --gold-light: #f0cf82;
  --blood: #8f2d2c;
  --blood-light: #d15b54;
  --moss: #677c58;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 0%, rgba(143, 45, 44, 0.13), transparent 32rem),
    linear-gradient(145deg, #100d0c, var(--night) 48%, #090807);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  opacity: .22;
  content: "";
  pointer-events: none;
}

a { color: var(--gold-light); text-decoration-color: rgba(240, 207, 130, .45); text-underline-offset: .2em; }
a:hover { color: #fff0c7; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; }
h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }

.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 200; padding: .7rem 1rem; background: #fff; color: #000; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.shell { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.shell-wide { width: min(1500px, calc(100% - 2rem)); margin-inline: auto; }
.shell-narrow { width: min(820px, calc(100% - 2rem)); margin-inline: auto; }
.eyebrow { margin: 0 0 .5rem; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.lead { color: #d8cdb8; font-size: 1.15rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: .65rem max(1rem, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(13, 11, 10, .88);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); font-family: var(--serif); font-size: 1.08rem; text-decoration: none; }
.brand em { color: var(--gold); font-style: normal; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-light); font-size: .7rem; font-weight: 800; letter-spacing: .06em; box-shadow: inset 0 0 0 4px var(--night); }
.top-nav, .audio-controls { display: flex; align-items: center; gap: .35rem; }
.top-nav > a { padding: .55rem .8rem; color: var(--ink-soft); text-decoration: none; }
.icon-button { display: inline-flex; min-height: 40px; align-items: center; gap: .45rem; padding: .45rem .7rem; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.icon-button:hover, .icon-button[aria-pressed="true"] { border-color: var(--line); background: rgba(208, 162, 75, .1); color: var(--gold-light); }
.control-label { font-size: .78rem; }

.flash-stack { position: fixed; top: 82px; right: 1rem; z-index: 100; display: grid; width: min(390px, calc(100vw - 2rem)); gap: .5rem; }
.flash { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 9px; background: #25201b; box-shadow: var(--shadow); }
.flash-success { border-color: rgba(103, 124, 88, .8); }
.flash-danger { border-color: rgba(199, 78, 71, .75); }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: #e0b458; background: linear-gradient(#d8a747, #aa7530); color: #19100a; box-shadow: 0 7px 25px rgba(170, 117, 48, .2); }
.button-primary:hover { background: linear-gradient(#eac36e, #bd8438); color: #120b08; }
.button-secondary { border-color: var(--line); background: #36291e; color: var(--ink); }
.button-danger { border-color: #b44842; background: linear-gradient(#9f3834, #72201f); color: #fff0e7; }
.button-ghost { border-color: var(--line); background: rgba(0, 0, 0, .18); color: var(--ink); }
.button-wide { width: 100%; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(39, 31, 25, .97), rgba(24, 20, 17, .97)); box-shadow: var(--shadow); }
.panel-heading, .section-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.panel-heading { margin-bottom: 1.3rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.panel-heading h1, .section-heading h2 { margin-bottom: 0; }
.section-heading { margin-bottom: 1rem; }
.section-heading > span { color: var(--ink-soft); font-size: .78rem; }
.seal { display: grid; min-width: 52px; height: 52px; place-items: center; border: 1px solid var(--blood-light); border-radius: 50%; color: #ef9b8f; font-family: var(--serif); transform: rotate(-7deg); }

.hero { position: relative; display: grid; min-height: min(620px, 78vh); place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-backdrop { position: absolute; inset: 0; background-image: linear-gradient(90deg, rgba(10, 8, 7, .97) 5%, rgba(10, 8, 7, .73) 49%, rgba(10, 8, 7, .4)), linear-gradient(0deg, var(--night), transparent 38%), url("../assets/brand/shop-background-1600.jpg"); background-position: center; background-size: cover; filter: saturate(.72) contrast(1.08); transform: scale(1.02); }
.hero-content { position: relative; width: min(1120px, calc(100% - 2rem)); margin-inline: auto; padding-block: 5rem; }
.hero-logo { display: block; width: min(620px, 90vw); max-height: 270px; margin: 0 0 1.25rem -1.5rem; object-fit: contain; object-position: left center; filter: drop-shadow(0 13px 24px #000); }
.hero-lead { width: min(600px, 100%); color: #d7cbbb; font-family: var(--serif); font-size: clamp(1.1rem, 2vw, 1.35rem); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr); gap: 1.25rem; padding-block: 3rem; align-items: start; }
.setup-panel, .join-panel, .recent-panel { padding: clamp(1.1rem, 3vw, 2rem); }
.home-side { display: grid; gap: 1.25rem; }
.character-builder { display: grid; gap: .65rem; margin-block: 1rem; }
.character-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: .75rem; padding: .8rem; border: 1px solid rgba(218, 185, 121, .14); border-radius: 8px; background: rgba(0, 0, 0, .13); }
.character-row[hidden] { display: none; }
.character-row legend { padding-inline: .35rem; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.character-row label, .field-block { display: grid; gap: .35rem; color: var(--ink-soft); font-size: .78rem; font-weight: 650; }
.name-suggestion-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.name-suggestion-field button { min-height: 44px; padding-inline: .7rem; border: 1px solid rgba(218, 185, 121, .3); border-radius: 6px; background: rgba(208, 162, 75, .08); color: var(--gold-light); cursor: pointer; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.compact-row select { width: 76px; }
input, select { min-height: 44px; width: 100%; border: 1px solid rgba(218, 185, 121, .23); border-radius: 6px; outline: none; background: #161311; color: var(--ink); padding: .55rem .7rem; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(208, 162, 75, .12); }
.form-note { margin: .9rem 0; color: var(--ink-soft); font-size: .82rem; }
.campaign-option { display: flex; align-items: flex-start; gap: .7rem; margin-top: .9rem; padding: .8rem; border: 1px solid rgba(208, 162, 75, .2); border-radius: 7px; background: rgba(208, 162, 75, .05); cursor: pointer; }
.campaign-option input { flex: 0 0 auto; width: 19px; min-height: 19px; margin-top: .12rem; accent-color: var(--gold); }
.campaign-option span { display: grid; }
.campaign-option strong { color: var(--ink); font-size: .86rem; }
.campaign-option small { color: var(--ink-soft); }
.join-panel h2, .recent-panel h2 { margin-bottom: 1rem; }
.join-form label { display: block; margin-bottom: .35rem; color: var(--ink-soft); font-size: .8rem; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.join-form input { letter-spacing: .12em; text-transform: uppercase; }
.recent-list { display: grid; margin: 0; padding: 0; gap: .4rem; list-style: none; }
.recent-list a { display: flex; justify-content: space-between; padding: .75rem; border-radius: 6px; background: rgba(0, 0, 0, .16); color: var(--ink); text-decoration: none; }
.recent-list span { color: var(--ink-soft); font-size: .78rem; }
.lore-card { padding: 1.5rem; border-left: 2px solid var(--blood-light); background: linear-gradient(90deg, rgba(143, 45, 44, .16), transparent); }
.lore-card p { font-family: var(--serif); font-size: 1.2rem; font-style: italic; }

.centered-card { margin-block: clamp(4rem, 12vh, 9rem); padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: center; box-shadow: var(--shadow); }
.centered-card h1 { font-size: clamp(2rem, 6vw, 3rem); }
.error-code { margin: 0; color: var(--blood-light); font-family: var(--serif); font-size: 5rem; line-height: 1; opacity: .75; }
.game-code { display: inline-flex; padding: .15em .35em; border: 1px solid rgba(208, 162, 75, .45); border-radius: 6px; background: rgba(208, 162, 75, .08); color: var(--gold-light); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8em; letter-spacing: .08em; }
button.game-code { cursor: copy; }

.legal-page { padding-block: clamp(3rem, 8vw, 6rem); }
.legal-page h1 { margin-bottom: 1rem; }
.legal-page h2 { margin: 2.2rem 0 .65rem; color: var(--gold-light); font-size: 1.45rem; }
.legal-page p, .legal-page li { color: #cec3b0; }
.legal-page ol { padding-left: 1.4rem; }
.legal-page li { margin-bottom: .55rem; }
.notice { padding: 1rem 1.1rem; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 6px; background: rgba(208, 162, 75, .07); }
.document-links { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-block: 1.8rem; }
.document-card { display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; }
.document-card > span { grid-row: 1 / 3; align-self: center; color: var(--blood-light); font-size: .72rem; font-weight: 900; }
.document-card small { color: var(--ink-soft); }

.game-shell { padding-block: 1.5rem 4rem; }
.game-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(95deg, rgba(143, 45, 44, .22), rgba(25, 20, 17, .95) 32%); }
.game-banner h1 { margin: 0 0 .2rem; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.game-banner p:last-child { margin: 0; color: var(--ink-soft); font-size: .84rem; }
.game-banner-actions { display: flex; align-items: center; gap: 1rem; }
.switch-label { display: flex; align-items: center; gap: .45rem; color: var(--ink-soft); font-size: .8rem; cursor: pointer; }
.switch-label input { appearance: none; position: relative; width: 38px; min-height: 21px; border-radius: 999px; padding: 0; background: #100d0c; cursor: pointer; }
.switch-label input::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #8e8272; content: ""; transition: .2s; }
.switch-label input:checked { border-color: var(--gold); }
.switch-label input:checked::after { left: 18px; background: var(--gold-light); }
.live-indicator { display: inline-flex; align-items: center; gap: .4rem; color: #b4c5a7; font-size: .75rem; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #7ca16d; box-shadow: 0 0 8px #7ca16d; }
.status-strip { display: grid; grid-template-columns: repeat(5, 1fr); border: solid var(--line); border-width: 0 1px 1px; background: rgba(14, 12, 10, .92); }
.status-strip div { display: grid; gap: .05rem; padding: .65rem 1rem; border-right: 1px solid var(--line); }
.status-strip div:last-child { border-right: 0; }
.status-strip span { color: var(--ink-soft); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.status-strip strong { color: var(--gold-light); font-family: var(--serif); font-weight: 500; }
.game-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, .78fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.board-column, .sidebar-column { display: grid; min-width: 0; gap: 1rem; }
.board-panel, .party-panel, .journal-panel { padding: clamp(1rem, 2vw, 1.4rem); }
.terrain-trail { display: flex; min-height: 180px; gap: .85rem; padding: .55rem .3rem 1rem; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--gold) #171310; }
.terrain-tile { position: relative; flex: 0 0 150px; margin: 0; opacity: .72; }
.terrain-tile::after { position: absolute; top: 62px; right: -.72rem; color: var(--gold); content: "◆"; font-size: .7rem; }
.terrain-tile:last-child::after { content: none; }
.terrain-tile img { display: block; aspect-ratio: 1; border: 1px solid #5b4938; border-radius: 9px; object-fit: cover; box-shadow: 0 10px 20px rgba(0, 0, 0, .34); }
.terrain-tile figcaption { margin-top: .35rem; color: var(--ink-soft); font-family: var(--serif); text-align: center; }
.terrain-tile.is-current { opacity: 1; transform: translateY(-3px); }
.terrain-tile.is-current img { border-color: var(--gold-light); box-shadow: 0 0 0 2px rgba(208, 162, 75, .12), 0 16px 28px #000; }
.dungeon-map-wrap { display: grid; min-height: 420px; max-height: 620px; place-items: center; overflow: auto; border: 1px solid rgba(218, 185, 121, .14); border-radius: 10px; background: radial-gradient(circle at center, #1d211e, #0c0b0a 72%); box-shadow: inset 0 0 70px rgba(0, 0, 0, .55); }
.dungeon-map { display: block; width: min(100%, 760px); min-width: 360px; max-height: 590px; padding: 1rem; filter: drop-shadow(0 13px 11px rgba(0, 0, 0, .5)); }
.dungeon-map-tile > rect { fill: none; stroke: var(--gold-light); stroke-width: 3; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 5px #d0a24b); }
.dungeon-map-tile > .dungeon-current-outline { stroke: #72cee8; stroke-width: 4px; filter: drop-shadow(0 0 6px rgba(85, 205, 237, .95)); }
.dungeon-party-marker { clip-path: circle(50% at 50% 50%); pointer-events: none; filter: drop-shadow(0 2px 4px #000) drop-shadow(0 0 6px rgba(114, 206, 232, .95)); }
.dungeon-party-mask { fill: transparent; stroke: #b5efff; stroke-width: 2px; pointer-events: none; filter: drop-shadow(0 0 4px rgba(85, 205, 237, .95)); }
.dungeon-map-tile:not(.is-current) { opacity: .82; }
.special-marker { fill: var(--blood); stroke: #f4c98b; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.special-marker-text { fill: #fff4d0; font-family: Georgia, serif; font-size: 12px; font-weight: 700; text-anchor: middle; }
.dungeon-current { display: flex; align-items: center; gap: .75rem; margin-top: .65rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, .18); }
.dungeon-current > div { display: grid; flex: 1; }
.dungeon-current small { color: var(--ink-soft); }
.dungeon-depth { display: grid; min-width: 60px; min-height: 48px; place-items: center; border: 1px solid var(--gold); border-radius: 6px; color: var(--gold-light); font-family: var(--serif); }
.special-result { padding: .3rem .5rem; border: 1px solid rgba(103, 124, 88, .6); border-radius: 5px; color: #bdcea9; font-size: .72rem; }
.encounter-zone { display: grid; grid-template-columns: minmax(180px, .65fr) 1.35fr; gap: 1rem; margin-top: .5rem; padding: 1rem; border: 1px solid rgba(199, 78, 71, .34); border-radius: 9px; background: radial-gradient(circle at 25% 30%, rgba(143, 45, 44, .2), transparent 52%), rgba(0, 0, 0, .19); }
.encounter-copy h3, .encounter-copy p:last-child { margin-bottom: .35rem; }
.encounter-copy p:last-child { color: var(--ink-soft); font-size: .82rem; }
.monster-line { display: flex; max-height: 320px; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; overflow-y: auto; }
.monster-card { display: grid; flex: 0 1 185px; grid-template-columns: 62px 1fr; align-items: center; gap: .65rem; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; background: #171311; }
.monster-card img { grid-row: 1 / 3; width: 62px; aspect-ratio: 1; border-radius: 6px; object-fit: cover; }
.monster-card div { display: grid; }
.monster-card span { color: #d7958d; font-size: .75rem; }
progress { appearance: none; overflow: hidden; width: 100%; height: 6px; border: 0; border-radius: 99px; background: #0c0a09; }
progress::-webkit-progress-bar { background: #0c0a09; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--blood), var(--blood-light)); }
progress::-moz-progress-bar { background: var(--blood-light); }
.is-defeated { filter: grayscale(1); opacity: .47; }
.village-zone, .catacombs-zone { display: block; border-color: rgba(103, 124, 88, .5); }
.catacombs-zone { border-color: rgba(208, 162, 75, .42); }
.village-zone h3, .catacombs-zone h3 { margin-bottom: .3rem; }
.village-zone p:last-child, .catacombs-zone p:last-child { margin-bottom: 0; color: var(--ink-soft); }
.action-dock { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.action-dock form { display: inline-flex; }
.outcome-message { display: grid; margin-right: auto; }
.outcome-message span { color: var(--ink-soft); font-size: .8rem; }
.party-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.hero-card { display: grid; grid-template-columns: 54px 1fr; gap: .5rem .7rem; padding: .65rem; border: 1px solid rgba(218, 185, 121, .14); border-radius: 8px; background: rgba(0, 0, 0, .16); }
.hero-card > img { grid-row: 1 / 4; width: 54px; aspect-ratio: 1; border-radius: 6px; object-fit: cover; }
.hero-info { display: flex; justify-content: space-between; gap: .5rem; }
.hero-info > div { display: grid; }
.hero-info span { color: var(--ink-soft); font-size: .69rem; }
.hp-value { color: #dc8d82 !important; white-space: nowrap; }
.mini-stats { display: flex; flex-wrap: wrap; gap: .45rem; color: var(--ink-soft); font-size: .66rem; }
.mission-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #1d1713; box-shadow: var(--shadow); }
.mission-card > img { display: block; width: 100%; max-height: 280px; object-fit: cover; object-position: center; filter: brightness(.72) sepia(.12); }
.mission-card > div { position: absolute; right: 0; bottom: 0; left: 0; padding: 3rem 1rem 1rem; background: linear-gradient(transparent, rgba(12, 10, 9, .97) 57%); }
.mission-card h2 { margin: 0; font-size: 1.25rem; text-shadow: 0 2px 6px #000; }
.mission-stamp { position: absolute; top: .8rem; right: .8rem; padding: .35rem .55rem; border: 2px solid #b9d09f; border-radius: 4px; color: #d2e7b9; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; transform: rotate(5deg); }
.inventory-panel { padding: 1rem; }
.inventory-panel .section-heading { margin-bottom: .65rem; }
.inventory-panel h2 { margin: 0; font-size: 1.3rem; }
.loot-summary { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.loot-summary > span { display: grid; padding: .55rem; border: 1px solid rgba(218, 185, 121, .14); border-radius: 5px; color: var(--ink-soft); font-size: .7rem; }
.loot-summary strong { color: var(--gold-light); font-family: var(--serif); font-size: 1.1rem; }
.model-3d-trigger { display: grid; width: 25px; height: 25px; place-items: center; padding: 0; border: 1px solid rgba(218, 185, 121, .28); border-radius: 5px; background: rgba(19, 15, 12, .78); color: var(--gold); line-height: 1; cursor: pointer; }
.model-3d-trigger svg { width: 14px; height: 14px; }
.model-3d-trigger:hover, .model-3d-trigger:focus-visible { border-color: var(--gold-light); background: rgba(208, 162, 75, .18); color: var(--gold-light); }
.loot-chest-trigger { margin-left: auto; }
.hero-sheet-portrait { position: relative; display: block; }
.hero-sheet-portrait .model-3d-trigger { position: absolute; right: -3px; bottom: -1px; }
.mission-visual .model-3d-trigger { position: absolute; top: .8rem; left: .8rem; z-index: 1; }
.magic-item-list { display: grid; gap: .35rem; max-height: none; margin: .65rem 0 0; padding: 0; overflow: visible; list-style: none; }
.magic-item-list li { display: grid; grid-template-columns: 72px 1fr; gap: .35rem .5rem; align-items: baseline; padding: .45rem .5rem; background: rgba(208, 162, 75, .06); font-size: .72rem; }
.magic-item-list span { color: var(--gold); font-size: .61rem; letter-spacing: .06em; text-transform: uppercase; }
.magic-item-list small { grid-column: 2; color: var(--ink-soft); }
.item-owner-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-column: 1 / -1; gap: .35rem; }
.item-owner-form select { width: 100%; min-height: 30px; border: 1px solid var(--line); border-radius: 3px; background: #15120f; color: var(--ink); font: inherit; }
.item-owner-form button { border: 1px solid var(--line); border-radius: 3px; background: #2c241b; color: var(--gold-light); font: inherit; cursor: pointer; }
.empty-loot { margin: .65rem 0 0; color: var(--ink-soft); font-size: .75rem; }
.journal-panel { max-height: 670px; overflow: hidden; }
.event-list { max-height: 580px; margin: 0; padding: 0 .3rem 0 0; overflow-y: auto; list-style: none; }
.event { display: grid; grid-template-columns: 2.25rem 10px minmax(0, 1fr); gap: .45rem; padding: .65rem 0; border-bottom: 1px solid rgba(218, 185, 121, .1); }
.event-number { padding-top: .12rem; color: var(--gold); font-size: .7rem; font-variant-numeric: tabular-nums; text-align: right; }
.event:last-child { border-bottom: 0; }
.event-rune { width: 7px; height: 7px; margin-top: .45rem; border: 1px solid var(--gold); transform: rotate(45deg); }
.event p { margin: 0; font-size: .83rem; }
.event details { margin-top: .2rem; color: var(--ink-soft); }
.event summary { font-size: .68rem; cursor: pointer; }
.event small { display: block; margin-top: .25rem; font-family: ui-monospace, monospace; }
.event-danger .event-rune, .event-combat .event-rune { border-color: var(--blood-light); background: rgba(143, 45, 44, .35); }
.event-success .event-rune { border-color: #9cb485; }
.dice-tray-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .25rem .8rem; padding: 1rem; }
.dice-tray-panel h2 { margin: 0; font-size: 1.35rem; }
.dice-tray-panel > p { grid-column: 1; margin: 0; color: var(--ink-soft); font-size: .74rem; }
.dice-tray-actions { display: flex; grid-column: 2; grid-row: 1 / 3; gap: .4rem; }
.dice-tray-actions form { display: flex; }
.die-button { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid var(--gold); background: #2d2823; color: var(--gold-light); font-family: var(--serif); font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform .16s, background .16s; }
.die-button:hover { background: #44382b; transform: translateY(-2px) rotate(3deg); }
.die-d3, .die-d6 { border-radius: 8px; }
.die-d8 { border-radius: 14px 3px; background: #203740; }

.dice-overlay { position: fixed; inset: 0; z-index: 150; padding: clamp(.7rem, 3vw, 2rem); background: rgba(5, 4, 3, .82); backdrop-filter: blur(7px); }
.dice-overlay[hidden] { display: none; }
.dice-stage { position: relative; width: min(900px, 100%); height: min(650px, calc(100vh - 4rem)); margin: auto; overflow: hidden; border: 1px solid rgba(208, 162, 75, .5); border-radius: 18px; background: radial-gradient(circle at 50% 20%, #34291f, #110e0c 65%); box-shadow: 0 30px 100px #000; }
#dice-canvas { width: 100%; height: 100%; }
.dice-caption { position: absolute; top: 1.2rem; left: 50%; display: grid; place-items: center; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 9px #000; pointer-events: none; }
.dice-caption span { color: var(--gold-light); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.dice-caption strong { font-family: var(--serif); font-size: clamp(2rem, 8vw, 4.6rem); }
#dice-skip { position: absolute; right: 1rem; bottom: 1rem; }

.site-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; padding: 2rem max(1rem, calc((100vw - 1180px) / 2)); border-top: 1px solid var(--line); background: #0a0908; color: var(--ink-soft); font-size: .76rem; }
.site-footer > div:first-child { display: grid; }
.site-footer strong { color: var(--ink); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.site-footer nav a { color: var(--ink-soft); }
.bitcoin { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.copy-bitcoin { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 4px; background: #161310; color: var(--gold-light); cursor: copy; }

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .sidebar-column { grid-template-columns: minmax(250px, .6fr) 1.4fr; }
  .dice-tray-panel { grid-column: 1 / -1; }
  .mission-card > img { height: 100%; max-height: 360px; }
  .journal-panel { max-height: 440px; }
  .event-list { max-height: 350px; }
  .party-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .site-header { min-height: 60px; }
  .brand > span:last-child, .control-label, .top-nav > a { display: none; }
  .hero { min-height: 520px; }
  .hero-logo { margin-left: -.5rem; }
  .home-grid { grid-template-columns: 1fr; padding-block: 1.5rem; }
  .home-side { grid-row: 1; }
  .setup-panel { grid-row: 2; }
  .character-row { grid-template-columns: 1fr; }
  .document-links { grid-template-columns: 1fr; }
  .game-banner { align-items: flex-start; }
  .game-banner-actions { align-items: flex-end; flex-direction: column; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip div:nth-child(even) { border-right: 0; }
  .status-strip div:nth-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .status-strip div:last-child { grid-column: 1 / -1; border-right: 0; }
  .encounter-zone { grid-template-columns: 1fr; }
  .monster-line { justify-content: flex-start; }
  .sidebar-column { grid-template-columns: 1fr; }
  .dice-tray-panel { grid-column: auto; }
  .mission-card > img { max-height: 290px; }
  .site-footer { grid-template-columns: 1fr; text-align: center; }
  .bitcoin { justify-content: center; }
}

@media (max-width: 520px) {
  .shell, .shell-wide, .shell-narrow { width: min(100% - 1rem, 1000px); }
  .hero-content { width: calc(100% - 1.2rem); }
  .hero-backdrop { background-position: 63% center; }
  .inline-form { grid-template-columns: 1fr; }
  .game-banner { padding: .85rem; }
  .game-banner p:last-child, .live-indicator { display: none; }
  .status-strip div { padding: .55rem .7rem; }
  .board-panel, .party-panel, .journal-panel { padding: .8rem; }
  .terrain-tile { flex-basis: 128px; }
  .terrain-trail { min-height: 160px; }
  .dungeon-map-wrap { min-height: 330px; }
  .dungeon-map { min-width: 310px; padding: .45rem; }
  .dungeon-current { align-items: flex-start; flex-wrap: wrap; }
  .party-grid { grid-template-columns: 1fr; }
  .action-dock, .action-dock form, .action-dock .button { width: 100%; }
  .outcome-message { width: 100%; margin-bottom: .5rem; }
  .dice-stage { height: calc(100vh - 1.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Refonte de table : marque au dragon, plateau plein écran et cadre légal partagé. */
:root { --gl-footer-h: 44px; }
html { overflow-x: hidden; }
body { max-width: 100%; padding-bottom: var(--gl-footer-h); overflow-x: hidden; scroll-padding-bottom: var(--gl-footer-h); }
.brand-dragon { width: 42px; height: 42px; border: 1px solid var(--gold); border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #0d0b0a, 0 0 18px rgba(208, 162, 75, .22); }
.hero { min-height: min(560px, 70vh); }
.hero-backdrop { background-image: linear-gradient(90deg, rgba(10, 8, 7, .96) 4%, rgba(10, 8, 7, .62) 53%, rgba(10, 8, 7, .18)), linear-gradient(0deg, var(--night), transparent 42%), url("../assets/brand/shop-background-1600.jpg"); background-position: center; }
.hero-content h1 { width: min(680px, 94vw); margin-bottom: 1rem; color: #f2e5c9; font-size: clamp(3rem, 7vw, 6.6rem); letter-spacing: -.045em; text-shadow: 0 7px 28px #000; }
.hero-content h1 em { display: block; color: var(--gold-light); font-size: .72em; font-style: normal; }
.random-mission-note { display: flex; gap: .55rem; margin: .9rem 0; padding: .75rem .85rem; border-left: 2px solid var(--gold); background: rgba(208, 162, 75, .06); color: var(--ink-soft); font-size: .82rem; }

.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; animation: toast-in .24s ease both; }
.flash.is-leaving { animation: toast-out .22s ease both; }
.flash-close { flex: 0 0 auto; width: 28px; height: 28px; margin: -.3rem -.35rem 0 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.07); color: var(--ink); font-size: 1.2rem; line-height: 1; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(32px); } }

.game-shell.shell-wide { width: 100%; margin: 0; padding: .65rem .75rem 1rem; }
.game-banner { min-height: 62px; padding: .55rem .9rem; border-radius: 8px 8px 0 0; }
.game-banner .eyebrow { margin-bottom: .15rem; }
.game-banner h1 { margin: 0; font-size: clamp(1.35rem, 2.2vw, 2rem); }
.game-banner p:last-child { display: flex; align-items: center; gap: .45rem; }
.status-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.status-strip div { padding: .38rem .7rem; }
.status-strip strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-strip .status-xp strong { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem; font-size: .82rem; white-space: normal; }
.status-strip .status-xp strong small { color: var(--ink-soft); font-family: var(--sans); font-size: .66rem; text-transform: none; }
.game-layout { grid-template-columns: 248px minmax(480px, 1fr) 330px; grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 292px); min-height: 590px; margin-top: .65rem; gap: .65rem; }
.board-column { display: contents; }
.board-panel { position: relative; grid-column: 2; grid-row: 1; display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: .8rem; overflow: hidden; }
.board-panel > .section-heading { flex: 0 0 auto; margin-bottom: .45rem; }
.board-panel > .section-heading h2 { font-size: 1.45rem; }
.board-panel > .section-heading .eyebrow { margin-bottom: .15rem; }
.party-panel { grid-column: 1; grid-row: 1; min-width: 0; max-height: 100%; padding: .75rem; overflow-y: auto; }
.party-panel .section-heading { margin-bottom: .55rem; }
.party-panel h2 { font-size: 1.45rem; }
.party-grid { grid-template-columns: 1fr; gap: .45rem; }
.hero-card { grid-template-columns: 48px minmax(0, 1fr); padding: .5rem; }
.hero-card > img { width: 48px; }
.hero-info { display: grid; }
.mini-stats { gap: .3rem; }
.sidebar-column { grid-column: 3; grid-row: 1; display: flex; min-width: 0; max-height: 100%; flex-direction: column; gap: .65rem; overflow-y: auto; scrollbar-width: thin; }
.mission-card { flex: 0 0 auto; }
.mission-card > img { width: 100%; height: 275px; max-height: none; object-fit: contain; object-position: center; background: radial-gradient(circle, #293247, #121419); filter: none; }
.mission-card > div { position: static; padding: .55rem .75rem .7rem; background: #171310; }
.mission-card > div .eyebrow { margin-bottom: .15rem; }
.mission-card h2 { font-size: 1rem; }
.inventory-panel { flex: 0 0 auto; }
/* Le butin grandit naturellement vers le bas; la colonne s'arrête au footer
   et devient défilable seulement lorsque tout son contenu ne tient plus. */
.sidebar-column .inventory-panel[open] { max-height: 100%; }
.journal-panel { flex: 1 0 260px; min-height: 260px; padding: .85rem; }
.event-list { max-height: none; height: calc(100% - 53px); }
.terrain-trail { min-height: 0; flex: 1; align-items: center; padding: .35rem .25rem .55rem; }
.terrain-tile { flex-basis: clamp(105px, 15vw, 142px); }
.dungeon-map-wrap { min-height: 0; max-height: none; flex: 1 1 300px; }
.dungeon-map { min-width: 260px; max-height: 100%; padding: .45rem; }
.dungeon-current { flex: 0 0 auto; margin-top: .4rem; padding: .45rem .6rem; }
.dungeon-depth { min-height: 40px; }
.encounter-zone { flex: 0 0 auto; max-height: 180px; margin-top: .35rem; padding: .65rem; overflow-y: auto; }
.action-dock { flex: 0 0 auto; margin-top: .45rem; padding-top: .55rem; }
.action-dock .button { min-height: 38px; padding: .45rem .8rem; font-size: .82rem; }

.event-stage { position: absolute; top: 63px; left: 50%; z-index: 20; display: grid; width: min(660px, calc(100% - 2rem)); gap: .18rem; padding: .85rem 1rem; border: 1px solid rgba(240, 207, 130, .48); border-left: 4px solid var(--gold); border-radius: 8px; background: rgba(16, 13, 11, .94); box-shadow: 0 16px 45px rgba(0,0,0,.62); text-align: center; transform: translateX(-50%); backdrop-filter: blur(9px); animation: event-in .2s ease both; pointer-events: none; }
.event-stage[hidden] { display: none !important; }
.event-stage > span { color: var(--gold); font-size: .65rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.event-stage > strong { font-family: var(--serif); font-size: clamp(1rem, 2vw, 1.35rem); }
.event-stage > small { color: var(--ink-soft); font-family: ui-monospace, monospace; }
.dungeon-event-stage { top: auto; bottom: .65rem; }
.event-stage-danger, .event-stage-combat { border-left-color: var(--blood-light); }
.event-stage-success { border-left-color: #9cb485; }
@keyframes event-in { from { opacity: 0; transform: translate(-50%, -10px); } }

.board-dice-layer { position: absolute; inset: 55px .75rem 66px; z-index: 12; overflow: hidden; border-radius: 10px; background: radial-gradient(circle at center, rgba(35, 25, 18, .98), rgba(10, 8, 7, .995)); pointer-events: none; }
.board-dice-layer[hidden] { display: none; }
#dice-canvas { display: block; width: 100%; height: 100%; }
.board-dice-layer .dice-caption { top: .7rem; width: min(620px, calc(100% - 1rem)); }
.dice-caption span { white-space: normal; font-size: clamp(.65rem, 1.2vw, .85rem); }
.dice-caption strong { font-size: clamp(2.1rem, 6vw, 4rem); line-height: 1; }
.dice-caption small { color: var(--ink); font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }

.rules-page { padding-block: 2rem 4rem; }
.rules-page > h1 { margin-bottom: .5rem; }
.rule-tabs { position: sticky; top: 70px; z-index: 4; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; padding: .55rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(13, 11, 10, .96); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.rule-tabs [role="tab"] { border-radius: 6px; }
.rule-tabs [role="tab"][aria-selected="true"] { border-color: var(--gold); background: linear-gradient(135deg, #c18a2f, #8e5c20); color: #fff7dc; }
.rule-tabs [role="tab"][aria-selected="false"] { background: transparent; color: var(--ink-soft); }
.rule-tab-panels { margin-block: 1rem 2rem; }
.rule-tab-panel[hidden] { display: none !important; }
.rule-tab-panel { min-height: calc(100dvh - 245px); outline: none; }
.rules-overview { margin-bottom: .8rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(22, 18, 15, .84); }
.rules-overview h2 { margin: 0 0 .35rem; font-size: 1.2rem; }
.rules-overview p { margin: .25rem 0; }
.embedded-rule { scroll-margin-top: 130px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.embedded-rule header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.embedded-rule h2 { margin: 0; font-size: 1.25rem; }
.embedded-rule iframe { display: block; width: 100%; height: min(78dvh, 850px); border: 0; background: #d4d4d4; }
.rules-section { scroll-margin-top: 145px; margin-top: 0; }
.rules-section > h2 { margin-block: .15rem .5rem; }
.spell-school { margin-top: 2rem; padding-left: 1rem; border-left: 4px solid var(--gold); }
.spell-school-blue { border-left-color: #668fca; }
.spell-school-yellow { border-left-color: #d9b849; }
.spell-school-red { border-left-color: #b94e47; }
.spell-school h3 { margin-top: 0; }
.spell-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.spell-card { padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.spell-card header { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.spell-card h4 { margin: 0; color: var(--gold-light); font-family: var(--serif); font-size: 1.08rem; }
.spell-card p { margin-bottom: 0; }
.spell-card .spell-type { margin-top: .25rem; color: var(--ink-soft); font-size: .72rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.spell-cost { flex: 0 0 auto; color: var(--ink-soft); font-size: .78rem; font-weight: 800; }
.roadmap-date { color: var(--ink-soft); font-size: .85rem; }
.roadmap-reminder { margin-block: 1rem; padding: .8rem 1rem; border: 1px solid var(--gold); border-radius: 8px; background: rgba(208, 162, 75, .1); }
.roadmap-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.roadmap-columns section { padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.roadmap-columns h3 { margin-top: 0; }
.roadmap-columns li + li { margin-top: .55rem; }

@media (max-width: 760px) {
  .spell-grid, .roadmap-columns { grid-template-columns: 1fr; }
  .rule-tabs { position: static; }
}

.combat-shell { display: grid; width: 100%; height: calc(100dvh - 68px - var(--gl-footer-h)); min-height: 650px; grid-template-rows: auto minmax(0, 1fr) auto; gap: .45rem; padding: .45rem .7rem; overflow: hidden; }
.combat-header, .combat-controls { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(24, 19, 16, .96); }
.combat-header .eyebrow { margin-bottom: .1rem; }
.combat-header h1 { margin: 0; font-size: clamp(1.3rem, 2.2vw, 2rem); }
.combat-header-meta { display: flex; align-items: center; gap: .75rem; color: var(--ink-soft); font-size: .78rem; }
.combat-table { position: relative; width: min(100%, calc((100dvh - 220px) * 1.78)); max-height: 100%; aspect-ratio: 16 / 9; place-self: center; overflow: hidden; border: 1px solid rgba(240, 207, 130, .28); border-radius: 10px; background-color: #343936; background-image: radial-gradient(circle at 28% 52%, rgba(8,10,9,.08), rgba(8,10,9,.58) 46%, rgba(5,6,5,.78)), linear-gradient(rgba(226,234,223,.11) 1px, transparent 1px), linear-gradient(90deg, rgba(226,234,223,.11) 1px, transparent 1px), repeating-linear-gradient(17deg, transparent 0 37px, rgba(0,0,0,.09) 38px 40px); background-size: auto, 7.2% 12.5%, 7.2% 12.5%, auto; box-shadow: inset 0 0 90px rgba(0,0,0,.72), 0 18px 50px rgba(0,0,0,.5); }
.combat-table::before { position: absolute; inset: 2.5%; border: 2px solid rgba(220,225,213,.16); border-radius: 4px; box-shadow: inset 0 0 0 5px rgba(0,0,0,.13); content: ""; pointer-events: none; }
.combat-tactical-field { position: absolute; top: 8%; bottom: 8%; left: 4%; display: grid; width: 54%; place-items: center; border: 2px solid rgba(210,218,207,.18); background-image: linear-gradient(rgba(225,233,222,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(225,233,222,.12) 1px, transparent 1px), radial-gradient(circle, rgba(143,45,44,.12), transparent 60%); background-size: 11.111% 16.666%, 11.111% 16.666%, auto; box-shadow: inset 0 0 42px rgba(0,0,0,.34); }
.combat-tactical-field span { position: absolute; top: .7rem; left: .8rem; color: rgba(238,228,207,.56); font-size: .7rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.combat-tactical-field strong { color: rgba(238,228,207,.18); font-family: var(--serif); font-size: clamp(4rem, 10vw, 9rem); font-weight: 500; text-transform: uppercase; }
.combat-tactical-field i { width: 22%; aspect-ratio: 1; border: 2px solid rgba(208,162,75,.18); transform: rotate(45deg); }
.combat-formation-zone { position: absolute; top: 5%; right: 3.5%; display: grid; width: 36%; height: 43%; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 2.5%; }
.combat-side { display: grid; min-width: 0; height: 100%; grid-template-rows: auto minmax(0, 1fr); }
.combat-side h2 { margin: 0 0 .35rem; color: rgba(238,228,207,.83); font-family: var(--serif); font-size: clamp(.8rem, 1.25vw, 1.25rem); letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.formation-versus { align-self: center; color: var(--gold-light); font-family: var(--serif); font-size: clamp(.65rem, 1vw, 1rem); font-weight: 800; }
.combat-grid { display: grid; min-width: 0; min-height: 0; border: 2px solid rgba(224,230,216,.28); grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); background: rgba(8,10,9,.24); box-shadow: inset 0 0 28px rgba(0,0,0,.4); }
.combat-cell { display: grid; min-width: 0; min-height: 0; place-items: center; border-right: 1px solid rgba(224,230,216,.25); border-bottom: 1px solid rgba(224,230,216,.25); }
.combat-cell:nth-child(3n) { border-right: 0; }
.combat-cell:nth-child(n+7) { border-bottom: 0; }
.combat-token { position: relative; display: grid; width: 78%; height: 78%; place-items: center; }
.combat-token img { display: block; width: 100%; height: 100%; border: 1px solid rgba(240,207,130,.8); border-radius: 7px; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,.62); }
.monster-token img { border-color: rgba(199,78,71,.9); }
.familiar-token img { border-color: rgba(164,211,134,.85); background: rgba(39,83,43,.72); }
.companion-token img { border-color: rgba(114,206,232,.78); background: rgba(28,57,70,.72); }
.combat-token span { position: absolute; right: 0; bottom: -1px; left: 0; overflow: hidden; padding: 1px 2px; background: rgba(8,7,6,.82); color: #fff1d2; font-size: clamp(5px, .45vw, 8px); font-weight: 800; line-height: 1.05; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.combat-token progress { position: absolute; right: 2px; bottom: -4px; left: 2px; width: calc(100% - 4px); height: 3px; }
.combat-token.is-attacker img { outline: 3px solid #f1ca69; box-shadow: 0 0 20px 7px rgba(240, 195, 93, .9); animation: attacker-pulse .55s ease-in-out infinite alternate; }
.combat-token.is-target img { outline: 3px solid #e2524a; box-shadow: 0 0 22px 8px rgba(199, 49, 44, .92); animation: target-pulse .32s ease-in-out infinite alternate; }
@keyframes attacker-pulse { to { transform: translateY(-3px) scale(1.05); } }
@keyframes target-pulse { to { transform: scale(.92); filter: saturate(1.5) brightness(1.2); } }
.combat-reserve { position: absolute; top: 49%; right: 4%; margin: 0; padding: .25rem .45rem; border-radius: 4px; background: rgba(0,0,0,.7); color: var(--gold-light); font-size: .7rem; }
.combat-event-stage { top: 32%; left: 31%; width: min(720px, 52%); }
.combat-dice-layer { inset: 10% 42% 8% 4%; }
.combat-controls { min-height: 58px; }
.combat-explanation { display: grid; }
.combat-explanation span { color: var(--ink-soft); font-size: .75rem; }
.combat-controls .button { min-height: 40px; }

.gl-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 90; display: flex; min-height: var(--gl-footer-h); align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: .3rem 1.1rem; padding: 6px 1.1rem; border-top: 1px solid rgba(255,255,255,.08); background: #0b0a09; box-shadow: 0 -6px 20px rgba(0,0,0,.3); color: rgba(218,205,185,.74); font-size: .72rem; line-height: 1.4; }
.gl-footer-copy { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-footer-legal { display: inline-flex; flex: none; align-items: center; gap: .4rem; white-space: nowrap; }
.gl-footer-legal a { color: rgba(218,205,185,.74); text-decoration: none; }
.gl-footer-legal a:hover { color: var(--gold-light); }
.gl-footer-btc { display: inline-flex; flex: none; align-items: center; gap: .4rem; padding: 0; border: 0; background: transparent; color: rgba(218,205,185,.8); white-space: nowrap; cursor: copy; }
.gl-footer-btc code { color: inherit; font-size: .7rem; }
.gl-short { display: none; }
.gl-modal-overlay { position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8,7,6,.72); backdrop-filter: blur(4px); }
.gl-modal-overlay.open { display: flex; }
.gl-modal { position: relative; width: min(680px, 100%); max-height: 85vh; padding: 28px 32px 32px; overflow-y: auto; border-radius: 12px; background: #fff; box-shadow: 0 24px 60px rgba(0,0,0,.55); color: #172033; font-family: var(--sans); line-height: 1.6; animation: gl-modal-in .18s ease; }
.gl-modal h2, .gl-modal h3 { color: #172033; }
.gl-modal h2 { margin: 0 0 4px; font-size: 1.45rem; }
.gl-modal h3 { margin: 20px 0 6px; font-size: 1.02rem; }
.gl-modal p { color: #334155; font-size: .92rem; }
.gl-modal .gl-legal-meta { margin-bottom: 16px; color: #607086; font-size: .85rem; }
.gl-legal-callout { margin: 16px 0; padding: 12px 14px; border-left: 4px solid #ca8a04; border-radius: 8px; background: #fffbeb; color: #475569; font-size: .9rem; font-weight: 700; }
.gl-modal-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eef2f7; color: #334155; font-size: 1.2rem; cursor: pointer; }
@keyframes gl-modal-in { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 1200px) {
  .game-layout { grid-template-columns: 210px minmax(430px, 1fr) 290px; }
  .mission-card > img { height: 240px; }
}
@media (max-width: 980px) {
  .game-layout { display: grid; height: auto; min-height: 0; grid-template-columns: 1fr; }
  .board-column { display: contents; }
  .board-panel { grid-column: 1; grid-row: 1; min-height: 620px; }
  .party-panel { grid-column: 1; grid-row: 2; max-height: none; }
  .party-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar-column { grid-column: 1; grid-row: 3; max-height: none; overflow: visible; }
  .mission-card > img { height: 390px; }
  .combat-shell { height: auto; min-height: calc(100dvh - 60px - var(--gl-footer-h)); overflow: visible; }
  .combat-table { width: 100%; }
}
@media (max-width: 560px) {
  .gl-long { display: none; }
  .gl-short { display: inline; }
  .gl-footer-btc { display: none; }
  .gl-footer { font-size: .68rem; }
  .gl-modal { padding: 22px 18px 26px; }
  .game-layout { display: grid; }
  .board-panel { min-height: 540px; }
  .party-grid { grid-template-columns: 1fr; }
  .mission-card > img { height: 340px; }
  .combat-header-meta > span, .combat-header-meta .switch-label { display: none; }
  .combat-controls { align-items: stretch; flex-direction: column; }
  .combat-controls form, .combat-controls .button { width: 100%; }
}

/* Jalon navigation, campagnes portables, plateaux lisibles et face-à-face. */
.brand-logo { display: block; width: 72px; height: 42px; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .65)); }
.brand-dragon { display: none; }
.page-stack { padding-block: clamp(1.2rem, 4vw, 3.2rem) calc(var(--gl-footer-h) + 2rem); }
.form-page .setup-panel { padding: clamp(1rem, 3vw, 2rem); }
.character-row-with-level { grid-template-columns: 1.05fr 1fr 90px; }
.character-row-with-level > input[type="hidden"] { display: none; }
.character-customization { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; padding-top: .75rem; border-top: 1px solid rgba(218, 185, 121, .13); }
.character-customization > label, .initial-spell-picker label { display: grid; gap: .35rem; color: var(--ink-soft); font-size: .74rem; font-weight: 650; }
.magic-school-picker { display: grid; grid-column: span 2; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; padding: .65rem; border: 1px solid rgba(218, 185, 121, .16); border-radius: 7px; }
.magic-school-picker legend { padding-inline: .3rem; }
.magic-school-picker label { display: flex; min-height: 36px; align-items: center; gap: .4rem; padding: .35rem .45rem; border-radius: 5px; background: rgba(0, 0, 0, .14); color: var(--ink-soft); font-size: .7rem; cursor: pointer; }
.magic-school-picker input { flex: 0 0 auto; width: 17px; min-height: 17px; padding: 0; accent-color: var(--gold); }
.magic-school-picker small { grid-column: 1 / -1; color: var(--ink-soft); }
.initial-spell-picker { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.initial-spell-picker > span { grid-column: 1 / -1; color: var(--gold-light); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.veteran-advancements { display: grid; grid-column: 1 / -1; gap: .45rem; padding: .7rem; border: 1px solid rgba(208, 162, 75, .3); border-radius: 8px; background: rgba(208, 162, 75, .06); }
.veteran-advancements > strong { color: var(--gold-light); font-family: var(--serif); }
.veteran-advancements > small { color: var(--ink-soft); }
.veteran-advancement { display: grid; grid-template-columns: 90px minmax(170px, 1fr) minmax(150px, 1fr); align-items: center; gap: .5rem; }
.veteran-advancement > span { color: var(--gold); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.character-customization [hidden], .initial-spell-picker[hidden] { display: none; }
.formation-note { margin-bottom: .25rem; }
.level-variant-note { margin-top: .25rem; border-left: 2px solid var(--gold); padding-left: .7rem; }

.home-page { overflow: hidden; }
.home-page #contenu { height: calc(100dvh - 68px - var(--gl-footer-h)); }
.home-page .hero { width: 100%; height: 100%; min-height: 0; border-bottom: 0; }
.home-page .hero-content { padding-block: clamp(2rem, 8vh, 6rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.page-heading h1 { margin-bottom: 0; }
.campaign-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.campaign-tools .panel { padding: 1.2rem; }
.campaign-tools h2 { margin-bottom: .8rem; font-size: 1.35rem; }
.import-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.import-form input[type="file"] { padding: .45rem; color: var(--ink-soft); }
.campaign-list { display: grid; gap: .75rem; }
.campaign-entry { padding: 1rem; }
.campaign-entry-main { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.campaign-entry h3 { margin: .15rem 0; font-size: 1.3rem; }
.campaign-entry small { color: var(--ink-soft); }
.campaign-status { color: #abc49a; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.campaign-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.campaign-actions form { display: flex; gap: .4rem; }
.campaign-actions .rename-form { flex: 1 1 360px; }
.campaign-actions .rename-form input { min-width: 160px; }
.campaign-actions .button { min-height: 40px; padding: .45rem .75rem; font-size: .78rem; }
.empty-library { padding: 1.5rem; color: var(--ink-soft); text-align: center; }
.empty-library p:last-child { margin-bottom: 0; }

.terrain-tile { flex-basis: clamp(125px, 15vw, 168px); }
.terrain-tile::after { top: 45%; right: -.72rem; }
.terrain-tile-visual { display: block; aspect-ratio: 1.125; padding: 3px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #5b4938; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .56)); }
.terrain-tile .terrain-tile-visual img { display: block; width: 100%; height: 100%; border: 0; border-radius: 0; clip-path: inherit; object-fit: cover; box-shadow: none; image-rendering: auto; }
.terrain-tile.is-current .terrain-tile-visual { background: var(--gold-light); filter: drop-shadow(0 0 8px rgba(240, 207, 130, .6)) drop-shadow(0 13px 15px #000); }
.terrain-tile.is-current img { border: 0; box-shadow: none; }

.game-layout { grid-template-columns: 268px minmax(460px, 1fr) 330px; height: calc(100dvh - 268px); min-height: 520px; }
.left-sidebar { grid-column: 1; grid-row: 1; display: flex; min-width: 0; max-height: 100%; flex-direction: column; gap: .65rem; overflow-y: auto; scrollbar-width: thin; }
.board-panel { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.party-panel { grid-column: auto; grid-row: auto; max-height: none; padding: 0; overflow: visible; }
.collapsible-panel { min-width: 0; padding: 0; overflow: hidden; }
.collapsible-panel > summary { display: grid; min-height: 58px; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .45rem; padding: .65rem .75rem; cursor: pointer; list-style: none; user-select: none; }
.collapsible-panel > summary::-webkit-details-marker { display: none; }
.collapse-heading { display: grid; min-width: 0; }
.collapse-heading .eyebrow { margin-bottom: .1rem; font-size: .62rem; }
.collapse-heading > strong { overflow: hidden; font-family: var(--serif); font-size: 1.13rem; font-weight: 500; line-height: 1.15; text-overflow: ellipsis; }
.collapse-chevron { width: 9px; height: 9px; margin-right: .2rem; border-right: 2px solid var(--gold-light); border-bottom: 2px solid var(--gold-light); transform: rotate(45deg); transition: transform .18s; }
.collapsible-panel[open] .collapse-chevron { transform: rotate(225deg) translate(-2px, -2px); }
.summary-meta { color: var(--ink-soft); font-size: .68rem; white-space: nowrap; }
.collapsible-content { padding: 0 .7rem .75rem; border-top: 1px solid rgba(218, 185, 121, .1); }
.party-grid.collapsible-content { display: grid; grid-template-columns: 1fr; gap: .45rem; padding-top: .65rem; }
.hero-card { grid-template-columns: 48px minmax(0, 1fr); }
.hero-card > img { width: 48px; height: 48px; image-rendering: auto; }
.castle-spell-preparation { display: grid; grid-column: 1 / -1; gap: .4rem; }
.castle-spell-preparation > strong { color: var(--gold-light); font-size: .72rem; }
.castle-spell-preparation form { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(0, 1.5fr) auto; align-items: center; gap: .4rem; padding: .45rem; border: 1px solid rgba(218,185,121,.14); border-radius: 6px; background: rgba(0,0,0,.2); }
.castle-spell-preparation form > span { display: grid; }
.castle-spell-preparation small { color: var(--ink-soft); font-size: .65rem; }
.castle-spell-options { display: flex; flex-wrap: wrap; gap: .35rem .55rem; }
.castle-spell-options label { display: inline-flex; align-items: center; gap: .25rem; color: var(--ink-soft); font-size: .7rem; white-space: nowrap; }
.castle-spell-preparation button { min-height: 34px; border: 1px solid rgba(208,162,75,.38); border-radius: 5px; background: rgba(208,162,75,.1); color: var(--gold-light); font-size: .68rem; cursor: pointer; }
.mission-panel { position: relative; flex: 0 0 auto; }
.mission-visual { position: relative; display: grid; max-height: 380px; place-items: center; padding-top: .7rem; overflow: auto; background: radial-gradient(circle, #293247, #121419); }
.mission-visual > img { display: block; width: 100%; height: auto; image-rendering: auto; }
.inventory-panel { flex: 0 0 auto; }
.journal-panel { display: block; flex: 1 1 240px; min-height: 58px; max-height: none; }
.journal-panel[open] { min-height: 220px; }
.journal-panel .event-list { height: calc(100% - 58px); max-height: none; padding-top: .2rem; }

.event-stage { pointer-events: auto; }
.event-stage-close { position: absolute; top: .35rem; right: .4rem; display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer; }

.combat-shell { height: calc(100dvh - 68px - var(--gl-footer-h)); min-height: 660px; grid-template-rows: auto minmax(0, 1fr) auto; }
.combat-table { display: grid; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; grid-template-columns: 210px minmax(0, 1fr) 210px; gap: .6rem; padding: .6rem; place-self: stretch; overflow: hidden; background-color: #171b19; background-image: radial-gradient(circle at center, rgba(74, 63, 49, .2), transparent 52%), repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 7px); background-size: auto; }
.combat-table::before { display: none; }
.combat-center { display: grid; min-width: 0; min-height: 0; grid-template-rows: minmax(0, 1fr) 138px; gap: .55rem; }
.combat-formation-zone { position: static; display: grid; width: 100%; height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .7rem; }
.combat-side { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); align-items: center; }
.combat-side h2 { margin-bottom: .25rem; font-size: clamp(.9rem, 1.3vw, 1.25rem); }
.combat-grid { width: auto; max-width: 100%; height: 100%; max-height: min(100%, calc(100dvh - 405px)); aspect-ratio: 1; justify-self: center; border-width: 2px; }
.combat-cell { aspect-ratio: 1; overflow: hidden; }
.combat-token { width: 86%; height: auto; aspect-ratio: 1; }
.combat-token img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; backface-visibility: hidden; }
.hero-side .combat-token img { transform: rotate(90deg) scale(.9); }
.monster-side .combat-token img { transform: rotate(-90deg) scale(.9); }
.combat-token span { right: 8%; bottom: 2%; left: 8%; padding: 2px 3px; font-size: clamp(7px, .58vw, 10px); }
.combat-token progress { display: none; }
.combat-token.is-attacker img, .combat-token.is-target img { animation: combat-glow .45s ease-in-out infinite alternate; }
@keyframes combat-glow { to { filter: brightness(1.35) saturate(1.3); } }

.combat-vitals { min-width: 0; overflow: hidden; border: 1px solid rgba(224,230,216,.18); border-radius: 7px; background: rgba(4, 6, 5, .38); }
.combat-vitals h2 { margin: 0; padding: .55rem .6rem; border-bottom: 1px solid rgba(224,230,216,.14); color: var(--gold-light); font-size: 1.05rem; }
.combat-vitals h2 small { color: var(--ink-soft); font-family: var(--sans); font-size: .62rem; }
.combat-vitals ul { display: grid; align-content: start; gap: .3rem; height: calc(100% - 48px); margin: 0; padding: .5rem; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.combat-vitals li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .22rem .4rem; padding: .45rem; border: 1px solid rgba(218,185,121,.12); border-radius: 5px; background: rgba(0,0,0,.2); }
.combat-vitals li > span { display: grid; min-width: 0; }
.combat-vitals li strong { overflow: hidden; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.combat-vitals li small { color: var(--ink-soft); font-size: .58rem; }
.combat-vitals li b { align-self: center; color: #e29489; font-size: .68rem; white-space: nowrap; }
.combat-vitals li progress { grid-column: 1 / -1; height: 5px; }
.combat-vitals li.familiar-vital { grid-template-columns: 34px minmax(0, 1fr) auto; border-color: rgba(139, 190, 110, .35); background: linear-gradient(145deg, rgba(43, 76, 43, .42), rgba(8, 20, 10, .3)); }
.combat-vitals li.familiar-vital > img { grid-row: 1 / 3; width: 34px; height: 34px; align-self: center; border: 1px solid rgba(164, 211, 134, .55); border-radius: 50%; background: rgba(39, 83, 43, .7); object-fit: contain; }
.combat-vitals li.familiar-vital progress { grid-column: 2 / -1; }
.combat-vitals li.is-selectable,
.monster-card[data-monster-sheet-open],
.combat-token[data-monster-sheet-open] { cursor: pointer; outline: none; }
.combat-vitals li.is-selectable:hover,
.combat-vitals li.is-selectable:focus-visible,
.monster-vitals li[data-monster-sheet-open]:hover,
.monster-vitals li[data-monster-sheet-open]:focus-visible,
.monster-card[data-monster-sheet-open]:hover,
.monster-card[data-monster-sheet-open]:focus-visible { border-color: var(--gold-light); background: rgba(208, 162, 75, .12); }
.combat-journal { display: grid; min-width: 0; min-height: 0; grid-template-columns: 190px minmax(0, 1fr); overflow: hidden; border: 1px solid rgba(218,185,121,.2); border-radius: 7px; background: rgba(7, 6, 5, .58); }
.combat-journal header { display: grid; align-content: center; padding: .7rem; border-right: 1px solid var(--line); }
.combat-journal header .eyebrow { margin-bottom: .12rem; }
.combat-journal h2 { margin: 0; font-size: 1.15rem; }
.combat-journal ol { margin: 0; padding: .45rem .8rem .45rem 2rem; overflow-y: auto; color: var(--ink-soft); font-size: .72rem; }
.combat-journal li { padding: .12rem 0; }
.combat-journal .event-danger { color: #e69a90; }
.combat-journal .event-success { color: #b8d2a4; }
.combat-event-stage { top: 18%; left: 50%; width: min(760px, 62%); }
.combat-dice-layer { inset: 8% 220px 150px; }

@media (max-width: 1200px) {
  .game-layout { grid-template-columns: 230px minmax(430px, 1fr) 285px; }
  .combat-table { grid-template-columns: 170px minmax(0, 1fr) 170px; }
  .combat-dice-layer { right: 180px; left: 180px; }
}

@media (max-width: 980px) {
  .game-layout { height: auto; }
  .left-sidebar { grid-column: 1; grid-row: 2; max-height: none; overflow: visible; }
  .board-panel { grid-row: 1; overflow: visible; }
  .sidebar-column { grid-row: 3; }
  .campaign-tools { grid-template-columns: 1fr; }
  .combat-shell { height: auto; min-height: calc(100dvh - 60px - var(--gl-footer-h)); overflow: visible; }
  .combat-table { min-height: 720px; grid-template-columns: 150px minmax(640px, 1fr) 150px; overflow-x: auto; }
}

@media (max-width: 760px) {
  .home-page #contenu { height: calc(100dvh - 60px - var(--gl-footer-h)); }
  .top-nav > a { display: inline-flex; padding: .45rem .35rem; font-size: .7rem; }
  .audio-controls { display: none; }
  .brand-logo { width: 54px; }
  .character-row-with-level { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .campaign-entry-main { align-items: stretch; flex-direction: column; }
  .campaign-actions, .campaign-actions form, .campaign-actions .button { width: 100%; }
  .campaign-actions .rename-form { flex-basis: auto; }
  .import-form { grid-template-columns: 1fr; }
}

/* Ajustements de navigation du plateau et défilement de la compagnie. */
.dungeon-map-tile.is-reachable { cursor: pointer; outline: none; }
.dungeon-tile-target { fill: transparent; stroke: transparent; stroke-width: 3px; transition: fill .15s, stroke .15s; }
.dungeon-map-tile.is-reachable:hover .dungeon-tile-target,
.dungeon-map-tile.is-reachable:focus .dungeon-tile-target,
.dungeon-map-tile.is-reachable:focus-visible .dungeon-tile-target { fill: rgba(240, 207, 130, .1); stroke: var(--gold-light); }
.dungeon-map-tile.is-reachable:focus-visible { outline: none; }

.dungeon-toolbar { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: .55rem; margin-top: .4rem; }
.dungeon-toolbar .dungeon-current { min-width: 0; margin-top: 0; }
.dungeon-navigation { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .45rem; padding: .35rem 0; }
.dungeon-navigation form { display: flex; }
.dungeon-navigation .button { min-width: 60px; min-height: 40px; padding: .45rem .7rem; }
.special-action-form { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .35rem; border: 1px solid rgba(208, 162, 75, .25); border-radius: 8px; background: rgba(208, 162, 75, .06); }
.special-action-form label { color: var(--gold-light); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.special-action-form select { min-width: 140px; min-height: 40px; }
.special-investigation-card { display: grid; flex: 0 1 500px; width: min(100%, 500px); grid-template-columns: 1fr auto; gap: .45rem; padding: .4rem; border: 1px solid rgba(208, 162, 75, .25); border-radius: 8px; background: rgba(208, 162, 75, .06); }
.special-investigation-card .special-investigate-form,
.special-investigation-card .special-ignore-form { display: contents; }
.special-investigation-card .special-investigate-form > label,
.special-investigation-card .special-investigate-form > select { grid-column: 1 / -1; }
.special-investigation-card .special-investigate-form > select { width: 100%; }
.special-investigation-card .special-investigate-form > .button { grid-column: 1; justify-self: start; }
.special-investigation-card .special-ignore-form .button { grid-column: 2; justify-self: end; min-height: 38px; white-space: nowrap; }
.encounter-spell-form { order: 2; }
.encounter-spell-form.special-action-form { flex: 1 1 100%; justify-content: flex-end; }
.utility-actions { flex: 1 1 100%; min-width: min(100%, 460px); border: 1px solid rgba(208, 162, 75, .28); border-radius: 8px; background: rgba(0, 0, 0, .16); }
.utility-actions > summary { padding: .5rem .65rem; color: var(--gold-light); font-size: .72rem; font-weight: 800; cursor: pointer; }
.utility-actions > div { display: grid; max-height: 220px; gap: .35rem; padding: .45rem; overflow-y: auto; }
.utility-actions form { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(110px, auto) auto; align-items: center; gap: .35rem; }
.utility-actions form span { display: grid; }
.utility-actions form small { color: var(--ink-soft); font-size: .62rem; }
.utility-actions select, .utility-actions button { min-height: 36px; }

@media (max-width: 620px) {
  .utility-actions form { grid-template-columns: 1fr; }
}

.left-sidebar { overflow: hidden; }
.party-panel[open] { max-height: 100%; overflow: hidden; }
.party-panel .party-grid { min-height: 0; overflow-y: scroll; overscroll-behavior: contain; scrollbar-color: var(--gold) rgba(0, 0, 0, .18); scrollbar-width: thin; }
.party-panel .party-grid::-webkit-scrollbar { width: 9px; }
.party-panel .party-grid::-webkit-scrollbar-track { background: rgba(0, 0, 0, .18); }
.party-panel .party-grid::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: var(--gold); background-clip: padding-box; }

@media (max-width: 980px) {
  .left-sidebar { overflow: visible; }
  .party-panel[open] { max-height: none; overflow: visible; }
  .party-panel .party-grid { overflow-y: visible; }
}

@media (max-width: 620px) {
  .dungeon-toolbar { grid-template-columns: 1fr; }
  .dungeon-navigation { justify-content: stretch; }
  .dungeon-navigation form { flex: 1 1 90px; }
  .dungeon-navigation .button { width: 100%; }
}

/* Navigation bord à bord, réglages audio et dialogues intégrés. */
.site-header { padding: .22rem .35rem; }
.brand { gap: .35rem; }
.brand-logo { width: 60px; height: 60px; }
.top-nav { justify-content: flex-end; }
.settings-menu { position: relative; }
.settings-menu > summary { list-style: none; }
.settings-menu > summary::-webkit-details-marker { display: none; }
.settings-menu[open] > summary { border-color: var(--line); background: rgba(208, 162, 75, .1); color: var(--gold-light); }
.settings-popover { position: absolute; top: calc(100% + .55rem); right: 0; z-index: 120; display: grid; width: min(290px, calc(100vw - 1rem)); gap: .7rem; padding: .8rem; border: 1px solid rgba(218, 185, 121, .28); border-radius: 10px; background: linear-gradient(155deg, #241d17, #151210); box-shadow: 0 18px 55px rgba(0, 0, 0, .72); }
.settings-popover-title { display: grid; gap: .08rem; padding: .05rem .1rem .55rem; border-bottom: 1px solid var(--line); }
.settings-popover-title strong { color: var(--gold-light); font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.settings-popover-title small, .settings-toggle small { color: var(--ink-soft); font-size: .62rem; }
.settings-popover .settings-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .15rem .1rem; color: var(--ink); cursor: pointer; }
.settings-toggle > span { display: grid; }
.settings-toggle > span strong { font-size: .75rem; }
.settings-toggle input { appearance: none; position: relative; flex: 0 0 auto; width: 38px; min-height: 22px; margin: 0; padding: 0; border: 1px solid #53483c; border-radius: 999px; background: #0d0b0a; cursor: pointer; transition: border-color .18s, background .18s; }
.settings-toggle input::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #84786a; content: ""; transition: left .18s, background .18s; }
.settings-toggle input:checked { border-color: #b58a37; background: rgba(208, 162, 75, .18); }
.settings-toggle input:checked::after { left: 19px; background: var(--gold-light); box-shadow: 0 0 7px rgba(240, 207, 130, .48); }
.settings-display-mode { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem .1rem; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.settings-display-mode > span { display: grid; }
.settings-display-mode strong { font-size: .75rem; }
.settings-display-mode small { color: var(--ink-soft); font-size: .62rem; }
.display-mode-switch { position: relative; flex: 0 0 auto; width: 38px; height: 22px; border: 1px solid #53483c; border-radius: 999px; background: #0d0b0a; }
.display-mode-switch b { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #84786a; transition: left .18s, background .18s; }
.settings-display-mode.is-mobile .display-mode-switch { border-color: #b58a37; background: rgba(208, 162, 75, .18); }
.settings-display-mode.is-mobile .display-mode-switch b { left: 19px; background: var(--gold-light); box-shadow: 0 0 7px rgba(240, 207, 130, .48); }
/* Séparé des réglages sonores : c'est une navigation, pas une préférence. */
.settings-link {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  margin-top: .15rem; padding: .55rem .6rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(0, 0, 0, .2); color: var(--ink); text-decoration: none;
  transition: border-color .18s, background .18s, color .18s;
}
.settings-link:hover { border-color: rgba(208, 162, 75, .5); background: rgba(208, 162, 75, .12); color: var(--gold-light); }
.settings-link > span { display: grid; gap: .08rem; }
.settings-link strong { font-size: .75rem; font-weight: 600; }
.settings-link small { color: var(--ink-soft); font-size: .62rem; }
.settings-link i { flex: 0 0 auto; color: var(--gold); font-style: normal; transition: transform .18s; }
.settings-link:hover i { transform: translateX(2px); }
.audio-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; align-items: center; gap: .25rem .5rem; padding: .6rem; border: 1px solid rgba(218, 185, 121, .12); border-radius: 8px; background: rgba(0, 0, 0, .16); }
.audio-setting label { color: var(--ink); font-size: .73rem; font-weight: 750; }
.audio-setting output { color: var(--gold-light); font-size: .68rem; font-variant-numeric: tabular-nums; text-align: right; }
.audio-setting input[type="range"] { grid-column: 1 / -1; width: 100%; min-height: 20px; padding: 0; accent-color: var(--gold); cursor: pointer; }
.audio-mute-button { appearance: none; display: grid; width: 30px; min-height: 30px; place-items: center; padding: 0; border: 1px solid rgba(208, 162, 75, .28); border-radius: 50%; background: rgba(208, 162, 75, .08); color: var(--gold-light); font-size: .8rem; line-height: 1; cursor: pointer; }
.audio-mute-button:hover, .audio-mute-button:focus-visible { border-color: var(--gold-light); background: rgba(208, 162, 75, .18); }
.audio-mute-button[aria-pressed="true"] { border-color: rgba(199, 78, 71, .65); background: rgba(143, 45, 44, .2); }

.action-modal-overlay[hidden] { display: none; }
.action-modal-overlay { position: fixed; inset: 0; z-index: 170; display: grid; padding: 1rem; place-items: center; background: rgba(4, 3, 3, .78); backdrop-filter: blur(5px); }
.action-modal { position: relative; width: min(510px, 100%); padding: 1.5rem; border: 1px solid rgba(199, 78, 71, .55); border-radius: 12px; background: linear-gradient(145deg, #2b211b, #171311); box-shadow: 0 28px 85px #000; animation: gl-modal-in .18s ease; }
.action-modal h2 { margin-bottom: .7rem; font-size: 1.65rem; }
.action-modal p:not(.eyebrow) { color: var(--ink-soft); }
.action-modal-close { position: absolute; top: .55rem; right: .6rem; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.07); color: var(--ink); font-size: 1.25rem; cursor: pointer; }
.action-modal-buttons { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1.2rem; }

.import-form { grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.file-drop-zone { display: grid; min-height: 118px; place-items: center; align-content: center; padding: .8rem; border: 1px dashed rgba(240, 207, 130, .55); border-radius: 9px; background: rgba(0,0,0,.18); color: var(--ink); text-align: center; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.file-drop-zone:hover, .file-drop-zone.is-dragging { border-color: var(--gold-light); background: rgba(208,162,75,.12); transform: translateY(-1px); }
.file-drop-zone.has-file { border-style: solid; border-color: var(--moss); }
.file-drop-zone.has-error { border-color: var(--blood-light); }
.file-drop-zone .drop-icon { color: var(--gold-light); font-size: 1.6rem; line-height: 1; }
.file-drop-zone strong { font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.file-drop-zone small { color: var(--ink-soft); font-size: .68rem; }

.party-panel[open] { display: flex; flex: 1 1 280px; min-height: 150px; flex-direction: column; }
.party-panel > summary { flex: 0 0 auto; }
.party-panel .party-grid { align-content: start; flex: 1 1 auto; min-height: 0; grid-auto-rows: max-content; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mission-panel { flex: 0 0 auto; }
.mission-visual { max-height: none; overflow: visible; background: radial-gradient(circle at 50% 38%, rgba(77, 91, 111, .42), rgba(13, 14, 16, .96) 72%); }
.mission-visual > img { width: min(82%, 230px); max-height: 225px; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(0,0,0,.72)); }
.mission-caption { display: grid; width: 100%; gap: .3rem; padding: .55rem .7rem .7rem; border-top: 1px solid rgba(218, 185, 121, .12); background: rgba(8, 8, 9, .55); }
.mission-visual > img { max-height: 160px; }
.mission-caption small { color: var(--ink-soft); font-size: .64rem; line-height: 1.35; text-align: left; }
.mission-caption .mission-victory-progress { color: var(--gold-light); }
.mission-xp-detail { display: grid; gap: .2rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.mission-xp-detail li { display: flex; flex-wrap: wrap; gap: .1rem .5rem; padding: .15rem 0; border-top: 1px solid rgba(218, 185, 121, .08); font-size: .68rem; }
.mission-xp-detail li:first-child { border-top: 0; }
.mission-xp-detail strong { flex: 0 0 auto; min-width: 6ch; color: var(--gold-light); font-family: var(--serif); font-weight: 500; }
.mission-xp-detail span { color: var(--ink-soft); }
.table-code-meta { color: var(--ink-soft); font-size: .75rem; white-space: nowrap; }

.hero-side .combat-token img,
.monster-side .combat-token img { transform: none; }
.hero-card > img,
.monster-card img { object-fit: contain; background: radial-gradient(circle at 50% 35%, rgba(87, 101, 118, .48), rgba(16, 17, 18, .9) 72%); }
.monster-card img { background: radial-gradient(circle at 50% 35%, rgba(117, 48, 44, .38), rgba(17, 13, 12, .92) 72%); }
.combat-token { overflow: hidden; border: 1px solid rgba(240,207,130,.65); border-radius: 8px; background: radial-gradient(circle at 50% 38%, rgba(83, 102, 121, .54), rgba(10, 13, 15, .9) 72%); box-shadow: 0 4px 12px rgba(0,0,0,.62); }
.combat-token.monster-token { border-color: rgba(199,78,71,.82); background: radial-gradient(circle at 50% 38%, rgba(126, 52, 48, .48), rgba(17, 10, 10, .92) 72%); }
.combat-token.charmed-hero-token { border-color: rgba(174, 91, 211, .92); background: radial-gradient(circle at 50% 38%, rgba(111, 48, 133, .62), rgba(20, 9, 23, .94) 72%); }
.combat-control-badge { position: absolute; top: 4px; right: 4px; z-index: 2; padding: 2px 4px; border: 1px solid rgba(230, 176, 255, .72); border-radius: 999px; background: rgba(46, 13, 55, .9); color: #f0c9ff; font-size: clamp(6px, .48vw, 9px); line-height: 1; }
.monster-vitals .charmed-vital small { color: #d9a4ee; }
.combat-token img { padding: 4%; border: 0; border-radius: 0; box-shadow: none; filter: drop-shadow(0 5px 4px rgba(0,0,0,.72)); }

@media (max-width: 760px) {
  .site-header { padding-inline: .2rem; }
  .brand-logo { width: 52px; height: 52px; }
  .top-nav { gap: .05rem; }
  .top-nav > a { padding-inline: .25rem; }
  .settings-menu .icon-button { padding-inline: .45rem; }
  .import-form { grid-template-columns: 1fr; }
}

/* Silhouettes plus lisibles sur la table sombre. */
.hero-card > img {
  border: 1px solid rgba(151, 192, 224, .72);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 34%, rgba(116, 159, 194, .72), rgba(24, 33, 43, .96) 72%);
  box-shadow: inset 0 0 14px rgba(202, 229, 248, .16), 0 3px 10px rgba(0, 0, 0, .72);
  filter: contrast(1.12) saturate(1.08) brightness(1.06) drop-shadow(0 4px 3px rgba(0, 0, 0, .7));
}
.hero-card.is-separated { border-color: rgba(121, 177, 220, .68); background: rgba(49, 93, 128, .2); }
.hero-card.is-separated > img { opacity: .72; filter: grayscale(.3) contrast(1.08) brightness(.9); }
.monster-card img {
  border: 1px solid rgba(221, 113, 98, .78);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 34%, rgba(166, 75, 67, .68), rgba(43, 18, 17, .97) 72%);
  box-shadow: inset 0 0 14px rgba(255, 186, 155, .12), 0 3px 10px rgba(0, 0, 0, .75);
  filter: contrast(1.14) saturate(1.1) brightness(1.06) drop-shadow(0 4px 3px rgba(0, 0, 0, .74));
}
.combat-token {
  box-shadow: inset 0 0 18px rgba(181, 218, 242, .14), 0 0 0 1px rgba(151, 192, 224, .34), 0 5px 15px rgba(0, 0, 0, .78);
}
.combat-token.monster-token {
  box-shadow: inset 0 0 18px rgba(255, 166, 139, .12), 0 0 0 1px rgba(221, 113, 98, .4), 0 5px 15px rgba(0, 0, 0, .8);
}
.combat-token img { filter: contrast(1.13) saturate(1.08) brightness(1.06) drop-shadow(0 5px 4px rgba(0, 0, 0, .78)); }

/* Commandes tactiques explicites du combat. */
.combat-token.can-act { cursor: pointer; outline: none; }
.combat-token.can-act:hover,
.combat-token.can-act:focus-visible,
.combat-token.can-act.is-selected { border-color: #f3d176; box-shadow: 0 0 0 3px rgba(243, 209, 118, .36), 0 5px 18px rgba(0, 0, 0, .7); }
.combat-token.has-acted { opacity: 1; }
.combat-token.has-acted img,
.combat-token.has-acted > span { opacity: .48; filter: grayscale(.55); }
.hero-formation .combat-cell { position: relative; }
.hero-formation .combat-cell:nth-child(1)::before,
.hero-formation .combat-cell:nth-child(2)::before,
.hero-formation .combat-cell:nth-child(3)::before { position: absolute; top: 2px; left: 3px; z-index: 2; color: rgba(240, 207, 130, .68); font-size: clamp(6px, .48vw, 9px); font-weight: 850; letter-spacing: .04em; pointer-events: none; }
.hero-formation .combat-cell:nth-child(1)::before { content: "R3 · réserve"; }
.hero-formation .combat-cell:nth-child(2)::before { content: "R2 · distance"; }
.hero-formation .combat-cell:nth-child(3)::before { content: "R1 · avant"; }
.combat-controls { min-height: 82px; padding: .4rem .55rem; }
.combat-action-deck { flex: 1 1 auto; min-width: 0; }
.combat-action-card { display: flex; min-width: 0; align-items: end; flex-wrap: wrap; gap: .35rem; }
.combat-action-card[hidden] { display: none; }
.combat-action-card > header { display: flex; min-width: 145px; align-items: center; gap: .45rem; padding-right: .35rem; }
.combat-action-card > header > span { display: grid; }
.combat-action-card > header strong { color: var(--gold-light); font-size: .82rem; }
.combat-action-card > header small { color: var(--ink-soft); font-size: .64rem; }
.combat-hero-sheet-button { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; padding: 0; overflow: hidden; border: 1px solid rgba(240,207,130,.55); border-radius: 50%; background: #17202a; cursor: pointer; }
.combat-hero-sheet-button img { width: 100%; height: 100%; object-fit: contain; }
.combat-action-section { display: flex; align-items: end; gap: .3rem; padding: .25rem .4rem; border-left: 1px solid rgba(218,185,121,.18); }
.combat-action-section > strong { align-self: start; color: var(--gold-light); font-size: .57rem; letter-spacing: .08em; text-transform: uppercase; }
.combat-action-card form { display: flex; align-items: end; gap: .3rem; }
.combat-spell-actions { display: flex; max-width: min(520px, 42vw); gap: .3rem; overflow-x: auto; scrollbar-width: thin; }
.combat-spell-actions form { flex: 0 0 auto; }
.combat-action-card label { display: grid; gap: .1rem; color: var(--ink-soft); font-size: .58rem; font-weight: 750; text-transform: uppercase; }
.combat-action-card select { min-width: 105px; min-height: 36px; padding: .25rem .4rem; font-size: .7rem; }
.combat-action-card .button,
.combat-auto-form .button { min-height: 36px; padding: .35rem .55rem; font-size: .68rem; }
.combat-auto-form { flex: 0 0 auto; }

@media (max-width: 980px) {
  .combat-controls { align-items: stretch; flex-direction: column; }
  .combat-action-card { align-items: stretch; }
  .combat-action-card form { flex-wrap: wrap; }
  .combat-action-card form, .combat-action-card label, .combat-action-card select { width: 100%; }
}

/* Correctifs de lisibilité et d'interaction des plateaux. */
.game-layout { grid-template-rows: minmax(0, 1fr) minmax(130px, 18dvh); align-items: stretch; }
.left-sidebar, .sidebar-column { grid-row: 1 / 3; }
.board-panel { height: 100%; }
.board-journal { position: relative; grid-column: 2; grid-row: 2; min-height: 0; overflow: hidden; }
.board-journal[open] { display: grid; height: 100%; min-height: 0; grid-template-columns: 165px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.board-journal > summary { border-right: 1px solid var(--line); }
.board-journal .event-list { height: auto; min-height: 0; max-height: 100%; padding-top: .45rem; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; scrollbar-color: var(--gold) rgba(0, 0, 0, .32); scrollbar-width: auto; scrollbar-gutter: stable; }
.board-journal .event-list::-webkit-scrollbar { width: 11px; }
.board-journal .event-list::-webkit-scrollbar-track { border-left: 1px solid rgba(218, 185, 121, .12); background: rgba(0, 0, 0, .32); }
.board-journal .event-list::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--gold); background-clip: padding-box; }
.journal-expand-button { display: inline-flex; min-height: 30px; align-items: center; gap: .3rem; padding: .25rem .45rem; border: 1px solid rgba(208, 162, 75, .28); border-radius: 5px; background: rgba(208, 162, 75, .08); color: var(--gold-light); font-size: .65rem; cursor: pointer; }
.journal-expand-button:hover, .journal-expand-button:focus-visible { border-color: var(--gold-light); background: rgba(208, 162, 75, .18); }
.board-journal .journal-expand-button { position: absolute; top: .55rem; right: .65rem; z-index: 3; display: grid; width: 32px; min-height: 32px; place-items: center; padding: 0; font-size: .9rem; }
.board-journal .journal-expand-label { display: none; }
.board-journal .event-list { padding-right: 3rem; }
body:has(.journal-panel.is-modal, .combat-journal.is-modal, .board-panel.is-map-modal)::before { position: fixed; inset: 0; z-index: 129; background: rgba(4, 3, 3, .78); backdrop-filter: blur(6px); content: ""; }
.board-panel.is-map-modal { position: fixed; inset: max(82px, 4dvh) max(2vw, 18px) max(calc(var(--gl-footer-h) + 18px), 4dvh); z-index: 130; width: auto; height: auto; max-height: none; overflow: hidden; box-shadow: 0 30px 100px #000; }
.board-panel.is-map-modal .map-viewport { min-height: 0; flex: 1 1 auto; }
.journal-panel.is-modal { position: fixed; inset: max(82px, 7dvh) max(3vw, 24px) max(calc(var(--gl-footer-h) + 24px), 7dvh); z-index: 130; width: auto; height: auto; min-height: 0; max-height: none; margin: 0; overflow: hidden; box-shadow: 0 30px 100px #000; }
.journal-panel.is-modal[open] { display: grid; grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.journal-panel.is-modal .event-list { height: 100%; min-height: 0; max-height: 100%; overflow-y: auto; font-size: .82rem; }
.combat-journal.is-modal { position: fixed; inset: max(82px, 7dvh) max(3vw, 24px) max(calc(var(--gl-footer-h) + 24px), 7dvh); z-index: 130; width: auto; min-height: 0; max-height: none; overflow: hidden; grid-template-columns: 190px minmax(0, 1fr); box-shadow: 0 30px 100px #000; }
.combat-journal.is-modal ol { min-height: 0; max-height: 100%; overflow-y: auto; }
.combat-journal.is-modal ol { font-size: .9rem; }
.combat-journal .journal-expand-button { margin-top: .45rem; justify-self: start; }
.board-heading-meta { display: grid; justify-items: end; }
.board-heading-meta small { color: var(--gold-light); font-size: .68rem; font-weight: 700; }
.map-action-forms { display: none; }
.board-panel.is-presenting-events .nature-map-wrap,
.board-panel.is-presenting-events .dungeon-map-wrap { pointer-events: none; user-select: none; }
.game-shell.is-presenting-events form button,
.combat-shell.is-presenting-events form button,
.combat-shell.is-presenting-events [data-combat-hero] { pointer-events: none; opacity: .48; }
.nature-party-marker { clip-path: circle(50% at 50% 50%); }
.nature-party-mask { fill: transparent; stroke: #f0cf82; stroke-width: 2px; pointer-events: none; filter: drop-shadow(0 0 4px rgba(240, 207, 130, .9)); }
.dungeon-map-target { cursor: pointer; outline: none; }
.dungeon-map-target rect { fill: rgba(208, 162, 75, .035); stroke: rgba(240, 207, 130, .42); stroke-width: 2px; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.dungeon-map-target text { fill: rgba(240, 207, 130, .78); font-family: var(--serif); font-size: 40px; text-anchor: middle; pointer-events: none; }
.dungeon-map-target:hover rect, .dungeon-map-target:focus rect { fill: rgba(208, 162, 75, .18); stroke: var(--gold-light); stroke-width: 4px; }
.utility-panel { flex: 0 0 auto; min-width: 0; background: linear-gradient(145deg, rgba(39, 31, 25, .97), rgba(24, 20, 17, .97)); }
.utility-panel > summary { min-height: 52px; color: var(--ink); }
.utility-panel[open] > div { max-height: min(240px, 28dvh); }
.action-dock:not(:has(form, button, .outcome-message, .navigation-hint, .special-action-form)) { display: none; }
.left-sidebar { height: 100%; min-height: 0; }
.left-sidebar:has(> .party-panel[open]) { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; align-content: stretch; }
.party-panel[open] { position: relative; display: block; height: auto; min-height: 150px; }
.party-panel[open] > summary { position: absolute; top: 0; right: 0; left: 0; height: 58px; }
.party-panel[open] .party-grid { position: absolute; inset: 58px 0 0; height: auto; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; touch-action: pan-y; scrollbar-color: var(--gold) rgba(0, 0, 0, .32); scrollbar-width: auto; scrollbar-gutter: stable; }
.party-panel .party-grid:focus-visible { outline: 2px solid rgba(240, 207, 130, .7); outline-offset: -2px; }
.party-panel .party-grid::-webkit-scrollbar { width: 11px; }
.party-panel .party-grid::-webkit-scrollbar-track { border-left: 1px solid rgba(218, 185, 121, .12); background: rgba(0, 0, 0, .32); }
.party-panel .party-grid::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--gold); background-clip: padding-box; }
.utility-panel, .mission-panel { min-height: 0; }

.combat-center { position: relative; }
.combat-event-stage { top: auto; bottom: 151px; left: 50%; width: min(760px, calc(100% - 1rem)); }
.combat-journal { position: relative; }
.event-stage.journal-event-stage { top: 50%; right: auto; bottom: auto; left: 50%; width: min(760px, calc(100% - 1rem)); transform: translate(-50%, -50%); }
.hero-card[data-hero-sheet-open] { cursor: pointer; outline: none; transition: border-color .15s, background .15s, transform .15s; }
.hero-card[data-hero-sheet-open]:hover,
.hero-card[data-hero-sheet-open]:focus-visible { border-color: var(--gold-light); background: rgba(208, 162, 75, .12); transform: translateY(-1px); }
.familiar-card { border-color: rgba(139, 190, 110, .42); background: linear-gradient(145deg, rgba(43, 76, 43, .38), rgba(8, 20, 10, .2)); }
.familiar-card > img { border-color: rgba(164, 211, 134, .62); border-radius: 50%; background: rgba(39, 83, 43, .72); object-fit: contain; }
.formation-editor { display: grid; gap: .4rem; padding: .65rem; }
.formation-editor label { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; gap: .45rem; font-size: .74rem; }
.formation-editor select { min-width: 0; padding: .38rem; }
.formation-editor button { width: 100%; margin-top: .15rem; }
.formation-editor small { color: var(--ink-soft); font-size: .62rem; line-height: 1.35; }
.hero-sheet-dialog { position: relative; width: min(920px, calc(100vw - 2rem)); max-height: min(88dvh, 900px); padding: 0; overflow: auto; border: 1px solid rgba(240, 207, 130, .5); border-radius: 13px; background: linear-gradient(145deg, #2a211b, #151210); color: var(--ink); box-shadow: 0 30px 100px #000; }
.hero-character-dialog { width: min(1240px, calc(100vw - 1rem)); height: min(88dvh, 900px); padding: 0 58px; overflow: hidden; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.hero-sheet-surface { display: grid; height: 100%; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; border: 1px solid rgba(240, 207, 130, .5); border-radius: 13px; background: linear-gradient(145deg, #2a211b, #151210); box-shadow: 0 30px 100px #000; }
.hero-sheet-surface > [role="tabpanel"] { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--gold) rgba(0,0,0,.24); scrollbar-width: thin; }
.hero-sheet-dialog::backdrop { background: rgba(4, 3, 3, .82); backdrop-filter: blur(6px); }
.hero-sheet-close { position: sticky; top: .55rem; z-index: 2; float: right; width: 34px; height: 34px; margin: .55rem .65rem -2.8rem 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.09); color: var(--ink); font-size: 1.3rem; cursor: pointer; }
.hero-character-dialog .hero-sheet-close { position: absolute; top: .55rem; right: 4.35rem; float: none; margin: 0; }
.hero-sheet-arrow { position: absolute; top: 50%; z-index: 3; display: grid; width: 42px; height: 64px; place-items: center; border: 1px solid rgba(240,207,130,.4); border-radius: 9px; background: rgba(25,20,17,.94); color: var(--gold-light); font-family: var(--serif); font-size: 2.3rem; line-height: 1; cursor: pointer; transform: translateY(-50%); box-shadow: 0 12px 30px rgba(0,0,0,.55); }
.hero-sheet-arrow:hover, .hero-sheet-arrow:focus-visible { border-color: var(--gold-light); background: #33271e; }
.hero-sheet-arrow-prev { left: .35rem; }
.hero-sheet-arrow-next { right: .35rem; }
.hero-sheet-header { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1.2rem 3.5rem 1.2rem 1.2rem; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 10% 20%, rgba(106, 142, 170, .28), transparent 35%); }
.hero-sheet-header img { width: 96px; height: 96px; border: 1px solid rgba(151, 192, 224, .72); border-radius: 50%; background: #17202a; object-fit: contain; }
.hero-sheet-header .eyebrow { margin-bottom: .15rem; }
.hero-sheet-header h2 { margin: 0; }
.hero-sheet-header span { color: var(--ink-soft); font-size: .78rem; }
.hero-sheet-hp { color: #e69a90; font-family: var(--serif); font-size: 1.1rem; white-space: nowrap; }
.hero-sheet-tabs { display: flex; gap: .25rem; padding: .55rem 1rem 0; border-bottom: 1px solid var(--line); }
.hero-sheet-tabs button { padding: .55rem .85rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-soft); font-weight: 800; cursor: pointer; }
.hero-sheet-tabs button[aria-selected="true"] { border-bottom-color: var(--gold); color: var(--gold-light); }
.hero-sheet-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; padding: 1rem; }
.hero-sheet-body section { padding: .8rem; border: 1px solid rgba(218, 185, 121, .14); border-radius: 8px; background: rgba(0,0,0,.16); }
.hero-sheet-body h3 { margin: 0 0 .55rem; color: var(--gold-light); font-size: 1rem; }
.hero-sheet-body h3:not(:first-child) { margin-top: 1rem; }
.hero-sheet-body ul { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.hero-sheet-body li { display: flex; justify-content: space-between; gap: .7rem; padding-bottom: .3rem; border-bottom: 1px solid rgba(218, 185, 121, .08); font-size: .76rem; }
.hero-sheet-body li span { color: var(--ink-soft); text-align: right; }
.hero-sheet-body .weapon-magic, .hero-sheet-body .weapon-selected { font-size: .66rem; font-style: normal; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hero-sheet-body .weapon-magic { color: var(--gold-light); }
.hero-sheet-body .weapon-selected { color: #8fbf8a; }
.hero-sheet-body .weapon-parts { color: var(--ink-soft); font-size: .68rem; font-style: normal; opacity: .85; }
.hero-sheet-pacts li { align-items: start; }
.hero-sheet-pacts .pact-pact strong { color: #d8b56a; }
.hero-sheet-pacts .pact-curse strong { color: #e69a90; }
.hero-equipment-section ul { gap: 0; }
.hero-equipment-section li { display: grid; grid-template-columns: minmax(105px, .75fr) minmax(110px, .7fr) minmax(250px, 1.6fr); align-items: center; gap: .55rem; padding: .55rem 0; }
.hero-equipment-section li > span { text-align: left; }
.hero-item-transfer { display: flex; grid-column: 3; gap: .35rem; width: 100%; margin: 0; }
.hero-item-transfer select { min-width: 0; flex: 1; }
.hero-item-transfer button { min-height: 30px; border: 1px solid rgba(208,162,75,.38); border-radius: 5px; background: rgba(208,162,75,.1); color: var(--gold-light); font-size: .68rem; cursor: pointer; }
.hero-sheet-actions { display: grid; gap: .35rem; margin-top: .5rem; }
.hero-sheet-actions form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, auto) auto; align-items: center; gap: .35rem; padding: .35rem; border: 1px solid rgba(218,185,121,.12); border-radius: 5px; background: rgba(0,0,0,.14); }
.hero-sheet-actions strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.hero-sheet-actions select, .hero-sheet-actions button { min-height: 30px; font-size: .68rem; }
.hero-sheet-actions button { border: 1px solid rgba(208,162,75,.38); border-radius: 5px; background: rgba(208,162,75,.1); color: var(--gold-light); cursor: pointer; }
.hero-sheet-actions .item-detail-trigger { display: block; min-height: 0; overflow: hidden; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: .72rem; font-weight: 800; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.hero-sheet-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin: 0; }
.hero-sheet-stats div { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem; border-radius: 4px; background: rgba(255,255,255,.025); }
.hero-sheet-stats dt { color: var(--ink-soft); font-size: .7rem; }
.hero-sheet-stats dd { margin: 0; color: var(--gold-light); font-size: .75rem; font-weight: 800; }
.hero-sheet-effects { grid-column: 1 / -1; }
.hero-progress-panel { padding: 1rem; }
.hero-progress-panel > header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.hero-progress-panel h3 { margin: 0; color: var(--gold-light); }
.hero-progress-panel > header > strong { color: #e69a90; }
.hero-progress-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.hero-progress-list li { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: .65rem .75rem; border: 1px solid rgba(218, 185, 121, .12); border-radius: 7px; background: rgba(0,0,0,.16); }
.hero-progress-list li div { display: grid; }
.hero-progress-list small, .hero-progress-list time { color: var(--ink-soft); font-size: .72rem; }
.progress-level { color: var(--gold); font-size: .72rem; font-weight: 850; text-transform: uppercase; }

@media (max-width: 980px) {
  .game-layout { grid-template-rows: auto; }
  .left-sidebar, .sidebar-column, .board-journal { grid-row: auto; }
  .board-journal { grid-column: 1; }
  .board-journal[open] { min-height: 180px; }
  .left-sidebar:has(> .party-panel[open]) { display: flex; }
  .party-panel[open], .party-panel .party-grid { position: static; height: auto; }
  .party-panel[open] > summary { position: static; height: auto; }
  .party-panel[open] .party-grid { overflow-y: visible; }
}

@media (max-width: 620px) {
  .board-journal[open] { grid-template-columns: 1fr; }
  .board-journal > summary { border-right: 0; border-bottom: 1px solid var(--line); }
  .journal-expand-label { display: none; }
  .journal-panel.is-modal[open] { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .hero-character-dialog { width: calc(100vw - .4rem); padding-inline: 40px; }
  .hero-character-dialog .hero-sheet-close { right: 2.85rem; }
  .hero-sheet-header { grid-template-columns: 68px minmax(0, 1fr); }
  .hero-sheet-header img { width: 68px; height: 68px; }
  .hero-sheet-hp { grid-column: 2; }
  .hero-sheet-body { grid-template-columns: 1fr; }
  .hero-sheet-effects { grid-column: auto; }
  .hero-sheet-arrow { top: auto; bottom: .65rem; width: 42px; height: 42px; transform: none; }
  .hero-sheet-arrow-prev { left: .65rem; }
  .hero-sheet-arrow-next { right: .65rem; }
  .hero-progress-list li { grid-template-columns: 1fr; gap: .25rem; }
  .special-investigation-card { width: 100%; }
}

.map-viewport { position: relative; min-width: 0; min-height: 0; flex: 1 1 320px; }
.dungeon-scout-control { position: absolute; top: .5rem; left: .55rem; z-index: 6; display: flex; align-items: center; gap: .4rem; padding: .3rem .45rem; border: 1px solid rgba(240,207,130,.35); border-radius: 6px; background: rgba(10,8,7,.9); color: var(--gold-light); font-size: .66rem; font-weight: 750; text-transform: uppercase; }
.dungeon-scout-control select { min-height: 30px; max-width: 190px; padding: .2rem .35rem; font-size: .68rem; text-transform: none; }
.map-viewport > .nature-map-wrap,
.map-viewport > .dungeon-map-wrap { width: 100%; height: 100%; }
.nature-map-wrap { position: relative; display: grid; min-height: 0; align-items: safe center; overflow: auto; overscroll-behavior: contain; border: 1px solid rgba(218, 185, 121, .18); border-radius: 8px; background: radial-gradient(circle at 50% 48%, rgba(45, 68, 43, .2), rgba(5, 7, 5, .96) 72%); cursor: grab; scrollbar-color: rgba(208, 162, 75, .65) rgba(0, 0, 0, .2); }
.nature-map-wrap.is-panning { cursor: grabbing; user-select: none; }
.nature-map { display: block; width: 100%; min-width: 0; max-width: none; height: auto; min-height: 0; margin: auto; padding: 1rem; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .7)); transform-origin: center; }
.nature-map-tile.is-reachable, .nature-map-target { cursor: pointer; outline: none; }
.nature-tile-outline { fill: transparent; stroke: rgba(233, 213, 169, .34); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.nature-map-tile.is-current .nature-tile-outline { stroke: var(--gold-light); stroke-width: 4px; filter: drop-shadow(0 0 5px rgba(240, 207, 130, .9)); }
.nature-map-tile.is-reachable:hover .nature-tile-outline,
.nature-map-tile.is-reachable:focus .nature-tile-outline { fill: rgba(240, 207, 130, .1); stroke: #fff0bd; stroke-width: 4px; }
.nature-party-marker { pointer-events: none; filter: drop-shadow(0 2px 4px #000) drop-shadow(0 0 5px rgba(240, 207, 130, .95)); }
.nature-map-target polygon { fill: rgba(208, 162, 75, .035); stroke: rgba(240, 207, 130, .42); stroke-width: 2px; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; transition: fill .15s, stroke .15s; }
.nature-map-target text { fill: rgba(240, 207, 130, .72); font-family: var(--serif); font-size: 30px; text-anchor: middle; pointer-events: none; }
.nature-map-target:hover polygon, .nature-map-target:focus polygon { fill: rgba(208, 162, 75, .18); stroke: var(--gold-light); stroke-width: 4px; }
.map-zoom-controls { position: absolute; top: .45rem; right: .45rem; z-index: 8; display: flex; width: max-content; height: 32px; align-items: stretch; gap: 1px; border: 1px solid rgba(240, 207, 130, .3); border-radius: 6px; overflow: hidden; background: rgba(10, 9, 8, .94); box-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
.map-zoom-controls button { min-width: 32px; padding: 0 .55rem; border: 0; background: transparent; color: var(--ink); font-size: .7rem; cursor: pointer; }
.map-zoom-controls button:hover, .map-zoom-controls button:focus-visible { background: rgba(208, 162, 75, .18); color: var(--gold-light); }
.map-zoom-controls button:disabled { color: rgba(218, 205, 185, .28); cursor: default; }
.map-zoom-controls [data-map-expand] { border-left: 1px solid rgba(240, 207, 130, .2); color: var(--gold-light); font-size: .9rem; }
.nature-map-wrap .nature-map { grid-area: 1 / 1; }
.dungeon-map-wrap { position: relative; align-items: safe center; }
.dungeon-map-wrap .dungeon-map { min-width: 0; max-height: none; grid-area: 1 / 1; transform-origin: center; }
.nature-toolbar { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .55rem; margin-top: .4rem; }
.nature-current { display: flex; min-width: 0; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: rgba(0, 0, 0, .18); }
.nature-current > div { display: grid; min-width: 0; }
.nature-current strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nature-current small { color: var(--ink-soft); }
.nature-orientation { color: var(--gold-light); font-size: 1.25rem; }
.nature-navigation { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .45rem; }
.nature-navigation .button { min-width: 68px; min-height: 40px; padding: .45rem .65rem; }
.navigation-hint { color: var(--ink-soft); font-size: .76rem; }
.village-zone { display: grid; max-height: min(520px, 68dvh); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .65rem; }
.village-heading { position: sticky; top: -.65rem; z-index: 6; display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; margin: -.65rem -.65rem 0; padding: .65rem; border-bottom: 1px solid var(--line); background: #1a1410; box-shadow: 0 8px 18px rgba(0, 0, 0, .42); }
.village-heading > div { min-width: 0; }
.village-heading form { grid-column: 2; justify-self: end; }
.village-heading .button { min-height: 36px; white-space: nowrap; }
.village-heading h3 { margin-bottom: .3rem; }
.village-heading p:last-child { color: var(--ink-soft); font-size: .75rem; }
.village-stock, .village-services, .village-progress { display: grid; min-width: 0; gap: .35rem; }
.village-offer, .village-services form, .village-progress form { display: grid; min-width: 0; grid-template-columns: minmax(210px, 1.65fr) minmax(105px, .55fr) auto; align-items: center; gap: .35rem; padding: .4rem; border: 1px solid rgba(218, 185, 121, .14); border-radius: 6px; background: rgba(0, 0, 0, .2); }
.village-offer > span, .village-progress form > span, .village-sale > span { display: grid; min-width: 0; gap: .1rem; }
.village-offer > strong, .village-offer > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.village-offer small, .village-sale small { color: var(--ink-soft); font-size: .62rem; }
/* Le nom et la ligne de type restent sur une ligne; la description, elle,
   doit pouvoir respirer : c'est la seule chose qui dit ce qu'on achète. */
.village-offer-name > strong { overflow: hidden; color: var(--ink); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.village-offer-name > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.village-offer-detail { margin: .25rem 0 0; padding: .4rem .55rem; border-left: 2px solid var(--gold); background: rgba(208, 162, 75, .06); color: var(--ink-soft); font-size: .7rem; line-height: 1.45; white-space: normal; }
.village-sale { grid-template-columns: minmax(0, 1fr) auto; }
.village-modal-backdrop[hidden] { display: none !important; }
.village-offer select, .village-progress select { min-height: 34px; padding: .28rem .4rem; font-size: .68rem; }
.village-offer button, .village-services button, .village-progress button { min-height: 34px; border: 1px solid rgba(208, 162, 75, .38); border-radius: 5px; background: rgba(208, 162, 75, .1); color: var(--gold-light); font-size: .68rem; cursor: pointer; }
.village-progress button:disabled { border-color: rgba(218, 205, 185, .12); background: rgba(255, 255, 255, .035); color: rgba(218, 205, 185, .32); cursor: not-allowed; filter: grayscale(1); }
.village-progress select:disabled, .village-progress select.is-not-required { border-color: rgba(218, 205, 185, .12); background: rgba(255,255,255,.035); color: rgba(218,205,185,.32); cursor: not-allowed; filter: grayscale(1); }
.village-progress form > span small { color: var(--ink-soft); font-size: .65rem; }
.village-services { grid-column: 2; }
.village-services > strong, .village-progress > strong { color: var(--gold-light); font-size: .72rem; }
.village-services form { grid-template-columns: minmax(0, 1fr) auto; }
.village-services form > span { min-width: 0; overflow-wrap: anywhere; }
.village-progress { grid-column: 1 / -1; }
.village-progress form { grid-template-columns: minmax(120px, .7fr) repeat(2, minmax(130px, 1fr)) auto; }
.village-modal-backdrop { position: fixed; inset: 68px 0 var(--gl-footer-h); z-index: 110; display: grid; place-items: center; padding: 1rem; background: rgba(4, 3, 3, .76); backdrop-filter: blur(7px); }
.village-modal-backdrop .village-building-modal { width: min(1040px, calc(100vw - 2rem)); max-height: min(82dvh, 760px); margin: 0; overflow-y: auto; border-color: rgba(208, 162, 75, .55); background: linear-gradient(145deg, #291e18, #15110e); box-shadow: 0 30px 95px #000; }
.village-building-modal .village-heading { top: -.65rem; }

/* Contraint réellement le contenu de <details> pour rendre sa barre visible. */
.left-sidebar { overflow: hidden; }
.party-panel[open] { max-height: 100%; overflow: hidden; }
.party-panel .party-grid { overflow-y: scroll; scrollbar-color: var(--gold) rgba(0, 0, 0, .18); }
/* La marge negative remonte la barre jusqu'au bord du scrollport : sans elle,
   elle se collait sous le padding-top de .party-grid et les cartes defilaient
   a decouvert dans cette bande. Le padding interne rend la hauteur visible. */
.party-quick-actions { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; margin-top: -.65rem; margin-bottom: .45rem; padding-top: .65rem; padding-bottom: .35rem; background: #211a14; box-shadow: 0 5px 14px rgba(0,0,0,.55); }
.party-quick-actions .button { display: inline-flex; min-width: 0; min-height: 30px; align-items: center; justify-content: center; gap: .25rem; padding: .3rem .35rem; font-size: .68rem; white-space: nowrap; }
.party-quick-actions .party-utility-button { border-color: rgba(117, 165, 199, .45); background: linear-gradient(135deg, #283138, #1f2224); color: #d7e8f0; box-shadow: inset 0 1px rgba(255,255,255,.08); }
.party-quick-actions .party-utility-button span { color: #8fd2ec; font-size: .92rem; line-height: 1; }
.party-quick-actions .party-utility-consumables { border-color: rgba(173, 139, 74, .48); background: linear-gradient(135deg, #3f2f19, #2d2014); color: #f0ddac; }
.party-quick-actions .party-utility-consumables span { color: var(--gold-light); }
.castle-continuity-zone { position: fixed; inset: 68px 0 var(--gl-footer-h); z-index: 140; display: grid; width: auto; height: auto; max-height: none; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: .75rem; margin: 0; padding: clamp(1rem, 3vw, 2.25rem) max(1rem, 7vw); overflow-y: auto; border: 0; border-radius: 0; background: radial-gradient(circle at 50% 0%, rgba(93,74,45,.28), transparent 42%), #17120f; box-shadow: 0 24px 80px #000; }
.castle-continuity-zone[hidden] { display: none; }
.castle-continuity-zone > .eyebrow, .castle-continuity-zone > h3, .castle-continuity-zone > p, .castle-continuity-zone > .village-progress, .castle-continuity-zone > .castle-spell-preparation, .castle-continuity-zone > .special-action-form { grid-column: 1 / -1; }
.castle-continuity-zone > h3 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.35rem); }
.castle-continuity-zone > p:not(.eyebrow) { max-width: 760px; margin: 0; color: var(--ink-soft); }
.castle-preparation-close { position: fixed; top: calc(68px + 1rem); right: max(1rem, 5vw); z-index: 1; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(240,207,130,.45); border-radius: 50%; background: rgba(20,16,13,.92); color: var(--gold-light); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.castle-preparation-close:hover, .castle-preparation-close:focus-visible { background: rgba(208,162,75,.2); border-color: var(--gold-light); }
.side-utility-actions { flex: 0 0 auto; min-width: 0; }
.side-utility-actions > div { max-height: min(320px, 34dvh); }
.utility-popup { width: min(680px, calc(100vw - 2rem)); max-height: min(78dvh, 760px); padding: 0; overflow: hidden; border: 1px solid rgba(240,207,130,.5); border-radius: 13px; background: linear-gradient(145deg, #2a211b, #151210); color: var(--ink); box-shadow: 0 30px 100px #000; }
.utility-popup::backdrop { background: rgba(4,3,3,.82); backdrop-filter: blur(6px); }
.utility-popup > header { padding: 1rem 1.2rem .7rem; border-bottom: 1px solid var(--line); }
.utility-popup > header h2 { margin: 0; }
.utility-popup-content { display: grid; max-height: min(62dvh, 620px); gap: .45rem; padding: .8rem 1rem 1rem; overflow-y: auto; }
.utility-popup-content form { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(110px, auto) auto; align-items: center; gap: .35rem; padding: .45rem; border: 1px solid rgba(218,185,121,.12); border-radius: 6px; background: rgba(0,0,0,.16); }
.utility-popup-content form span { display: grid; }
.utility-popup-content form small { color: var(--ink-soft); font-size: .65rem; }
.utility-popup-content .item-detail-trigger { padding: 0; border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: .65rem; text-align: left; cursor: pointer; }
.utility-popup-content .item-detail-trigger:hover, .utility-popup-content .item-detail-trigger:focus-visible { color: var(--gold-light); text-decoration: underline; }
.utility-popup-content select, .utility-popup-content button { min-height: 34px; }
.utility-popup-close { position: absolute; top: .55rem; right: .6rem; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: var(--ink); font-size: 1.25rem; cursor: pointer; }
.item-detail-popup { width: min(480px, calc(100vw - 2rem)); padding: 0; border: 1px solid rgba(240,207,130,.5); border-radius: 13px; background: linear-gradient(145deg, #2a211b, #151210); color: var(--ink); box-shadow: 0 30px 100px #000; }
.item-detail-popup::backdrop { background: rgba(4,3,3,.82); backdrop-filter: blur(6px); }
.item-detail-popup header { padding: 1rem 1.2rem .7rem; border-bottom: 1px solid var(--line); }
.item-detail-popup header h2 { margin: 0; }
.item-detail-popup > p { margin: 0; padding: 1rem 1.2rem 1.2rem; color: var(--ink-soft); line-height: 1.5; }
.model-3d-popup { width: min(620px, calc(100vw - 2rem)); padding: 0; overflow: hidden; border: 1px solid rgba(240,207,130,.5); border-radius: 13px; background: radial-gradient(circle at 50% 30%, #3a2b1d, #151210 72%); color: var(--ink); box-shadow: 0 30px 100px #000; }
.model-3d-popup::backdrop { background: rgba(4,3,3,.88); backdrop-filter: none; }
.model-3d-popup header { padding: 1rem 1.2rem .7rem; border-bottom: 1px solid var(--line); }
.model-3d-popup header h2 { margin: 0; }
.model-3d-popup model-viewer { display: block; width: 100%; height: min(62dvh, 520px); overflow: hidden; background: radial-gradient(circle at 50% 42%, rgba(190,137,48,.2), transparent 48%), linear-gradient(#20170f, #0f0d0b); cursor: grab; touch-action: pan-y; }
.model-3d-popup model-viewer:active { cursor: grabbing; }
.model-3d-popup model-viewer.is-loading { visibility: hidden; }
.model-3d-tools { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem .8rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .68rem; }
.model-3d-tools button { min-height: 32px; padding: .35rem .65rem; border: 1px solid rgba(208,162,75,.32); border-radius: 5px; background: rgba(208,162,75,.1); color: var(--gold-light); cursor: pointer; }
.model-3d-tools button:hover, .model-3d-tools button:focus-visible { border-color: var(--gold-light); background: rgba(208,162,75,.18); }
.model-3d-tools button:disabled { cursor: wait; opacity: .5; }
.character-library-save { display: flex; justify-content: flex-end; padding: .8rem 1rem 1rem; border-top: 1px solid var(--line); }
.multiplayer-lobby { margin: 0 0 1rem; padding: 1rem; }
.lobby-grid { display: grid; grid-template-columns: minmax(240px, .75fr) minmax(320px, 1.25fr); gap: 1rem; }
.lobby-members, .lobby-characters { padding: .9rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.18); }
.lobby-members h3, .lobby-characters h3 { margin-top: 0; }
.lobby-members ul, .lobby-characters ul { display: grid; gap: .55rem; padding: 0; list-style: none; }
.lobby-members li, .lobby-characters li { display: flex; align-items: center; gap: .55rem; padding: .55rem; border-radius: 6px; background: rgba(255,255,255,.025); }
.lobby-members li > small, .lobby-characters li span small { display: block; color: var(--muted); }
.lobby-members li.is-expected { outline: 1px solid var(--gold); }
.presence-dot { width: .65rem; height: .65rem; flex: 0 0 auto; border-radius: 50%; background: #655; box-shadow: 0 0 0 2px rgba(255,255,255,.05); }
.presence-dot.is-online { background: #75b878; box-shadow: 0 0 8px rgba(117,184,120,.65); }
.lobby-characters li { justify-content: space-between; }
.lobby-characters li form { display: flex; gap: .4rem; }
.lobby-import { display: grid; gap: .55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.lobby-import > label:not(.field-block) { display: flex; gap: .5rem; align-items: center; }
.lobby-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.lobby-board-preview { opacity: .55; pointer-events: none; user-select: none; }
@media (max-width: 780px) { .lobby-grid { grid-template-columns: 1fr; } .lobby-footer { align-items: stretch; flex-direction: column; } }
.item-detail-trigger { display: inline; width: fit-content; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.item-detail-trigger:hover strong, .item-detail-trigger:focus-visible strong { color: var(--gold-light); text-decoration: underline; }

/* Éditeur visuel de l'ordre de marche. */
.formation-shell { grid-template-rows: auto minmax(0, 1fr) auto; }
.formation-workspace { display: grid; min-height: 0; grid-template-columns: minmax(190px, .65fr) minmax(340px, 1.5fr) minmax(190px, .65fr); align-items: stretch; gap: .7rem; padding: .7rem; overflow: hidden; border: 1px solid rgba(240,207,130,.28); border-radius: 10px; background: radial-gradient(circle at center, rgba(74,63,49,.2), transparent 52%), #171b19; }
.formation-guide, .formation-reserve { min-width: 0; padding: 1rem; overflow-y: auto; }
.formation-guide h2, .formation-reserve h2 { margin-bottom: .7rem; font-size: 1.35rem; }
.formation-guide p, .formation-guide li, .formation-empty { color: var(--ink-soft); font-size: .78rem; }
.formation-guide ul { padding-left: 1.1rem; }
.formation-board { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); justify-items: center; }
.formation-board > h2 { margin: .2rem 0 .5rem; color: var(--ink); font-size: clamp(1rem, 1.6vw, 1.45rem); }
.formation-drag-grid { width: min(100%, 62dvh); height: auto; max-height: 100%; aspect-ratio: 1; }
.formation-drop-zone { position: relative; overflow: hidden; outline: none; transition: background .15s, box-shadow .15s; }
.formation-drop-zone:hover, .formation-drop-zone:focus-visible, .formation-drop-zone.is-drop-target { background: rgba(208,162,75,.16); box-shadow: inset 0 0 0 2px var(--gold-light); }
.formation-token { width: 84%; height: 84%; cursor: grab; touch-action: manipulation; transition: opacity .15s, transform .15s, box-shadow .15s; }
.formation-token:active { cursor: grabbing; }
.formation-token.is-dragging { opacity: .4; }
.formation-token.is-selected { transform: scale(1.04); box-shadow: 0 0 0 3px var(--gold-light), 0 0 22px rgba(240,207,130,.5); }
.formation-token > b { position: absolute; top: -2px; right: -2px; padding: 1px 4px; border-radius: 4px; background: rgba(8,7,6,.86); color: var(--gold-light); font-size: clamp(5px, .45vw, 8px); line-height: 1.1; }
.formation-token-familiar img { border-color: rgba(164,211,134,.82); background: rgba(39,83,43,.72); object-fit: contain; }
.formation-token-companion img { border-color: rgba(114,206,232,.72); background: rgba(28,57,70,.72); object-fit: contain; }
.formation-reserve.is-drop-target { border-color: var(--gold-light); box-shadow: inset 0 0 0 2px rgba(240,207,130,.45); }
.formation-reserve-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: .55rem; }
.formation-reserve-list .formation-token { width: 72px; height: 72px; justify-self: center; }
.formation-reserve-list .formation-token span { font-size: 8px; }
.formation-reserve-list .formation-token > b { font-size: 7px; }
.formation-controls > div { display: flex; gap: .45rem; }
.formation-status { color: var(--ink-soft); font-size: .78rem; }
[data-formation-save].has-changes { box-shadow: 0 0 0 3px rgba(240,207,130,.25); }

@media (max-width: 980px) {
  .left-sidebar, .party-panel[open] { max-height: none; overflow: visible; }
  .party-panel .party-grid { overflow-y: visible; }
}

@media (max-width: 900px) {
  .formation-shell { height: auto; min-height: calc(100dvh - 60px - var(--gl-footer-h)); overflow: visible; }
  .formation-workspace { grid-template-columns: 1fr; overflow: visible; }
  .formation-guide, .formation-reserve { overflow: visible; }
  .formation-board { min-height: min(90vw, 620px); }
  .formation-controls { align-items: stretch; flex-direction: column; }
  .formation-controls > div, .formation-controls .button { width: 100%; }
}

@media (max-width: 760px) {
  .castle-continuity-zone { grid-template-columns: 1fr; padding: 1rem; }
  .castle-preparation-close { top: calc(68px + .65rem); right: .8rem; }
}

@media (max-width: 760px) {
  .character-customization { grid-template-columns: 1fr; }
  .veteran-advancement { grid-template-columns: 1fr; }
  .magic-school-picker, .initial-spell-picker { grid-column: 1; grid-template-columns: 1fr; }
  .magic-school-picker small, .initial-spell-picker > span { grid-column: 1; }
  .nature-map { min-width: 430px; }
  .nature-toolbar { grid-template-columns: 1fr; }
  .nature-navigation { justify-content: stretch; }
  .nature-navigation form { flex: 1 1 80px; }
  .nature-navigation .button { width: 100%; }
  .village-zone { grid-template-columns: 1fr; }
  .village-heading { position: static; }
  .village-services, .village-progress { grid-column: 1; }
  .village-offer, .village-progress form { grid-template-columns: 1fr; }
  .castle-spell-preparation form { grid-template-columns: 1fr; }
  .castle-spell-preparation button { width: 100%; }
}

/* Jalon 9 — finition visuelle, focus robuste et mise en page tablette. */
::selection { background: #8f652c; color: #fff8e7; }
:where(a, button, summary, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
  outline: 3px solid #ffe09a;
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: #ffe09a;
  box-shadow: 0 0 0 3px rgba(255, 224, 154, .2);
}
#contenu:focus { outline: none; }
.panel, .game-banner, .combat-header, .combat-controls {
  box-shadow: inset 0 1px rgba(255, 237, 194, .07), inset 0 0 0 1px rgba(0, 0, 0, .24), var(--shadow);
}
.panel {
  background:
    radial-gradient(circle at 12% 0%, rgba(208, 162, 75, .08), transparent 24rem),
    linear-gradient(145deg, rgba(42, 33, 27, .98), rgba(23, 19, 16, .98));
}
.site-header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 207, 130, .6), transparent);
  content: "";
  pointer-events: none;
}
.button-primary { text-shadow: 0 1px rgba(255, 244, 210, .24); }
.file-drop-zone:has(input:focus-visible) {
  outline: 3px solid #ffe09a;
  outline-offset: 3px;
  border-color: var(--gold-light);
  background: rgba(208, 162, 75, .12);
}
.model-3d-frame { position: relative; min-height: min(62dvh, 520px); }
.model-3d-status {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(28rem, calc(100% - 2rem));
  margin: 0;
  color: var(--ink-soft);
  text-align: center;
  transform: translate(-50%, -50%);
}
.model-3d-status[hidden] { display: none; }
.gl-modal-overlay[aria-hidden="true"] { display: none; }

/* Sur ordinateur, la carte et la décision restent visibles côte à côte. */
@media (min-width: 1280px) {
  .board-panel-with-decision,
  .board-panel-with-context {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: .55rem .7rem;
  }
  .board-panel-with-decision > .section-heading,
  .board-panel-with-context > .section-heading {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0;
  }
  .board-panel-with-decision > .map-viewport,
  .board-panel-with-context > .map-viewport {
    grid-column: 1;
    grid-row: 2 / 4;
    height: 100%;
  }
  .board-panel-with-decision > .encounter-zone {
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 0;
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    margin-top: 0;
    overflow: hidden;
  }
  .board-panel-with-decision > .encounter-zone .monster-line {
    display: grid;
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-content: stretch;
    overflow-y: auto;
  }
  .board-panel-with-decision > .encounter-zone .monster-card {
    width: 100%;
    min-width: 0;
    align-self: start;
  }
  .board-panel-with-decision > .encounter-zone .monster-card img {
    height: 62px;
  }
  .board-panel-with-decision > .action-dock {
    grid-column: 2;
    grid-row: 3;
    align-self: end;
    margin-top: 0;
  }
  .board-panel-with-decision > .action-dock form {
    flex: 1 1 135px;
  }
  .board-panel-with-decision > .action-dock form > .button {
    width: 100%;
  }
  .board-panel-with-context > .action-dock {
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: stretch;
    align-content: start;
    margin-top: 0;
  }
  .board-panel-with-context > .action-dock .special-investigation-card,
  .board-panel-with-context > .action-dock .special-action-form {
    width: 100%;
  }
  .board-panel-with-decision.is-map-modal {
    display: flex;
  }
  .board-panel-with-decision.is-map-modal > .encounter-zone,
  .board-panel-with-decision.is-map-modal > .action-dock {
    display: none;
  }
  .board-panel-with-context.is-map-modal {
    display: flex;
  }
  .board-panel-with-context.is-map-modal > .action-dock {
    display: none;
  }
}

@media (max-width: 980px) {
  .game-shell.shell-wide { padding-inline: .55rem; }
  .game-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .board-panel {
    grid-column: 1;
    grid-row: 1;
    height: min(68dvh, 720px);
    min-height: 520px;
    overflow: hidden;
  }
  .left-sidebar {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
    overflow: visible;
  }
  .sidebar-column {
    grid-column: 1;
    grid-row: 3;
    max-height: none;
    overflow: visible;
  }
  .board-journal, .board-journal[open] {
    grid-column: 1;
    grid-row: 4;
    min-height: 190px;
  }
  .party-panel .party-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .combat-table {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    overflow: visible;
  }
  .combat-center {
    grid-column: 1;
    grid-row: 1;
    min-height: 620px;
    grid-template-rows: minmax(430px, 62dvh) 150px;
  }
  .hero-vitals { grid-column: 1; grid-row: 2; }
  .monster-vitals { grid-column: 1; grid-row: 3; }
  .combat-vitals ul {
    height: auto;
    max-height: 220px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .combat-dice-layer { inset: 8% .6rem 155px; }
}

@media (max-width: 620px) {
  .site-header { gap: .25rem; }
  .brand > span { display: none; }
  .brand-logo { width: 50px; height: 50px; }
  .top-nav {
    min-width: 0;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .top-nav > a { flex: 0 0 auto; }
  .game-banner { align-items: flex-start; flex-direction: column; }
  .game-banner-actions { width: 100%; justify-content: space-between; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip div:nth-child(even) { border-right: 0; }
  .status-strip div:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .status-strip div:last-child { grid-column: 1 / -1; border-right: 0; }
  .board-panel { height: min(65dvh, 620px); min-height: 440px; }
  .party-panel .party-grid { grid-template-columns: 1fr; }
  .combat-table { overflow-x: auto; }
  .combat-center, .combat-vitals { min-width: 560px; }
  .combat-vitals ul { grid-template-columns: 1fr; }
  .utility-popup-content form { grid-template-columns: 1fr; }
}

/* Sauvegardes et récupération ------------------------------------------- */
/* « .panel » n'a pas de rembourrage propre : sans ces règles les sections
   héritaient du « padding-block » de « .page-stack » et s'étiraient sur toute
   la hauteur de l'écran. */
.recovery-page { display: grid; gap: 1.1rem; align-content: start; }
.recovery-intro { max-width: 62ch; margin: -.4rem 0 .2rem; color: var(--ink-soft); line-height: 1.6; }
.recovery-intro em { color: var(--gold-light); font-style: normal; font-weight: 600; }
.recovery-card { display: grid; gap: .85rem; padding: clamp(1.1rem, 3vw, 1.6rem); }
.recovery-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.recovery-card-head h2 { margin: 0; font-size: 1.22rem; }
.recovery-badge {
  padding: .2rem .55rem; border: 1px solid rgba(208, 162, 75, .38); border-radius: 999px;
  background: rgba(208, 162, 75, .1); color: var(--gold-light);
  font-size: .64rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
}
.recovery-hint { max-width: 60ch; margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.55; }
.recovery-key-row { display: flex; gap: .55rem; align-items: stretch; flex-wrap: wrap; }
.recovery-key {
  flex: 1 1 22ch; min-width: 0;
  border-color: rgba(208, 162, 75, .34); background: rgba(208, 162, 75, .07); color: var(--gold-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; letter-spacing: .04em;
}
.recovery-key:focus { border-color: var(--gold); }
.recovery-copy { flex: 0 0 auto; white-space: nowrap; }
.recovery-copy.is-copied { border-color: var(--moss); background: rgba(103, 124, 88, .24); color: #dcecc9; }
.recovery-form { display: grid; gap: .85rem; justify-items: start; }
.recovery-field { display: grid; gap: .38rem; width: 100%; }
.recovery-field > span { color: var(--ink-soft); font-size: .74rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.recovery-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.recovery-field input::placeholder { color: #7d7264; font-family: var(--sans); letter-spacing: normal; }

@media (max-width: 30rem) {
  .recovery-copy { width: 100%; }
}

/* Bestiaire --------------------------------------------------------------- */
.bestiary-page .lead { max-width: 68ch; margin-top: -0.4rem; }
.bestiary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .8rem; }
.bestiary-card {
  display: grid; margin: 0; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(14, 12, 10, .92); overflow: hidden; cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.bestiary-card:hover, .bestiary-card:focus-visible {
  border-color: var(--gold); transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, .4);
}
.bestiary-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.bestiary-card-info { display: grid; gap: .1rem; padding: .55rem .7rem .65rem; }
.bestiary-card-info strong { color: var(--gold-light); font-family: var(--serif); font-weight: 500; }
.bestiary-card-info small { color: var(--ink-soft); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }

@media (forced-colors: active) {
  :where(a, button, summary, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
    outline: 3px solid CanvasText;
  }
  .presence-dot, .live-indicator i { border: 2px solid CanvasText; }
}
