:root {
  --font-main: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --font-size: 20px;
  --tablet-resource-columns: 1;
  --bg: #2f432f;
  --bg-deep: #1c2b1d;
  --paper: #f4e6bf;
  --paper-strong: #fff4d2;
  --ink: #271b10;
  --muted: #5b472d;
  --wood: #5a361a;
  --wood-dark: #2d1a0d;
  --leaf: #355d35;
  --leaf-bright: #4e7d42;
  --accent: #8a4d22;
  --danger: #9a2f24;
  --good: #34683b;
  --outline: #3d2714;
  --button-text: #fff8df;
  --bubble-empty: #fff5d6;
  --bubble-filled: #2f5d35;
  --bubble-border: #2b1a0d;
  --shadow: rgba(12, 8, 4, .38);
  --focus: #ffcc3d;
}

body[data-palette="autumn"] {
  --bg: #583922;
  --bg-deep: #2e1c12;
  --paper: #ffe3ad;
  --paper-strong: #fff1c9;
  --leaf: #7a4f22;
  --leaf-bright: #a76527;
  --accent: #93441f;
  --good: #5e6b2b;
}

body[data-palette="night"] {
  --bg: #111c25;
  --bg-deep: #071017;
  --paper: #e8ddb7;
  --paper-strong: #fff6ce;
  --ink: #120f0a;
  --leaf: #26475a;
  --leaf-bright: #3b6880;
  --accent: #684a82;
  --good: #2f6464;
}

body[data-palette="contrast"],
body.high-contrast {
  --bg: #000;
  --bg-deep: #000;
  --paper: #fff6c7;
  --paper-strong: #fffbe3;
  --ink: #000;
  --muted: #1a1a1a;
  --wood: #000;
  --wood-dark: #000;
  --leaf: #003d20;
  --leaf-bright: #005e31;
  --accent: #622200;
  --danger: #8b0000;
  --good: #005e1f;
  --outline: #000;
  --bubble-empty: #fff;
  --bubble-filled: #000;
  --bubble-border: #000;
  --focus: #005cff;
}

body[data-info-contrast="strong"] {
  --bubble-empty: #fff9dd;
  --bubble-filled: #173d1f;
}

body[data-info-contrast="maximum"] {
  --bubble-empty: #ffffff;
  --bubble-filled: #000000;
  --bubble-border: #000000;
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-main);
  background:
    radial-gradient(circle at top left, rgba(255, 245, 195, .18), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, .35), transparent 28rem),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
}

body[data-font="system"] {
  --font-main: "Segoe UI", Arial, sans-serif;
}

body[data-font="serif"] {
  --font-main: Georgia, "Times New Roman", serif;
}

body[data-font="mono"] {
  --font-main: "Cascadia Mono", Consolas, monospace;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: .2rem solid var(--focus);
  outline-offset: .12rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(.8rem, 3vw, 1.8rem);
  background: linear-gradient(180deg, rgba(18, 11, 5, .82), rgba(18, 11, 5, .56));
  color: #fff8df;
  border-bottom: .25rem solid rgba(255, 241, 184, .35);
}

.eyebrow {
  margin: 0 0 .15rem;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .84;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  line-height: 1.05;
}

.top-actions,
.quick-hp-panel,
.card-footer,
.dialog-footer {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}

.page-shell {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: clamp(.75rem, 2vw, 1.2rem);
}

.status-ribbon {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .9rem;
  padding: .55rem .8rem;
  color: #fff7dc;
  background: rgba(0, 0, 0, .32);
  border: 1px solid rgba(255, 245, 205, .32);
  border-radius: .75rem;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}

.character-card {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(90deg, rgba(74, 45, 22, .18), transparent 1.2rem, transparent calc(100% - 1.2rem), rgba(74, 45, 22, .18)),
    linear-gradient(180deg, var(--paper-strong), var(--paper));
  border: .32rem solid var(--wood);
  border-radius: 1.15rem;
  box-shadow: 0 .8rem 1.8rem var(--shadow), inset 0 0 0 .13rem rgba(255, 255, 255, .45);
  overflow: hidden;
}

.character-card::before,
.character-card::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: .55rem;
  background:
    linear-gradient(90deg, transparent, rgba(36, 71, 37, .65), transparent),
    repeating-linear-gradient(90deg, rgba(72, 45, 21, .7) 0 .7rem, rgba(34, 80, 37, .75) .7rem 1.25rem);
  z-index: -1;
}

.character-card::before { top: 0; }
.character-card::after { bottom: 0; }

.character-header {
  display: grid;
  grid-template-columns: 8.2rem 1fr;
  gap: .75rem;
  padding: 1rem .95rem .75rem;
}

.portrait-frame {
  position: relative;
  min-height: 9.8rem;
  border: .28rem solid var(--outline);
  border-radius: .8rem;
  background: var(--wood-dark);
  overflow: hidden;
  box-shadow: inset 0 0 0 .15rem rgba(255, 244, 197, .35);
}

.portrait {
  width: 100%;
  height: 100%;
  min-height: 9.8rem;
  object-fit: cover;
  display: block;
}

.identity-block {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.tiny-label {
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.name-input,
.subtitle-input,
.resource-input,
.field select,
.field input[type="range"],
.notes-area {
  width: 100%;
  min-height: 2.2rem;
  color: var(--ink);
  background: rgba(255, 250, 222, .78);
  border: .13rem solid rgba(50, 29, 12, .58);
  border-radius: .55rem;
  padding: .35rem .5rem;
}

.name-input {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.05;
}

.subtitle-input {
  color: var(--muted);
  font-weight: 700;
}

.quick-hp-panel {
  padding: 0 .95rem .85rem;
}

.btn {
  min-height: 2.45rem;
  padding: .45rem .8rem;
  border: .14rem solid rgba(20, 12, 4, .7);
  border-radius: .65rem;
  color: var(--button-text);
  font-weight: 900;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
  box-shadow: 0 .18rem 0 rgba(0, 0, 0, .45);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 .06rem 0 rgba(0, 0, 0, .55);
}

.btn.primary {
  background: linear-gradient(180deg, #9f6b32, var(--accent));
}

.btn.secondary {
  background: linear-gradient(180deg, #72502c, #4b3019);
}

.btn.danger,
.damage-btn {
  background: linear-gradient(180deg, #b74738, var(--danger));
}

.heal-btn {
  background: linear-gradient(180deg, #4e8b4e, var(--good));
}

.temp-btn {
  background: linear-gradient(180deg, #5f7897, #344c6e);
}

.icon-btn,
.mini-btn {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: 999px;
  border: .13rem solid var(--outline);
  color: var(--button-text);
  font-weight: 950;
  background: linear-gradient(180deg, #70502f, #3c2512);
}

.resources-list {
  display: grid;
  gap: .7rem;
  padding: 0 .95rem .95rem;
}

.resource-card {
  padding: .7rem;
  background: rgba(255, 251, 230, .56);
  border: .13rem solid rgba(58, 35, 15, .36);
  border-radius: .85rem;
  box-shadow: inset 0 0 0 .08rem rgba(255, 255, 255, .42);
}

.resource-topline,
.resource-controls,
.resource-values {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.resource-topline {
  justify-content: space-between;
  margin-bottom: .45rem;
}

.resource-title {
  font-size: 1rem;
  font-weight: 950;
}

.resource-values {
  font-weight: 950;
}

.resource-input {
  width: 4.6rem;
  text-align: center;
  font-weight: 900;
}

.max-input {
  width: 4rem;
}

.slash {
  color: var(--muted);
  font-weight: 900;
}

.bar-shell {
  position: relative;
  min-height: 1.15rem;
  margin-top: .4rem;
  overflow: hidden;
  border: .13rem solid var(--outline);
  border-radius: 999px;
  background: rgba(60, 37, 16, .2);
}

.bar-fill {
  height: 100%;
  min-height: .9rem;
  width: 0%;
  background: linear-gradient(90deg, var(--danger), #d39234, var(--good));
  border-radius: 999px;
  transition: width .18s ease;
}

.bubbles-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.bubble {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border: .18rem solid var(--bubble-border);
  border-radius: 999px;
  background: var(--bubble-empty);
  color: var(--ink);
  font-weight: 950;
  box-shadow: inset 0 0 0 .13rem rgba(255, 255, 255, .45);
}

.bubble.filled {
  background: var(--bubble-filled);
  color: #fff8df;
}

.notes-area {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.35;
}

.card-footer {
  justify-content: space-between;
  padding: .9rem .95rem 1.15rem;
  background: rgba(77, 45, 18, .13);
  border-top: .12rem solid rgba(64, 39, 20, .22);
}

.dialog-card {
  width: min(760px, calc(100vw - 1rem));
  color: var(--ink);
  border: .3rem solid var(--wood);
  border-radius: 1rem;
  background: var(--paper-strong);
  box-shadow: 0 1rem 2.5rem rgba(0,0,0,.55);
}

.dialog-card::backdrop {
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(3px);
}

.dialog-inner {
  display: grid;
  gap: .8rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border-bottom: .13rem solid rgba(67, 42, 18, .28);
  padding-bottom: .55rem;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.dialog-hint,
.settings-note {
  padding: .65rem .75rem;
  border-radius: .65rem;
  background: rgba(73, 48, 20, .13);
  font-weight: 700;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(2.7rem, 1fr));
  gap: .45rem;
}

.number-btn {
  min-height: 3.2rem;
  font-size: 1.1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: .85rem;
}

.field {
  display: grid;
  gap: .35rem;
  font-weight: 900;
}

.check-field {
  grid-template-columns: 1.45rem 1fr;
  align-items: center;
}

.check-field input {
  width: 1.3rem;
  height: 1.3rem;
}

@media (max-width: 1180px) {
  .characters-grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions,
  .quick-hp-panel,
  .card-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .characters-grid {
    grid-template-columns: 1fr;
  }

  .character-header {
    grid-template-columns: 1fr;
  }

  .portrait-frame,
  .portrait {
    min-height: 15rem;
  }

  .number-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .status-ribbon {
    flex-direction: column;
  }
}

.settings-dialog {
  width: min(1120px, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  overflow: auto;
}

.settings-section {
  padding: .75rem;
  border: .14rem solid rgba(58, 35, 15, .34);
  border-radius: .85rem;
  background: rgba(255, 251, 230, .42);
}

.settings-section h3 {
  margin: 0 0 .55rem;
  font-size: 1.18rem;
}

.settings-help {
  margin: 0 0 .7rem;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.3;
}

.visibility-settings {
  display: grid;
  gap: .8rem;
}

.visibility-character-panel {
  border: .13rem solid rgba(58, 35, 15, .38);
  border-radius: .8rem;
  background: rgba(255, 245, 210, .62);
  overflow: hidden;
}

.visibility-character-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  padding: .65rem .75rem;
  color: #fff8df;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
  border-bottom: .13rem solid rgba(37, 22, 9, .35);
}

.visibility-subtitle {
  font-weight: 800;
  opacity: .9;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: .48rem;
  font-weight: 950;
}

.toggle-line input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--leaf);
}

.big-toggle {
  font-size: 1.08rem;
}

.visibility-resources-list {
  display: grid;
  gap: .45rem;
  padding: .65rem;
}

.visibility-resource-row {
  display: grid;
  grid-template-columns: minmax(13rem, 1.4fr) minmax(6rem, .55fr) minmax(5.5rem, .5fr) auto;
  gap: .55rem;
  align-items: end;
  padding: .55rem;
  border: .1rem solid rgba(58, 35, 15, .22);
  border-radius: .65rem;
  background: rgba(255, 255, 255, .28);
}

.compact-field {
  display: grid;
  gap: .2rem;
  font-weight: 900;
}

.compact-field span {
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.compact-field input {
  width: 100%;
  min-height: 2.05rem;
  color: var(--ink);
  background: rgba(255, 250, 222, .92);
  border: .12rem solid rgba(50, 29, 12, .58);
  border-radius: .5rem;
  padding: .25rem .4rem;
  font-weight: 950;
  text-align: center;
}

.resource-type-pill {
  align-self: center;
  justify-self: end;
  padding: .24rem .48rem;
  border: .1rem solid rgba(58, 35, 15, .38);
  border-radius: 999px;
  background: rgba(69, 45, 20, .12);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 1rem;
  color: var(--ink);
  background: var(--paper-strong);
  border: .24rem solid var(--wood);
  border-radius: 1rem;
  box-shadow: 0 .8rem 1.8rem var(--shadow);
}

.empty-state h2 {
  margin-bottom: .35rem;
}

.empty-state p {
  margin: 0;
  font-weight: 800;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .visibility-resource-row {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .resource-toggle,
  .resource-type-pill {
    grid-column: 1 / -1;
  }

  .resource-type-pill {
    justify-self: start;
  }
}

/* V0.1.5 - Réserves de dés */
.resource-dicePool .resource-values,
.resource-hitDicePool .resource-values {
  align-items: center;
}

.die-type-inline,
.resource-die-setting {
  min-height: 2.05rem;
  color: var(--ink);
  background: rgba(255, 250, 222, .92);
  border: .12rem solid rgba(50, 29, 12, .58);
  border-radius: .5rem;
  padding: .22rem .4rem;
  font-weight: 950;
}

.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin-top: .25rem;
}

.die-shape {
  position: relative;
  width: 3.15rem;
  height: 3.15rem;
  display: grid;
  place-items: center;
  border: .16rem solid var(--outline);
  color: var(--ink);
  background: var(--bubble-empty);
  font-weight: 950;
  box-shadow: 0 .12rem .18rem rgba(0,0,0,.24), inset 0 0 0 .12rem rgba(255,255,255,.45);
}

.die-shape.filled {
  color: #fff8df;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
}

.die-shape.empty {
  opacity: .68;
  filter: grayscale(.18);
}

.die-label {
  position: relative;
  z-index: 1;
  font-size: .86rem;
  text-shadow: 0 1px 0 rgba(0,0,0,.22);
}

.die-d4 {
  clip-path: polygon(50% 4%, 96% 92%, 4% 92%);
  padding-top: .42rem;
}

.die-d6 {
  border-radius: .38rem;
}

.die-d8 {
  clip-path: polygon(50% 0%, 96% 50%, 50% 100%, 4% 50%);
}

.die-d10 {
  clip-path: polygon(50% 0%, 90% 18%, 100% 58%, 50% 100%, 0% 58%, 10% 18%);
}

.die-d12 {
  clip-path: polygon(50% 0%, 79% 10%, 98% 35%, 92% 66%, 68% 92%, 32% 92%, 8% 66%, 2% 35%, 21% 10%);
}

.die-d20 {
  clip-path: polygon(50% 0%, 76% 8%, 94% 28%, 100% 55%, 88% 82%, 64% 98%, 36% 98%, 12% 82%, 0% 55%, 6% 28%, 24% 8%);
}

.dice-empty-note {
  margin: .2rem 0 .65rem;
  color: var(--muted);
  font-weight: 850;
}

.dice-controls {
  margin-top: .55rem;
}

.visibility-resource-row {
  grid-template-columns: minmax(13rem, 1.4fr) minmax(6rem, .55fr) minmax(5.5rem, .5fr) minmax(4.8rem, .42fr) auto;
}

.die-setting select {
  width: 100%;
}

@media (max-width: 920px) {
  .visibility-resource-row {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .resource-toggle,
  .resource-type-pill {
    grid-column: 1 / -1;
  }

  .resource-type-pill {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .die-shape {
    width: 3.35rem;
    height: 3.35rem;
  }

  .resource-dicePool .resource-values,
.resource-hitDicePool .resource-values {
    width: 100%;
  }

  .die-type-inline {
    flex: 1 1 5rem;
  }
}

/* V0.1.5 - Valeur individuelle sur chaque dé */
.dice-hint {
  margin: .15rem 0 .55rem;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
  line-height: 1.25;
}

.dice-row-editable {
  align-items: flex-start;
  gap: .7rem;
}

.die-tile {
  display: grid;
  justify-items: center;
  gap: .25rem;
  min-width: 3.8rem;
}

.die-tile.spent {
  opacity: .72;
}

.die-shape {
  width: 3.55rem;
  height: 3.55rem;
  grid-template-rows: .95rem 1fr;
  align-items: center;
  justify-items: center;
  padding: .25rem .28rem .36rem;
  line-height: 1;
}

.die-type-label {
  position: relative;
  z-index: 1;
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: .03em;
  opacity: .92;
  text-transform: uppercase;
}

.die-value-display {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}

.die-value-input {
  width: 3.8rem;
  min-height: 2.05rem;
  color: var(--ink);
  background: rgba(255, 250, 222, .95);
  border: .12rem solid rgba(50, 29, 12, .62);
  border-radius: .5rem;
  padding: .2rem .25rem;
  font-weight: 950;
  text-align: center;
}

.die-meta {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
}

.clear-values {
  flex: 1 1 auto;
}

@media (max-width: 760px) {
  .die-shape {
    width: 3.8rem;
    height: 3.8rem;
  }

  .die-value-input {
    width: 4.1rem;
    min-height: 2.25rem;
  }
}


/* V0.1.6 - Dés plus lisibles, surtout quand ils sont vides */
.die-shape {
  --die-clip: inset(0 round .38rem);
  position: relative;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  filter: drop-shadow(0 .12rem .14rem rgba(0, 0, 0, .34));
  grid-template-rows: 1fr;
  padding: .34rem;
}

.die-shape::before,
.die-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: var(--die-clip);
  pointer-events: none;
}

.die-shape::before {
  z-index: 0;
  background: var(--outline);
}

.die-shape::after {
  z-index: 0;
  inset: .18rem;
  background: var(--paper-strong);
  box-shadow: inset 0 0 0 .08rem rgba(255, 255, 255, .68);
}

.die-shape.filled::after {
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
}

.die-shape.empty {
  opacity: 1;
  filter: drop-shadow(0 .12rem .16rem rgba(0, 0, 0, .42));
}

.die-shape.empty::before {
  background: #1d1108;
}

.die-shape.empty::after {
  background: #fff7d7;
}

.die-shape.spent,
.die-tile.spent .die-shape::after {
  background: transparent;
}

.die-tile.spent .die-shape::after {
  background: #d8cba9;
}

.die-tile.spent .die-shape.filled::after {
  background: #816f52;
}

.die-d4 { --die-clip: polygon(50% 2%, 98% 94%, 2% 94%); }
.die-d6 { --die-clip: inset(0 round .45rem); }
.die-d8 { --die-clip: polygon(50% 0%, 98% 50%, 50% 100%, 2% 50%); }
.die-d10 { --die-clip: polygon(50% 0%, 91% 17%, 100% 58%, 50% 100%, 0% 58%, 9% 17%); }
.die-d12 { --die-clip: polygon(50% 0%, 79% 9%, 99% 35%, 93% 67%, 68% 94%, 32% 94%, 7% 67%, 1% 35%, 21% 9%); }
.die-d20 { --die-clip: polygon(50% 0%, 77% 7%, 95% 27%, 100% 55%, 88% 83%, 64% 99%, 36% 99%, 12% 83%, 0% 55%, 5% 27%, 23% 7%); }

.die-value-display {
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 1.75rem;
  min-height: 1.55rem;
  font-size: 1.55rem;
  line-height: 1;
}

.die-shape.no-value .die-value-display {
  font-size: .92rem;
  letter-spacing: .04em;
  opacity: .82;
}

.die-shape.filled .die-value-display {
  color: #fff8df;
  text-shadow: 0 1px 1px rgba(0,0,0,.42);
}

.die-shape.empty .die-value-display {
  color: var(--ink);
  text-shadow: none;
}

.die-type-label {
  display: none;
}

body.high-contrast .die-shape::before,
body[data-palette="contrast"] .die-shape::before {
  background: #000;
}

body.high-contrast .die-shape::after,
body[data-palette="contrast"] .die-shape::after {
  background: #fff;
}

body.high-contrast .die-shape.filled::after,
body[data-palette="contrast"] .die-shape.filled::after {
  background: #000;
}

body.high-contrast .die-shape.filled .die-value-display,
body[data-palette="contrast"] .die-shape.filled .die-value-display {
  color: #fff;
}


/* V0.1.7 - Inspiration toggle + dés de vie sans valeur inscrite */
.resource-toggle .resource-values {
  min-width: 3.5rem;
  justify-content: flex-end;
}

.inspiration-toggle {
  width: 100%;
  min-height: 3.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  border: .18rem solid var(--outline);
  border-radius: .85rem;
  color: var(--ink);
  background: rgba(255, 250, 222, .9);
  font-weight: 950;
  box-shadow: inset 0 0 0 .12rem rgba(255,255,255,.42), 0 .14rem .18rem rgba(0,0,0,.18);
}

.inspiration-toggle.active {
  color: #fff8df;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
}

.inspiration-toggle.inactive {
  color: var(--muted);
  background: rgba(255, 250, 222, .82);
}

.toggle-orb {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: .14rem solid currentColor;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
}

.toggle-text {
  font-size: 1.05rem;
}

.hit-dice-hint {
  margin-bottom: .7rem;
}

.hit-dice-row .die-tile {
  min-width: 3.9rem;
}

.hit-dice-row .die-value-display {
  font-size: .92rem;
  letter-spacing: .04em;
}

.hit-dice-row .die-tile.available .die-meta {
  color: var(--leaf);
}

.hit-dice-row .die-tile.spent .die-meta {
  color: var(--muted);
}

body.high-contrast .inspiration-toggle.active,
body[data-palette="contrast"] .inspiration-toggle.active {
  background: #000;
  color: #fff;
}

body.high-contrast .inspiration-toggle.inactive,
body[data-palette="contrast"] .inspiration-toggle.inactive {
  background: #fff;
  color: #000;
}

/* V0.1.8 - Paramètres minimisés tant que la ressource n'est pas cochée */
.visibility-character-panel.character-collapsed .visibility-resources-list {
  display: none;
}

.visibility-resource-row {
  grid-template-columns: minmax(13rem, 1fr) minmax(17rem, 2fr);
  align-items: start;
}

.visibility-resource-row.resource-collapsed {
  grid-template-columns: 1fr;
  align-items: center;
  background: rgba(255, 255, 255, .18);
}

.visibility-resource-row.resource-collapsed .resource-config-options {
  display: none;
}

.resource-config-options {
  display: grid;
  grid-template-columns: minmax(6rem, .65fr) minmax(5.5rem, .6fr) minmax(5rem, .5fr) auto;
  gap: .55rem;
  align-items: end;
}

.visibility-resource-row.resource-expanded {
  background: rgba(255, 255, 255, .36);
  border-color: rgba(58, 35, 15, .42);
}

.visibility-resource-row.resource-expanded .resource-toggle span::after {
  content: "  · options ouvertes";
  color: var(--muted);
  font-size: .74rem;
  font-weight: 850;
}

.visibility-resource-row.resource-collapsed .resource-toggle span::after {
  content: "  · options fermées";
  color: var(--muted);
  font-size: .74rem;
  font-weight: 850;
}

@media (max-width: 920px) {
  .visibility-resource-row,
  .visibility-resource-row.resource-collapsed {
    grid-template-columns: 1fr;
  }

  .resource-config-options {
    grid-template-columns: 1fr 1fr;
  }

  .resource-type-pill {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .resource-config-options {
    grid-template-columns: 1fr;
  }
}

/* V0.1.9 - Deux vues séparées : tablette et téléphone */
.view-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.view-link.active {
  filter: brightness(1.18);
  outline: .14rem solid rgba(255, 246, 194, .72);
  outline-offset: .08rem;
}

body[data-layout="tablet"] .page-shell {
  width: min(1700px, 100%);
  padding: clamp(.7rem, 1.6vw, 1.25rem);
}

body[data-layout="tablet"] .characters-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
}

body[data-layout="tablet"] .character-card {
  width: 100%;
}

body[data-layout="tablet"] .character-header {
  grid-template-columns: 7.2rem minmax(0, 1fr);
  align-items: center;
  padding: .9rem 1.05rem .65rem;
}

body[data-layout="tablet"] .portrait-frame,
body[data-layout="tablet"] .portrait {
  min-height: 7.2rem;
  height: 7.2rem;
}

body[data-layout="tablet"] .quick-hp-panel,
body[data-layout="tablet"] .resources-list,
body[data-layout="tablet"] .card-footer {
  padding-left: 1.05rem;
  padding-right: 1.05rem;
}

body[data-layout="tablet"] .resources-list {
  display: grid;
  grid-template-columns: repeat(var(--tablet-resource-columns), minmax(0, 1fr));
  gap: .75rem;
}

body[data-layout="tablet"] .resource-notes {
  grid-column: 1 / -1;
}

body[data-layout="phone"] .resources-list {
  grid-template-columns: 1fr;
}

body[data-layout="tablet"] .resource-card {
  width: 100%;
  padding: .8rem .9rem;
}

body[data-layout="tablet"] .resource-topline {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto;
  gap: .75rem;
  align-items: center;
}

body[data-layout="tablet"] .resource-body {
  width: 100%;
}

body[data-layout="tablet"] .resource-controls {
  width: 100%;
}

body[data-layout="tablet"] .bar-shell {
  min-height: 1.35rem;
}

body[data-layout="tablet"] .notes-area {
  min-height: 4.8rem;
}

body[data-layout="tablet"] .dice-row {
  width: 100%;
}

body[data-layout="phone"] .page-shell {
  width: min(690px, 100%);
  padding: .65rem;
}

body[data-layout="phone"] .characters-grid {
  grid-template-columns: 1fr;
  gap: .9rem;
}

body[data-layout="phone"] .topbar {
  flex-direction: column;
  align-items: stretch;
}

body[data-layout="phone"] .top-actions,
body[data-layout="phone"] .quick-hp-panel,
body[data-layout="phone"] .card-footer {
  display: grid;
  grid-template-columns: 1fr;
}

body[data-layout="phone"] .character-header {
  grid-template-columns: 1fr;
}

body[data-layout="phone"] .portrait-frame,
body[data-layout="phone"] .portrait {
  min-height: 14rem;
}

body[data-layout="phone"] .status-ribbon {
  flex-direction: column;
}

@media (max-width: 900px) {
  body[data-layout="tablet"] .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-layout="tablet"] .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-layout="tablet"] .character-header {
    grid-template-columns: 6.4rem minmax(0, 1fr);
  }

  body[data-layout="tablet"] .portrait-frame,
  body[data-layout="tablet"] .portrait {
    min-height: 6.4rem;
    height: 6.4rem;
  }
}

@media (max-width: 560px) {
  body[data-layout="tablet"] .resource-topline,
  body[data-layout="phone"] .resource-topline {
    grid-template-columns: 1fr;
  }
}

/* V0.1.11 - Section Affichage repliable et visuelle dans les paramètres */
.collapsible-settings {
  padding: 0;
  overflow: hidden;
}

.settings-summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .45rem .75rem;
  align-items: center;
  padding: .75rem .85rem;
  color: #fff8df;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
  border-bottom: .13rem solid rgba(37, 22, 9, .35);
  user-select: none;
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: .13rem solid rgba(255, 248, 223, .78);
  border-radius: 999px;
  color: #fff8df;
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
}

.collapsible-settings[open] .settings-summary::before {
  content: "−";
}

.summary-title {
  font-size: 1.18rem;
  font-weight: 950;
}

.summary-hint {
  grid-column: 2;
  margin-top: -.25rem;
  opacity: .9;
  font-size: .84rem;
  font-weight: 850;
}

.display-settings-grid {
  padding: .85rem;
}

.display-settings-section:not([open]) {
  background: rgba(255, 245, 210, .62);
}

.display-settings-section[open] {
  background: rgba(255, 251, 230, .46);
}

@media (max-width: 760px) {
  .settings-summary {
    grid-template-columns: auto 1fr;
  }

  .summary-hint {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}


/* V0.1.11 - Affichage visuel façon cartes de sélection */
.display-settings-section {
  border-color: rgba(217, 184, 255, .38);
  background: linear-gradient(180deg, rgba(59, 44, 78, .98), rgba(45, 34, 61, .98));
  color: #fff7ff;
  box-shadow: 0 .9rem 2.4rem rgba(0, 0, 0, .28);
}

.display-settings-section:not([open]) {
  background: linear-gradient(180deg, rgba(59, 44, 78, .98), rgba(45, 34, 61, .98));
}

.display-settings-section .settings-summary {
  background: linear-gradient(180deg, #4b3764, #332545);
  border-bottom-color: rgba(229, 196, 255, .25);
}

.display-settings-section[open] .settings-summary {
  border-bottom-color: rgba(255, 255, 255, .16);
}

.display-visual-panel {
  display: grid;
  gap: .9rem;
  padding: .85rem;
}

.visual-settings-group {
  display: grid;
  gap: .62rem;
  padding: .75rem;
  border: .1rem solid rgba(238, 205, 255, .28);
  border-radius: .85rem;
  background: rgba(24, 17, 34, .28);
}

.visual-settings-group h3 {
  margin: 0;
  color: #fff8ff;
  font-size: 1.06rem;
  text-shadow: 0 .06rem 0 rgba(0, 0, 0, .65);
}

.visual-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .55rem;
}

.visual-choice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .12rem .42rem;
  align-items: center;
  min-height: 3.15rem;
  padding: .55rem .6rem;
  color: #fff;
  border: .12rem solid rgba(255, 255, 255, .35);
  border-radius: .72rem;
  box-shadow: inset 0 .08rem .08rem rgba(255, 255, 255, .28), 0 .18rem .38rem rgba(0, 0, 0, .26);
  text-align: left;
  font-weight: 950;
  overflow: hidden;
}

.visual-choice-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .18), transparent 48%, rgba(0, 0, 0, .2));
  pointer-events: none;
}

.visual-choice-card.selected {
  border-color: #e6c1ff;
  box-shadow: 0 0 0 .16rem rgba(230, 193, 255, .8), inset 0 0 0 .12rem rgba(64, 35, 96, .75), 0 .22rem .5rem rgba(0, 0, 0, .28);
}

.choice-radio {
  position: relative;
  z-index: 1;
  width: 1rem;
  height: 1rem;
  border: .12rem solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 .12rem rgba(0, 0, 0, .2);
}

.visual-choice-card.selected .choice-radio::after {
  content: "";
  position: absolute;
  inset: .18rem;
  border-radius: 999px;
  background: #fff;
}

.choice-label,
.choice-hint {
  position: relative;
  z-index: 1;
}

.choice-label {
  font-size: 1rem;
  text-shadow: 0 .06rem .08rem rgba(0, 0, 0, .65);
}

.choice-hint {
  grid-column: 2;
  margin-top: -.12rem;
  font-size: .72rem;
  line-height: 1.1;
  opacity: .92;
  text-shadow: 0 .05rem .08rem rgba(0, 0, 0, .6);
}

.visual-choice-card.forest { background: linear-gradient(135deg, #24512d, #85c66a); }
.visual-choice-card.autumn { background: linear-gradient(135deg, #704018, #ffad3c); }
.visual-choice-card.night { background: linear-gradient(135deg, #1b2a42, #6c8ccc); }
.visual-choice-card.contrast { background: repeating-linear-gradient(135deg, #171717 0, #171717 .55rem, #4d4d4d .55rem, #4d4d4d 1.1rem); }
.visual-choice-card.interface { background: linear-gradient(135deg, #4b3764, #b16bed); }
.visual-choice-card.strong { background: linear-gradient(135deg, #222, #f5f0dd); color: #fff; }
.visual-choice-card.maximum { background: linear-gradient(135deg, #000 0 47%, #fff 48% 100%); color: #fff; }
.visual-choice-card.atkinson { background: linear-gradient(135deg, #3b2e4b, #8c62bd); }
.visual-choice-card.system { background: linear-gradient(135deg, #254a72, #6fc0df); }
.visual-choice-card.serif { background: linear-gradient(135deg, #5d371c, #d7b36a); }
.visual-choice-card.mono { background: linear-gradient(135deg, #222, #68717f); }

.font-choice-grid .visual-choice-card.serif .choice-label {
  font-family: Georgia, "Times New Roman", serif;
}

.font-choice-grid .visual-choice-card.mono .choice-label {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.font-size-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem .75rem;
  border: .12rem solid rgba(255, 255, 255, .24);
  border-radius: .75rem;
  background: rgba(255, 255, 255, .12);
  font-weight: 950;
}

.font-size-panel input[type="range"] {
  width: 100%;
  accent-color: #c491ff;
}

.font-size-panel strong {
  min-width: 3.8rem;
  padding: .25rem .45rem;
  border-radius: .5rem;
  color: #271b10;
  background: #fff0c8;
  text-align: center;
}

.readable-toggle-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: center;
  padding: .75rem;
  border: .12rem solid rgba(255, 255, 255, .28);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .12);
  cursor: pointer;
}

.readable-toggle-card input {
  width: 1.65rem;
  height: 1.65rem;
  accent-color: #c491ff;
}

.readable-toggle-body {
  display: grid;
  gap: .12rem;
}

.readable-title {
  font-weight: 950;
}

.readable-hint {
  font-size: .82rem;
  line-height: 1.25;
  opacity: .92;
}

.hidden-native-settings {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.high-contrast .display-settings-section,
body[data-palette="contrast"] .display-settings-section {
  background: #000;
  color: #fff;
  border-color: #fff;
}

body.high-contrast .display-settings-section .settings-summary,
body[data-palette="contrast"] .display-settings-section .settings-summary {
  background: #000;
  color: #fff;
  border-bottom-color: #fff;
}

body.high-contrast .visual-settings-group,
body[data-palette="contrast"] .visual-settings-group,
body.high-contrast .font-size-panel,
body[data-palette="contrast"] .font-size-panel,
body.high-contrast .readable-toggle-card,
body[data-palette="contrast"] .readable-toggle-card {
  border-color: #fff;
  background: #111;
}

@media (max-width: 760px) {
  .visual-choice-grid {
    grid-template-columns: repeat(2, minmax(7.4rem, 1fr));
  }

  .font-size-panel {
    grid-template-columns: 1fr;
  }
}

/* V0.1.13 - Choix visuels enrichis comme dans le programme D&D */
body[data-palette="amber"] {
  --bg: #4d3217;
  --bg-deep: #231509;
  --paper: #f2d99c;
  --paper-strong: #fff0bd;
  --wood: #6b431d;
  --wood-dark: #2d1a0b;
  --accent: #9f6b25;
}

body[data-palette="forest"] {
  --bg: #2f432f;
  --bg-deep: #1c2b1d;
  --paper: #f4e6bf;
  --paper-strong: #fff4d2;
  --wood: #5a361a;
  --wood-dark: #2d1a0d;
}

body[data-palette="arcane"] {
  --bg: #25314f;
  --bg-deep: #12172b;
  --paper: #e8e1bd;
  --paper-strong: #fff5cf;
  --wood: #3a3968;
  --wood-dark: #17152b;
  --accent: #5d69a5;
}

body[data-palette="royal"] {
  --bg: #38284d;
  --bg-deep: #1d132b;
  --paper: #f0dfc6;
  --paper-strong: #fff3dc;
  --wood: #4a2c65;
  --wood-dark: #21102f;
  --accent: #7550a4;
}

body[data-palette="dragon"] {
  --bg: #573022;
  --bg-deep: #240f0b;
  --paper: #f6d6ad;
  --paper-strong: #fff0c8;
  --wood: #70291e;
  --wood-dark: #2a0d08;
  --accent: #9b382b;
}

body[data-palette="ocean"] {
  --bg: #1d4a55;
  --bg-deep: #0b2228;
  --paper: #d9ead3;
  --paper-strong: #f3ffe3;
  --wood: #266170;
  --wood-dark: #0c2a31;
  --accent: #267f93;
}

body[data-palette="steel"] {
  --bg: #34414c;
  --bg-deep: #161d24;
  --paper: #e8e5da;
  --paper-strong: #fbf8ec;
  --wood: #4a5663;
  --wood-dark: #1b232c;
  --accent: #5d6b7a;
}

body[data-palette="ember"],
body[data-palette="autumn"] {
  --bg: #583922;
  --bg-deep: #2e1c12;
  --paper: #ffe3ad;
  --paper-strong: #fff1c9;
  --wood: #6a3516;
  --wood-dark: #2d1308;
  --accent: #93441f;
}

body[data-palette="sand"] {
  --bg: #5a4b2a;
  --bg-deep: #27210f;
  --paper: #f1e1b0;
  --paper-strong: #fff4c9;
  --wood: #78612d;
  --wood-dark: #33270f;
  --accent: #8b7133;
}

body[data-palette="night"] {
  --bg: #25314f;
  --bg-deep: #12172b;
  --paper: #e8e1bd;
  --paper-strong: #fff5cf;
  --wood: #3a3968;
  --wood-dark: #17152b;
  --accent: #5d69a5;
}

body[data-accent="red"] {
  --leaf: #962f36;
  --leaf-bright: #f15b65;
  --accent: #ab3330;
  --good: #7d2e34;
}

body[data-accent="orange"] {
  --leaf: #9a5a18;
  --leaf-bright: #ffac39;
  --accent: #ae661c;
  --good: #8b5b20;
}

body[data-accent="purple"] {
  --leaf: #6e3a94;
  --leaf-bright: #c77cff;
  --accent: #7b49a4;
  --good: #714190;
}

body[data-accent="blue"] {
  --leaf: #2e6796;
  --leaf-bright: #68bfff;
  --accent: #3477ad;
  --good: #2f6c90;
}

body[data-accent="green"] {
  --leaf: #355d35;
  --leaf-bright: #65c66a;
  --accent: #47702d;
  --good: #34683b;
}

body[data-accent="other"] {
  --leaf: #4f514f;
  --leaf-bright: #b9c0b8;
  --accent: #5d5d5d;
  --good: #4b5a4b;
}

body[data-info-contrast="interface"],
body[data-info-contrast="normal"] {
  --bubble-empty: #fff5d6;
  --bubble-filled: var(--leaf);
  --bubble-border: var(--outline);
}

body[data-info-contrast="light"] {
  --bubble-empty: #efe4c7;
  --bubble-filled: #efe4c7;
  --bubble-border: #3a2a12;
}

body[data-info-contrast="dark"],
body[data-info-contrast="strong"] {
  --bubble-empty: #2c2c2c;
  --bubble-filled: #2c2c2c;
  --bubble-border: #f6f2df;
}

body[data-info-contrast="white"] {
  --bubble-empty: #ffffff;
  --bubble-filled: #ffffff;
  --bubble-border: #000000;
}

body[data-info-contrast="yellow"] {
  --bubble-empty: #ffec18;
  --bubble-filled: #ffec18;
  --bubble-border: #000000;
}

body[data-info-contrast="cyan"] {
  --bubble-empty: #13b8c8;
  --bubble-filled: #13b8c8;
  --bubble-border: #003840;
}

body[data-info-contrast="violet"] {
  --bubble-empty: #ba70ff;
  --bubble-filled: #8e33c9;
  --bubble-border: #f4e7ff;
}

body[data-info-contrast="black"],
body[data-info-contrast="maximum"] {
  --bubble-empty: #111111;
  --bubble-filled: #000000;
  --bubble-border: #ffffff;
}

.accent-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(7.3rem, 1fr));
}

.contrast-choice-grid,
.palette-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr));
}

.settings-mini-note {
  margin: -.25rem 0 .1rem;
  color: #ffeefc;
  font-size: .82rem;
  font-weight: 850;
  line-height: 1.28;
  opacity: .95;
}

.visual-choice-card {
  min-height: 3.35rem;
}

.visual-choice-card.light,
.visual-choice-card.white,
.visual-choice-card.yellow,
.visual-choice-card.sand {
  color: #101010;
}

.visual-choice-card.light .choice-label,
.visual-choice-card.light .choice-hint,
.visual-choice-card.white .choice-label,
.visual-choice-card.white .choice-hint,
.visual-choice-card.yellow .choice-label,
.visual-choice-card.yellow .choice-hint,
.visual-choice-card.sand .choice-label,
.visual-choice-card.sand .choice-hint {
  text-shadow: none;
}

.visual-choice-card.red { background: linear-gradient(135deg, #b62435, #ff7272); }
.visual-choice-card.orange { background: linear-gradient(135deg, #9b560e, #ffad3c); }
.visual-choice-card.purple { background: linear-gradient(135deg, #5b2e88, #c67cff); }
.visual-choice-card.blue { background: linear-gradient(135deg, #1f5f96, #6fc2ff); }
.visual-choice-card.green { background: linear-gradient(135deg, #22733a, #6fe889); }
.visual-choice-card.other { background: repeating-linear-gradient(135deg, #1d1d1d 0, #1d1d1d .5rem, #555 .5rem, #555 1rem); }

.visual-choice-card.interface { background: linear-gradient(135deg, #4b3764, #b16bed); }
.visual-choice-card.light { background: linear-gradient(135deg, #efe2c4, #fff5d8); }
.visual-choice-card.dark { background: linear-gradient(135deg, #171717, #4b4b4b); }
.visual-choice-card.white { background: linear-gradient(135deg, #ffffff, #e9e9e9); }
.visual-choice-card.yellow { background: linear-gradient(135deg, #ffea00, #fff176); }
.visual-choice-card.cyan { background: linear-gradient(135deg, #007b8a, #22d1df); }
.visual-choice-card.violet { background: linear-gradient(135deg, #6e2cad, #c98bff); }
.visual-choice-card.black { background: linear-gradient(135deg, #000000, #222222); }

.visual-choice-card.amber { background: linear-gradient(135deg, #6c4a17, #dfb553); }
.visual-choice-card.forest { background: linear-gradient(135deg, #24512d, #85c66a); }
.visual-choice-card.arcane { background: linear-gradient(135deg, #2b345f, #85a0ff); }
.visual-choice-card.royal { background: linear-gradient(135deg, #4d2c72, #be8dff); }
.visual-choice-card.dragon { background: linear-gradient(135deg, #7e251d, #ff775c); }
.visual-choice-card.ocean { background: linear-gradient(135deg, #0d6672, #5fd7e7); }
.visual-choice-card.steel { background: linear-gradient(135deg, #2f3e4c, #c7d4e4); }
.visual-choice-card.ember { background: linear-gradient(135deg, #70320d, #ff9a28); }
.visual-choice-card.sand { background: linear-gradient(135deg, #7c6c37, #eee0a7); }
.visual-choice-card.contrast { background: repeating-linear-gradient(135deg, #171717 0, #171717 .55rem, #4d4d4d .55rem, #4d4d4d 1.1rem); }

.visual-choice-card.selected.red { border-color: #ffabb1; box-shadow: 0 0 0 .16rem rgba(255, 120, 120, .8), inset 0 0 0 .12rem rgba(90, 0, 0, .55); }
.visual-choice-card.selected.orange { border-color: #ffd098; box-shadow: 0 0 0 .16rem rgba(255, 172, 57, .75), inset 0 0 0 .12rem rgba(84, 43, 0, .55); }
.visual-choice-card.selected.purple,
.visual-choice-card.selected.royal,
.visual-choice-card.selected.violet,
.visual-choice-card.selected.interface { border-color: #e6c1ff; box-shadow: 0 0 0 .16rem rgba(230, 193, 255, .8), inset 0 0 0 .12rem rgba(64, 35, 96, .75); }
.visual-choice-card.selected.blue,
.visual-choice-card.selected.ocean,
.visual-choice-card.selected.arcane { border-color: #b7e4ff; box-shadow: 0 0 0 .16rem rgba(93, 190, 255, .72), inset 0 0 0 .12rem rgba(0, 52, 90, .58); }
.visual-choice-card.selected.green,
.visual-choice-card.selected.forest { border-color: #b9ffbf; box-shadow: 0 0 0 .16rem rgba(91, 224, 106, .7), inset 0 0 0 .12rem rgba(0, 70, 18, .56); }
.visual-choice-card.selected.yellow { border-color: #fffbd0; box-shadow: 0 0 0 .16rem rgba(255, 234, 0, .72), inset 0 0 0 .12rem rgba(0, 0, 0, .45); }
.visual-choice-card.selected.white,
.visual-choice-card.selected.light,
.visual-choice-card.selected.sand,
.visual-choice-card.selected.steel { border-color: #ffffff; box-shadow: 0 0 0 .16rem rgba(255, 255, 255, .72), inset 0 0 0 .12rem rgba(0, 0, 0, .38); }
.visual-choice-card.selected.black,
.visual-choice-card.selected.other,
.visual-choice-card.selected.contrast { border-color: #ffffff; box-shadow: 0 0 0 .16rem rgba(255, 255, 255, .62), inset 0 0 0 .12rem rgba(255, 255, 255, .25); }
.visual-choice-card.selected.amber,
.visual-choice-card.selected.ember,
.visual-choice-card.selected.dragon { border-color: #ffd29c; box-shadow: 0 0 0 .16rem rgba(255, 164, 82, .72), inset 0 0 0 .12rem rgba(84, 35, 0, .55); }


.visual-choice-card.columns-1 { background: linear-gradient(135deg, #345235, #7bc56b); }
.visual-choice-card.columns-2 { background: linear-gradient(135deg, #23517a, #66c6ff); }
.visual-choice-card.columns-3 { background: linear-gradient(135deg, #5b3a85, #c084ff); }
.visual-choice-card.columns-4 { background: linear-gradient(135deg, #5d4221, #e0b05a); }

.visual-choice-card.selected.columns-1,
.visual-choice-card.selected.columns-2,
.visual-choice-card.selected.columns-3,
.visual-choice-card.selected.columns-4 {
  border-color: #fff0bd;
  box-shadow: 0 0 0 .16rem rgba(255, 224, 142, .78), inset 0 0 0 .12rem rgba(38, 22, 8, .55);
}

.tablet-column-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(8.2rem, 1fr));
}

@media (max-width: 1100px) {
  body[data-layout="tablet"][data-resource-columns="4"] .resources-list,
  body[data-layout="tablet"][data-resource-columns="3"] .resources-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body[data-layout="tablet"] .resources-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 940px) {
  .accent-choice-grid {
    grid-template-columns: repeat(6, minmax(7.1rem, 1fr));
  }

  .contrast-choice-grid {
    grid-template-columns: repeat(4, minmax(7.4rem, 1fr));
  }

  .palette-choice-grid {
    grid-template-columns: repeat(5, minmax(7.4rem, 1fr));
  }
}

body.high-contrast,
body[data-palette="contrast"] {
  --bg: #000;
  --bg-deep: #000;
  --paper: #fff6c7;
  --paper-strong: #fffbe3;
  --ink: #000;
  --muted: #1a1a1a;
  --wood: #000;
  --wood-dark: #000;
  --leaf: #003d20;
  --leaf-bright: #005e31;
  --accent: #622200;
  --danger: #8b0000;
  --good: #005e1f;
  --outline: #000;
  --bubble-empty: #fff;
  --bubble-filled: #000;
  --bubble-border: #000;
  --focus: #005cff;
}

/* V0.1.13 - récupération manuelle, sans repos court/long */
.recovery-dialog .dialog-inner {
  max-width: min(980px, 96vw);
}

.recovery-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: .75rem 0 1rem;
}

.recovery-options {
  display: grid;
  gap: .75rem;
}

.recovery-resource-group {
  padding: .75rem;
  border: .12rem solid rgba(61, 39, 20, .45);
  border-radius: .8rem;
  background: rgba(255, 250, 224, .55);
  box-shadow: inset 0 0 0 .08rem rgba(255, 255, 255, .5);
}

.recovery-resource-group h3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .45rem;
  align-items: baseline;
  margin: 0 0 .55rem;
  font-size: 1.05rem;
}

.recovery-resource-group h3 span {
  padding: .12rem .45rem;
  border-radius: 99rem;
  color: var(--button-text);
  background: var(--leaf);
  font-size: .82rem;
}

.recovery-action-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .5rem;
}

.recovery-action {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.4rem;
  padding: .45rem .6rem;
  border: .11rem solid rgba(61, 39, 20, .55);
  border-radius: .7rem;
  background: var(--paper-strong);
  color: var(--ink);
  font-weight: 800;
}

.recovery-action input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--leaf-bright);
}

.recovery-action.disabled {
  opacity: .66;
  font-weight: 650;
  background: rgba(255, 255, 255, .35);
}

/* V0.1.15 - Ressources de base obligatoires et PV regroupés */
.quick-hp-panel.is-hidden {
  display: none;
}

.resource-hp-core {
  border-width: .18rem;
  background: rgba(255, 248, 220, .72);
}

.hp-topline {
  align-items: start;
}

.hp-values {
  justify-content: flex-end;
  gap: .4rem;
}

.inline-value-label {
  display: grid;
  gap: .15rem;
  min-width: 4.2rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.inline-value-label input {
  margin-top: .05rem;
}

.inline-value-label.temp-inline {
  min-width: 5.2rem;
}

.hp-summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .9rem;
  margin: .45rem 0 .55rem;
  padding: .45rem .55rem;
  border: .1rem solid rgba(58, 35, 15, .28);
  border-radius: .6rem;
  background: var(--info-bg);
  color: var(--info-text);
  font-weight: 900;
}

.hp-main-controls,
.hp-action-panel {
  margin-top: .55rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.hp-action-panel .btn {
  flex: 1 1 8rem;
  min-height: 2.75rem;
  font-size: 1.02rem;
}

.core-resource-row {
  border-color: rgba(74, 117, 58, .58);
  background: rgba(255, 255, 255, .42);
}

.locked-resource {
  display: grid;
  gap: .2rem;
}

.locked-resource strong {
  width: fit-content;
  padding: .18rem .45rem;
  border: .09rem solid rgba(74, 117, 58, .45);
  border-radius: 999px;
  background: rgba(74, 117, 58, .14);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.core-resource-row .resource-toggle span::after {
  content: "" !important;
}

.hp-settings-options {
  grid-template-columns: minmax(6rem, .7fr) minmax(6rem, .7fr) minmax(6rem, .7fr) auto;
}

@media (max-width: 920px) {
  .hp-settings-options,
  .resource-config-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-type-pill {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .hp-values,
  body[data-layout="tablet"] .resource-topline.hp-topline {
    grid-template-columns: 1fr;
    display: grid;
    justify-content: stretch;
  }

  .inline-value-label {
    width: 100%;
  }

  .inline-value-label input {
    width: 100%;
  }

  .hp-action-panel .btn {
    flex-basis: 100%;
  }
}


/* V0.1.16 - Entêtes centrés et ordre des ressources */
.resource-card {
  display: flex;
  flex-direction: column;
}

.resource-topline,
body[data-layout="tablet"] .resource-topline,
.resource-topline.hp-topline,
body[data-layout="tablet"] .resource-topline.hp-topline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem;
  width: 100%;
  text-align: center;
}

.resource-title {
  width: 100%;
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.1;
}

.resource-values,
.hp-values,
.resource-dicePool .resource-values,
.resource-hitDicePool .resource-values {
  width: 100%;
  justify-content: center;
  align-items: end;
}

.resource-body {
  width: 100%;
}

.resource-values .resource-input,
.hp-values .resource-input,
.inline-value-label input {
  min-height: 2.35rem;
}

.visibility-resource-row,
.visibility-resource-row.resource-expanded {
  grid-template-columns: minmax(13rem, 1fr) minmax(17rem, 2fr) auto;
  align-items: start;
}

.visibility-resource-row.resource-collapsed {
  grid-template-columns: minmax(13rem, 1fr) auto;
}

.visibility-resource-row.resource-collapsed .resource-order-controls {
  justify-self: end;
}

.resource-order-controls {
  display: flex;
  gap: .35rem;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
}

.order-resource-btn {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border: .13rem solid var(--outline);
  border-radius: .55rem;
  color: var(--button-text);
  background: linear-gradient(180deg, #70502f, #3c2512);
  font-weight: 950;
  box-shadow: 0 .12rem 0 rgba(0,0,0,.38);
}

.order-resource-btn:disabled {
  opacity: .38;
  filter: grayscale(.35);
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 920px) {
  .visibility-resource-row,
  .visibility-resource-row.resource-expanded,
  .visibility-resource-row.resource-collapsed {
    grid-template-columns: 1fr;
  }

  .resource-order-controls,
  .visibility-resource-row.resource-collapsed .resource-order-controls {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .resource-values,
  .hp-values,
  body[data-layout="tablet"] .resource-topline.hp-topline {
    align-items: stretch;
  }
}

/* V0.1.17 - Conditions Nimble */
.name-and-conditions {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: .55rem;
  align-items: center;
}

.condition-bubbles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  flex-wrap: wrap;
  min-width: 11rem;
}

.condition-bubbles.empty {
  opacity: .78;
}

.condition-empty-hint {
  padding: .22rem .48rem;
  border: .1rem dashed rgba(58, 35, 15, .35);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 250, 222, .45);
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}

.condition-bubble {
  min-height: 1.8rem;
  padding: .22rem .55rem;
  border: .13rem solid var(--bubble-border);
  border-radius: 999px;
  color: var(--button-text);
  background: linear-gradient(180deg, #9a5b30, var(--accent));
  font-size: .76rem;
  font-weight: 950;
  line-height: 1.05;
  box-shadow: inset 0 0 0 .08rem rgba(255,255,255,.28), 0 .12rem .16rem rgba(0,0,0,.2);
}

.condition-bubble.condition-minor {
  background: linear-gradient(180deg, #5d728b, #35465d);
}

.conditions-btn::before {
  content: "⚑ ";
}

.conditions-dialog {
  width: min(1120px, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  overflow: auto;
}

.condition-info-dialog {
  width: min(720px, calc(100vw - 1rem));
}

.conditions-grid {
  display: grid;
  gap: .85rem;
}

.conditions-group {
  padding: .75rem;
  border: .14rem solid rgba(58, 35, 15, .34);
  border-radius: .85rem;
  background: rgba(255, 251, 230, .52);
}

.conditions-group h3 {
  margin: 0 0 .6rem;
  font-size: 1.12rem;
}

.conditions-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: .55rem;
}

.condition-choice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .55rem;
  border: .13rem solid rgba(58, 35, 15, .38);
  border-radius: .8rem;
  background: rgba(255, 250, 222, .76);
  box-shadow: inset 0 0 0 .08rem rgba(255,255,255,.35);
  cursor: pointer;
}

.condition-choice.active {
  color: #fff8df;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
  border-color: var(--outline);
}

.condition-choice input[type="checkbox"] {
  width: 1.45rem;
  height: 1.45rem;
  accent-color: var(--leaf);
}

.condition-choice-main {
  display: grid;
  gap: .1rem;
}

.condition-choice-title {
  font-weight: 950;
  line-height: 1.1;
}

.condition-choice-original {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.condition-choice.active .condition-choice-original,
.condition-choice.active .condition-choice-short {
  color: rgba(255, 248, 223, .88);
}

.condition-choice-short {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.25;
}

.condition-info-mini {
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  border: .12rem solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: rgba(255,255,255,.22);
  font-weight: 950;
}

.condition-info-body {
  padding: .85rem;
  border: .13rem solid rgba(58, 35, 15, .3);
  border-radius: .85rem;
  background: rgba(255, 250, 222, .72);
  font-weight: 850;
  line-height: 1.45;
}

.condition-info-body p:last-child {
  margin-bottom: 0;
}

.condition-original {
  color: var(--muted);
  font-size: .9rem;
}

body.high-contrast .condition-bubble,
body[data-palette="contrast"] .condition-bubble,
body.high-contrast .condition-bubble.condition-minor,
body[data-palette="contrast"] .condition-bubble.condition-minor {
  color: #fff;
  background: #000;
  border-color: #000;
}

body.high-contrast .condition-choice.active,
body[data-palette="contrast"] .condition-choice.active {
  color: #fff;
  background: #000;
}

body.high-contrast .condition-choice:not(.active),
body[data-palette="contrast"] .condition-choice:not(.active) {
  color: #000;
  background: #fff;
  border-color: #000;
}

@media (max-width: 1000px) {
  .name-and-conditions {
    grid-template-columns: 1fr;
  }

  .condition-bubbles {
    justify-content: flex-start;
    min-width: 0;
  }

  .conditions-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .condition-choice {
    grid-template-columns: auto 1fr;
  }

  .condition-info-mini {
    grid-column: 1 / -1;
    width: 100%;
    border-radius: .65rem;
  }
}


/* V0.1.18 - Entête de personnage plus compacte en vue tablette */
body[data-layout="tablet"] .identity-block {
  align-self: start;
}

body[data-layout="tablet"] .name-and-conditions {
  grid-template-columns: minmax(14rem, 50%) minmax(10rem, 1fr);
}

body[data-layout="tablet"] .subtitle-input {
  width: 50%;
  min-width: min(100%, 14rem);
}

body[data-layout="tablet"] .name-input,
body[data-layout="tablet"] .subtitle-input {
  min-height: 1.75rem;
  padding-top: .18rem;
  padding-bottom: .18rem;
}

body[data-layout="tablet"] .name-input {
  font-size: 1.35rem;
}

body[data-layout="tablet"] .subtitle-input {
  font-size: .95rem;
}

@media (max-width: 760px) {
  body[data-layout="tablet"] .name-and-conditions {
    grid-template-columns: 1fr;
  }

  body[data-layout="tablet"] .subtitle-input {
    width: 100%;
  }
}

body[data-layout="phone"] .name-and-conditions {
  grid-template-columns: 1fr;
}

body[data-layout="phone"] .subtitle-input {
  width: 100%;
}

/* V0.1.19 - Ajout de personnages et de ressources personnalisées */
.settings-toolbar {
  display: flex;
  gap: .65rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 .75rem;
}

.character-toolbar .btn {
  min-height: 2.65rem;
}

.visibility-character-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.visibility-character-actions .btn {
  min-height: 2.25rem;
  padding: .35rem .7rem;
  font-size: .86rem;
}

.delete-resource-btn {
  background: linear-gradient(180deg, #a94937, #5b241a);
}

.edit-dialog .dialog-inner {
  max-width: min(52rem, 96vw);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(12rem, 1fr));
  gap: .75rem;
  margin-top: .8rem;
}

.dialog-field {
  display: grid;
  gap: .28rem;
  font-weight: 950;
}

.dialog-field span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .78rem;
}

.dialog-field input,
.dialog-field select {
  width: 100%;
  min-height: 2.55rem;
  padding: .35rem .55rem;
  border: .13rem solid var(--outline);
  border-radius: .65rem;
  color: var(--ink);
  background: var(--paper-strong);
  font: inherit;
  font-weight: 900;
}

.wide-field {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.55rem;
  padding: .35rem .55rem;
  border: .13rem solid rgba(58, 35, 15, .25);
  border-radius: .65rem;
  background: rgba(255, 255, 255, .22);
}

.checkbox-field input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--leaf);
}

.checkbox-field span {
  text-transform: none;
  letter-spacing: 0;
  font-size: .95rem;
  color: var(--ink);
}

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

  .visibility-character-actions {
    width: 100%;
    margin-left: 0;
  }

  .visibility-character-actions .btn {
    flex: 1 1 10rem;
  }
}

/* V0.1.20 - accès, portraits, compactage et contrôles centrés */
.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 2.45rem;
  padding: .35rem .65rem;
  border: .1rem solid rgba(255, 246, 194, .5);
  border-radius: 999px;
  color: #fff8df;
  background: rgba(0, 0, 0, .28);
  font-weight: 850;
}

.hidden-file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.portrait-frame {
  cursor: pointer;
}

.portrait-frame::after {
  content: "Changer";
  position: absolute;
  left: .35rem;
  right: .35rem;
  bottom: .35rem;
  padding: .18rem .3rem;
  border-radius: .45rem;
  color: #fff8df;
  background: rgba(0, 0, 0, .62);
  font-size: .68rem;
  font-weight: 950;
  text-align: center;
  opacity: 0;
  transition: opacity .15s ease;
}

.portrait-frame:hover::after,
.portrait-frame:focus-visible::after {
  opacity: 1;
}

.resource-controls,
.hp-main-controls,
.dice-controls,
.hp-action-panel {
  justify-content: center;
  text-align: center;
}

.resource-controls .btn,
.resource-controls .mini-btn,
.hp-action-panel .btn {
  justify-content: center;
}

body[data-layout="tablet"] .resources-list {
  grid-auto-flow: dense;
  grid-auto-rows: minmax(5.7rem, auto);
  align-items: stretch;
}

body[data-layout="tablet"] .resource-card {
  grid-row: span 2;
}

body[data-layout="tablet"] .resource-card.compact-resource {
  grid-row: span 1;
  min-height: 5.7rem;
}

.resource-card.compact-resource .resource-topline {
  margin-bottom: .25rem;
}

.resource-card.compact-resource .resource-title {
  font-size: .98rem;
}

.resource-card.compact-resource .resource-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-card.compact-resource .inspiration-toggle {
  min-height: 2.55rem;
  padding: .35rem .6rem;
}

.resource-card.compact-resource .toggle-text {
  font-size: .9rem;
}

.compact-display-setting {
  min-width: 5.8rem;
}

.account-settings-section {
  margin-top: .8rem;
}

.account-panel {
  display: grid;
  gap: .75rem;
  padding-top: .75rem;
}

.users-list {
  display: grid;
  gap: .55rem;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .65rem;
  border: .11rem solid rgba(58, 35, 15, .32);
  border-radius: .75rem;
  background: rgba(255, 251, 230, .55);
}

.user-row div {
  display: grid;
  gap: .1rem;
}

.user-row span {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 750;
}

.add-user-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(10rem, 1fr)) auto;
  gap: .65rem;
  align-items: end;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(34rem, 100%);
  padding: 1.4rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-strong), var(--paper));
  border: .28rem solid var(--wood);
  border-radius: 1.2rem;
  box-shadow: 0 .8rem 1.8rem var(--shadow);
}

.login-card .eyebrow {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: .75rem;
  margin-top: .9rem;
}

.login-error {
  min-height: 1.4rem;
  margin-top: .75rem;
  color: var(--danger);
  font-weight: 900;
}

.login-defaults {
  margin-top: .8rem;
  padding: .65rem;
  border-radius: .65rem;
  background: rgba(255, 251, 230, .6);
  border: .1rem solid rgba(58, 35, 15, .25);
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 900px) {
  .add-user-grid {
    grid-template-columns: 1fr;
  }

  .user-row {
    align-items: stretch;
    flex-direction: column;
  }
}

/* V0.1.22 - Les couleurs de l'interface teintent aussi l'intérieur des fiches */
:root {
  --card-tinted-top: color-mix(in srgb, var(--paper-strong) 84%, var(--leaf) 16%);
  --card-tinted-bottom: color-mix(in srgb, var(--paper) 82%, var(--accent) 18%);
  --resource-tinted-top: color-mix(in srgb, var(--paper-strong) 74%, var(--leaf-bright) 26%);
  --resource-tinted-bottom: color-mix(in srgb, var(--paper) 76%, var(--accent) 24%);
  --resource-heading-bg: color-mix(in srgb, var(--paper-strong) 66%, var(--accent) 34%);
  --resource-heading-border: color-mix(in srgb, var(--outline) 58%, var(--accent) 42%);
}

.character-card {
  background:
    linear-gradient(90deg, rgba(74, 45, 22, .18), transparent 1.2rem, transparent calc(100% - 1.2rem), rgba(74, 45, 22, .18)),
    linear-gradient(180deg, var(--card-tinted-top), var(--card-tinted-bottom));
  border-color: var(--accent);
}

.character-header {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 18%, transparent),
    color-mix(in srgb, var(--paper-strong) 20%, transparent),
    transparent);
}

.name-input,
.subtitle-input,
.resource-input,
.field select,
.field input[type="range"],
.notes-area {
  background: color-mix(in srgb, var(--paper-strong) 86%, var(--leaf-bright) 14%);
  border-color: color-mix(in srgb, var(--outline) 70%, var(--accent) 30%);
}

.resource-card {
  background: linear-gradient(180deg, var(--resource-tinted-top), var(--resource-tinted-bottom));
  border-color: color-mix(in srgb, var(--outline) 48%, var(--accent) 52%);
  box-shadow:
    inset 0 0 0 .08rem rgba(255, 255, 255, .42),
    0 .16rem .55rem color-mix(in srgb, var(--shadow) 65%, var(--accent) 35%);
}

.resource-topline {
  padding: .38rem .45rem;
  border: .1rem solid color-mix(in srgb, var(--resource-heading-border) 72%, transparent);
  border-radius: .68rem;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--resource-heading-bg) 78%, white 22%),
    var(--resource-heading-bg));
}

.resource-title {
  color: color-mix(in srgb, var(--ink) 84%, var(--accent) 16%);
  text-shadow: 0 .06rem 0 rgba(255, 255, 255, .35);
}

.hp-action-panel,
.resource-controls,
.resource-values,
.hp-values {
  justify-content: center;
}

.bar-shell {
  border-color: color-mix(in srgb, var(--outline) 55%, var(--accent) 45%);
  background: color-mix(in srgb, var(--paper) 55%, var(--wood-dark) 45%);
}

.condition-bubble,
.user-badge {
  border-color: color-mix(in srgb, var(--outline) 54%, var(--accent) 46%);
}

/* V0.1.22 - Gestion des mots de passe */
.user-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(18rem, 2fr) auto;
  align-items: end;
}

.user-row-identity {
  display: grid;
  gap: .1rem;
}

.user-row-password {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  gap: .5rem;
  align-items: end;
}

.user-row-password label {
  display: grid;
  gap: .18rem;
  font-weight: 850;
  color: var(--muted);
}

.user-row-password input {
  min-height: 2.3rem;
  width: 100%;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-strong) 86%, var(--leaf-bright) 14%);
  border: .13rem solid color-mix(in srgb, var(--outline) 70%, var(--accent) 30%);
  border-radius: .55rem;
  padding: .35rem .5rem;
  font-weight: 850;
}

@media (max-width: 900px) {
  .user-row,
  .user-row-password {
    grid-template-columns: 1fr;
  }
}

body[data-palette="contrast"] .resource-card,
body.high-contrast .resource-card {
  background: #fffbe3;
  border-color: #000;
  box-shadow: inset 0 0 0 .14rem #000;
}

body[data-palette="contrast"] .resource-topline,
body.high-contrast .resource-topline {
  color: #000;
  background: #fff19b;
  border-color: #000;
}

/* V0.1.23 - Palettes globales cohérentes, façon Gestion D&D */
:root {
  --bg: #102216;
  --panel: #f1e6bf;
  --panel-2: #fff4cf;
  --text: #24170d;
  --muted: #5a4933;
  --accent: #6b4a22;
  --accent-2: #4c8a48;
  --border: #2b1c10;
  --button: #2f653c;
  --button-hover: #4d8b47;
  --button-text: #fffaf0;
  --danger: #a63a30;
  --success: #2d743f;
  --temp: #2b6f93;
  --info-bubble-bg: #fff5d6;
  --info-bubble-text: #24170d;
  --modal: #fff4cf;
  --modal-2: #f1e6bf;
  --input-bg: #fff9dc;
  --input-border: #5e4428;
  --header-bg: #162719;
  --header-text: #fffaf0;
  --shadow: rgba(0, 0, 0, .38);
  --focus: #ffe36a;
  --bar-danger: var(--danger);
  --bar-middle: var(--temp);
  --bar-success: var(--success);

  /* Aliases historiques de l'app. */
  --bg-deep: color-mix(in srgb, var(--bg) 72%, #000 28%);
  --paper: var(--panel);
  --paper-strong: var(--panel-2);
  --ink: var(--text);
  --wood: var(--border);
  --wood-dark: color-mix(in srgb, var(--bg) 55%, #000 45%);
  --leaf: var(--button);
  --leaf-bright: var(--button-hover);
  --good: var(--success);
  --outline: var(--border);
  --bubble-empty: var(--info-bubble-bg);
  --bubble-filled: var(--accent-2);
  --bubble-border: var(--border);
  --card-tinted-top: var(--panel-2);
  --card-tinted-bottom: var(--panel);
  --resource-tinted-top: var(--panel-2);
  --resource-tinted-bottom: var(--panel);
  --resource-heading-bg: color-mix(in srgb, var(--panel-2) 70%, var(--accent) 30%);
  --resource-heading-border: var(--border);
  --info-bg: var(--info-bubble-bg);
  --info-text: var(--info-bubble-text);
}

body.theme-amber,
body[data-palette="amber"] {
  --bg: #241509;
  --panel: #f3d99b;
  --panel-2: #fff2c6;
  --text: #241509;
  --muted: #61461d;
  --accent: #8b5a1c;
  --accent-2: #c78a2b;
  --border: #5a3514;
  --button: #905f20;
  --button-hover: #c98a2d;
  --danger: #9e3328;
  --success: #517a30;
  --temp: #416a8b;
  --info-bubble-bg: #fff0bd;
  --info-bubble-text: #241509;
  --modal: #fff2c6;
  --modal-2: #f3d99b;
  --input-bg: #fff8d7;
  --input-border: #6d4618;
  --header-bg: #2b190b;
  --header-text: #fff8dd;
}

body.theme-forest,
body[data-palette="forest"] {
  --bg: #102216;
  --panel: #e8ddb5;
  --panel-2: #fff4cf;
  --text: #21170f;
  --muted: #4f462f;
  --accent: #6b4a22;
  --accent-2: #4c8a48;
  --border: #2d2112;
  --button: #2f653c;
  --button-hover: #4d8b47;
  --danger: #9f392e;
  --success: #2f743d;
  --temp: #2a6d88;
  --info-bubble-bg: #fff4d3;
  --info-bubble-text: #21170f;
  --modal: #fff4cf;
  --modal-2: #e8ddb5;
  --input-bg: #fff9de;
  --input-border: #5b4525;
  --header-bg: #14291a;
  --header-text: #fff9e8;
}

body.theme-arcane,
body[data-palette="arcane"],
body[data-palette="night"] {
  --bg: #11162d;
  --panel: #d8d4f0;
  --panel-2: #ede6ff;
  --text: #19142b;
  --muted: #4b4564;
  --accent: #4f52a4;
  --accent-2: #43b9d3;
  --border: #27234d;
  --button: #4a4ca3;
  --button-hover: #7c6ee8;
  --danger: #a3436b;
  --success: #2b817a;
  --temp: #307fa8;
  --info-bubble-bg: #eee8ff;
  --info-bubble-text: #19142b;
  --modal: #ede6ff;
  --modal-2: #d8d4f0;
  --input-bg: #f7f3ff;
  --input-border: #3b386b;
  --header-bg: #121733;
  --header-text: #f7f1ff;
}

body.theme-royal,
body[data-palette="royal"] {
  --bg: #1f1231;
  --panel: #e4d0ef;
  --panel-2: #f4e4ff;
  --text: #22102f;
  --muted: #584067;
  --accent: #6a3b93;
  --accent-2: #d7b46a;
  --border: #3a1f55;
  --button: #633494;
  --button-hover: #8b55d6;
  --danger: #9d315c;
  --success: #437447;
  --temp: #456d9f;
  --info-bubble-bg: #f6e7ff;
  --info-bubble-text: #22102f;
  --modal: #f4e4ff;
  --modal-2: #e4d0ef;
  --input-bg: #fff5ff;
  --input-border: #4c286b;
  --header-bg: #28183a;
  --header-text: #fff5ff;
}

body.theme-dragon,
body[data-palette="dragon"] {
  --bg: #270b08;
  --panel: #f4c8ab;
  --panel-2: #ffe2c5;
  --text: #2c100a;
  --muted: #6c3b28;
  --accent: #8c2119;
  --accent-2: #f09b35;
  --border: #4e140e;
  --button: #96291f;
  --button-hover: #c23b2d;
  --danger: #8f1f19;
  --success: #4e7730;
  --temp: #3d698a;
  --info-bubble-bg: #ffe9ce;
  --info-bubble-text: #2c100a;
  --modal: #ffe2c5;
  --modal-2: #f4c8ab;
  --input-bg: #fff1dc;
  --input-border: #64190f;
  --header-bg: #2d0e0a;
  --header-text: #fff1dd;
}

body.theme-ocean,
body[data-palette="ocean"] {
  --bg: #062831;
  --panel: #c9edf0;
  --panel-2: #dcfbff;
  --text: #05272f;
  --muted: #27555f;
  --accent: #176b7c;
  --accent-2: #6ed7e6;
  --border: #073b47;
  --button: #0d6f84;
  --button-hover: #1788a0;
  --danger: #a5363d;
  --success: #197b68;
  --temp: #1d6ca8;
  --info-bubble-bg: #e1fbff;
  --info-bubble-text: #05272f;
  --modal: #dcfbff;
  --modal-2: #c9edf0;
  --input-bg: #f0fdff;
  --input-border: #0b5361;
  --header-bg: #07313b;
  --header-text: #edfdff;
}

body.theme-steel,
body[data-palette="steel"] {
  --bg: #111923;
  --panel: #dbe3e7;
  --panel-2: #edf3f6;
  --text: #121a22;
  --muted: #45515a;
  --accent: #4a5c6b;
  --accent-2: #9fb5c6;
  --border: #28333d;
  --button: #4b5d6b;
  --button-hover: #5d7182;
  --danger: #984146;
  --success: #3b7357;
  --temp: #436f99;
  --info-bubble-bg: #f0f5f7;
  --info-bubble-text: #121a22;
  --modal: #edf3f6;
  --modal-2: #dbe3e7;
  --input-bg: #f7fbfd;
  --input-border: #344350;
  --header-bg: #172231;
  --header-text: #f4fbff;
}

body.theme-ember,
body[data-palette="ember"],
body[data-palette="autumn"] {
  --bg: #2c1005;
  --panel: #f4c591;
  --panel-2: #ffe4bd;
  --text: #2d1207;
  --muted: #674022;
  --accent: #8b3914;
  --accent-2: #ff9d32;
  --border: #4b1b09;
  --button: #943f16;
  --button-hover: #b84918;
  --danger: #9e2d20;
  --success: #607932;
  --temp: #476d92;
  --info-bubble-bg: #ffebca;
  --info-bubble-text: #2d1207;
  --modal: #ffe4bd;
  --modal-2: #f4c591;
  --input-bg: #fff0d5;
  --input-border: #5f250b;
  --header-bg: #351507;
  --header-text: #fff0dd;
}

body.theme-sand,
body[data-palette="sand"] {
  --bg: #4c3d19;
  --panel: #e8d696;
  --panel-2: #fff4cc;
  --text: #292108;
  --muted: #615421;
  --accent: #7b6726;
  --accent-2: #d9c274;
  --border: #493915;
  --button: #806b27;
  --button-hover: #aa8b39;
  --danger: #9a4133;
  --success: #5e7b31;
  --temp: #526f91;
  --info-bubble-bg: #fff8dc;
  --info-bubble-text: #292108;
  --modal: #fff4cc;
  --modal-2: #e8d696;
  --input-bg: #fff9df;
  --input-border: #645019;
  --header-bg: #514018;
  --header-text: #fff8dd;
}

body.theme-contrast,
body[data-palette="contrast"],
body.high-contrast {
  --bg: #000000;
  --panel: #ffffff;
  --panel-2: #fff9b8;
  --text: #000000;
  --muted: #111111;
  --accent: #fff200;
  --accent-2: #00e5ff;
  --border: #000000;
  --button: #000000;
  --button-hover: #333333;
  --button-text: #ffffff;
  --danger: #8b0000;
  --success: #006b2f;
  --temp: #003d99;
  --info-bubble-bg: #ffffff;
  --info-bubble-text: #000000;
  --modal: #ffffff;
  --modal-2: #fff9b8;
  --input-bg: #ffffff;
  --input-border: #000000;
  --header-bg: #000000;
  --header-text: #ffffff;
  --focus: #00e5ff;
  --shadow: rgba(0, 0, 0, .8);
}

/* Couleur secondaire des fiches / ressources : accent sans casser la palette globale. */
body[data-accent="red"] { --button: #962f36; --button-hover: #f15b65; --accent-2: #ff858b; }
body[data-accent="orange"] { --button: #9a5a18; --button-hover: #ffac39; --accent-2: #ffbd62; }
body[data-accent="purple"] { --button: #6e3a94; --button-hover: #c77cff; --accent-2: #d7a0ff; }
body[data-accent="blue"] { --button: #2e6796; --button-hover: #68bfff; --accent-2: #92d0ff; }
body[data-accent="green"] { --button: #2f653c; --button-hover: #65c66a; --accent-2: #8ddb8d; }
body[data-accent="other"] { --button: #4f514f; --button-hover: #b9c0b8; --accent-2: #d0d7cf; }

body[data-info-contrast="interface"],
body[data-info-contrast="normal"] {
  --info-bubble-bg: var(--panel-2);
  --info-bubble-text: var(--text);
  --bubble-empty: var(--info-bubble-bg);
  --bubble-filled: var(--button);
  --bubble-border: var(--border);
}
body[data-info-contrast="light"] { --info-bubble-bg: #fff8df; --info-bubble-text: #111; --bubble-empty: #fff8df; --bubble-filled: #fff8df; --bubble-border: #111; }
body[data-info-contrast="dark"] { --info-bubble-bg: #191919; --info-bubble-text: #fff; --bubble-empty: #191919; --bubble-filled: #191919; --bubble-border: #fff; }
body[data-info-contrast="white"] { --info-bubble-bg: #fff; --info-bubble-text: #000; --bubble-empty: #fff; --bubble-filled: #fff; --bubble-border: #000; }
body[data-info-contrast="yellow"] { --info-bubble-bg: #fff200; --info-bubble-text: #000; --bubble-empty: #fff200; --bubble-filled: #fff200; --bubble-border: #000; }
body[data-info-contrast="cyan"] { --info-bubble-bg: #00e5ff; --info-bubble-text: #00181c; --bubble-empty: #00e5ff; --bubble-filled: #00e5ff; --bubble-border: #002a30; }
body[data-info-contrast="violet"] { --info-bubble-bg: #c98bff; --info-bubble-text: #210032; --bubble-empty: #c98bff; --bubble-filled: #9d45d8; --bubble-border: #27003b; }
body[data-info-contrast="black"] { --info-bubble-bg: #000; --info-bubble-text: #fff; --bubble-empty: #000; --bubble-filled: #000; --bubble-border: #fff; }

body.theme-contrast,
body[data-palette="contrast"],
body.high-contrast {
  --button: #000000;
  --button-hover: #333333;
  --accent-2: #00e5ff;
  --bubble-empty: #ffffff;
  --bubble-filled: #000000;
  --bubble-border: #000000;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-2) 28%, transparent) 0, transparent 28rem),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--accent) 36%, transparent) 0, transparent 30rem),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg) 70%, #000 30%));
}

.topbar {
  color: var(--header-text);
  background: linear-gradient(180deg, var(--header-bg), color-mix(in srgb, var(--header-bg) 78%, var(--accent) 22%));
  border-bottom-color: var(--accent-2);
}

.eyebrow,
.tiny-label,
.settings-help,
.dialog-field span,
.compact-field span,
.dice-hint,
.dice-empty-note,
.die-meta,
.condition-choice-original,
.condition-choice-short,
.condition-original,
.login-card .eyebrow,
.login-defaults,
.user-row span,
.user-row-password label,
.settings-mini-note {
  color: var(--muted);
}

.status-ribbon,
.user-badge {
  color: var(--header-text);
  background: color-mix(in srgb, var(--header-bg) 82%, transparent);
  border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
}

.character-card,
.login-card,
.empty-state {
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--border);
  box-shadow: 0 .8rem 1.8rem var(--shadow), inset 0 0 0 .12rem color-mix(in srgb, var(--panel-2) 74%, #fff 26%);
}

.character-card::before,
.character-card::after {
  background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), var(--accent-2), transparent);
  opacity: .85;
}

.character-header,
.card-footer {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--panel-2) 24%, transparent), transparent);
  border-color: color-mix(in srgb, var(--border) 36%, transparent);
}

.portrait-frame {
  background: color-mix(in srgb, var(--bg) 72%, #000 28%);
  border-color: var(--border);
}

.name-input,
.subtitle-input,
.resource-input,
.field select,
.field input[type="range"],
.notes-area,
.compact-field input,
.dialog-field input,
.dialog-field select,
.user-row-password input,
.die-value-input,
.die-type-inline,
.resource-die-setting {
  color: var(--text);
  background: var(--input-bg);
  border-color: var(--input-border);
}

.subtitle-input {
  color: var(--muted);
}

.resource-card,
.resource-hp-core,
.recovery-resource-group,
.conditions-group,
.visibility-character-panel,
.visibility-resource-row,
.user-row,
.login-defaults,
.checkbox-field {
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--border);
}

.resource-topline,
.hp-summary-line,
.dialog-hint,
.settings-note,
.condition-info-body,
.recovery-action,
.condition-choice:not(.active) {
  color: var(--text);
  background: var(--info-bubble-bg);
  border-color: var(--border);
}

.hp-summary-line,
.dialog-hint,
.settings-note {
  color: var(--info-bubble-text);
}

.resource-title,
.dialog-header h2,
.conditions-group h3,
.visual-settings-group h3,
.settings-section h3 {
  color: var(--text);
  text-shadow: none;
}

.btn,
.icon-btn,
.mini-btn,
.order-resource-btn,
.number-btn,
.condition-choice.active,
.inspiration-toggle.active,
.die-shape.filled::after {
  color: var(--button-text);
  background: linear-gradient(180deg, var(--button-hover), var(--button));
  border-color: var(--border);
}

.btn:hover,
.icon-btn:hover,
.mini-btn:hover,
.order-resource-btn:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--button-hover) 84%, #fff 16%), var(--button-hover));
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--button));
}

.btn.secondary {
  color: var(--button-text);
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000 38%));
}

.btn.danger,
.damage-btn,
.delete-resource-btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 82%, #fff 18%), var(--danger));
}

.heal-btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--success) 78%, #fff 22%), var(--success));
}

.temp-btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--temp) 78%, #fff 22%), var(--temp));
}

.bar-shell {
  background: color-mix(in srgb, var(--bg) 26%, var(--panel) 74%);
  border-color: var(--border);
}

.bar-fill {
  background: linear-gradient(90deg, var(--bar-danger), var(--bar-middle), var(--bar-success));
}

.bubble,
.condition-empty-hint,
.inspiration-toggle.inactive {
  color: var(--info-bubble-text);
  background: var(--info-bubble-bg);
  border-color: var(--bubble-border);
}

.bubble.filled,
.condition-bubble,
.condition-bubble.condition-minor {
  color: var(--button-text);
  background: linear-gradient(180deg, var(--button-hover), var(--button));
  border-color: var(--bubble-border);
}

.condition-bubble.condition-minor {
  background: linear-gradient(180deg, var(--temp), color-mix(in srgb, var(--temp) 65%, #000 35%));
}

.dialog-card,
.settings-dialog,
.conditions-dialog,
.condition-info-dialog,
.recovery-dialog,
.edit-dialog {
  color: var(--text);
  background: linear-gradient(180deg, var(--modal), var(--modal-2));
  border-color: var(--border);
  box-shadow: 0 1rem 2.5rem var(--shadow), inset 0 0 0 .12rem color-mix(in srgb, var(--panel-2) 72%, #fff 28%);
}

.dialog-card::backdrop,
.settings-dialog::backdrop,
.conditions-dialog::backdrop,
.condition-info-dialog::backdrop,
.recovery-dialog::backdrop,
.edit-dialog::backdrop {
  background: color-mix(in srgb, var(--bg) 72%, #000 28%);
  backdrop-filter: blur(4px);
}

.dialog-inner {
  padding: .15rem;
}

.dialog-header {
  color: var(--text);
  border-bottom-color: var(--border);
}

.settings-section,
.visual-settings-group,
.account-panel {
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 86%, var(--bg) 14%);
  border-color: var(--border);
}

.settings-summary,
.display-settings-section .settings-summary,
.visibility-character-header {
  color: var(--header-text);
  background: linear-gradient(180deg, var(--button-hover), var(--button));
  border-color: var(--border);
}

.display-settings-section,
.display-settings-section:not([open]),
.display-settings-section[open] {
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--border);
}

.display-visual-panel,
.visual-settings-group {
  background: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
}

.visual-choice-card {
  color: var(--button-text);
  border-color: color-mix(in srgb, var(--border) 72%, var(--panel-2) 28%);
}

.visual-choice-card.selected {
  border-color: var(--focus);
  box-shadow: 0 0 0 .18rem var(--focus), inset 0 0 0 .12rem var(--border), 0 .22rem .5rem var(--shadow);
}

.choice-swatches {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .2rem;
  margin-top: .2rem;
  min-height: .7rem;
}

.choice-swatches span {
  min-height: .7rem;
  border: .07rem solid rgba(0, 0, 0, .35);
  border-radius: .22rem;
}

.font-size-panel,
.readable-toggle-card {
  color: var(--text);
  background: color-mix(in srgb, var(--panel-2) 78%, var(--bg) 22%);
  border-color: var(--border);
}

.font-size-panel input[type="range"] {
  accent-color: var(--button-hover);
}

.font-size-panel strong {
  color: var(--info-bubble-text);
  background: var(--info-bubble-bg);
  border: .1rem solid var(--border);
}

.toggle-line input[type="checkbox"],
.checkbox-field input[type="checkbox"],
.condition-choice input[type="checkbox"],
.readable-toggle-card input,
.recovery-action input {
  accent-color: var(--button-hover);
}

.die-shape::before,
.die-shape.empty::before {
  background: var(--border);
}

.die-shape::after,
.die-shape.empty::after {
  background: var(--info-bubble-bg);
}

.die-shape.empty .die-value-display,
.die-value-display {
  color: var(--info-bubble-text);
}

.die-shape.filled .die-value-display {
  color: var(--button-text);
}

.die-tile.spent .die-shape::after,
.die-tile.spent .die-shape.filled::after {
  background: color-mix(in srgb, var(--panel) 62%, #777 38%);
}

.condition-choice.active .condition-choice-original,
.condition-choice.active .condition-choice-short {
  color: color-mix(in srgb, var(--button-text) 85%, transparent);
}

.login-page {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 28rem),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg) 70%, #000 30%));
}

body.theme-contrast .topbar,
body[data-palette="contrast"] .topbar,
body.high-contrast .topbar,
body.theme-contrast .settings-summary,
body[data-palette="contrast"] .settings-summary,
body.high-contrast .settings-summary,
body.theme-contrast .visibility-character-header,
body[data-palette="contrast"] .visibility-character-header,
body.high-contrast .visibility-character-header {
  border-color: #ffffff;
}

body.theme-contrast .btn,
body[data-palette="contrast"] .btn,
body.high-contrast .btn,
body.theme-contrast .icon-btn,
body[data-palette="contrast"] .icon-btn,
body.high-contrast .icon-btn,
body.theme-contrast .mini-btn,
body[data-palette="contrast"] .mini-btn,
body.high-contrast .mini-btn {
  border-color: #ffffff;
  box-shadow: 0 .16rem 0 #555;
}

body.theme-contrast .resource-card,
body[data-palette="contrast"] .resource-card,
body.high-contrast .resource-card,
body.theme-contrast .character-card,
body[data-palette="contrast"] .character-card,
body.high-contrast .character-card,
body.theme-contrast .dialog-card,
body[data-palette="contrast"] .dialog-card,
body.high-contrast .dialog-card {
  border-color: #000000;
  box-shadow: 0 0 0 .14rem #ffffff, 0 .75rem 1.5rem rgba(0,0,0,.9);
}

/* V0.1.24 - Navigation plus propre : on ne montre pas le bouton de la vue déjà active */
body[data-layout="tablet"] .tablet-link,
body[data-layout="phone"] .phone-link {
  display: none;
}

/* V0.1.24 - Aide courte pour les ressources génériques dans les paramètres */
.resource-toggle-stack {
  display: grid;
  gap: .2rem;
}

.resource-help-text {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
  font-weight: 800;
  padding-left: 1.9rem;
}

.core-resource-row .resource-help-text,
.locked-resource ~ .resource-help-text {
  padding-left: 0;
}

/* V0.1.26 · Repos Nimble */
.rest-button-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .55rem;
}

.rest-button-group .btn {
  min-width: 9.2rem;
}

body[data-layout="phone"] .rest-button-group,
body[data-layout="phone"] .card-footer {
  justify-content: stretch;
}

body[data-layout="phone"] .rest-button-group .btn {
  flex: 1 1 100%;
}

.resource-rest-settings {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: .45rem;
  padding: .7rem;
  border: .12rem solid var(--border);
  border-radius: .75rem;
  background: color-mix(in srgb, var(--panel-2) 80%, var(--bg) 20%);
}

.resource-rest-settings > strong {
  display: block;
  margin-bottom: .45rem;
  color: var(--text);
}

.disabled-rest-settings {
  color: var(--muted);
}

.rest-rule-grid {
  display: grid;
  gap: .45rem;
}

.rest-rule-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, .75fr) minmax(12rem, 1fr) minmax(5.5rem, auto);
  gap: .45rem;
  align-items: center;
}

.rest-rule-name {
  font-weight: 900;
  color: var(--text);
}

.recovery-mode-setting,
.recovery-amount-setting {
  width: 100%;
  min-height: 2.35rem;
  border: .12rem solid var(--input-border);
  border-radius: .55rem;
  background: var(--input-bg);
  color: var(--text);
  font-weight: 800;
  padding: .25rem .45rem;
}

.rest-amount-field {
  display: flex;
  gap: .25rem;
  align-items: center;
  font-weight: 900;
}

.rest-amount-field input {
  max-width: 5.5rem;
}

.rest-dialog .dialog-inner {
  max-height: min(82vh, 920px);
  overflow: auto;
}

.rest-rules-panel,
.rest-effects-panel {
  border: .15rem solid var(--border);
  border-radius: .9rem;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: .9rem 1rem;
}

.rest-rules-panel h3,
.rest-effects-panel h3 {
  margin: 0 0 .55rem;
  font-size: 1.15rem;
}

.rest-rules-list {
  display: grid;
  gap: .45rem;
  margin: 0;
  padding-left: 1.4rem;
}

.rest-rules-list li {
  line-height: 1.35;
}

.rest-effects-list {
  display: grid;
  gap: .55rem;
}

.rest-effect-card {
  display: grid;
  gap: .15rem;
  padding: .75rem .85rem;
  border: .12rem solid var(--border);
  border-radius: .75rem;
  background: var(--info-bubble-bg);
  color: var(--info-bubble-text);
}

.rest-effect-card strong {
  color: var(--text);
  font-size: 1.05rem;
}

.rest-effect-card.applied {
  border-width: .18rem;
  border-color: var(--success);
}

.rest-applied-title {
  margin: 0;
  font-weight: 950;
  color: var(--text);
}

@media (max-width: 760px) {
  .rest-rule-row {
    grid-template-columns: 1fr;
  }

  .rest-amount-field input {
    max-width: none;
  }
}

/* V0.1.26 · Repos globaux et PV simplifiés */
.global-rest-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  margin: .8rem auto 1rem;
  padding: .8rem .9rem;
  width: min(980px, 100%);
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: .16rem solid var(--border);
  border-radius: .95rem;
  box-shadow: 0 .35rem .8rem var(--shadow), inset 0 0 0 .08rem color-mix(in srgb, var(--panel-2) 70%, #fff 30%);
}

.global-rest-label {
  padding: .25rem .55rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.global-rest-toolbar .btn {
  min-width: 11.5rem;
  min-height: 2.75rem;
  font-size: .96rem;
}

.hp-body .bar-shell {
  margin-top: .2rem;
}

.card-footer {
  justify-content: center;
}

@media (max-width: 760px) {
  .global-rest-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .global-rest-label {
    text-align: center;
  }

  .global-rest-toolbar .btn {
    width: 100%;
  }
}


.admin-user-toggle,
.add-user-admin-toggle {
  align-items: center;
  justify-content: center;
  min-width: 7rem;
  padding: 0.55rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: 0.85rem;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 900;
}

.admin-user-row {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 34%, transparent);
}

.account-settings-section[hidden] {
  display: none !important;
}


/* V0.1.28 - Inspiration dans l'entête + ressources moins redondantes */
.identity-main-row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(10rem, auto);
  gap: .65rem;
  align-items: stretch;
}

.identity-fields {
  display: flex;
  flex-direction: column;
  gap: .42rem;
  min-width: 0;
}

.header-inspiration-toggle {
  min-width: 4.4rem;
  min-height: 100%;
  align-self: stretch;
  border: .18rem solid var(--bubble-border);
  border-radius: .75rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 .12rem rgba(255, 255, 255, .28), 0 .18rem 0 rgba(0,0,0,.28);
}

.header-inspiration-toggle .sun-icon {
  font-size: 2.15rem;
  line-height: 1;
  filter: grayscale(1);
  opacity: .58;
}

.header-inspiration-toggle.active {
  background: var(--info-bubble-bg);
  color: var(--info-bubble-text);
  border-color: var(--accent-2);
}

.header-inspiration-toggle.active .sun-icon {
  filter: none;
  opacity: 1;
  text-shadow: 0 0 .6rem rgba(255,255,255,.65);
}

.header-inspiration-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.resource-dicePool .resource-values,
.resource-hitDicePool .resource-values {
  display: none !important;
}

.resource-dicePool .resource-topline,
.resource-hitDicePool .resource-topline {
  justify-content: center;
}

.resource-dicePool .resource-title,
.resource-hitDicePool .resource-title {
  text-align: center;
}

.resource-dicePool .dice-row,
.resource-hitDicePool .dice-row {
  margin-top: .55rem;
}

@media (max-width: 760px) {
  .identity-main-row,
  body[data-layout="tablet"] .identity-main-row {
    grid-template-columns: 1fr auto;
  }
  .condition-bubbles {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

body[data-layout="phone"] .identity-main-row {
  grid-template-columns: 1fr auto;
}

body[data-layout="phone"] .condition-bubbles {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

/* V0.1.29 - Ressources visuelles, entête compact, icônes */
.save-icon-btn {
  min-width: 3.4rem;
  padding-inline: .8rem;
  font-size: 1.55rem;
  line-height: 1;
}

body[data-layout="tablet"] .identity-main-row {
  grid-template-columns: minmax(15rem, 21rem) 5.4rem minmax(12rem, 1fr);
  align-items: stretch;
}

body[data-layout="tablet"] .identity-fields {
  max-width: 21rem;
}

body[data-layout="tablet"] .name-input,
body[data-layout="tablet"] .subtitle-input {
  max-width: 100%;
}

body[data-layout="tablet"] .header-inspiration-toggle {
  min-width: 5rem;
  height: 100%;
}

body[data-layout="tablet"] .header-inspiration-toggle .sun-icon {
  font-size: 2.65rem;
}

.header-inspiration-toggle .sun-icon {
  font-family: Georgia, 'Times New Roman', serif;
}

.header-inspiration-toggle.active .sun-icon {
  color: var(--info-bubble-text);
  filter: drop-shadow(0 0 .35rem var(--accent-2));
}

.header-inspiration-toggle.inactive .sun-icon {
  opacity: .4;
  filter: grayscale(1);
}

.resource-hp-core .hp-topline .resource-values,
.resource-hp-core .hp-summary {
  display: block !important;
  font-weight: 950;
  color: var(--muted);
  text-align: center;
}

.visual-hp-body {
  display: grid;
  gap: .75rem;
}

.hp-heart-panel {
  display: flex;
  flex-wrap: wrap;
  gap: .17rem;
  align-items: center;
  padding: .55rem;
  border: .12rem solid var(--border);
  border-radius: .85rem;
  background: color-mix(in srgb, var(--panel-2) 72%, transparent);
  max-height: 11.5rem;
  overflow-y: auto;
}

.hp-heart {
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  font-size: 1.14rem;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 .08rem .08rem rgba(0,0,0,.34);
}

.hp-heart-red.active {
  color: #e33b3b;
}

.hp-heart-red.inactive {
  color: color-mix(in srgb, var(--muted) 42%, transparent);
  filter: grayscale(1);
  opacity: .42;
}

.hp-heart-temp.active {
  color: #35c968;
  filter: drop-shadow(0 0 .12rem rgba(70,255,140,.45));
}

.wounds-panel {
  padding: .55rem;
  border: .12rem solid var(--border);
  border-radius: .85rem;
  background: color-mix(in srgb, var(--panel-2) 72%, transparent);
}

.wounds-title,
.magic-frequency {
  color: var(--muted);
  font-weight: 950;
  margin: 0 0 .4rem;
}

.wound-icons,
.icon-charge-row,
.visual-dice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}

.wound-icon {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  border: .14rem solid var(--border);
  border-radius: .75rem;
  background: var(--panel-2);
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 .12rem .2rem var(--shadow);
}

.wound-icon.inactive {
  opacity: .42;
  filter: grayscale(1);
}

.wound-icon.active {
  background: color-mix(in srgb, var(--danger) 32%, var(--panel-2));
  border-color: var(--danger);
}

.resource-charges .resource-values,
.resource-magicItem .resource-values,
.resource-dicePool .resource-values {
  display: block !important;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 950;
}

.charge-icon {
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  border: .16rem solid var(--border);
  border-radius: .85rem;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 1.65rem;
  cursor: pointer;
  box-shadow: 0 .14rem .25rem var(--shadow), inset 0 0 0 .08rem rgba(255,255,255,.25);
}

.charge-icon.active {
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
  color: var(--button-text);
  border-color: var(--accent-2);
  filter: drop-shadow(0 0 .16rem color-mix(in srgb, var(--accent-2) 55%, transparent));
}

.charge-icon.inactive {
  opacity: .45;
  filter: grayscale(1);
}

.helm-icon {
  border-radius: 1rem;
}

.icon-charge-controls,
.visual-dice-controls {
  justify-content: center;
  margin-top: .7rem;
}

.visual-dice-row .die-tile {
  min-width: 4.4rem;
}

.die-onoff {
  min-width: 3.8rem;
  min-height: 2.1rem;
  padding: .22rem .4rem;
  border: .14rem solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--panel-2);
  font-size: .78rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 .12rem .16rem var(--shadow);
}

.die-onoff.active {
  color: var(--button-text);
  background: linear-gradient(180deg, var(--success), var(--button));
  border-color: var(--accent-2);
}

.die-onoff.inactive {
  opacity: .72;
  background: color-mix(in srgb, var(--panel-2) 75%, #000 25%);
}

.visual-dice-row .die-shape {
  cursor: pointer;
}

.visual-dice-row .die-tile.spent .die-shape {
  opacity: .62;
  filter: grayscale(1) drop-shadow(0 .12rem .14rem rgba(0, 0, 0, .34));
}

.die-value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(3.2rem, 1fr));
  gap: .7rem;
  margin-block: 1rem;
}

.die-value-choice {
  min-height: 3.5rem;
  border: .16rem solid var(--border);
  border-radius: 999px;
  color: var(--button-text);
  background: radial-gradient(circle at 50% 45%, var(--accent-2), var(--button));
  font-size: 1.35rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 .18rem .32rem var(--shadow), inset 0 0 0 .1rem rgba(255,255,255,.22);
}

.die-value-choice:hover,
.charge-icon:hover,
.hp-heart:hover,
.wound-icon:hover,
.die-onoff:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.magic-frequency {
  padding: .35rem .55rem;
  border: .1rem solid var(--border);
  border-radius: .65rem;
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
  text-align: center;
}

.wounds-max-setting-field,
.icon-setting-field,
.frequency-setting-field {
  min-width: 8rem;
}

@media (max-width: 760px) {
  body[data-layout="tablet"] .identity-main-row,
  body[data-layout="phone"] .identity-main-row {
    grid-template-columns: 1fr auto;
  }
  .hp-heart-panel {
    max-height: 14rem;
  }
  .hp-heart {
    width: 1.32rem;
    height: 1.32rem;
    font-size: 1.24rem;
  }
}

/* V0.1.31 - menu déroulant et PV réorganisés */
.menu-top-actions {
  justify-content: flex-end;
  position: relative;
}

.app-menu {
  position: relative;
  z-index: 60;
}

.menu-trigger {
  list-style: none;
  width: 3.35rem;
  height: 3.35rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: .18rem solid var(--border);
  border-radius: .8rem;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 .2rem .35rem var(--shadow), inset 0 0 0 .08rem rgba(255,255,255,.22);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
}

.menu-trigger::-webkit-details-marker { display: none; }

.app-menu[open] .menu-trigger,
.menu-trigger:focus-visible {
  outline: .18rem solid var(--focus);
  outline-offset: .12rem;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + .55rem);
  min-width: 18rem;
  display: grid;
  gap: .45rem;
  padding: .65rem;
  border: .18rem solid var(--border);
  border-radius: .9rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 .8rem 1.6rem var(--shadow);
}

.menu-user-name {
  display: block;
  padding: .65rem .75rem;
  border: .12rem solid var(--border);
  border-radius: .65rem;
  background: var(--info-bubble-bg);
  color: var(--info-bubble-text);
  font-weight: 950;
  text-align: center;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  width: 100%;
  padding: .65rem .9rem;
  border: .14rem solid var(--border);
  border-radius: .75rem;
  background: var(--button);
  color: var(--button-text);
  font: inherit;
  font-weight: 950;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 .16rem .25rem var(--shadow);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.danger-menu-item {
  background: var(--danger);
  color: #fff;
}

body[data-layout="tablet"] .identity-main-row {
  grid-template-columns: minmax(13rem, 21rem) 5rem minmax(12rem, 1fr) !important;
}

body[data-layout="tablet"] .identity-fields {
  max-width: 21rem !important;
}

body[data-layout="tablet"] .name-input,
body[data-layout="tablet"] .subtitle-input {
  width: 100% !important;
  max-width: 21rem !important;
}

.resource-hp-v30 .v30-hp-topline {
  display: grid !important;
  grid-template-columns: minmax(4.5rem, auto) 1fr minmax(9rem, auto);
  align-items: center;
  gap: .7rem;
  padding: .35rem .7rem;
}

.resource-hp-v30 .hp-header-center {
  display: grid;
  justify-items: center;
  gap: .15rem;
  min-width: 0;
}

.resource-hp-v30 .hp-header-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.resource-hp-v30 .hp-header-left {
  justify-content: flex-start;
}

.resource-hp-v30 .hp-header-right {
  justify-content: flex-end;
}

.resource-hp-v30 .hp-summary {
  font-size: .95rem;
  line-height: 1.05;
}

.resource-hp-v30 .v30-heart-panel {
  gap: .28rem .35rem;
  justify-content: flex-start;
  align-items: center;
  max-height: 8.5rem;
}

.hp-inline-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .16rem;
}

.wound-inline-group {
  gap: .2rem;
}

.inline-wound-icon.wound-icon {
  width: 1.55rem;
  height: 1.55rem;
  min-width: 1.55rem;
  border-radius: .48rem;
  font-size: .98rem;
  padding: 0;
  box-shadow: none;
}

.hp-major-separator,
.hp-pack-separator,
.hp-temp-separator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.45rem;
  margin: 0 .22rem;
  color: var(--text);
  font-weight: 950;
  opacity: .78;
}

.hp-major-separator {
  margin-inline: .45rem;
  opacity: .95;
}

.hp-temp-separator {
  color: var(--temp);
  opacity: .9;
}

.resource-hp-v30 .hp-heart {
  width: 1.08rem;
  height: 1.08rem;
  font-size: 1.04rem;
}

.resource-hp-v30 .hp-action-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}

.resource-hp-v30 .hp-action-panel .btn {
  width: 100%;
}

.resource-hp-v30 .wounds-panel,
.resource-hp-v30 .hp-main-controls {
  display: none !important;
}

@media (max-width: 760px) {
  .menu-panel {
    right: -.25rem;
    min-width: min(19rem, calc(100vw - 1.2rem));
  }
  .resource-hp-v30 .v30-hp-topline {
    grid-template-columns: 1fr;
  }
  .resource-hp-v30 .hp-header-left,
  .resource-hp-v30 .hp-header-right {
    justify-content: center;
  }
  .resource-hp-v30 .hp-action-panel {
    grid-template-columns: 1fr;
  }
}

/* V0.1.31 - PV : entête propre, grosses icônes tactiles et séparateurs doubles */
.resource-hp-v31 .v31-hp-topline {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: .35rem;
  padding: .55rem .75rem .7rem;
  min-height: auto;
}

.resource-hp-v31 .v31-hp-topline .resource-title {
  text-align: center;
  justify-self: center;
  line-height: 1;
  margin: 0;
}

.resource-hp-v31 .v31-hp-controls-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 1fr) auto minmax(8.5rem, 1fr);
  align-items: center;
  gap: .65rem;
  width: 100%;
}

.resource-hp-v31 .hp-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.resource-hp-v31 .hp-header-left {
  justify-content: flex-start;
}

.resource-hp-v31 .hp-header-right {
  justify-content: flex-end;
}

.resource-hp-v31 .hp-summary {
  display: block !important;
  text-align: center;
  justify-self: center;
  min-width: 6.25rem;
  font-size: 1.1rem;
  font-weight: 950;
  line-height: 1.1;
  color: var(--text);
}

.resource-hp-v31 .v31-heart-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .28rem .34rem;
  padding: .7rem .85rem;
  max-height: 12rem;
  overflow-y: auto;
}

.resource-hp-v31 .hp-heart,
.resource-hp-v31 .v31-wound-icon {
  width: 2.15rem;
  min-width: 2.15rem;
  height: 2.15rem;
  border-radius: .55rem;
  display: inline-grid;
  place-items: center;
  font-size: 1.42rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.resource-hp-v31 .hp-heart {
  border: .08rem solid transparent;
  background: color-mix(in srgb, var(--panel) 22%, transparent);
}

.resource-hp-v31 .hp-heart:hover,
.resource-hp-v31 .v31-wound-icon:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.resource-hp-v31 .hp-heart-red.active {
  color: #e43b42;
  text-shadow: 0 .1rem .08rem rgba(0, 0, 0, .28);
}

.resource-hp-v31 .hp-heart-red.inactive {
  color: color-mix(in srgb, var(--muted) 56%, transparent);
  opacity: .5;
  filter: grayscale(1);
}

.resource-hp-v31 .hp-heart-temp.active {
  color: #32cf6a;
  filter: drop-shadow(0 0 .18rem rgba(72, 255, 140, .42));
}

.resource-hp-v31 .v31-wound-icon {
  padding: 0;
  border: .12rem solid color-mix(in srgb, var(--border) 75%, transparent);
  box-shadow: 0 .12rem .22rem rgba(0, 0, 0, .18);
}

.resource-hp-v31 .v31-wound-icon.active {
  background: color-mix(in srgb, var(--danger) 25%, var(--panel-2));
  color: var(--danger);
  opacity: 1;
  filter: none;
}

.resource-hp-v31 .v31-wound-icon.inactive {
  background: color-mix(in srgb, var(--panel-2) 76%, var(--bg));
  color: color-mix(in srgb, var(--muted) 60%, transparent);
  opacity: .58;
  filter: grayscale(1);
}

.resource-hp-v31 .hp-double-separator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 1.35rem;
  padding-inline: .1rem;
  margin-inline: .2rem;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 950;
  line-height: 1;
  opacity: .88;
}

.resource-hp-v31 .hp-wound-separator {
  margin-inline: .35rem;
  opacity: .95;
}

.resource-hp-v31 .hp-temp-separator {
  color: var(--temp);
}

.resource-hp-v31 .v31-hp-action-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.resource-hp-v31 .v31-hp-action-panel .btn {
  width: 100%;
}

@media (max-width: 760px) {
  .resource-hp-v31 .v31-hp-controls-row {
    grid-template-columns: 1fr;
  }
  .resource-hp-v31 .hp-header-left,
  .resource-hp-v31 .hp-header-right {
    justify-content: center;
  }
  .resource-hp-v31 .v31-hp-action-panel {
    grid-template-columns: 1fr;
  }
}

/* V0.1.33 - menu de repos et objets magiques multi-lignes */
.rest-dropdown-toolbar {
  width: auto;
  max-width: min(30rem, 100%);
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  position: relative;
  z-index: 35;
}

.rest-menu {
  position: relative;
  display: inline-block;
}

.rest-trigger {
  list-style: none;
  min-width: 10.5rem;
  min-height: 3.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .55rem .9rem;
  cursor: pointer;
  border: .18rem solid var(--border);
  border-radius: .9rem;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 .22rem .38rem var(--shadow), inset 0 0 0 .08rem rgba(255,255,255,.22);
  font-weight: 950;
}

.rest-trigger::-webkit-details-marker { display: none; }

.rest-trigger-icon {
  font-size: 1.55rem;
  line-height: 1;
}

.rest-trigger-text {
  font-size: 1.05rem;
}

.rest-menu[open] .rest-trigger,
.rest-trigger:focus-visible {
  outline: .18rem solid var(--focus);
  outline-offset: .12rem;
}

.rest-menu-panel {
  position: absolute;
  left: 50%;
  top: calc(100% + .55rem);
  transform: translateX(-50%);
  min-width: 19rem;
  display: grid;
  gap: .45rem;
  padding: .65rem;
  border: .18rem solid var(--border);
  border-radius: .9rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 .8rem 1.6rem var(--shadow);
}

.rest-menu-panel .global-rest-btn {
  min-width: 100%;
  min-height: 3rem;
}

.magic-item-visibility-row .resource-config-options {
  grid-template-columns: 1fr;
}

.magic-item-settings-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .75rem;
  padding: .45rem .55rem;
  border: .12rem solid var(--border);
  border-radius: .75rem;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}

.magic-item-settings-header strong {
  font-size: 1.04rem;
  font-weight: 950;
}

.magic-item-settings-header span {
  color: var(--muted);
  font-weight: 850;
}

.magic-item-settings-list {
  display: grid;
  gap: .65rem;
}

.magic-item-setting-row {
  display: grid;
  grid-template-columns: minmax(13rem, 1.4fr) minmax(6rem, .55fr) minmax(12rem, .9fr) minmax(10rem, .8fr) auto;
  gap: .55rem;
  align-items: end;
  padding: .65rem;
  border: .14rem solid var(--border);
  border-radius: .85rem;
  background: color-mix(in srgb, var(--panel) 82%, var(--panel-2) 18%);
}

.magic-item-setting-row .delete-magic-item-line {
  min-width: 3.1rem;
  min-height: 3.1rem;
  background: var(--danger);
  color: #fff;
}

.add-magic-item-line {
  justify-self: start;
}

.magic-item-compact-field {
  max-width: 12rem;
}

.magic-items-list {
  display: grid;
  gap: .75rem;
}

.magic-item-card {
  display: grid;
  gap: .6rem;
  padding: .75rem;
  border: .14rem solid var(--border);
  border-radius: .9rem;
  background: color-mix(in srgb, var(--panel-2) 80%, transparent);
}

.magic-item-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem .75rem;
}

.magic-item-card-header strong {
  font-size: 1.12rem;
  font-weight: 950;
}

.magic-item-card-header span {
  color: var(--muted);
  font-weight: 900;
}

.magic-item-charge-row {
  justify-content: flex-start;
}

.medieval-helm-svg {
  width: 2rem;
  height: 2rem;
  display: block;
}

.helm-dome,
.helm-neck {
  fill: currentColor;
}

.helm-face {
  fill: color-mix(in srgb, currentColor 55%, var(--panel-2) 45%);
}

.helm-ridge,
.helm-slit,
.helm-trim {
  fill: none;
  stroke: color-mix(in srgb, var(--panel-2) 78%, #fff 22%);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.magic-helm-charge.active {
  color: var(--accent);
}

.magic-helm-charge.inactive {
  color: var(--muted);
  opacity: .42;
  filter: grayscale(1);
}

@media (max-width: 900px) {
  .magic-item-setting-row {
    grid-template-columns: 1fr 1fr;
  }

  .magic-item-name-field,
  .magic-item-frequency-field,
  .magic-item-icon-field {
    grid-column: 1 / -1;
  }
}

/* V0.1.34 - ajustements menu repos + objets magiques */
.top-actions.menu-top-actions {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
}

.topbar-rest-menu {
  z-index: 61;
}

.topbar-rest-menu .rest-trigger {
  width: 3.35rem;
  min-width: 3.35rem;
  height: 3.35rem;
  min-height: 3.35rem;
  padding: 0;
  border-radius: .8rem;
}

.topbar-rest-menu .rest-trigger-icon {
  font-size: 1.72rem;
}

.topbar-rest-menu .rest-menu-panel {
  left: auto;
  right: 0;
  top: calc(100% + .55rem);
  transform: none;
  min-width: 20rem;
  z-index: 100;
}

.rest-dropdown-toolbar {
  display: none !important;
}

.magic-item-visibility-row-v34 {
  grid-template-columns: minmax(18rem, 1fr) auto;
  align-items: start;
}

.magic-item-visibility-row-v34 .resource-toggle-stack {
  grid-column: 1 / 2;
  align-self: start;
}

.magic-item-visibility-row-v34 .magic-item-config-options {
  grid-column: 1 / 2;
  width: 100%;
  min-width: 0;
  margin-top: .65rem;
}

.magic-item-visibility-row-v34 .resource-order-controls {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.magic-item-config-options {
  overflow: visible;
}

.magic-item-setting-row-v34 {
  grid-template-columns: minmax(16rem, 1.7fr) minmax(5.5rem, .55fr) minmax(12rem, .95fr) minmax(11rem, .8fr) auto;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.magic-item-setting-row-v34 input,
.magic-item-setting-row-v34 select {
  min-width: 0;
  width: 100%;
}

.magic-item-setting-row-v34 .magic-item-icon-field select {
  font-weight: 950;
}

.magic-item-card-v34 {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  row-gap: .45rem;
}

.magic-item-card-v34 .magic-item-card-header {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  justify-content: start;
  gap: .25rem;
}

.magic-item-card-v34 .magic-item-card-header strong {
  overflow-wrap: anywhere;
}

.magic-item-card-v34 .magic-item-charge-row {
  justify-self: start;
  align-self: center;
  min-width: 7rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: .45rem;
}

.magic-item-card-v34 .charge-icon {
  width: 3.45rem;
  height: 3.45rem;
  pointer-events: auto;
}

.magic-item-card-v34 .medieval-helm-svg {
  width: 2.18rem;
  height: 2.18rem;
  pointer-events: none;
}

@media (max-width: 900px) {
  .magic-item-visibility-row-v34 {
    grid-template-columns: 1fr;
  }
  .magic-item-visibility-row-v34 .resource-toggle-stack,
  .magic-item-visibility-row-v34 .magic-item-config-options,
  .magic-item-visibility-row-v34 .resource-order-controls {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .magic-item-setting-row-v34 {
    grid-template-columns: 1fr 1fr;
  }
  .magic-item-setting-row-v34 .magic-item-name-field,
  .magic-item-setting-row-v34 .magic-item-frequency-field,
  .magic-item-setting-row-v34 .magic-item-icon-field {
    grid-column: 1 / -1;
  }
  .magic-item-card-v34 {
    grid-template-columns: 1fr;
  }
}


/* V0.1.35 - nettoyage visuel des ressources */
.resource-dicePool .resource-values,
.resource-hitDicePool .resource-values,
.resource-magicItem .resource-values,
.resource-charges .resource-values {
  display: none !important;
}

.magic-item-visibility-row-v34 .resource-type-pill,
.magic-item-visibility-row .resource-type-pill {
  display: none !important;
}

.magic-item-config-options {
  width: 100% !important;
  max-width: none !important;
}

.magic-item-settings-header,
.magic-item-settings-list,
.magic-item-setting-row-v34,
.magic-item-setting-row {
  width: 100% !important;
  max-width: none !important;
}

.magic-items-list-v35 {
  width: 100%;
}

.magic-item-card-v35 {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  row-gap: .45rem;
}

.magic-item-card-v35 .magic-item-charge-row {
  justify-self: start;
  justify-content: flex-start;
  align-items: center;
}

.magic-item-card-v35 .charge-icon.inactive {
  cursor: pointer;
  pointer-events: auto;
}

/* V0.1.36 - Actions / Réactions */
.resource-actionsReactions .resource-title {
  text-align: center;
}

.actions-reactions-panel {
  display: grid;
  gap: .8rem;
}

.actions-section,
.reactions-section {
  border: 2px solid var(--border, var(--outline));
  border-radius: .8rem;
  background: var(--panel-2, color-mix(in srgb, var(--paper-strong), transparent 25%));
  padding: .7rem;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border, var(--outline)), transparent 65%);
}

.actions-section-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .55rem;
  align-items: center;
  margin-bottom: .55rem;
}

.actions-section-header strong,
.reactions-section > strong {
  font-size: 1.05rem;
  letter-spacing: .02em;
}

.actions-section-header span {
  font-weight: 900;
  color: var(--muted);
}

.action-token-row,
.reaction-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  justify-content: center;
}

.action-token,
.reaction-token {
  min-height: 3.7rem;
  min-width: 5.2rem;
  border-radius: .85rem;
  border: 3px solid var(--border, var(--outline));
  background: var(--button, var(--accent));
  color: var(--button-text, #fff);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--border, var(--outline)), black 20%);
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
  touch-action: manipulation;
}

.action-token:hover,
.reaction-token:hover,
.action-token:focus-visible,
.reaction-token:focus-visible {
  transform: translateY(-1px);
  outline: 4px solid var(--focus, #ffcc3d);
  outline-offset: 2px;
}

.action-token.inactive,
.reaction-token.inactive {
  opacity: .42;
  filter: grayscale(1) saturate(.45);
  background: color-mix(in srgb, var(--panel), black 12%);
  color: var(--muted);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--border, var(--outline)), transparent 35%);
}

.action-token {
  display: grid;
  gap: .15rem;
  place-items: center;
  padding: .45rem .75rem;
}

.action-token-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.reaction-token {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .5rem;
  align-items: center;
  justify-items: start;
  min-width: 8.8rem;
  padding: .35rem .65rem;
}

.reaction-icon-wrap {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), white 18%);
  border: 2px solid var(--border, var(--outline));
  overflow: hidden;
}

.reaction-glyph {
  font-size: 1.6rem;
  line-height: 1;
}

.reaction-img {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  display: block;
}

.reaction-label {
  font-size: .9rem;
  line-height: 1.05;
  text-align: left;
}

.actions-reactions-visibility-row .actions-reactions-config-options {
  align-items: end;
}

.actions-reactions-visibility-row .actions-full-reset-setting {
  align-self: end;
  min-height: 2.4rem;
}

body[data-layout="phone"] .reaction-token {
  width: 100%;
}

@media (max-width: 760px) {
  .actions-section-header {
    grid-template-columns: 1fr auto;
  }
  .actions-section-header .actions-reset-btn {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .reaction-token {
    width: 100%;
  }
}

/* V0.1.37 - Actions / Réactions plus visuelles, sans doublons de texte */
.actions-reactions-panel-v37 {
  gap: .65rem;
}

.actions-reactions-panel-v37 .actions-section,
.actions-reactions-panel-v37 .reactions-section {
  padding: .55rem;
}

.actions-section-header-v37 {
  display: flex;
  justify-content: center;
  margin-bottom: .45rem;
}

.actions-section-header-v37 .actions-reset-btn {
  min-height: 2.7rem;
  min-width: 5.2rem;
}

.actions-reactions-panel-v37 .action-token-row,
.actions-reactions-panel-v37 .reaction-token-row {
  justify-content: center;
  gap: .55rem;
}

.actions-reactions-panel-v37 .action-token {
  min-width: 4.4rem;
  min-height: 4.1rem;
  padding: .35rem;
  font-size: 1.45rem;
}

.actions-reactions-panel-v37 .action-token-icon {
  font-size: 2rem;
}

.actions-reactions-panel-v37 .reaction-token {
  display: grid;
  grid-template-columns: 3.55rem 1.25rem;
  min-width: 5.5rem;
  min-height: 4.3rem;
  gap: .35rem;
  justify-items: center;
  align-items: center;
  padding: .3rem .45rem;
}

.actions-reactions-panel-v37 .reaction-icon-wrap {
  width: 3.3rem;
  height: 3.3rem;
  border-radius: .75rem;
  background: color-mix(in srgb, var(--panel-2), var(--accent) 18%);
}

.actions-reactions-panel-v37 .reaction-img {
  width: 3.15rem;
  height: 3.15rem;
  object-fit: contain;
}

.actions-reactions-panel-v37 .reaction-label {
  font-size: 1.35rem;
  font-weight: 1000;
  text-align: center;
  line-height: 1;
}

.actions-reactions-panel-v37 .reaction-token.inactive {
  filter: none;
  opacity: .72;
}

.actions-reactions-panel-v37 .reaction-token.inactive .reaction-label,
.actions-reactions-panel-v37 .action-token.inactive .action-token-icon {
  opacity: .55;
}

body[data-layout="phone"] .actions-reactions-panel-v37 .reaction-token {
  width: auto;
}

/* V0.1.38 - Choix de ressources à la création d'un personnage */
.new-character-resource-picker {
  margin-top: 1rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--panel-2);
}

.resource-picker-heading h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1em;
}

.resource-picker-heading p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.new-character-resource-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.65rem;
}

.new-character-resource-choice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
}

.new-character-resource-choice input {
  width: 1.5rem;
  height: 1.5rem;
  accent-color: var(--accent);
}

.new-character-resource-choice input:disabled {
  cursor: not-allowed;
}

.new-character-resource-choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.mandatory-resource-choice {
  opacity: 0.92;
  cursor: not-allowed;
}

.resource-choice-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.resource-choice-text small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}

.locked-resource-badge {
  align-self: center;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  background: var(--info-bubble-bg);
  color: var(--info-bubble-text);
  border: 1px solid var(--border);
  font-size: 0.75em;
  font-weight: 900;
}

/* V0.1.41 - Paramètres de ressources standardisés */
.resource-settings-row-v41.visibility-resource-row,
.resource-settings-row-v41.visibility-resource-row.resource-expanded {
  grid-template-columns: minmax(18rem, .9fr) minmax(26rem, 2.4fr) minmax(8.5rem, auto) !important;
  align-items: start;
}

.resource-settings-row-v41.visibility-resource-row.resource-collapsed {
  grid-template-columns: minmax(18rem, 1fr) minmax(8.5rem, auto) !important;
}

.resource-settings-row-v41 .resource-toggle {
  flex-wrap: wrap;
  gap: .35rem .5rem;
}

.resource-settings-row-v41 .resource-toggle span::after {
  content: '' !important;
}

.resource-type-inline-v41 {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: .16rem .48rem;
  border: .12rem solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2) 78%, var(--accent) 22%);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 1000;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .035em;
  white-space: nowrap;
}

.resource-option-state-v41 {
  display: inline-flex;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  white-space: nowrap;
}

.resource-settings-row-v41.resource-expanded .resource-option-state-v41::before {
  content: 'options ouvertes';
}

.resource-settings-row-v41.resource-collapsed .resource-option-state-v41::before {
  content: 'options fermées';
}

.resource-settings-row-v41 .resource-config-options {
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: .6rem;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.resource-settings-row-v41 .resource-order-controls-v41 {
  display: grid !important;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: start;
  gap: .45rem;
  align-self: start;
  min-width: 8.5rem;
}

.resource-arrow-row-v41 {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: .35rem;
}

.compact-under-arrows-v41 {
  display: grid;
  justify-items: center;
  gap: .2rem;
  min-width: 7rem;
  margin-top: .15rem;
}

.compact-under-arrows-v41 span {
  text-align: center;
}

.compact-under-arrows-v41 input[type="checkbox"] {
  width: 1.55rem;
  height: 1.55rem;
}

.resource-settings-row-v41 .magic-item-config-options {
  grid-template-columns: 1fr;
}

.resource-settings-row-v41 .magic-item-settings-header,
.resource-settings-row-v41 .magic-item-settings-list,
.resource-settings-row-v41 .magic-item-setting-row,
.resource-settings-row-v41 .magic-item-setting-row-v34 {
  width: 100% !important;
  max-width: none !important;
}

@media (max-width: 920px) {
  .resource-settings-row-v41.visibility-resource-row,
  .resource-settings-row-v41.visibility-resource-row.resource-expanded,
  .resource-settings-row-v41.visibility-resource-row.resource-collapsed {
    grid-template-columns: 1fr !important;
  }

  .resource-settings-row-v41 .resource-order-controls-v41 {
    justify-self: start;
    justify-items: start;
  }

  .compact-under-arrows-v41 {
    justify-items: start;
  }
}

/* V0.1.45 - PV compact : barre de vie dans l'entête du personnage et contrôles intégrés */
.header-hp-bar {
  width: min(100%, 42rem);
  margin-top: .42rem;
}

.header-hp-bar.is-hidden {
  display: none !important;
}

.header-hp-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-size: .84rem;
  font-weight: 950;
  color: var(--text);
  margin-bottom: .14rem;
  padding-inline: .15rem;
  opacity: .92;
}

.header-hp-label span {
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-hp-shell {
  min-height: .9rem !important;
  height: .9rem;
  border-width: .1rem;
  box-shadow: inset 0 0 0 .05rem color-mix(in srgb, var(--border) 35%, transparent), 0 .08rem .18rem rgba(0, 0, 0, .18);
}

.resource-hp-v43 .v43-hp-topline {
  padding: .55rem .7rem .62rem;
}

.resource-hp-v43 .v43-hp-controls-row {
  grid-template-columns: minmax(12rem, 1fr) auto minmax(16rem, 1fr);
  gap: .65rem;
}

.resource-hp-v43 .hp-header-actions .btn,
.resource-hp-v43 .hp-temp-inline {
  min-height: 2.35rem;
  padding: .42rem .8rem;
  font-size: .98rem;
}

.resource-hp-v43 .hp-summary {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .45rem;
  min-width: 12.5rem;
}

.resource-hp-v43 .hp-summary-main {
  white-space: nowrap;
}

.resource-hp-v43 .hp-temp-inline {
  white-space: nowrap;
  background: linear-gradient(180deg, var(--temp), color-mix(in srgb, var(--temp) 72%, #000));
  color: var(--button-text);
  border-color: var(--border-strong);
}

.resource-hp-v43 .v43-hp-body {
  gap: .62rem;
}

.resource-hp-v43 .v43-heart-panel {
  max-height: none;
  overflow-y: visible;
  padding: .7rem .8rem;
  gap: .2rem .3rem;
}

.resource-hp-v43 .hp-heart,
.resource-hp-v43 .v31-wound-icon {
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  font-size: 1.5rem;
}

.resource-hp-v43 .hp-bar,
.resource-hp-v43 .v31-hp-action-panel,
.resource-hp-v43 .hp-action-panel {
  display: none !important;
}

body[data-layout="tablet"] .character-header {
  grid-template-columns: 7.2rem minmax(0, 1fr);
}

body[data-layout="tablet"] .identity-fields {
  max-width: 42rem;
}

body[data-layout="phone"] .header-hp-bar {
  width: 100%;
}

@media (max-width: 860px) {
  .resource-hp-v43 .v43-hp-controls-row {
    grid-template-columns: 1fr;
  }
  .resource-hp-v43 .hp-header-left,
  .resource-hp-v43 .hp-header-right {
    justify-content: center;
  }
}

/* V1.0.1 - Actions / Réactions : groupes côte à côte, réactions en 2 x 2 */
.actions-reactions-panel-v37 {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(300px, 1.15fr);
  gap: .85rem;
  align-items: stretch;
}

.actions-reactions-panel-v37 .actions-section,
.actions-reactions-panel-v37 .reactions-section {
  min-height: 0;
  height: 100%;
}

.actions-reactions-panel-v37 .actions-section {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
}

.actions-reactions-panel-v37 .action-token-row {
  align-self: center;
}

.actions-reactions-panel-v37 .reactions-section {
  display: grid;
  align-items: center;
}

.actions-reactions-panel-v37 .reaction-token-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(6.2rem, 1fr));
  justify-content: center;
  align-content: center;
  gap: .65rem .75rem;
  max-width: 18rem;
  margin-inline: auto;
}

.actions-reactions-panel-v37 .reaction-token {
  width: 100%;
  min-width: 0;
}

body[data-layout="phone"] .actions-reactions-panel-v37,
.resource-card.compact-resource .actions-reactions-panel-v37 {
  grid-template-columns: 1fr;
}

body[data-layout="phone"] .actions-reactions-panel-v37 .reaction-token-row {
  grid-template-columns: repeat(2, minmax(5.4rem, 1fr));
  max-width: 16rem;
}

@media (max-width: 760px) {
  .actions-reactions-panel-v37 {
    grid-template-columns: 1fr;
  }
}

/* V1.0.3 - PV : retour à une grosse barre lisible + blessures en dessous */
.header-hp-bar {
  display: none !important;
}

.resource-hp-v103 .v103-hp-body {
  gap: .75rem;
}

.resource-hp-v103 .hp-combo-bar-wrap {
  width: 100%;
  padding: .2rem 0;
}

.resource-hp-v103 .hp-combo-track {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 3rem;
  border: 3px solid var(--border-strong);
  border-radius: 1rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel-2) 80%, #000 20%);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, .22), 0 2px 0 rgba(255, 255, 255, .16);
}

.resource-hp-v103 .hp-base-segment {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--danger) 78%, #000 22%) 0%,
    color-mix(in srgb, var(--accent-2) 70%, var(--danger) 30%) 52%,
    color-mix(in srgb, var(--success) 84%, #000 16%) 100%);
}

.resource-hp-v103 .hp-base-segment::after {
  content: '';
  position: absolute;
  inset: 0;
  left: var(--hp-percent);
  background: color-mix(in srgb, var(--panel-2) 72%, #000 28%);
  opacity: .72;
}

.resource-hp-v103 .hp-base-fill {
  width: var(--hp-percent);
  height: 100%;
}

.resource-hp-v103 .hp-temp-segment {
  flex: 0 0 var(--temp-percent);
  min-width: 3.5rem;
  display: grid;
  place-items: center;
  border-left: 3px solid var(--border-strong);
  color: var(--button-text);
  font-weight: 950;
  text-shadow: 0 2px 2px rgba(0, 0, 0, .35);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--temp) 88%, #fff 12%),
    color-mix(in srgb, var(--temp) 72%, #000 28%));
}

.resource-hp-v103 .hp-wounds-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
  width: 100%;
  min-height: 3.05rem;
  padding: .55rem .65rem;
  border: 2px solid var(--border);
  border-radius: .9rem;
  background: color-mix(in srgb, var(--panel) 78%, var(--accent) 8%);
}

.resource-hp-v103 .v103-wound-icon {
  width: 2.55rem;
  min-width: 2.55rem;
  height: 2.55rem;
  font-size: 1.55rem;
}

.resource-hp-v103 .v103-wound-icon.inactive {
  filter: grayscale(1);
  opacity: .46;
}

.resource-hp-v103 .v103-wound-icon.active {
  opacity: 1;
}

.resource-hp-v103 .v43-heart-panel,
.resource-hp-v103 .hp-heart-panel,
.resource-hp-v103 .hp-heart,
.resource-hp-v103 .hp-double-separator {
  display: none !important;
}

body[data-layout="phone"] .resource-hp-v103 .hp-combo-track {
  min-height: 3.4rem;
}

body[data-layout="phone"] .resource-hp-v103 .hp-temp-segment {
  min-width: 4rem;
}

/* V1.0.4 - Ressources à barre (Mana, etc.) avec icônes et entête compact façon PV */
.resource-visual-bar .v104-bar-topline {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
}

.resource-visual-bar .visual-bar-center {
  display: grid;
  justify-items: center;
  justify-self: center;
  gap: .25rem;
  min-width: max-content;
  text-align: center;
}

.resource-visual-bar .visual-bar-values {
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 950;
}

.resource-visual-bar .visual-bar-side {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.resource-visual-bar .visual-bar-left {
  justify-content: flex-start;
  justify-self: start;
}

.resource-visual-bar .visual-bar-right {
  justify-content: flex-end;
  justify-self: end;
}

.resource-visual-bar .v104-bar-body {
  display: grid;
  gap: .75rem;
}

.visual-bar-icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  min-height: 3.2rem;
  padding: .45rem;
  border: 2px solid var(--border);
  border-radius: .9rem;
  background: color-mix(in srgb, var(--panel) 76%, var(--accent) 8%);
}

.bar-resource-icon {
  width: 3.15rem;
  height: 3.15rem;
  display: grid;
  place-items: center;
  border: .16rem solid var(--border);
  border-radius: .85rem;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 1.65rem;
  cursor: pointer;
  box-shadow: 0 .14rem .25rem var(--shadow), inset 0 0 0 .08rem rgba(255,255,255,.25);
}

.bar-resource-icon.active {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--button-text);
  border-color: var(--border-strong);
  filter: drop-shadow(0 0 .16rem color-mix(in srgb, var(--accent-2) 55%, transparent));
}

.bar-resource-icon.inactive {
  opacity: .42;
  filter: grayscale(1);
}

.resource-visual-bar .visual-bar-shell {
  min-height: 2.25rem;
  margin-top: 0;
  border-width: .17rem;
}

.resource-visual-bar .visual-bar-shell .bar-fill {
  min-height: 2rem;
}

@media (max-width: 760px) {
  .resource-visual-bar .v104-bar-topline {
    grid-template-columns: 1fr;
  }
  .resource-visual-bar .visual-bar-left,
  .resource-visual-bar .visual-bar-right {
    justify-content: center;
  }
}

/* V1.0.6 - Correction réelle du centrage des titres des ressources à barre.
   Les règles tablette plus anciennes avaient une spécificité plus forte et écrasaient
   grid-template-columns. On force ici une grille à trois zones égales. */
body[data-layout="tablet"] .resource-card.resource-visual-bar .resource-topline.v104-bar-topline,
body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-topline.v104-bar-topline,
.resource-card.resource-visual-bar .resource-topline.v104-bar-topline,
.resource-card.resource-visual-bar .visual-bar-topline.v104-bar-topline {
  display: grid !important;
  grid-template-columns: minmax(7rem, 1fr) minmax(8rem, auto) minmax(7rem, 1fr) !important;
  grid-template-areas: "barleft barcenter barright" !important;
  align-items: center !important;
  gap: .75rem !important;
  flex-direction: unset !important;
  text-align: center !important;
}

body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-left,
.resource-card.resource-visual-bar .visual-bar-left {
  grid-area: barleft !important;
  justify-self: start !important;
  justify-content: flex-start !important;
  width: 100% !important;
}

body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-center,
.resource-card.resource-visual-bar .visual-bar-center {
  grid-area: barcenter !important;
  justify-self: center !important;
  justify-items: center !important;
  align-self: center !important;
  width: max-content !important;
  min-width: 8rem !important;
  max-width: 100% !important;
  margin-inline: auto !important;
  text-align: center !important;
}

body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-center .resource-title,
body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-center .resource-values,
.resource-card.resource-visual-bar .visual-bar-center .resource-title,
.resource-card.resource-visual-bar .visual-bar-center .resource-values {
  width: auto !important;
  max-width: none !important;
  justify-content: center !important;
  text-align: center !important;
}

body[data-layout="tablet"] .resource-card.resource-visual-bar .visual-bar-right,
.resource-card.resource-visual-bar .visual-bar-right {
  grid-area: barright !important;
  justify-self: end !important;
  justify-content: flex-end !important;
  width: 100% !important;
}

body[data-layout="phone"] .resource-card.resource-visual-bar .resource-topline.v104-bar-topline,
body[data-layout="phone"] .resource-card.resource-visual-bar .visual-bar-topline.v104-bar-topline {
  grid-template-columns: 1fr !important;
  grid-template-areas:
    "barcenter"
    "barleft"
    "barright" !important;
}

body[data-layout="phone"] .resource-card.resource-visual-bar .visual-bar-left,
body[data-layout="phone"] .resource-card.resource-visual-bar .visual-bar-right {
  justify-self: center !important;
  justify-content: center !important;
  width: auto !important;
}


/* V1.0.7 - Entête des ressources à barre en deux lignes, comme PV.
   Ligne 1 : titre centré. Ligne 2 : -   valeur   + Max. */
.resource-card.resource-visual-bar-v107 .resource-topline.v107-bar-topline,
body[data-layout="tablet"] .resource-card.resource-visual-bar-v107 .resource-topline.v107-bar-topline,
body[data-layout="phone"] .resource-card.resource-visual-bar-v107 .resource-topline.v107-bar-topline {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-areas:
    "bartitle"
    "barcontrols" !important;
  gap: .45rem !important;
  align-items: center !important;
  justify-items: stretch !important;
  padding: .65rem .9rem !important;
  text-align: center !important;
}

.resource-card.resource-visual-bar-v107 .visual-bar-title-row,
body[data-layout="tablet"] .resource-card.resource-visual-bar-v107 .visual-bar-title-row,
body[data-layout="phone"] .resource-card.resource-visual-bar-v107 .visual-bar-title-row {
  grid-area: bartitle !important;
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
}

.resource-card.resource-visual-bar-v107 .visual-bar-title-row .resource-title {
  text-align: center !important;
  width: auto !important;
  justify-content: center !important;
  font-size: 1.1rem;
}

.resource-card.resource-visual-bar-v107 .visual-bar-control-row,
body[data-layout="tablet"] .resource-card.resource-visual-bar-v107 .visual-bar-control-row,
body[data-layout="phone"] .resource-card.resource-visual-bar-v107 .visual-bar-control-row {
  grid-area: barcontrols !important;
  display: grid !important;
  grid-template-columns: minmax(5.5rem, 1fr) auto minmax(8.5rem, 1fr) !important;
  align-items: center !important;
  gap: .75rem !important;
  width: 100% !important;
}

.resource-card.resource-visual-bar-v107 .visual-bar-control-left {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
}

.resource-card.resource-visual-bar-v107 .visual-bar-control-right {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: .55rem !important;
}

.resource-card.resource-visual-bar-v107 .visual-bar-values,
body[data-layout="tablet"] .resource-card.resource-visual-bar-v107 .visual-bar-values,
body[data-layout="phone"] .resource-card.resource-visual-bar-v107 .visual-bar-values {
  justify-self: center !important;
  text-align: center !important;
  justify-content: center !important;
  min-width: 6rem !important;
  width: auto !important;
}

body[data-layout="phone"] .resource-card.resource-visual-bar-v107 .visual-bar-control-row {
  grid-template-columns: 1fr auto 1fr !important;
}

/* V1.0.8 - Charges visuelles propres : icônes centrées, aucun bouton Vider */
.resource-charges .resource-body {
  display: grid;
  place-items: center;
  gap: .85rem;
  min-height: 6.5rem;
}

.charge-resource-panel {
  width: 100%;
  display: grid;
  justify-items: center;
  align-items: center;
  gap: .85rem;
  padding: .4rem .25rem .25rem;
}

.charge-resource-row {
  width: 100%;
  justify-content: center !important;
  align-items: center;
  gap: .85rem;
}

.resource-charges .charge-icon {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 1rem;
  font-size: 2rem;
}

.resource-charges .charge-icon svg {
  width: 2.55rem;
  height: 2.55rem;
}

.resource-charges .charge-icon.active {
  transform: translateY(-.04rem);
}

.resource-charges .charge-icon.inactive {
  opacity: .42;
  filter: grayscale(1);
}

.charge-max-only-controls {
  width: 100%;
  justify-content: center !important;
  margin-top: .15rem !important;
}

.charge-max-only-controls .clear,
.resource-charges .icon-charge-controls .clear {
  display: none !important;
}

.charge-frequency-line {
  justify-self: center;
  text-align: center;
  margin-bottom: 0 !important;
}

.compact-resource.resource-charges .resource-body {
  min-height: 4.8rem;
}

.compact-resource.resource-charges .charge-icon {
  width: 3.45rem;
  height: 3.45rem;
}

@media (max-width: 700px) {
  .resource-charges .charge-icon {
    width: 3.7rem;
    height: 3.7rem;
  }
  .charge-resource-row {
    gap: .6rem;
  }
}

/* V1.0.9 - Barres visuelles pastel : moins agressives, plus Humblewood */
:root {
  --hp-pastel-red: #e99a98;
  --hp-pastel-orange: #f3bf82;
  --hp-pastel-yellow: #f6e99d;
  --hp-pastel-green: #a9d79a;
  --hp-pastel-temp: #9fcbed;
  --hp-pastel-temp-2: #c2def5;
  --hp-empty-mask: color-mix(in srgb, var(--panel-2) 78%, #ffffff 22%);
}

/* La même intention visuelle partout : rouge doux -> orange -> jaune -> vert. */
.bar-fill,
.resource-visual-bar .visual-bar-shell .bar-fill {
  background: linear-gradient(90deg,
    var(--hp-pastel-red) 0%,
    var(--hp-pastel-orange) 34%,
    var(--hp-pastel-yellow) 64%,
    var(--hp-pastel-green) 100%) !important;
}

.resource-hp-v103 .hp-combo-track,
.resource-visual-bar .visual-bar-shell,
.bar-shell {
  background: color-mix(in srgb, var(--panel-2) 72%, #ffffff 28%) !important;
  box-shadow: inset 0 .1rem .32rem rgba(0, 0, 0, .14), 0 .08rem 0 rgba(255, 255, 255, .24) !important;
}

.resource-hp-v103 .hp-base-segment {
  background: linear-gradient(90deg,
    var(--hp-pastel-red) 0%,
    var(--hp-pastel-orange) 34%,
    var(--hp-pastel-yellow) 64%,
    var(--hp-pastel-green) 100%) !important;
}

.resource-hp-v103 .hp-base-segment::after {
  background: var(--hp-empty-mask) !important;
  opacity: .76 !important;
}

.resource-hp-v103 .hp-temp-segment {
  background: linear-gradient(180deg,
    var(--hp-pastel-temp-2),
    var(--hp-pastel-temp)) !important;
  color: #10243d !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45) !important;
}

body[data-palette="contrast"] .bar-fill,
body.high-contrast .bar-fill,
body[data-palette="contrast"] .resource-visual-bar .visual-bar-shell .bar-fill,
body.high-contrast .resource-visual-bar .visual-bar-shell .bar-fill,
body[data-palette="contrast"] .resource-hp-v103 .hp-base-segment,
body.high-contrast .resource-hp-v103 .hp-base-segment {
  background: linear-gradient(90deg,
    #ff8f8f 0%,
    #ffc06e 34%,
    #fff06e 64%,
    #93e078 100%) !important;
}

body[data-palette="contrast"] .resource-hp-v103 .hp-base-segment::after,
body.high-contrast .resource-hp-v103 .hp-base-segment::after {
  background: #ffffff !important;
  opacity: .86 !important;
}

body[data-palette="contrast"] .resource-hp-v103 .hp-temp-segment,
body.high-contrast .resource-hp-v103 .hp-temp-segment {
  background: linear-gradient(180deg, #bde7ff, #7fc9ff) !important;
  color: #000 !important;
  text-shadow: none !important;
}
