@import url("https://fonts.googleapis.com/css2?family=Uncial+Antiqua&display=swap");

/* =========================================================
   DIARIO DI ALYNDRA v7.13 — Sistema Multi-PG, Campagne, Sessione & Archivio Locale
   ========================================================= */

body.mpg-home-active {
  padding-top: 0 !important;
}

body.mpg-home-active > header,
body.mpg-home-active > .shell {
  display: none !important;
}

#mpg-home-screen {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  min-height: 100dvh;
  padding: 28px 24px 64px;
  background-color: var(--bg, #101011);
  background-image:
    radial-gradient(ellipse 78% 46% at 50% 0%, rgba(186, 134, 68, 0.16), transparent 64%),
    radial-gradient(ellipse 56% 42% at 12% 18%, rgba(114, 48, 56, 0.20), transparent 66%),
    radial-gradient(ellipse 56% 42% at 88% 22%, rgba(92, 66, 40, 0.18), transparent 66%),
    radial-gradient(ellipse 68% 44% at 50% 100%, rgba(124, 88, 48, 0.10), transparent 68%);
}

#mpg-home-screen::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: clamp(580px, 88vh, 940px);
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      to bottom,
      rgba(16, 15, 17, 0.44) 0%,
      rgba(16, 15, 17, 0.28) 24%,
      rgba(16, 15, 17, 0.56) 56%,
      rgba(16, 15, 17, 0.88) 82%,
      var(--bg, #101011) 100%
    ),
    linear-gradient(
      to right,
      rgba(16, 15, 17, 0.94) 0%,
      rgba(16, 15, 17, 0.52) 15%,
      rgba(16, 15, 17, 0.16) 36%,
      rgba(16, 15, 17, 0.16) 64%,
      rgba(16, 15, 17, 0.52) 85%,
      rgba(16, 15, 17, 0.94) 100%
    ),
    radial-gradient(
      ellipse 64% 44% at 50% 16%,
      rgba(216, 180, 118, 0.14),
      rgba(92, 36, 44, 0.10) 48%,
      transparent 76%
    ),
    url("assets/home-fantasy-bg.webp");
  background-position: center top, center center, center top, center 26%;
  background-size: 100% 100%, 100% 100%, 100% 100%, cover;
  background-repeat: no-repeat;
}

#mpg-home-screen::after {
  content: "";
  position: absolute;
  inset: 440px 0 0 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 56% 32% at 14% 24%, rgba(146, 98, 52, 0.085), transparent 72%),
    radial-gradient(ellipse 54% 34% at 86% 52%, rgba(114, 46, 56, 0.09), transparent 74%),
    radial-gradient(ellipse 68% 36% at 50% 94%, rgba(176, 134, 72, 0.07), transparent 76%);
}

/* Varied ambient medieval runes across the home backdrop (no enclosing frame) */
.mpg-home-runes-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.72) 55%, rgba(0, 0, 0, 0.28) 84%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.72) 55%, rgba(0, 0, 0, 0.28) 84%, transparent 100%);
}

.mpg-rune {
  position: absolute;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  font-weight: 400;
  pointer-events: none;
}

.mpg-rune-1  { top: 34px;  left: 3.5%;  font-size: 36px; color: rgba(232, 194, 124, 0.24); transform: rotate(-11deg); text-shadow: 0 0 14px rgba(216, 174, 96, 0.18); }
.mpg-rune-2  { top: 108px; left: 8.8%;  font-size: 20px; color: rgba(244, 224, 186, 0.20); transform: rotate(9deg);   text-shadow: 0 0 10px rgba(232, 200, 146, 0.14); }
.mpg-rune-3  { top: 196px; left: 2.2%;  font-size: 28px; color: rgba(196, 134, 72, 0.23);  transform: rotate(-7deg);  text-shadow: 0 0 12px rgba(196, 128, 62, 0.16); }
.mpg-rune-4  { top: 286px; left: 6.4%;  font-size: 17px; color: rgba(218, 176, 108, 0.19); transform: rotate(14deg); }
.mpg-rune-5  { top: 410px; left: 2.8%;  font-size: 32px; color: rgba(182, 128, 78, 0.18);  transform: rotate(-13deg); }
.mpg-rune-6  { top: 540px; left: 5.5%;  font-size: 21px; color: rgba(230, 206, 164, 0.16); transform: rotate(6deg); }
.mpg-rune-7  { top: 690px; left: 2.4%;  font-size: 26px; color: rgba(206, 152, 86, 0.15);  transform: rotate(-8deg); }
.mpg-rune-8  { top: 860px; left: 4.8%;  font-size: 19px; color: rgba(186, 144, 92, 0.13);  transform: rotate(11deg); }

.mpg-rune-9  { top: 42px;  right: 3.8%; font-size: 34px; color: rgba(142, 184, 232, 0.22); transform: rotate(10deg);  text-shadow: 0 0 14px rgba(102, 158, 224, 0.20); }
.mpg-rune-10 { top: 118px; right: 9.2%; font-size: 19px; color: rgba(238, 212, 166, 0.20); transform: rotate(-12deg); text-shadow: 0 0 10px rgba(216, 180, 118, 0.15); }
.mpg-rune-11 { top: 204px; right: 2.5%; font-size: 29px; color: rgba(218, 134, 68, 0.21);  transform: rotate(7deg);   text-shadow: 0 0 12px rgba(218, 122, 54, 0.16); }
.mpg-rune-12 { top: 298px; right: 6.8%; font-size: 16px; color: rgba(164, 190, 224, 0.16); transform: rotate(-9deg); }
.mpg-rune-13 { top: 426px; right: 3.0%; font-size: 33px; color: rgba(222, 184, 116, 0.18); transform: rotate(13deg); }
.mpg-rune-14 { top: 562px; right: 5.8%; font-size: 22px; color: rgba(196, 138, 78, 0.16);  transform: rotate(-6deg); }
.mpg-rune-15 { top: 716px; right: 2.6%; font-size: 27px; color: rgba(236, 212, 172, 0.14); transform: rotate(8deg); }
.mpg-rune-16 { top: 884px; right: 5.0%; font-size: 18px; color: rgba(188, 142, 84, 0.12);  transform: rotate(-11deg); }

.mpg-rune-17 { top: 64px;  left: 16%;   font-size: 23px; color: rgba(226, 174, 96, 0.18);  transform: rotate(-15deg); }
.mpg-rune-18 { top: 58px;  right: 16%;  font-size: 24px; color: rgba(136, 178, 228, 0.18); transform: rotate(14deg); }

/* Active PG page: subtle distinct fantasy backdrop + matching ambient runes (non-invasive, high readability) */
body:not(.mpg-home-active) > .shell > main {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  background-color: #101011;
}

body:not(.mpg-home-active) > .shell > main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: min(760px, 92vh);
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      180deg,
      rgba(16, 15, 18, 0.68) 0%,
      rgba(16, 15, 18, 0.78) 38%,
      rgba(16, 15, 18, 0.92) 72%,
      rgba(16, 15, 18, 0.985) 90%,
      rgba(16, 15, 18, 1) 100%
    ),
    linear-gradient(
      to right,
      rgba(16, 15, 18, 0.86) 0%,
      rgba(16, 15, 18, 0.42) 18%,
      rgba(16, 15, 18, 0.28) 50%,
      rgba(16, 15, 18, 0.42) 82%,
      rgba(16, 15, 18, 0.86) 100%
    ),
    radial-gradient(
      ellipse 62% 40% at 50% 10%,
      rgba(196, 156, 92, 0.08),
      rgba(86, 36, 48, 0.08) 52%,
      transparent 78%
    ),
    url("assets/pg-fantasy-bg.webp");
  background-position: center top, center center, center top, center 24%;
  background-size: 100% 100%, 100% 100%, 100% 100%, cover;
  background-repeat: no-repeat;
}

body:not(.mpg-home-active) > .shell > main > #status,
body:not(.mpg-home-active) > .shell > main > #warning,
body:not(.mpg-home-active) > .shell > main > #content {
  position: relative;
  z-index: 1;
}

.mpg-pg-runes-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
  opacity: 0.78;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.62) 48%, rgba(0, 0, 0, 0.2) 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.62) 48%, rgba(0, 0, 0, 0.2) 82%, transparent 100%);
}

body.mpg-home-active .mpg-pg-runes-field {
  display: none;
}

@media (max-width: 760px) {
  body:not(.mpg-home-active) > .shell > main::before {
    height: min(560px, 78vh);
    background-image:
      linear-gradient(
        180deg,
        rgba(16, 15, 18, 0.72) 0%,
        rgba(16, 15, 18, 0.84) 45%,
        rgba(16, 15, 18, 0.96) 80%,
        rgba(16, 15, 18, 1) 100%
      ),
      url("assets/pg-fantasy-bg.webp");
    background-position: center top, center 22%;
    background-size: 100% 100%, cover;
  }

  .mpg-pg-runes-field {
    opacity: 0.56;
  }
}

.mpg-container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
}

.mpg-home-brand-banner {
  position: relative;
  text-align: center;
  margin: 0 auto 8px;
  padding: 0 8px;
  max-width: 100%;
}

.mpg-home-brand-artwork-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  background: transparent;
  isolation: isolate;
}

.mpg-home-brand-artwork-wrap::before {
  content: "";
  position: absolute;
  inset: 14% 6% 10%;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 52%,
    rgba(18, 12, 16, 0.56) 0%,
    rgba(16, 11, 15, 0.24) 56%,
    rgba(16, 11, 15, 0) 80%
  );
}

.mpg-home-brand-artwork {
  display: block;
  width: min(410px, 84vw);
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: transparent;
  filter:
    drop-shadow(0 3px 8px rgba(8, 5, 7, 0.72))
    drop-shadow(0 10px 24px rgba(12, 8, 12, 0.48));
}

.mpg-home-brand-fallback {
  display: none;
  font-family: "Uncial Antiqua", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.8rem, 4.2vw, 3.05rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: 0.05em;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.12em 0.34em;
  padding: 0.14em 0.12em 0.24em;
}

.mpg-home-brand-banner.is-fallback .mpg-home-brand-fallback {
  display: inline-flex;
}

.mpg-brand-fb-chronicle {
  color: #f4e2bc;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.94),
    0 0 18px rgba(96, 162, 240, 0.56);
}

.mpg-brand-fb-forge {
  color: #f6b252;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(232, 108, 32, 0.72);
}

@media (max-width: 1180px) {
  .mpg-rune-2,
  .mpg-rune-4,
  .mpg-rune-6,
  .mpg-rune-10,
  .mpg-rune-12,
  .mpg-rune-14,
  .mpg-rune-17,
  .mpg-rune-18 {
    display: none;
  }
}

.mpg-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 26px 56px 22px;
  border-radius: 10px;
  border: 1px solid rgba(176, 138, 82, 0.56);
  background:
    radial-gradient(circle at 6% 0%, rgba(196, 152, 86, 0.16), transparent 46%),
    linear-gradient(155deg, #281820 0%, #1a1318 58%, #131015 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 180, 118, 0.14),
    inset 0 1px 0 rgba(235, 204, 148, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.48);
  margin-bottom: 18px;
}

.mpg-hero.mpg-campaigns-hero {
  padding: 24px 28px 20px;
}

.mpg-hero.has-custom-bg {
  background-color: #141218;
}

.mpg-hero.has-custom-bg .mpg-eyebrow,
.mpg-hero.has-custom-bg h1,
.mpg-hero.has-custom-bg h2,
.mpg-hero.has-custom-bg .mpg-subtitle,
.mpg-hero.has-custom-bg .mpg-home-hero-count {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.94), 0 1px 3px rgba(0, 0, 0, 0.96);
}

.mpg-hero-edit,
.mpg-campaign-edit {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #91764e;
  background: rgba(23, 20, 26, 0.88);
  color: var(--gold, #d8b476);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mpg-hero-edit:hover,
.mpg-hero-edit:focus-visible,
.mpg-campaign-edit:hover,
.mpg-campaign-edit:focus-visible {
  border-color: var(--gold, #d8b476);
  background: linear-gradient(155deg, #4b2831, #27181e);
  color: #fff3da;
  outline: 2px solid #f0cf8e66;
  outline-offset: 2px;
}

.mpg-hero-edit svg,
.mpg-campaign-edit svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-eyebrow {
  display: block;
  font-size: 11.5px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--gold, #d8b476);
  margin-bottom: 8px;
}

.mpg-hero .mpg-home-title,
.mpg-hero h1,
.mpg-hero h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(176, 138, 82, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(23px, 3.6vw, 34px);
  letter-spacing: 1.2px;
  color: #f4ddb2;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.mpg-hero .mpg-home-title .page-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e4c17f;
  flex-shrink: 0;
}

.mpg-hero .mpg-home-title .page-title-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-subtitle {
  margin: 0 auto;
  max-width: 640px;
  color: #dcd1c1;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.mpg-home-hero-count {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(176, 138, 82, 0.34);
  background: rgba(18, 13, 18, 0.55);
  color: #d8c7ab;
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* Home Archive Bar + Storage Notice (Fase 2) */
.mpg-archive-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(176, 138, 82, 0.44);
  border-radius: 10px;
  background: linear-gradient(155deg, rgba(31, 21, 27, 0.9), rgba(16, 15, 19, 0.95));
}

.mpg-archive-bar-bottom {
  margin-top: 8px;
  margin-bottom: 14px;
  border: 1px solid rgba(226, 189, 118, 0.72);
  background: linear-gradient(155deg, rgba(64, 34, 45, 0.94) 0%, rgba(36, 26, 35, 0.96) 55%, rgba(26, 22, 30, 0.97) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 232, 184, 0.24), 0 10px 26px rgba(0, 0, 0, 0.42);
}

.mpg-archive-bar-bottom .mpg-archive-note {
  color: #f6ecd9;
}

.mpg-archive-bar-bottom .mpg-last-export-meta {
  color: #dbcab0;
}

.mpg-archive-note-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 280px;
}

.mpg-archive-note {
  margin: 0;
  font-size: 13px;
  color: #e5dccb;
  line-height: 1.45;
}

.mpg-last-export-meta {
  font-size: 12px;
  color: #bfb5a3;
}

.mpg-archive-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mpg-save-archive-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  color: #f2fbf4;
  background: linear-gradient(155deg, #214a37 0%, #143023 100%);
  border: 1px solid #7fb88f;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(198, 240, 210, 0.22), 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}

.mpg-save-archive-icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #b5e6c3;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-save-archive-icon-btn:hover,
.mpg-save-archive-icon-btn:focus-visible {
  background: linear-gradient(155deg, #2b5f47 0%, #1b3f2f 100%);
  border-color: #b4e4c2;
  color: #ffffff;
  outline: 2px solid rgba(180, 228, 194, 0.6);
  outline-offset: 2px;
}

.mpg-save-archive-icon-btn.is-saved {
  background: linear-gradient(155deg, #2d6a4e 0%, #1d4734 100%);
  border-color: #c5f0d1;
}

.mpg-save-archive-icon-btn:active {
  transform: translateY(1px);
}

.mpg-save-archive-icon-btn:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.mpg-save-archive-icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translate(-50%, 4px);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #7fb88f;
  background: linear-gradient(155deg, #1b3a2b, #11241b);
  color: #f2fbf4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.mpg-save-archive-icon-btn[data-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translate(-50%, 4px) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #11241b;
  border-right: 1px solid #7fb88f;
  border-bottom: 1px solid #7fb88f;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 39;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.mpg-save-archive-icon-btn[data-tooltip]:hover::after,
.mpg-save-archive-icon-btn[data-tooltip]:focus-visible::after,
.mpg-save-archive-icon-btn[data-tooltip]:hover::before,
.mpg-save-archive-icon-btn[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.mpg-save-archive-icon-btn[data-tooltip]:hover::before,
.mpg-save-archive-icon-btn[data-tooltip]:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

.mpg-archive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 15px;
  font-family: Georgia, serif;
  font-size: 14px;
  color: #f3dcaf;
  background: linear-gradient(155deg, #2d2329, #19161c);
  border: 1px solid #96784f;
  border-radius: 8px;
  cursor: pointer;
}

.mpg-archive-btn:hover,
.mpg-archive-btn:focus-visible {
  border-color: var(--gold, #d8b476);
  background: linear-gradient(155deg, #432b32, #241b20);
  color: #fff3da;
  outline: 2px solid #f0cf8e66;
  outline-offset: 2px;
}

.mpg-archive-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Filter bars (Fase 7) */
.mpg-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
}

.mpg-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(176, 138, 82, 0.42);
  border-radius: 9px;
  background: linear-gradient(155deg, rgba(31, 21, 27, 0.92), rgba(18, 15, 20, 0.95));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mpg-filter-bar.mpg-filter-bar-with-action,
.mpg-filter-bar.mpg-filter-bar-campaigns {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
  width: 100%;
}

.mpg-filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin: 0 !important;
  font-size: 12.5px;
  color: #d6c8b2;
  line-height: 1.25;
}

.mpg-filter-field input,
.mpg-filter-field select {
  width: 100%;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 7px 11px;
  border: 1px solid rgba(195, 158, 98, 0.45);
  border-radius: 7px;
  background: #121015;
  color: #f3ece2;
  font-size: 14px;
  line-height: 1.25;
  box-sizing: border-box;
}

.mpg-filter-field input:focus-visible,
.mpg-filter-field select:focus-visible {
  outline: 2px solid #e6c686;
  outline-offset: 1px;
  border-color: #d8b476;
}

.mpg-filter-bar .mpg-filter-action-btn {
  height: 40px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
  white-space: nowrap;
  align-self: end;
}

.mpg-count {
  font-size: 13px;
  color: var(--muted, #b6b0a6);
}

.mpg-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  font-size: 15px;
  font-family: Georgia, serif;
  line-height: 1.25;
  letter-spacing: 0.35px;
  color: #f9e6c1;
  background: linear-gradient(155deg, #5d252b, #36181e);
  border: 1px solid #b58c52;
  border-radius: 8px;
  box-shadow: 0 6px 18px #0007;
  cursor: pointer;
  white-space: normal;
  text-align: center;
  text-decoration: none;
  max-width: 100%;
  box-sizing: border-box;
}

.mpg-new-btn:hover,
.mpg-new-btn:focus-visible {
  background: linear-gradient(155deg, #742e35, #472027);
  border-color: var(--gold, #d8b476);
  color: #fff6e2;
  outline: 2px solid #f0cf8e66;
  outline-offset: 2px;
}

.mpg-new-btn:active {
  background: linear-gradient(155deg, #4b1d23, #2b1217);
  transform: translateY(1px);
}

.mpg-new-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mpg-new-btn-compact {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
  gap: 6px;
  box-shadow: 0 3px 10px #0006;
}

.mpg-new-btn-compact svg {
  width: 15px;
  height: 15px;
}

.mpg-new-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mpg-back-section-btn {
  flex-shrink: 0;
}

.mpg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.mpg-home-notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #6b5842;
  background: #1d1a1f;
  color: #efe4cf;
  font-size: 14px;
  line-height: 1.5;
}

.mpg-home-notice.is-success {
  border-color: #6b9158;
  background: linear-gradient(155deg, rgba(28, 43, 27, 0.92), rgba(18, 25, 18, 0.94));
  color: #dff3d8;
}

.mpg-home-notice.is-error {
  border-color: #c75353;
  background: linear-gradient(155deg, rgba(66, 22, 27, 0.94), rgba(36, 14, 17, 0.95));
  color: #ffd8d8;
}

/* Home local-data notice, end-of-session save reminder & distinct full-archive save button */
.mpg-local-alert-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 9px;
  border: 1px solid rgba(194, 152, 86, 0.52);
  border-left: 3px solid var(--gold, #d8b476);
  background:
    radial-gradient(circle at 0% 50%, rgba(164, 52, 68, 0.2), transparent 52%),
    linear-gradient(155deg, rgba(38, 20, 26, 0.94), rgba(20, 17, 22, 0.96));
  box-shadow: inset 0 1px 0 rgba(235, 204, 148, 0.14), 0 6px 18px rgba(0, 0, 0, 0.38);
  box-sizing: border-box;
}

.mpg-local-alert-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 320px;
}

.mpg-local-alert-line,
.mpg-local-reminder-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #efe4cf;
}

.mpg-local-reminder-line {
  color: #f6ddb0;
}

.mpg-local-alert-ico,
.mpg-local-reminder-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  flex: 0 0 19px;
  color: #e6bf77;
}

.mpg-local-reminder-ico {
  color: #9ed9af;
}

.mpg-local-alert-ico svg,
.mpg-local-reminder-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-local-save-feedback {
  margin: 2px 0 0;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(114, 176, 130, 0.5);
  background: rgba(24, 46, 33, 0.85);
  color: #dff5e4;
  font-size: 12.5px;
  line-height: 1.4;
}

.mpg-local-save-feedback.is-error {
  border-color: rgba(204, 88, 96, 0.65);
  background: rgba(66, 22, 28, 0.9);
  color: #ffd8dc;
}

.mpg-local-alert-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.mpg-save-archive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.25;
  color: #f2fbf4;
  background: linear-gradient(155deg, #214a37 0%, #143023 100%);
  border: 1px solid #7fb88f;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(198, 240, 210, 0.22), 0 5px 15px rgba(0, 0, 0, 0.44);
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}

.mpg-save-archive-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: #b5e6c3;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-save-archive-btn:hover,
.mpg-save-archive-btn:focus-visible {
  background: linear-gradient(155deg, #2b5f47 0%, #1b3f2f 100%);
  border-color: #b4e4c2;
  color: #ffffff;
  outline: 2px solid rgba(180, 228, 194, 0.6);
  outline-offset: 2px;
}

.mpg-save-archive-btn:active {
  transform: translateY(1px);
}

.mpg-save-archive-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 680px) {
  .mpg-local-alert-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 13px;
    gap: 11px;
  }

  .mpg-local-alert-copy {
    flex: 1 1 auto;
  }

  .mpg-local-alert-actions,
  .mpg-save-archive-btn {
    width: 100%;
    white-space: normal;
  }
}

.mpg-empty-archive {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 18px;
  border: 1px dashed #6b5842;
  border-radius: 11px;
  background: linear-gradient(155deg, rgba(28, 22, 26, 0.72), rgba(16, 16, 20, 0.85));
}

.mpg-empty-archive p {
  margin: 0 0 8px;
}

.mpg-empty-archive p:last-child {
  margin-bottom: 0;
}

.mpg-card-wrap {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 16px;
  border: 1px solid #79694e;
  border-radius: 11px;
  background: linear-gradient(155deg, #211c21, #141418);
  box-shadow: 0 10px 26px #0006;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mpg-card-wrap:hover,
.mpg-card-wrap:focus-within {
  transform: translateY(-2px);
  border-color: var(--gold, #d8b476);
  background: linear-gradient(155deg, #2a2127, #18171d);
  box-shadow: 0 14px 30px #0009, 0 0 0 1px #d8b47644;
}

.mpg-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 36px;
  margin-bottom: 4px;
}

.mpg-card-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid #7d6748;
  background: linear-gradient(155deg, #2b2126, #19161c);
  color: var(--gold, #d8b476);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mpg-card-edit:hover,
.mpg-card-edit:focus-visible {
  border-color: var(--gold, #d8b476);
  background: linear-gradient(155deg, #4b2831, #27181e);
  color: #fff3da;
}

.mpg-card-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 13px;
  flex: 1;
  width: 100%;
  padding: 4px 4px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.mpg-card:hover,
.mpg-card:focus-visible {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.mpg-card:focus-visible {
  outline: 2px solid var(--gold, #d8b476);
  outline-offset: 2px;
}

.mpg-card-portrait {
  width: 132px;
  max-width: 100%;
  pointer-events: none;
}

.mpg-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 12px;
  color: var(--gold, #d8b476);
  background: radial-gradient(circle at 50% 35%, #34232d, #131217 85%);
}

.mpg-placeholder-crest {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  opacity: 0.72;
}

.mpg-placeholder-initial {
  font-family: Georgia, serif;
  font-size: 40px;
  line-height: 1;
  color: #f1d49b;
  text-shadow: 0 2px 10px #000a;
}

.mpg-lock-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #141218dd;
  border: 1px solid #b58d52;
  color: var(--gold, #d8b476);
  box-shadow: 0 2px 8px #0009;
}

.mpg-lock-badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.mpg-card-name {
  display: block;
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1.3;
  color: var(--gold, #d8b476);
  overflow-wrap: anywhere;
}

.mpg-footer-note {
  margin-top: 12px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted, #b6b0a6);
}

/* Creator signature at the very bottom of the Home page */
.mpg-creator-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px auto 0;
  padding: 9px 18px;
  width: fit-content;
  max-width: 100%;
  border-top: 1px solid rgba(176, 138, 82, 0.34);
  color: #e6cca0;
  box-sizing: border-box;
}

.mpg-creator-sig-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: var(--gold, #d8b476);
}

.mpg-creator-sig-emblem svg {
  width: 28px;
  height: 28px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.mpg-creator-sig-emblem .mpg-sig-hood {
  fill: #14366e;
  stroke: #d8b476;
  stroke-width: 1.15;
  stroke-linejoin: round;
}

.mpg-creator-sig-emblem .mpg-sig-cowl {
  fill: none;
  stroke: #3b82d6;
  stroke-width: 0.78;
}

.mpg-creator-sig-emblem .mpg-sig-shadow {
  fill: #07060c;
  stroke: #4a96eb;
  stroke-width: 0.75;
}

.mpg-creator-sig-emblem .mpg-sig-rune {
  fill: none;
  stroke: #92dcff;
  stroke-width: 0.88;
  filter: drop-shadow(0 0 1.6px rgba(114, 198, 255, 0.75));
}

.mpg-creator-sig-emblem .mpg-sig-collar {
  fill: none;
  stroke: #b5263b;
  stroke-width: 0.95;
}

.mpg-creator-sig-emblem .mpg-sig-clasp {
  fill: #c92a40;
  stroke: none;
}

.mpg-creator-sig-emblem .mpg-sig-skull {
  fill: #f3eadb;
  stroke: #b7a88e;
  stroke-width: 0.62;
}

.mpg-creator-sig-emblem .mpg-sig-socket,
.mpg-creator-sig-emblem .mpg-sig-nose {
  fill: #08070d;
  stroke: none;
}

.mpg-creator-sig-emblem .mpg-sig-grin {
  fill: none;
  stroke: #08070d;
  stroke-width: 0.92;
}

.mpg-creator-sig-emblem .mpg-sig-stitch {
  fill: none;
  stroke: #08070d;
  stroke-width: 0.76;
}

.mpg-creator-sig-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13.5px;
  letter-spacing: 1.5px;
  color: #f0d7a7;
}

.mpg-creator-signature:focus-visible {
  outline: 2px solid #f0c990;
  outline-offset: 2px;
  border-radius: 6px;
}

.mpg-creator-signature-nav {
  width: 100%;
  justify-content: flex-start;
  margin: 14px 0 2px;
  padding: 10px 8px 6px;
  border-top: 1px solid rgba(176, 138, 82, 0.34);
  transition: border-color 0.16s ease, color 0.16s ease;
}

.mpg-creator-signature-nav:hover {
  border-top-color: rgba(224, 188, 124, 0.65);
  color: #fff2d6;
}

.mpg-creator-signature-nav:hover .mpg-creator-sig-name {
  color: #fff2d6;
}

@media (max-width: 760px) {
  .mpg-creator-signature-nav {
    flex: 1 0 100%;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
    padding: 7px 8px 3px;
  }
}

@media (max-width: 600px) {
  .mpg-creator-sig-emblem,
  .mpg-creator-sig-emblem svg {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }
}

/* Switch PG + Special Tools (Session Mode / Internal Search) in nav — stylized to match Strumenti rapidi */
#mpg-switch-nav {
  position: relative;
  overflow: hidden;
  padding: 11px 10px 11px;
  margin-bottom: 12px;
  border: 1px solid rgba(186, 148, 92, 0.56);
  border-radius: 10px;
  background:
    radial-gradient(circle at 12% 10%, rgba(102, 134, 98, 0.14), transparent 52%),
    radial-gradient(circle at 88% 92%, rgba(124, 52, 60, 0.22), transparent 52%),
    linear-gradient(155deg, rgba(35, 25, 29, 0.96), rgba(19, 17, 21, 0.98));
  box-shadow: inset 0 0 0 1px rgba(216, 180, 118, 0.14), 0 6px 18px rgba(0, 0, 0, 0.42);
  box-sizing: border-box;
}

.mpg-nav-vine-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.mpg-nav-vine-frame .mpg-qt-vine-corner {
  width: 72px;
  height: 41px;
  opacity: 0.42;
}

.mpg-nav-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.mpg-nav-pg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(186, 148, 92, 0.28);
  min-width: 0;
}

.mpg-nav-pg-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.52);
  background: rgba(84, 38, 44, 0.52);
  color: #ebd09a;
  flex: 0 0 auto;
}

.mpg-nav-pg-crest svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-nav-pg-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}

#mpg-switch-nav .mpg-active-label {
  display: none;
}

#mpg-switch-nav .mpg-active-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: #f3d69c;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

#mpg-switch-nav .mpg-switch-btn,
.mpg-nav-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.15px;
  padding: 5px 8px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid rgba(186, 148, 92, 0.46);
  color: #f3e4c6;
  background: linear-gradient(155deg, rgba(48, 28, 34, 0.88), rgba(24, 19, 23, 0.94));
  box-shadow: inset 0 1px 0 rgba(240, 212, 160, 0.12), 0 3px 9px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.mpg-nav-btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(216, 180, 118, 0.42);
  background: rgba(18, 14, 18, 0.72);
  color: #e6c483;
  flex: 0 0 auto;
}

.mpg-nav-btn-ico.is-session {
  border-color: rgba(216, 180, 118, 0.56);
  background: rgba(66, 30, 38, 0.82);
  color: #f0cf8e;
}

.mpg-nav-btn-ico.is-memorie {
  border-color: rgba(206, 166, 98, 0.56);
  background: rgba(52, 38, 22, 0.85);
  color: #ebd096;
}

.mpg-nav-btn-ico.is-talenti {
  border-color: rgba(238, 176, 200, 0.66);
  background: rgba(74, 38, 54, 0.88);
  color: #f8c6da;
}

.mpg-nav-btn-ico.is-search {
  border-color: rgba(114, 162, 182, 0.52);
  background: rgba(24, 39, 49, 0.85);
  color: #93c6d9;
}

.mpg-nav-btn-ico.is-trash {
  border-color: rgba(182, 186, 196, 0.44);
  background: rgba(46, 48, 56, 0.86);
  color: #d2d5dd;
}

.mpg-nav-btn-ico.is-switch {
  border-color: rgba(176, 134, 206, 0.52);
  background: rgba(38, 24, 50, 0.86);
  color: #d7b2f0;
}

.mpg-nav-btn-ico.is-guida {
  border-color: rgba(164, 174, 192, 0.58);
  background: rgba(46, 50, 62, 0.9);
  color: #d0d7e4;
}

.mpg-nav-btn-ico.is-save {
  border-color: rgba(128, 174, 142, 0.52);
  background: rgba(22, 42, 32, 0.84);
  color: #b4d8be;
}

.mpg-nav-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.mpg-nav-tool-btn.is-active {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, rgba(96, 39, 48, 0.96), rgba(46, 25, 32, 0.98));
  color: #fff6e2;
  box-shadow: 0 0 0 1px rgba(240, 207, 142, 0.34), 0 4px 12px rgba(0, 0, 0, 0.4);
}

#mpg-switch-nav .mpg-switch-btn:hover,
#mpg-switch-nav .mpg-switch-btn:focus-visible,
.mpg-nav-tool-btn:hover,
.mpg-nav-tool-btn:focus-visible {
  background: linear-gradient(155deg, rgba(84, 37, 46, 0.94), rgba(38, 22, 28, 0.96));
  border-color: #e4c17f;
  color: #fff7e8;
  transform: translateY(-1px);
}

#mpg-switch-nav .mpg-switch-btn:active,
.mpg-nav-tool-btn:active {
  transform: translateY(0);
}

#mpg-switch-nav .mpg-switch-btn svg,
.mpg-nav-tool-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mpg-nav-tool-btn.mpg-nav-save-btn {
  color: #e4f0e7;
  background: linear-gradient(155deg, rgba(31, 56, 44, 0.82) 0%, rgba(20, 35, 28, 0.9) 100%);
  border-color: rgba(116, 164, 132, 0.54);
  box-shadow: inset 0 1px 0 rgba(182, 220, 194, 0.14), 0 3px 9px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

.mpg-nav-tool-btn.mpg-nav-save-btn svg {
  stroke: #aed2b9;
}

.mpg-nav-tool-btn.mpg-nav-save-btn:hover,
.mpg-nav-tool-btn.mpg-nav-save-btn:focus-visible {
  background: linear-gradient(155deg, rgba(41, 74, 58, 0.92) 0%, rgba(26, 48, 38, 0.95) 100%);
  border-color: rgba(154, 204, 170, 0.72);
  color: #f4fbf6;
}

.mpg-nav-tool-btn.mpg-nav-save-btn.is-saved {
  background: linear-gradient(155deg, rgba(42, 82, 62, 0.92) 0%, rgba(26, 52, 39, 0.95) 100%);
  border-color: rgba(168, 220, 184, 0.76);
  color: #f5fcf7;
}

.mpg-nav-tool-btn.mpg-nav-save-btn:disabled {
  opacity: 0.78;
  cursor: wait;
  transform: none;
}

.mpg-nav-tool-btn.mpg-nav-trash-btn {
  color: #d9dce3;
  background: linear-gradient(155deg, rgba(52, 54, 62, 0.82) 0%, rgba(33, 35, 41, 0.9) 100%);
  border-color: rgba(178, 182, 192, 0.44);
  box-shadow: inset 0 1px 0 rgba(230, 232, 238, 0.12), 0 3px 9px rgba(0, 0, 0, 0.28);
}

.mpg-nav-tool-btn.mpg-nav-trash-btn:hover,
.mpg-nav-tool-btn.mpg-nav-trash-btn:focus-visible,
.mpg-nav-tool-btn.mpg-nav-trash-btn.is-active {
  background: linear-gradient(155deg, rgba(66, 69, 79, 0.92) 0%, rgba(42, 44, 52, 0.95) 100%);
  border-color: rgba(208, 212, 222, 0.66);
  color: #f3f5f8;
}

/* Dialogs & Full Backup Preview (Fase 2) */
.mpg-dialog {
  max-width: 480px;
}

.mpg-dialog h2 {
  margin-top: 0;
  color: var(--gold, #d8b476);
}

.mpg-dialog form > label {
  margin-bottom: 12px;
}

.mpg-backup-section {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #5e503e;
  border-radius: 9px;
  background: #151419;
}

.mpg-backup-section h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--gold, #d8b476);
}

.mpg-backup-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.mpg-backup-stat {
  padding: 8px 10px;
  border: 1px solid #4e4234;
  border-radius: 7px;
  background: #1b181f;
}

.mpg-backup-stat span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #b6b0a6;
}

.mpg-backup-stat strong {
  font-family: Georgia, serif;
  font-size: 15px;
  color: #f6e7c8;
}

.mpg-backup-preview {
  padding: 12px 14px;
  margin-top: 12px;
  border: 1px solid #8a6e48;
  border-radius: 8px;
  background: linear-gradient(155deg, #221b20, #141318);
}

.mpg-backup-preview h4 {
  margin: 0 0 8px;
  color: #f6e7c8;
}

.mpg-mode-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 12px;
}

.mpg-mode-option {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  margin: 0 !important;
  padding: 10px 12px;
  border: 1px solid #5e503e;
  border-radius: 8px;
  background: #18161c;
  color: #ede9e2 !important;
  cursor: pointer;
}

.mpg-mode-option input[type="radio"] {
  width: auto;
  margin: 3px 0 0;
  accent-color: var(--gold, #d8b476);
}

.mpg-mode-option strong {
  display: block;
  color: #f6e7c8;
}

.mpg-mode-option small {
  display: block;
  margin-top: 2px;
  color: #c4bab0;
  line-height: 1.4;
}

.mpg-pw-box {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #5e503e;
  border-radius: 7px;
  background: #151419;
}

.mpg-pw-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-bottom: 0 !important;
  color: var(--ink, #ede9e2) !important;
  cursor: pointer;
}

.mpg-pw-fields {
  margin-top: 10px;
}

.mpg-pw-fields[hidden] {
  display: none !important;
}

.mpg-form-error {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #b74a4a;
  background: #471d22;
  color: #ffd7d7;
  font-size: 13px;
}

.mpg-form-error[hidden] {
  display: none !important;
}

.mpg-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mpg-manage-dialog {
  max-width: 520px;
}

.mpg-manage-pg-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid #6b5842;
  border-radius: 8px;
  background: linear-gradient(155deg, #241c21, #151419);
}

.mpg-manage-pg-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted, #b6b0a6);
}

.mpg-manage-pg-header strong {
  font-family: Georgia, serif;
  font-size: 18px;
  color: var(--gold, #d8b476);
  overflow-wrap: anywhere;
}

.mpg-manage-section {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #5e503e;
  border-radius: 8px;
  background: #151419;
}

.mpg-manage-section h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--gold, #d8b476);
}

.mpg-subform h4 {
  margin: 10px 0 8px;
  font-size: 14px;
  color: #f3dcaf;
}

.mpg-subform label {
  display: block;
  margin-bottom: 9px;
}

.mpg-subform-sep {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #453a2f;
}

.mpg-manage-danger-zone {
  padding: 12px 14px;
  border: 1px solid #8a353b;
  border-radius: 8px;
  background: linear-gradient(155deg, rgba(61, 21, 26, 0.48), rgba(24, 14, 17, 0.72));
}

.mpg-manage-danger-zone h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #ffb8b8;
}

.mpg-danger-outline-btn {
  margin-top: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #cc4d54;
  border-radius: 7px;
  background: linear-gradient(155deg, #5c1e24, #371317);
  color: #ffe2e2;
  font-weight: 600;
  cursor: pointer;
}

.mpg-danger-outline-btn:hover,
.mpg-danger-outline-btn:focus-visible {
  border-color: #ff7c82;
  background: linear-gradient(155deg, #79272f, #4b181d);
  color: #fff;
}

/* Mandatory Double-Confirmation Delete Dialog */
.mpg-delete-dialog {
  width: min(500px, calc(100vw - 24px));
  padding: 0;
  border: 2px solid #c9464d;
  border-radius: 12px;
  background: linear-gradient(160deg, #251317, #130e11);
  color: #f4ece8;
  box-shadow: 0 22px 60px #000c, 0 0 0 1px #ff787833;
}

.mpg-delete-dialog::backdrop {
  background: rgba(6, 4, 6, 0.82);
  backdrop-filter: blur(2px);
}

.mpg-delete-box {
  padding: 20px 20px 18px;
}

.mpg-delete-title {
  margin: 0 0 12px;
  font-family: Georgia, serif;
  font-size: 21px;
  color: #ffc7c7;
}

.mpg-danger-banner {
  padding: 13px 14px;
  margin-bottom: 14px;
  border: 1px solid #c5484f;
  border-left: 5px solid #e2535a;
  border-radius: 8px;
  background: rgba(110, 22, 30, 0.45);
  color: #ffe3e3;
  font-size: 14px;
  line-height: 1.55;
}

.mpg-danger-banner p {
  margin: 0;
}

.mpg-danger-banner-strong {
  border-color: #e4555d;
  border-left-width: 6px;
  background: rgba(134, 24, 33, 0.56);
  color: #fff0f0;
}

.mpg-delete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.mpg-cancel-btn {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid rgba(195, 158, 98, 0.56);
  border-radius: 8px;
  background: linear-gradient(155deg, #2d1b22, #1c1317);
  color: #f3e6cf;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.mpg-cancel-btn:hover,
.mpg-cancel-btn:focus-visible {
  border-color: var(--gold, #d8b476);
  background: linear-gradient(155deg, #40242e, #281920);
  color: #fff6e2;
  outline: 2px solid #e6c686;
  outline-offset: 2px;
}

.mpg-danger-btn {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid #df575e;
  border-radius: 7px;
  background: linear-gradient(155deg, #9d242d, #68161d);
  color: #fff4f4;
  font-weight: 700;
  cursor: pointer;
}

.mpg-danger-btn:hover,
.mpg-danger-btn:focus-visible {
  border-color: #ff8c91;
  background: linear-gradient(155deg, #bb2c37, #811a23);
  color: #ffffff;
}

.mpg-danger-btn-final {
  border-color: #ff6b72;
  background: linear-gradient(155deg, #b8212c, #7b141c);
  box-shadow: 0 4px 16px #b8212c55;
}

.mpg-danger-btn-final:hover,
.mpg-danger-btn-final:focus-visible {
  border-color: #ffa2a6;
  background: linear-gradient(155deg, #d12835, #941923);
}

.mpg-danger-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Concentrazione active state */
#livepanel .livebox-conc {
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#livepanel .livebox-conc.is-conc-active {
  background: linear-gradient(150deg, #4f2331, #2e1823 70%, #20161c);
  border-color: #d8a85f;
  box-shadow: 0 0 0 1px #d8b47644, 0 6px 18px #6e282d55;
}

#livepanel .livebox-conc.is-conc-active h3 {
  color: #f6dc9f;
}

#livepanel .livebox-conc.is-conc-active > div {
  color: #fff6ea;
  font-weight: 600;
}

/* Anime intrecciate: balanced horizontal card header, framed Legame/Note & unified actions */
#content .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  align-items: start;
}

#content .gallery > article.card.soul-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #6b5842;
  border-radius: 10px;
  box-sizing: border-box;
}

#content .gallery > article.card.soul-card:has(details) {
  padding: 0;
}

#content .gallery > article.card.soul-card:has(details[open]),
#content .gallery > article.card.soul-card.soul-open {
  grid-column: 1 / -1;
}

.soul-fold {
  display: block;
  width: 100%;
  min-width: 0;
}

.soul-card-layout {
  display: grid;
  grid-template-columns: var(--pg-portrait-width, 124px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.soul-card-layout.soul-body-no-portrait {
  grid-template-columns: minmax(0, 1fr);
}

#content .gallery details > .soul-card-layout.soul-body-no-portrait {
  padding: 18px;
}

.soul-portrait-frame {
  width: var(--pg-portrait-width, 124px);
  aspect-ratio: var(--pg-portrait-ratio, 3 / 4);
  padding: var(--pg-portrait-frame-padding, 6px);
  flex-shrink: 0;
  box-sizing: border-box;
}

.soul-portrait-frame .header-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.soul-portrait-frame .header-portrait-placeholder {
  width: 100%;
  height: 100%;
  gap: 6px;
  padding: 10px;
  box-sizing: border-box;
}

.soul-portrait-frame .header-portrait-placeholder svg {
  width: 36px;
  height: 36px;
}

.soul-portrait-frame .header-portrait-placeholder span {
  font-size: 10px;
  letter-spacing: 1.1px;
}

.soul-card-info {
  min-width: 0;
  overflow-wrap: anywhere;
}

.soul-card-info h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.soul-card-info .meta {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.soul-card-info .prose {
  margin: 0;
  overflow-wrap: anywhere;
}

.soul-portrait-editor {
  margin: 14px 0;
}

#content .gallery summary.soul-summary-with-portrait,
#content .gallery .v711-summary.soul-summary-with-portrait,
#content .gallery .v711-head.soul-summary-with-portrait {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  text-align: left;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  box-sizing: border-box;
}

#content .gallery details[open] > summary.soul-summary-with-portrait {
  border-bottom: 1px solid #5e4d3a;
}

#content .gallery summary.soul-summary-with-portrait::-webkit-details-marker {
  display: none;
}

#content .gallery summary.soul-summary-with-portrait::after,
#content .gallery details[open] > summary.soul-summary-with-portrait::after {
  content: none;
  display: none;
}

#content .gallery summary.soul-summary-with-portrait:hover {
  background: #8d5b451f;
}

#content .gallery summary.soul-summary-with-portrait:focus-visible {
  outline: 2px solid var(--gold, #d8b476);
  outline-offset: -3px;
}

.soul-summary-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  flex-shrink: 0;
}

.soul-summary-portrait .soul-portrait-frame {
  width: var(--pg-portrait-width, 124px);
  aspect-ratio: var(--pg-portrait-ratio, 3 / 4);
  padding: var(--pg-portrait-frame-padding, 6px);
  margin: 0;
  box-sizing: border-box;
}

.soul-summary-main,
.soul-summary-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.soul-summary-title {
  margin: 0;
  font: 700 20px/1.25 Georgia, serif;
  color: var(--gold, #d8b476);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.soul-summary-legame,
.soul-summary-info .meta,
.soul-summary-role {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #cfc6ce;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.soul-toggle-indicator,
.soul-open-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #5e4d3a;
  background: rgba(20, 17, 24, 0.62);
  color: var(--gold, #d8b476);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.soul-toggle-chevron {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

#content .gallery details[open] > summary .soul-toggle-chevron {
  transform: rotate(180deg);
}

.soul-card-body {
  padding: 16px 18px 18px;
  background: rgba(14, 12, 18, 0.36);
  box-sizing: border-box;
  min-width: 0;
}

.soul-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.soul-card-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #5e4d3a;
  border-radius: 8px;
  background: rgba(22, 19, 27, 0.72);
  overflow: hidden;
  box-sizing: border-box;
}

.soul-card-field-head {
  margin: 0;
  padding: 9px 14px;
  font: 700 12px/1.25 Georgia, serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold, #d8b476);
  background: rgba(34, 27, 35, 0.72);
  border-bottom: 1px solid #4c3e30;
}

.soul-card-field-content,
.soul-card-legame,
.soul-card-notes {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14.5px;
  line-height: 1.6;
  color: #e8e1d8;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.soul-card-field-content p {
  margin: 0 0 8px;
}

.soul-card-field-content p:last-child,
.soul-card-field-content ul:last-child,
.soul-card-field-content ol:last-child {
  margin-bottom: 0;
}

.soul-card-field-content ul,
.soul-card-field-content ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

.soul-card-field-content li {
  margin-bottom: 4px;
}

.soul-card-field-content a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.soul-card-legame strong,
.soul-card-notes strong {
  color: var(--gold, #d8b476);
}

.soul-card-actions {
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid #4c3e30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

/* Header background preview in editors */
.header-bg-editor {
  margin: 14px 0 10px;
  padding: 14px;
  border: 1px solid #675845;
  border-radius: 7px;
  background: #16141a99;
}

.header-bg-editor h3 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--gold, #d8b476);
}

.header-bg-controls {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.header-bg-preview-frame {
  position: relative;
  width: 220px;
  aspect-ratio: 16 / 7;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #8c7049;
  background: linear-gradient(90deg, #101013ee, #18101955), url('assets/cavern.svg') center/cover;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.header-bg-preview-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(14, 13, 18, 0.36), rgba(20, 14, 22, 0.22));
  pointer-events: none;
}

.header-bg-preview-frame.is-empty::after {
  display: none;
}

.header-bg-preview-label {
  position: relative;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #f3ead9;
  text-shadow: 0 1px 5px #000, 0 0 8px rgba(0, 0, 0, 0.85);
}

.mpg-sr-file {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.mpg-tools-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #60513e;
}

.mpg-tools-section h3 {
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--gold, #d8b476);
}

/* Campaign Badges shared between Home PG cards and PG <header> */
.mpg-card-campaigns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #44382c;
}

.mpg-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.mpg-camp-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid #7d6748;
  background: linear-gradient(155deg, #271f24, #151419);
  color: var(--gold, #d8b476);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.mpg-camp-badge:hover,
.mpg-camp-badge:focus-visible,
.mpg-camp-badge[aria-expanded="true"] {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, #3e2830, #20181d);
  color: #fff3da;
  transform: translateY(-1px);
}

.mpg-camp-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
}

.mpg-camp-badge-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-camp-status-dot,
.mpg-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mpg-camp-badge .mpg-camp-status-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border: 1.5px solid #131116;
}

.mpg-camp-badge.is-in-progress .mpg-camp-status-dot,
.mpg-status-dot.is-in-progress,
.mpg-status-badge.is-in-progress .mpg-status-dot {
  background: #f3c64f;
  box-shadow: 0 0 6px rgba(243, 198, 79, 0.7);
}

.mpg-camp-badge.is-completed .mpg-camp-status-dot,
.mpg-status-dot.is-completed,
.mpg-status-badge.is-completed .mpg-status-dot {
  background: #57c97a;
  box-shadow: 0 0 6px rgba(87, 201, 122, 0.7);
}

.mpg-badge-detail-status {
  color: #cbbfa9;
}

/* Ornamental Divider & Campaigns Section on Start Screen */
.mpg-section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0 30px;
}

.mpg-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #8e6f46 35%, #8e6f46 65%, transparent);
  opacity: 0.75;
}

.mpg-divider-ornament {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--gold, #d8b476);
  stroke-width: 1.6;
  opacity: 0.9;
}

.mpg-campaigns-section {
  margin-top: 4px;
}

.mpg-campaigns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.mpg-campaigns-header h2 {
  margin: 0 0 4px;
  font-family: Georgia, serif;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 1.4px;
  color: var(--gold, #d8b476);
}

.mpg-campaign-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mpg-campaign-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 58px 20px 22px;
  border: 1px solid var(--border, #79694e);
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(31, 24, 29, 0.96), rgba(16, 16, 20, 0.98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48);
}

.mpg-campaign-card.has-custom-bg {
  background-color: #141218;
}

.mpg-campaign-card.has-custom-bg .mpg-campaign-title,
.mpg-campaign-card.has-custom-bg .mpg-campaign-subtitle,
.mpg-campaign-card.has-custom-bg .mpg-campaign-desc,
.mpg-campaign-card.has-custom-bg .mpg-campaign-part-label {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.94), 0 1px 2px rgba(0, 0, 0, 0.96);
}

.mpg-campaign-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.mpg-campaign-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid #96774c;
  background: linear-gradient(155deg, #312329, #18151b);
  color: var(--gold, #d8b476);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.mpg-campaign-emblem svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-campaign-heading {
  min-width: 0;
  flex: 1;
}

/* Fase 1B: Campaign footer placing participants on left & status badge on bottom-right */
.mpg-campaign-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(121, 105, 78, 0.42);
}

.mpg-campaign-participants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.mpg-campaign-status-corner {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-shrink: 0;
}

.mpg-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(2px);
}

.mpg-status-badge.is-in-progress {
  color: #fce49a;
  background: rgba(62, 45, 16, 0.88);
  border-color: rgba(243, 198, 79, 0.65);
}

.mpg-status-badge.is-completed {
  color: #c5f7d2;
  background: rgba(18, 52, 30, 0.88);
  border-color: rgba(87, 201, 122, 0.65);
}

.mpg-campaign-title {
  margin: 0 0 4px;
  font-family: Georgia, serif;
  font-size: clamp(19px, 2.5vw, 24px);
  line-height: 1.25;
  color: #f6e7c8;
  overflow-wrap: anywhere;
}

.mpg-campaign-subtitle {
  margin: 0;
  font-size: 14px;
  color: #d8c6aa;
  overflow-wrap: anywhere;
}

.mpg-campaign-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.58;
  color: #e2dadf;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.mpg-campaign-part-label {
  font-size: 11px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: #cfc1aa;
}

.mpg-campaign-part-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mpg-participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border-radius: 7px;
  border: 1px solid #6b5842;
  background: rgba(20, 17, 23, 0.88);
  color: #efe5d2;
  font-size: 13px;
}

.mpg-participant-avatar,
.mpg-pg-mini-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #9c7b4d;
  background: #241c23;
  color: var(--gold, #d8b476);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.mpg-participant-avatar img,
.mpg-pg-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mpg-campaign-no-pgs {
  font-size: 13px;
  color: var(--muted, #b6b0a6);
  font-style: italic;
}

/* Campaign & Home Header Modals */
.mpg-wide-dialog {
  max-width: 680px;
}

.mpg-field-block {
  margin: 14px 0;
}

.mpg-field-title {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--gold, #d8b476);
}

.mpg-icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.mpg-icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid #5e503e;
  background: #16141a;
  color: #d6c8b2;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.mpg-icon-option:hover,
.mpg-icon-option:focus-visible {
  border-color: #b58d52;
  background: #241d23;
  color: #fff2d6;
}

.mpg-icon-option.is-selected {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, #4b2831, #26191f);
  color: #ffe8ba;
  box-shadow: 0 0 0 1px #f0cf8e55, 0 4px 12px rgba(0, 0, 0, 0.45);
}

.mpg-icon-svg svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-icon-label {
  font-size: 12px;
  line-height: 1.25;
}

.mpg-status-select-label {
  display: block;
}

.mpg-status-select-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.mpg-status-select-row select {
  flex: 1;
  min-width: 170px;
  margin: 0;
}

.mpg-camp-participants-block {
  padding: 13px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(226, 180, 102, 0.78);
  background: linear-gradient(155deg, rgba(96, 34, 48, 0.62) 0%, rgba(44, 22, 34, 0.86) 58%, rgba(24, 18, 28, 0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 228, 174, 0.2), 0 6px 18px rgba(0, 0, 0, 0.36);
}

.mpg-camp-participants-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.mpg-camp-participants-head .mpg-field-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffe3a8;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mpg-camp-part-ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #f4c975;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mpg-camp-part-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(242, 200, 118, 0.68);
  background: linear-gradient(155deg, rgba(164, 58, 74, 0.85), rgba(108, 36, 48, 0.9));
  color: #fff3d6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mpg-camp-participants-hint {
  margin: 2px 0 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #f0dfbe;
}

.mpg-pg-multiselect {
  border: 1px solid #5e503e;
  border-radius: 8px;
  background: #151419;
  padding: 0;
}

.mpg-camp-participants-block .mpg-pg-multiselect {
  border-color: rgba(226, 184, 108, 0.66);
  background: rgba(22, 16, 24, 0.92);
}

.mpg-pg-multiselect > summary {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #efe5d2;
  user-select: none;
}

.mpg-camp-participants-block .mpg-pg-multiselect > summary {
  color: #fff1d4;
  font-weight: 600;
}

.mpg-pg-multiselect[open] > summary {
  border-bottom: 1px solid #483c2f;
}

.mpg-camp-participants-block .mpg-selected-pg-chip {
  border-color: rgba(232, 190, 112, 0.72);
  background: linear-gradient(155deg, rgba(118, 42, 56, 0.88), rgba(62, 23, 33, 0.92));
  color: #fff4dd;
}

.mpg-pg-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
}

.mpg-pg-check-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin: 0 !important;
  border-radius: 6px;
  cursor: pointer;
  color: #ede9e2 !important;
}

.mpg-pg-check-item:hover {
  background: rgba(141, 91, 69, 0.22);
}

.mpg-pg-check-item input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--gold, #d8b476);
}

.mpg-pg-check-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mpg-pg-check-lock {
  font-size: 11px;
  color: var(--gold, #d8b476);
}

.mpg-pg-check-empty {
  margin: 4px 6px;
}

.mpg-selected-pg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mpg-selected-pg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #7d6748;
  background: #231c21;
  color: #f4e7cd;
  font-size: 12px;
}

.mpg-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #e8b384;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.mpg-chip-remove:hover,
.mpg-chip-remove:focus-visible {
  background: rgba(201, 70, 77, 0.3);
  color: #fff;
}

.mpg-campaign-danger-zone {
  margin-top: 16px;
}

/* Favorite toggle on Spells / Abilities / Actions cards */
.mpg-entry-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mpg-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 5px;
  border-radius: 7px;
  border: 1px solid #6e5a42;
  background: #1a171d;
  color: #a89f92;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mpg-fav-btn .mpg-fav-ico {
  display: block;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.mpg-fav-btn.is-fav {
  border-color: #d8a85f;
  background: linear-gradient(155deg, #4b2d22, #291a16);
  color: #f8d88a;
  box-shadow: 0 0 0 1px rgba(248, 216, 138, 0.16);
}

.mpg-fav-btn:hover,
.mpg-fav-btn:focus-visible {
  border-color: #f0cf8e;
  color: #fff2cc;
  outline: none;
}

.mpg-fav-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(240, 207, 142, 0.35);
}

/* Special Views (Fase 6 Modalità sessione & Fase 7 Cerca nel PG) */
.mpg-special-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
}

.mpg-special-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.mpg-special-head h2 {
  margin: 0;
}

.mpg-panel-card {
  padding: 16px;
  border: 1px solid var(--border, #79694e);
  border-radius: 10px;
  background: linear-gradient(155deg, rgba(28, 22, 26, 0.94), rgba(16, 16, 20, 0.96));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
}

.mpg-panel-card h3 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  color: var(--gold, #d8b476);
}

.mpg-session-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.mpg-session-conc-val {
  margin: 0 0 12px;
  font-size: 16px;
  color: #f4e6cc;
}

.mpg-session-conc-active {
  border-color: #d8a85f;
  background: linear-gradient(150deg, #47212d, #24161c);
}

.mpg-session-cond-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #483b2f;
  border-radius: 7px;
  background: #141318;
  margin-bottom: 8px;
}

.mpg-session-res-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mpg-session-res-controls button {
  min-width: 36px;
  min-height: 36px;
}

.mpg-session-compendium {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 18px;
  border: 1px solid rgba(176, 138, 82, 0.58);
  border-radius: 12px;
  background:
    radial-gradient(circle at 8% 0%, rgba(196, 152, 86, 0.11), transparent 44%),
    linear-gradient(160deg, rgba(31, 21, 27, 0.88) 0%, rgba(18, 16, 22, 0.94) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 180, 118, 0.14),
    inset 0 1px 0 rgba(235, 204, 148, 0.16),
    0 8px 24px rgba(0, 0, 0, 0.44);
  box-sizing: border-box;
}

.mpg-comp-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 2px 2px 12px;
  border: 0;
  border-bottom: 1px solid rgba(176, 138, 82, 0.36);
  border-radius: 0;
  background: transparent;
}

.mpg-comp-banner strong {
  font-family: Georgia, serif;
  font-size: 16.5px;
  letter-spacing: 0.03em;
  color: var(--gold, #d8b476);
}

.mpg-comp-banner span {
  font-size: 13px;
  color: #cfc6c0;
}

@media (max-width: 640px) {
  .mpg-session-compendium {
    padding: 12px 11px 13px;
    gap: 12px;
    border-radius: 10px;
  }

  .mpg-comp-banner {
    padding: 0 2px 10px;
  }
}

.mpg-comp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3c3229;
}

.mpg-comp-section-head h3 {
  margin: 0;
}

.mpg-comp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid #79694e;
  background: #19161c;
  color: #f0d7a7;
  font-size: 12px;
  font-weight: 700;
}

.mpg-comp-empty {
  margin: 4px 0 0;
}

.mpg-comp-group + .mpg-comp-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #393029;
}

.mpg-comp-group-title {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d6bd92;
}

.mpg-comp-group-count {
  font-weight: 400;
  color: #9e958e;
}

.mpg-comp-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.mpg-comp-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 11px 13px;
  text-align: left;
  border: 1px solid #594b3b;
  border-radius: 9px;
  background: linear-gradient(155deg, #211b20, #151418);
  color: #f3ece2;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mpg-comp-item:hover,
.mpg-comp-item:focus-visible,
.mpg-comp-item.is-popover-open {
  border-color: #d8b476;
  background: linear-gradient(155deg, rgba(49, 35, 41, 0.92), rgba(28, 24, 29, 0.95));
  box-shadow: 0 0 0 1px rgba(216, 180, 118, 0.25), 0 8px 18px rgba(0, 0, 0, 0.42);
  outline: none;
}

.mpg-comp-item.is-concentrating {
  border-color: #d8a85f;
  background: linear-gradient(150deg, #3c1e29, #1f1419);
  box-shadow: 0 0 0 1px rgba(216, 168, 95, 0.35), 0 6px 18px rgba(110, 40, 45, 0.38);
}

.mpg-comp-use-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #8a6c45;
  border-radius: 6px;
  background: linear-gradient(155deg, #3b242a, #21181c);
  color: #f7e6c4;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.mpg-comp-use-btn:hover:not(:disabled),
.mpg-comp-use-btn:focus-visible:not(:disabled) {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, #542d36, #2c1e24);
  color: #fff5df;
  outline: 2px solid #d8b476;
  outline-offset: 1px;
}

.mpg-comp-use-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mpg-comp-use-btn.is-free {
  border-color: #5b7c54;
  background: linear-gradient(155deg, #213624, #152118);
  color: #d7f2d0;
}

.mpg-comp-use-btn.is-ritual {
  border-color: #5d6c89;
  background: linear-gradient(155deg, #20283a, #151923);
  color: #d6e2fa;
}

.mpg-comp-use-btn.is-conc {
  border-color: #9e7e4f;
  background: linear-gradient(155deg, #33271e, #1d1714);
  color: #f1dcb1;
}

.mpg-comp-use-btn.is-conc.is-active {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, #5b2833, #31191f);
  color: #fff4d6;
}

.mpg-session-res-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.mpg-session-res-head h3 {
  margin: 0;
}

.mpg-session-res-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.mpg-sess-res-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #483b2f;
  border-radius: 7px;
  background: #141318;
  margin-bottom: 8px;
}

.mpg-sess-res-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mpg-sess-res-info strong {
  font-size: 13px;
  color: #f4e6cc;
  overflow-wrap: anywhere;
}

.mpg-comp-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.mpg-comp-item-name {
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.28;
  color: #f7e6c4;
  overflow-wrap: anywhere;
}

.mpg-comp-item-it {
  font-size: 12px;
  line-height: 1.3;
  color: #bfb5ad;
  overflow-wrap: anywhere;
}

.mpg-comp-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.mpg-comp-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #4d4034;
  background: #141216;
  color: #dcd1c5;
  font-size: 11px;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Body-mounted opaque popover for personal descriptions */
#mpg-compendium-popover.mpg-compendium-popover {
  position: fixed;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  border: 1px solid #c9a363;
  border-radius: 12px;
  background: #17141a;
  color: #f2ebe1;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.88), 0 0 0 1px rgba(201, 163, 99, 0.28);
  opacity: 1;
  overflow: hidden;
  box-sizing: border-box;
}

#mpg-compendium-popover[hidden] {
  display: none !important;
}

.mpg-comp-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  background: #221b22;
  border-bottom: 1px solid #4c3e30;
  flex-shrink: 0;
}

.mpg-comp-pop-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mpg-comp-pop-kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d8b476;
}

.mpg-comp-pop-title {
  font-family: Georgia, serif;
  font-size: 16px;
  line-height: 1.25;
  color: #faebd0;
  overflow-wrap: anywhere;
}

.mpg-comp-pop-it {
  font-size: 12px;
  color: #c7bdb4;
  overflow-wrap: anywhere;
}

.mpg-comp-pop-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #7a6447;
  background: #2b2126;
  color: #f8e3ba;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.mpg-comp-pop-close:hover,
.mpg-comp-pop-close:focus-visible {
  border-color: #f0cf8e;
  background: #472830;
  outline: none;
}

.mpg-comp-pop-info {
  padding: 9px 14px;
  background: #1c1820;
  border-bottom: 1px solid #3c3128;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.mpg-comp-pop-info[hidden],
.mpg-comp-pop-actions[hidden] {
  display: none !important;
}

.mpg-comp-pop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mpg-comp-pop-avail p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #e6d7b9;
}

.mpg-comp-pop-avail p + p {
  margin-top: 2px;
}

.mpg-comp-pop-body {
  flex: 1 1 auto;
  min-height: 64px;
  padding: 13px 15px 15px;
  background: #17141a;
  color: #f0e8dd;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  overscroll-behavior: auto;
}

.mpg-comp-pop-body.is-empty {
  color: #aba197;
  font-style: italic;
}

.mpg-comp-pop-actions {
  padding: 10px 14px 12px;
  background: #201a21;
  border-top: 1px solid #4c3e30;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.mpg-comp-pop-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mpg-comp-pop-reason {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #eab3a7;
}

.mpg-comp-pop-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #bfb6ad;
  font-style: italic;
}

.mpg-session-notes {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  box-sizing: border-box;
}

.mpg-search-result-card {
  padding: 14px 16px;
  border: 1px solid #6b5842;
  border-radius: 9px;
  background: linear-gradient(155deg, #211b20, #151418);
}

.mpg-search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.mpg-search-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #8a6e48;
  background: #271f24;
  color: #f3dcaf;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mpg-search-snippet {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #dad0db;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  body.mpg-home-active {
    padding-top: 0 !important;
  }

  #mpg-home-screen {
    padding: 16px 12px 38px;
  }

  #mpg-home-screen::before {
    height: clamp(420px, 66vh, 620px);
    background-image:
      linear-gradient(
        to bottom,
        rgba(16, 15, 17, 0.50) 0%,
        rgba(16, 15, 17, 0.36) 24%,
        rgba(16, 15, 17, 0.66) 58%,
        rgba(16, 15, 17, 0.92) 84%,
        var(--bg, #101011) 100%
      ),
      linear-gradient(
        to right,
        rgba(16, 15, 17, 0.78) 0%,
        rgba(16, 15, 17, 0.24) 24%,
        rgba(16, 15, 17, 0.24) 76%,
        rgba(16, 15, 17, 0.78) 100%
      ),
      radial-gradient(
        ellipse 74% 46% at 50% 14%,
        rgba(216, 180, 118, 0.14),
        rgba(92, 36, 44, 0.10) 48%,
        transparent 76%
      ),
      url("assets/home-fantasy-bg.webp");
  }

  .mpg-rune {
    opacity: 0.72;
  }

  .mpg-rune-1 { top: 14px; left: 10px; font-size: 24px; }
  .mpg-rune-9 { top: 16px; right: 10px; font-size: 24px; }
  .mpg-rune-3,
  .mpg-rune-5,
  .mpg-rune-7,
  .mpg-rune-8,
  .mpg-rune-11,
  .mpg-rune-13,
  .mpg-rune-15,
  .mpg-rune-16 {
    display: none;
  }

  .mpg-home-brand-banner {
    margin: 0 auto 6px;
    padding: 0 4px;
  }

  .mpg-home-brand-artwork {
    width: min(290px, 84vw);
  }

  .mpg-hero,
  .mpg-hero.mpg-campaigns-hero {
    padding: 18px 46px 16px 14px;
    margin-bottom: 14px;
  }

  .mpg-hero.mpg-campaigns-hero {
    padding-right: 14px;
  }

  .mpg-hero .mpg-home-title,
  .mpg-hero h1,
  .mpg-hero h2 {
    font-size: clamp(20px, 5.6vw, 26px);
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .mpg-hero-edit,
  .mpg-campaign-edit {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  .mpg-archive-bar {
    padding: 10px 12px;
  }

  .mpg-archive-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .mpg-save-archive-icon-btn[data-tooltip]::after {
    left: 0;
    transform: translate(0, 4px);
  }

  .mpg-save-archive-icon-btn[data-tooltip]:hover::after,
  .mpg-save-archive-icon-btn[data-tooltip]:focus-visible::after {
    transform: translate(0, 0);
  }

  .mpg-filter-bar,
  .mpg-filter-bar.mpg-filter-bar-with-action,
  .mpg-filter-bar.mpg-filter-bar-campaigns {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 10px 12px;
  }

  .mpg-filter-bar .mpg-filter-action-btn {
    width: 100%;
  }

  .mpg-campaign-card {
    padding: 18px 46px 16px 14px;
  }

  .mpg-campaign-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .mpg-campaign-status-corner {
    justify-content: flex-end;
  }

  .mpg-campaign-top {
    gap: 12px;
  }

  .mpg-campaign-emblem {
    width: 44px;
    height: 44px;
  }

  .mpg-campaign-emblem svg {
    width: 24px;
    height: 24px;
  }

  .mpg-icon-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 240px;
  }

  .mpg-grid {
    grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
    gap: 12px;
  }

  .mpg-card-wrap {
    padding: 8px 9px 13px;
  }

  .mpg-card-head {
    min-height: 32px;
  }

  .mpg-card-edit {
    width: 32px;
    height: 32px;
  }

  .mpg-card {
    padding: 2px 2px 0;
    gap: 10px;
  }

  .mpg-card-portrait {
    width: 104px;
  }

  .mpg-placeholder-initial {
    font-size: 32px;
  }

  .mpg-card-name {
    font-size: 15px;
  }

  #mpg-switch-nav {
    padding: 8px 9px;
    margin-bottom: 6px;
  }

  .mpg-nav-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mpg-nav-tool-btn {
    min-width: 0;
    text-align: left;
    line-height: 1.25;
  }

  .mpg-nav-tool-btn span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #content .gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .soul-card-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .soul-card-layout .soul-portrait-frame {
    width: var(--pg-portrait-width, 84px);
    padding: var(--pg-portrait-frame-padding, 4px);
    margin: 0 auto;
  }

  #content .gallery summary.soul-summary-with-portrait,
  #content .gallery .v711-summary.soul-summary-with-portrait,
  #content .gallery .v711-head.soul-summary-with-portrait {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 12px 14px;
    gap: 10px 14px;
  }

  .soul-summary-portrait {
    grid-row: 1 / span 2;
    align-self: center;
  }

  .soul-summary-portrait .soul-portrait-frame {
    width: var(--pg-portrait-width, 84px);
    padding: var(--pg-portrait-frame-padding, 4px);
  }

  .soul-portrait-frame .header-portrait-placeholder {
    gap: 4px;
    padding: 6px;
  }

  .soul-portrait-frame .header-portrait-placeholder svg {
    width: 26px;
    height: 26px;
  }

  .soul-portrait-frame .header-portrait-placeholder span {
    font-size: 9px;
    letter-spacing: 0.9px;
  }

  .soul-summary-title {
    font-size: 18px;
  }

  .soul-toggle-indicator,
  .soul-open-hint {
    grid-column: 2;
    justify-self: start;
    font-size: 11px;
  }

  .soul-card-body {
    padding: 14px;
  }

  .soul-card-fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .soul-card-actions {
    margin-top: 14px;
    padding-top: 12px;
    gap: 8px;
  }

  .soul-card-actions > button {
    max-width: 100%;
  }

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

  .header-bg-preview-frame {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }

  .mpg-session-top-grid,
  .mpg-session-res-grid,
  .mpg-comp-items,
  .mpg-fav-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Editor di testo con formattazione (AlyndraRichText)
   ========================================================= */
.aly-rt-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid #6b5842;
  border-radius: 7px;
  overflow: hidden;
  background: #141318;
}

.aly-rt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-bottom: 1px solid #594a39;
  background: #1d1921;
}

.aly-rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid #5e503e;
  border-radius: 5px;
  background: #272129;
  color: #ede5d8;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.aly-rt-btn:hover,
.aly-rt-btn:focus-visible {
  border-color: #d8b476;
  background: #3a2b31;
  color: #fff4da;
  outline: none;
}

.aly-rt-btn.is-active {
  border-color: #e4be7b;
  background: #553528;
  color: #ffeab9;
}

.aly-rt-font-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}

.aly-rt-font-lbl {
  font-size: 11.5px;
  color: #c5b69f;
  white-space: nowrap;
  user-select: none;
}

.aly-rt-font-select,
.aly-rt-toolbar select.aly-rt-font-select {
  width: auto !important;
  max-width: 190px;
  min-height: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  padding: 2px 8px !important;
  border: 1px solid #6b5842;
  border-radius: 5px;
  background: #17131a;
  color: #f0e4ce;
  font-size: 12px !important;
  line-height: 1.25 !important;
  cursor: pointer;
  box-sizing: border-box;
  vertical-align: middle;
}

.aly-rt-font-select:hover,
.aly-rt-font-select:focus-visible,
.aly-rt-toolbar select.aly-rt-font-select:hover,
.aly-rt-toolbar select.aly-rt-font-select:focus-visible {
  border-color: #d8b476;
  background: #231922;
  color: #fff4da;
  outline: none;
}

.aly-font-serif {
  font-family: Georgia, "Times New Roman", serif !important;
}

.aly-font-antiqua {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif !important;
}

.aly-font-sans {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
}

.aly-font-humanist {
  font-family: "Trebuchet MS", Verdana, "Segoe UI", sans-serif !important;
}

.mpg-session-notes-slot {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
}

.mpg-session-notes-slot .aly-rt-wrap {
  border-color: rgba(154, 126, 182, 0.55);
  background: #14111a;
}

.mpg-session-notes-slot .aly-rt-toolbar {
  padding: 5px 7px;
  gap: 4px 5px;
  background: #1b1523;
  border-bottom-color: rgba(154, 126, 182, 0.35);
}

.mpg-session-notes-slot .aly-rt-surface {
  min-height: 105px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 14.5px;
  line-height: 1.62;
}

@media (max-width: 640px) {
  .aly-rt-toolbar {
    gap: 4px;
    padding: 5px 6px;
  }

  .aly-rt-btn {
    min-width: 28px;
    min-height: 28px;
    padding: 3px 6px;
    font-size: 11.5px;
  }

  .aly-rt-font-wrap {
    margin-left: 0;
    flex: 1 1 100%;
    padding-top: 2px;
  }

  .aly-rt-font-select {
    flex: 1 1 auto;
    max-width: 100%;
  }
}

.aly-rt-surface {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  background: #131217;
  color: #efe9df;
  font: 15px/1.68 system-ui, sans-serif;
  white-space: pre-wrap;
  outline: none;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .aly-rt-surface {
    font-size: 16px;
  }
}

.aly-rt-surface.is-compact {
  min-height: 54px;
  padding: 9px 12px;
}

.aly-rt-surface.is-tall {
  min-height: 260px;
  font-size: 17px;
  line-height: 1.8;
}

.aly-rt-surface:focus {
  box-shadow: inset 0 0 0 1px #c9a363;
}

.aly-rt-surface:empty::before {
  content: attr(data-placeholder);
  color: #8f8880;
  pointer-events: none;
}

.aly-rt-surface p,
.aly-rt-content p {
  margin: 0 0 0.55em;
}

.aly-rt-surface p:last-child,
.aly-rt-content p:last-child {
  margin-bottom: 0;
}

.aly-rt-surface ul,
.aly-rt-surface ol,
.aly-rt-content ul,
.aly-rt-content ol {
  margin: 0.35em 0 0.55em;
  padding-left: 1.35em;
}

.aly-rt-surface li + li,
.aly-rt-content li + li {
  margin-top: 0.2em;
}

.aly-rt-content.is-plain {
  white-space: pre-wrap;
}

.aly-rt-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.aly-rt-content-inline {
  display: inline;
}

.aly-rt-content-inline p {
  display: inline;
  margin: 0;
}

/* =========================================================
   Indicatori di turno a 5 categorie: M / A / I / B / R
   Colori: M #38bdf8, A #22c55e, I #eab308, B #f97316, R #ef4444
   ========================================================= */
#mpg-turn-nav {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 9px 0;
  padding: 10px 11px;
  border: 1px solid #6b5842;
  border-radius: 7px;
  background: linear-gradient(155deg, #211a20, #151419);
  box-sizing: border-box;
}

#mpg-turn-nav-bar {
  display: block;
  width: 100%;
  min-width: 0;
}

.mpg-turn-head,
.mpg-turn-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  min-width: 0;
}

.mpg-turn-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gold, #d8b476);
}

.mpg-turn-title-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--gold, #d8b476);
}

.mpg-turn-title-ico svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-turn-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.mpg-turn-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.mpg-turn-row-secondary {
  justify-content: flex-start;
}

#mpg-turn-nav .mpg-turn-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
  width: 100%;
}

#mpg-turn-nav .mpg-turn-row.mpg-turn-row-secondary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.48fr);
}

#mpg-turn-nav .mpg-turn-pill,
#mpg-turn-nav .mpg-turn-reset-btn {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 6px;
}

#mpg-turn-nav .mpg-turn-reset-btn {
  padding: 4px 7px;
  font-size: 11.5px;
}

#mpg-turn-nav .mpg-turn-hover-info {
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.mpg-turn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 42px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease, transform 0.12s ease;
}

.mpg-turn-pill svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.mpg-turn-pill:hover,
.mpg-turn-pill:focus-visible {
  transform: translateY(-1px);
  outline: 2px solid #f0cf8e66;
  outline-offset: 1px;
}

/* 5 category available colors */
.mpg-turn-pill.is-move {
  border-color: #38bdf8;
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.24), rgba(14, 52, 74, 0.72));
  color: #e0f5ff;
  box-shadow: 0 2px 7px rgba(56, 189, 248, 0.22);
}

.mpg-turn-pill.is-action {
  border-color: #22c55e;
  background: linear-gradient(155deg, rgba(34, 197, 94, 0.24), rgba(14, 62, 34, 0.72));
  color: #dcfce7;
  box-shadow: 0 2px 7px rgba(34, 197, 94, 0.22);
}

.mpg-turn-pill.is-interaction {
  border-color: #eab308;
  background: linear-gradient(155deg, rgba(234, 179, 8, 0.24), rgba(70, 52, 10, 0.76));
  color: #fef3c7;
  box-shadow: 0 2px 7px rgba(234, 179, 8, 0.2);
}

.mpg-turn-pill.is-bonus {
  border-color: #f97316;
  background: linear-gradient(155deg, rgba(249, 115, 22, 0.26), rgba(78, 34, 10, 0.76));
  color: #ffedd5;
  box-shadow: 0 2px 7px rgba(249, 115, 22, 0.22);
}

.mpg-turn-pill.is-reaction {
  border-color: #ef4444;
  background: linear-gradient(155deg, rgba(239, 68, 68, 0.26), rgba(76, 18, 22, 0.76));
  color: #fee2e2;
  box-shadow: 0 2px 7px rgba(239, 68, 68, 0.22);
}

/* Used / darkened state (clearly spent yet legible) */
.mpg-turn-pill.is-used {
  border-color: #46434b;
  background: #161519;
  color: #847f89;
  box-shadow: none;
  opacity: 0.62;
  text-decoration: line-through;
}

.mpg-turn-pill.is-used:hover,
.mpg-turn-pill.is-used:focus-visible {
  opacity: 0.9;
  border-color: #7d6748;
  color: #d2cbc0;
}

.mpg-turn-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid #7d6748;
  background: linear-gradient(155deg, #2d2328, #19161b);
  color: #f3dcaf;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mpg-turn-reset-btn:hover,
.mpg-turn-reset-btn:focus-visible {
  border-color: #e4be7b;
  background: linear-gradient(155deg, #452b33, #23191f);
  color: #fff3da;
}

.mpg-turn-hover-info {
  margin-top: 2px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(12, 11, 16, 0.72);
  border: 1px solid rgba(125, 103, 72, 0.28);
  font-size: 11px;
  line-height: 1.38;
  color: #c9c1b5;
}

.mpg-turn-hover-info strong {
  color: #f1dbb0;
}

@media (max-width: 760px) {
  #livepanel > #mpg-turn-nav {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 7px 8px;
    box-sizing: border-box;
  }

  #mpg-turn-nav .mpg-turn-nav-head {
    margin-bottom: 5px;
  }

  #mpg-turn-nav .mpg-turn-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.28fr);
    gap: 6px;
    align-items: stretch;
  }

  #mpg-turn-nav .mpg-turn-hover-info {
    grid-column: 1 / -1;
    margin-top: 0;
    padding: 4px 7px;
    font-size: 10.5px;
  }

  #mpg-turn-nav .mpg-turn-pill {
    min-width: 0;
    min-height: 30px;
    padding: 3px 5px;
    font-size: 12px;
  }

  #mpg-turn-nav .mpg-turn-reset-btn {
    min-width: 0;
    min-height: 30px;
    padding: 3px 7px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  #mpg-turn-nav .mpg-turn-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  #mpg-turn-nav .mpg-turn-row.mpg-turn-row-secondary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.55fr);
  }
}

/* Modalità Sessione: 5 riquadri compatti espandibili */
.mpg-session-turn-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#mpg-session-turn-panels,
.mpg-session-turn-panels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mpg-session-turn-row1,
.mpg-session-turn-row2 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mpg-session-turn-item {
  --turn-accent: #d8b476;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 11px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--turn-accent) 55%, #2a242c);
  background: linear-gradient(160deg, color-mix(in srgb, var(--turn-accent) 13%, #1e1a22), #15141a);
  transition: opacity 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.mpg-session-turn-item.is-move { --turn-accent: #38bdf8; }
.mpg-session-turn-item.is-action { --turn-accent: #22c55e; }
.mpg-session-turn-item.is-interaction { --turn-accent: #eab308; }
.mpg-session-turn-item.is-bonus { --turn-accent: #f97316; }
.mpg-session-turn-item.is-reaction { --turn-accent: #ef4444; }

.mpg-session-turn-item.is-used {
  border-color: #423e48;
  background: #141318;
  opacity: 0.72;
}

.mpg-st-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mpg-st-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mpg-st-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--turn-accent) 18%, #121116);
  border: 1px solid color-mix(in srgb, var(--turn-accent) 52%, transparent);
  color: var(--turn-accent);
  flex: 0 0 auto;
}

.mpg-session-turn-item.is-used .mpg-st-icon {
  color: #8a8490;
  border-color: #46424d;
  background: #1a191f;
}

.mpg-st-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-st-name {
  display: block;
  font-size: 13.5px;
  line-height: 1.2;
  color: #f3ece0;
}

.mpg-st-sym {
  color: var(--turn-accent);
  font-weight: 700;
}

.mpg-session-turn-item.is-used .mpg-st-name {
  color: #9e98a3;
  text-decoration: line-through;
}

.mpg-st-state {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: color-mix(in srgb, var(--turn-accent) 82%, #ffffff);
}

.mpg-session-turn-item.is-used .mpg-st-state {
  color: #8f8995;
}

.mpg-st-toggle-btn {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 6px;
  border: 1px solid #6b5842;
  background: #231d25;
  color: #f1dfbc;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mpg-st-toggle-btn:hover,
.mpg-st-toggle-btn:focus-visible {
  border-color: var(--turn-accent);
  color: #fff;
}

.mpg-st-short {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #cbc3b7;
}

.mpg-st-more {
  margin-top: auto;
  border-top: 1px solid rgba(125, 103, 72, 0.22);
  padding-top: 5px;
  font-size: 11.5px;
  color: #b7afa4;
}

.mpg-st-more summary {
  cursor: pointer;
  color: #dec089;
  font-weight: 600;
  user-select: none;
}

.mpg-st-more p {
  margin: 6px 0 0;
  line-height: 1.45;
  color: #d6cfc3;
}

.mpg-session-turn-reset-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px dashed #7d6748;
  background: linear-gradient(160deg, #211a22, #151419);
}

.mpg-session-turn-reset-box p {
  margin: 0;
  font-size: 12px;
  line-height: 1.42;
}

.mpg-session-reset-big {
  width: 100%;
  min-height: 36px;
  font-size: 13px;
}

/* Badge informativi del costo nel turno accanto ai pulsanti Usa/Lancia */
.mpg-btn-with-cost {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.mpg-turn-cost-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  pointer-events: none;
  user-select: none;
}

.mpg-turn-cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.03em;
}

.mpg-turn-cost-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-turn-cost-badge.is-move {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.mpg-turn-cost-badge.is-action {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.mpg-turn-cost-badge.is-interaction {
  border-color: rgba(234, 179, 8, 0.55);
  background: rgba(234, 179, 8, 0.14);
  color: #fde047;
}

.mpg-turn-cost-badge.is-bonus {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
}

.mpg-turn-cost-badge.is-reaction {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.mpg-turn-cost-none,
.mpg-turn-cost-unconf {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
  user-select: none;
}

.mpg-turn-cost-none {
  border: 1px solid #4d4854;
  background: #1b1920;
  color: #b5aebc;
}

.mpg-turn-cost-unconf {
  border: 1px solid rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.09);
  color: #e8cf86;
}

/* Selezione multipla "Costo nel turno" nei moduli di modifica voce */
.mpg-turn-cost-fieldset {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #5e503e;
  border-radius: 7px;
  background: #151419;
}

.mpg-turn-cost-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--gold, #d8b476);
}

.mpg-turn-cost-help {
  margin: 0 0 8px;
  font-size: 12px;
}

.mpg-turn-cost-checks,
.mpg-turn-cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.mpg-turn-cost-none-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(125, 103, 72, 0.22);
}

.mpg-turn-opt,
.mpg-turn-cost-checks label,
.mpg-turn-cost-row label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #3c3643;
  background: #1b1921;
  font-size: 12.5px;
  cursor: pointer;
}

.mpg-turn-opt svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-turn-opt.is-move { border-color: rgba(56, 189, 248, 0.4); color: #bae6fd; }
.mpg-turn-opt.is-action { border-color: rgba(34, 197, 94, 0.4); color: #bbf7d0; }
.mpg-turn-opt.is-interaction { border-color: rgba(234, 179, 8, 0.4); color: #fef08a; }
.mpg-turn-opt.is-bonus { border-color: rgba(249, 115, 22, 0.4); color: #fed7aa; }
.mpg-turn-opt.is-reaction { border-color: rgba(239, 68, 68, 0.4); color: #fecaca; }
.mpg-turn-opt.is-none { border-color: #544e5c; color: #d3ccd9; }

.mpg-turn-decision-dialog {
  max-width: 480px;
}

/* Shared Possession Dialog (usable on all pages) */
.v710-poss-dialog {
  max-width: 640px;
  width: min(94vw, 640px);
}

.v710-poss-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v710-poss-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v710-armi-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.v710-subcat-empty {
  margin: 22px 0 0;
  font-size: 12.5px;
}

.v710-poss-qty-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}

.v710-qty-step-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.v710-qty-step-row button {
  min-width: 34px;
  min-height: 34px;
  font-size: 16px;
  font-weight: 700;
}

.v710-qty-step-row input {
  width: 110px;
  text-align: center;
}

.v710-poss-optional-details {
  border: 1px solid #4c4138;
  border-radius: 8px;
  padding: 9px 11px;
  background: #141319;
}

.v710-poss-optional-details summary {
  cursor: pointer;
  color: var(--gold, #d8b476);
  font-weight: 600;
  font-size: 13px;
}

.v710-poss-opt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.v710-poss-att-extra,
.v710-poss-price-extra,
.v710-poss-weight-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.v710-poss-att-extra {
  grid-template-columns: 1fr;
}

.mpg-inline-check {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #d6cec0;
}

/* Session Mode Possedimenti + Borsello */
.mpg-sess-coins-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #5b4b38;
  background: linear-gradient(155deg, #211b20, #151419);
}

.mpg-sess-coins-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.mpg-sess-coins-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f0d7a3;
  font-size: 13.5px;
}

.mpg-sess-coins-title svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-sess-coins-link {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #6b5842;
  background: #231c24;
  color: #ebd3a2;
  cursor: pointer;
}

.mpg-sess-coins-link:hover,
.mpg-sess-coins-link:focus-visible {
  border-color: #e4be7b;
  color: #fff3da;
}

.mpg-sess-coins-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mpg-coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--coin-color, #d8b476) 45%, #342f39);
  background: rgba(16, 15, 20, 0.84);
  font-size: 12.5px;
  color: #f2ebe0;
}

.mpg-coin-code {
  font-weight: 700;
  color: var(--coin-color, #d8b476);
  letter-spacing: 0.04em;
}

.mpg-sess-poss-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.mpg-sess-poss-search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 340px;
}

.mpg-sess-poss-cat {
  flex: 0 1 220px;
  min-width: 150px;
}

.mpg-sess-poss-note {
  font-size: 12px;
}

.mpg-comp-cat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #dfc088;
  flex: 0 0 auto;
}

.mpg-comp-cat-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-comp-item.is-possession,
.mpg-comp-item.mpg-comp-possession {
  min-height: 44px;
}

/* Session Mode: Riquadro Preferiti sotto Appunti rapidi di sessione */
.mpg-session-favorites-card {
  margin-top: 0;
  border-color: #7b6344;
  background: linear-gradient(160deg, #211a23, #15141a);
}

.mpg-fav-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

/* Unified Session Mode card frame with integrated top-right favorite star */
.mpg-comp-card {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  border: 1px solid #594b3b;
  border-radius: 9px;
  background: linear-gradient(155deg, #211b20, #151418);
  color: #f3ece2;
  box-sizing: border-box;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mpg-comp-card:has(> .mpg-comp-card-trigger:hover),
.mpg-comp-card:has(> .mpg-comp-card-trigger:focus-visible),
.mpg-comp-card:has(> .mpg-comp-card-trigger.is-popover-open) {
  border-color: #d8b476;
  background: linear-gradient(155deg, rgba(49, 35, 41, 0.92), rgba(28, 24, 29, 0.95));
  box-shadow: 0 0 0 1px rgba(216, 180, 118, 0.25), 0 8px 18px rgba(0, 0, 0, 0.42);
}

.mpg-comp-card.is-concentrating {
  border-color: #d8a85f;
  background: linear-gradient(150deg, #3c1e29, #1f1419);
  box-shadow: 0 0 0 1px rgba(216, 168, 95, 0.35), 0 6px 18px rgba(110, 40, 45, 0.38);
}

.mpg-comp-card > .mpg-comp-card-trigger {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: 52px;
  padding: 10px 4px 10px 12px;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.mpg-comp-card > .mpg-comp-card-trigger:hover,
.mpg-comp-card > .mpg-comp-card-trigger:focus-visible,
.mpg-comp-card > .mpg-comp-card-trigger.is-popover-open,
.mpg-comp-card > .mpg-comp-card-trigger.is-concentrating {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.mpg-comp-card > .mpg-comp-card-trigger:focus-visible {
  outline: 2px solid #d8b476;
  outline-offset: -2px;
}

.mpg-comp-card > .mpg-comp-card-trigger .mpg-comp-item-meta-right {
  justify-content: flex-start;
}

.mpg-comp-card > .mpg-comp-fav-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  margin: 6px 6px 6px 0;
  padding: 0;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #b7a892;
  box-shadow: none;
}

.mpg-comp-card > .mpg-comp-fav-btn .mpg-fav-ico {
  width: 17px;
  height: 17px;
}

.mpg-comp-card > .mpg-comp-fav-btn.is-fav {
  border-color: rgba(216, 168, 95, 0.45);
  background: rgba(216, 168, 95, 0.14);
  color: #f8d88a;
  box-shadow: none;
}

.mpg-comp-card > .mpg-comp-fav-btn:hover,
.mpg-comp-card > .mpg-comp-fav-btn:focus-visible {
  border-color: #f0cf8e;
  background: rgba(240, 207, 142, 0.16);
  color: #fff2cc;
}

.mpg-comp-card > .mpg-fav-remove-btn:hover,
.mpg-comp-card > .mpg-fav-remove-btn:focus-visible {
  border-color: rgba(239, 68, 68, 0.72);
  background: rgba(127, 29, 29, 0.38);
  color: #ffd7d7;
}

.mpg-fav-trigger .mpg-comp-item-main {
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
}

.mpg-fav-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mpg-fav-prov {
  font-size: 11px;
  color: #b7afa4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mpg-fav-costs {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

/* ============================================================================
   VERSIONE 8 — COSTI INLINE, ANIME INTRECCIATE FORM, CONDIZIONI SESSIONE,
   IMMAGINI POSSEDIMENTI
   ============================================================================ */

/* Inline informative M/A/B/I/R cost badges on base cards & Session compendium */
.mpg-entry-cost-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 4px 0 8px;
}

.mpg-inline-cost-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.mpg-inline-cost-badges .mpg-turn-cost-badge {
  opacity: 1 !important;
  filter: none !important;
  pointer-events: none;
}

.mpg-comp-item-meta-right {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.mpg-comp-item-costs {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Anime intrecciate creation/edit modal form containment */
#personform.soul-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

#personform.soul-edit-form *,
#personform.soul-edit-form *::before,
#personform.soul-edit-form *::after {
  box-sizing: border-box;
}

#personform.soul-edit-form > label,
#personform.soul-edit-form > div {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}

#personform.soul-edit-form input[type="text"],
#personform.soul-edit-form input[type="file"],
#personform.soul-edit-form textarea,
#personform.soul-edit-form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#personform.soul-edit-form .aly-rt-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#personform.soul-edit-form .soul-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #493f34;
}

/* Session Mode: unified condition badges + Dettagli / Rimuovi controls */
.mpg-session-cond-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.mpg-session-cond-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid #594b3b;
  background: rgba(18, 16, 22, 0.72);
}

.mpg-session-cond-item .mpg-session-cond-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.mpg-sess-cond-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.mpg-sess-cond-badge svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.mpg-sess-cond-name {
  overflow-wrap: anywhere;
}

.mpg-session-cond-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.mpg-sess-cond-detail-btn.is-open,
.mpg-sess-cond-detail-btn.has-notes {
  border-color: var(--gold, #d8b476);
  color: #f6e3be;
}

.mpg-sess-cond-detail-panel {
  padding-top: 6px;
  border-top: 1px dotted #56493c;
}

.mpg-sess-cond-detail-panel[hidden] {
  display: none !important;
}

.mpg-sess-cond-detail-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 11.5px;
  color: #cfc5b7;
}

.mpg-sess-cond-notes {
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 6px 8px;
  font-size: 12.5px;
  line-height: 1.45;
  box-sizing: border-box;
}

/* Possedimenti optional image picker in dialog & Session Mode thumbnails/popover */
.v710-poss-img-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #5c4e3e;
  background: rgba(16, 15, 20, 0.65);
}

.v710-poss-img-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.v710-poss-img-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 1px solid #756044;
  background: rgba(12, 11, 16, 0.88);
  overflow: hidden;
  flex-shrink: 0;
}

.v710-poss-img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.v710-poss-img-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--gold, #d8b476);
}

.v710-poss-img-fallback svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v710-poss-img-preview-box img[hidden],
.v710-poss-img-fallback[hidden] {
  display: none !important;
}

.v710-poss-img-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 180px;
  min-width: 0;
}

.v710-poss-img-status {
  margin: 0;
  font-size: 12px;
}

.mpg-comp-poss-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid #6b5842;
  background: rgba(14, 13, 18, 0.85);
  overflow: hidden;
  flex: 0 0 28px;
}

.mpg-comp-poss-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mpg-comp-poss-thumb-img[hidden],
.mpg-comp-poss-fallback[hidden],
.mpg-comp-pop-img-wrap[hidden],
.mpg-comp-pop-img[hidden] {
  display: none !important;
}

.mpg-comp-pop-img-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
  margin-bottom: 8px;
  border-radius: 7px;
  border: 1px solid #594a39;
  background: rgba(12, 11, 16, 0.78);
}

.mpg-comp-pop-img {
  display: block;
  max-width: 100%;
  max-height: 165px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 5px;
}

@media (max-width: 820px) {
  .mpg-session-turn-row1,
  .mpg-session-turn-row2 {
    grid-template-columns: 1fr;
  }

  .v710-poss-form-grid,
  .v710-poss-opt-grid,
  .v710-poss-price-extra,
  .v710-poss-weight-row {
    grid-template-columns: 1fr;
  }

  #personform.soul-edit-form .soul-form-actions {
    justify-content: stretch;
  }

  #personform.soul-edit-form .soul-form-actions > button {
    flex: 1 1 120px;
  }
}

/* =========================================================
   VERSIONE 8 — COMPONENTI CONDIVISI SCOPED, SALVATAGGIO,
   COLLEGAMENTI NARRATIVI, FILTRI SESSIONE & PROTEZIONI
   ========================================================= */

.ui-btn-primary,
.ui-btn-secondary,
.ui-btn-danger,
.ui-btn-icon,
.ui-nav-chip {
  font: inherit;
  box-sizing: border-box;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.ui-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #c8a56a;
  background: linear-gradient(180deg, #6e273e, #4e192a);
  color: #f9eed8;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.ui-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #812f49, #5d1f33);
  border-color: #e2c287;
}

.ui-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid rgba(195, 158, 98, 0.54);
  background: linear-gradient(155deg, #2d1b22, #1c1317);
  color: #f2e5ce;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.25;
}

.ui-btn-secondary:hover:not(:disabled) {
  background: linear-gradient(155deg, #40242e, #281920);
  border-color: #e2c287;
  color: #fff5e0;
}

.ui-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid #c86472;
  background: linear-gradient(180deg, #5a1824, #3d0f18);
  color: #ffe0e4;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.2;
}

.ui-btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #74202f, #501520);
  border-color: #e68290;
  color: #fff2f4;
}

.ui-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(200, 165, 106, 0.35);
  background: rgba(24, 19, 24, 0.85);
  color: #e7d7bc;
}

.ui-btn-icon:hover:not(:disabled) {
  background: rgba(102, 32, 48, 0.85);
  border-color: #d9828e;
  color: #fff;
}

.ui-btn-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-btn-primary:focus-visible,
.ui-btn-secondary:focus-visible,
.ui-btn-danger:focus-visible,
.ui-btn-icon:focus-visible,
.ui-nav-chip:focus-visible {
  outline: 2px solid #e6c686;
  outline-offset: 2px;
}

.ui-btn-primary:disabled,
.ui-btn-secondary:disabled,
.ui-btn-danger:disabled,
.ui-btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  border: 1px solid rgba(200, 165, 106, 0.35);
  background: rgba(34, 28, 33, 0.85);
  color: #e8dac2;
  white-space: nowrap;
}

.ui-card {
  border: 1px solid rgba(154, 130, 92, 0.42);
  border-radius: 10px;
  background: rgba(24, 20, 25, 0.92);
  padding: 12px 14px;
}

.ui-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(173, 146, 102, 0.38);
  background: rgba(26, 22, 27, 0.88);
  color: #e5d8c2;
  font-size: 0.83rem;
  line-height: 1.25;
  max-width: 100%;
}

.ui-nav-chip:hover:not(:disabled) {
  border-color: rgba(220, 188, 128, 0.72);
  background: rgba(48, 34, 41, 0.92);
  color: #fff6e5;
}

.ui-nav-chip.is-active {
  border-color: #d4b072;
  background: linear-gradient(180deg, #652338, #481727);
  color: #fdf2dc;
  font-weight: 600;
}

/* Indicatore discreto stato salvataggio */
.v8-save-status-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 24px;
}

.v8-save-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.79rem;
  line-height: 1.25;
  border: 1px solid transparent;
  max-width: 100%;
}

.v8-save-status.is-idle {
  display: none;
}

.v8-save-status.is-dirty {
  background: rgba(54, 39, 18, 0.75);
  border-color: rgba(224, 178, 92, 0.55);
  color: #f6d591;
}

.v8-save-status.is-saving {
  background: rgba(34, 31, 40, 0.82);
  border-color: rgba(176, 166, 190, 0.45);
  color: #ddd6e5;
}

.v8-save-status.is-saved {
  background: rgba(22, 42, 31, 0.72);
  border-color: rgba(102, 168, 124, 0.48);
  color: #b7e5c4;
}

.v8-save-status.is-error {
  background: rgba(66, 20, 28, 0.88);
  border-color: rgba(214, 98, 112, 0.7);
  color: #ffc5cc;
}

.v8-save-status-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.v8-save-status-ico svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v8-save-retry {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 0.76rem;
  margin-left: 4px;
}

.v8-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.v8-notes-head h3 {
  margin: 0;
}

/* Collegamenti narrativi bidirezionali */
.v8-links-section {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(164, 137, 94, 0.34);
  border-radius: 9px;
  background: rgba(18, 15, 20, 0.62);
}

.v8-links-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.v8-links-title {
  margin: 0;
  font-size: 0.92rem;
  color: #e6cca0;
  letter-spacing: 0.02em;
}

.v8-links-allowed-hint {
  font-size: 0.78rem;
  color: rgba(226, 212, 188, 0.72);
  margin-right: auto;
}

.v8-links-toggle-btn {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.82rem;
}

.v8-links-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.v8-links-empty {
  margin: 2px 0;
  font-size: 0.84rem;
}

.v8-link-chip {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  max-width: 100%;
}

.v8-link-nav-btn {
  text-align: left;
  padding: 5px 10px;
  min-height: 34px;
  max-width: 100%;
}

.v8-link-nav-btn.is-locked {
  border-style: dashed;
  border-color: rgba(206, 174, 114, 0.55);
  color: #e5d2ad;
}

.v8-link-missing-body {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px dashed rgba(185, 130, 136, 0.45);
  background: rgba(40, 22, 26, 0.55);
  color: #d6b6ba;
  font-size: 0.82rem;
}

.v8-link-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: #d8b577;
}

.v8-link-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v8-link-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.v8-link-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.v8-link-cat {
  font-size: 0.74rem;
  color: rgba(226, 212, 188, 0.74);
  overflow-wrap: anywhere;
}

.v8-link-rm-btn {
  align-self: center;
}

.v8-links-picker {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(154, 130, 92, 0.28);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v8-links-picker[hidden],
.v8-links-section:not(.is-picker-open) .v8-links-picker {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.v8-links-search {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.v8-links-picker-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.v8-links-picker-group-title {
  margin: 4px 0 2px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cfa96b;
}

.v8-links-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid rgba(154, 130, 92, 0.3);
  background: rgba(26, 21, 27, 0.86);
  color: #f0e4ce;
  text-align: left;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.v8-links-picker-item:hover:not(:disabled) {
  border-color: rgba(218, 184, 124, 0.72);
  background: rgba(54, 34, 42, 0.9);
}

.v8-links-picker-item.is-selected {
  border-color: rgba(112, 174, 132, 0.55);
  background: rgba(24, 42, 32, 0.55);
}

.v8-links-picker-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.v8-links-picker-action {
  font-size: 0.76rem;
  font-weight: 600;
  color: #e4c385;
  flex-shrink: 0;
}

.v8-links-picker-item.is-selected .v8-links-picker-action {
  color: #a9dfb6;
}

/* Filtri compatti Modalità Sessione e stato disponibilità */
.v8-sess-filters {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 124, 88, 0.32);
  background: rgba(16, 13, 18, 0.56);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.v8-sess-filters-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.v8-filter-seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(156, 132, 92, 0.34);
  background: rgba(14, 11, 16, 0.7);
}

.v8-filter-seg .ui-nav-chip {
  min-height: 27px;
  padding: 3px 10px;
  font-size: 0.81rem;
  border-color: transparent;
  background: transparent;
}

.v8-filter-seg .ui-nav-chip.is-active {
  border-color: #d4b072;
  background: linear-gradient(180deg, #652338, #481727);
}

.v8-filter-select {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.84rem;
  border-radius: 7px;
  width: auto;
  max-width: 100%;
  margin: 0;
}

.v8-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.84rem;
  color: #e6dac4;
  cursor: pointer;
  user-select: none;
}

.v8-filter-check input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: #c8a56a;
}

.v8-filter-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 124, 88, 0.22);
  font-size: 0.8rem;
  color: rgba(235, 222, 200, 0.86);
}

.v8-filter-active-txt strong {
  color: #efd29c;
  font-weight: 600;
}

.v8-filter-reset-btn {
  min-height: 27px;
  padding: 3px 9px;
  font-size: 0.79rem;
}

.v8-filter-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(164, 137, 94, 0.35);
  background: rgba(18, 15, 20, 0.45);
}

.v8-filter-empty .mpg-comp-empty {
  margin: 0;
}

.v8-avail-badge {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.01em;
}

.v8-avail-badge.is-exhausted {
  border: 1px dashed rgba(214, 118, 128, 0.62);
  background: rgba(58, 22, 29, 0.62);
  color: #f2bec4;
}

.v8-avail-badge.is-consult {
  border: 1px dashed rgba(176, 170, 190, 0.48);
  background: rgba(34, 32, 42, 0.72);
  color: #d6d0e0;
}

.mpg-comp-card.is-unavailable .mpg-comp-item-name {
  opacity: 0.85;
}

/* Finestre di protezione modifiche, eliminazione dettagliata e riepilogo import */
.mpg-guard-dialog,
.mpg-delete-dialog {
  max-width: 520px;
  width: min(94vw, 520px);
}

.mpg-guard-lead,
.mpg-delete-lead {
  margin: 0 0 10px;
  line-height: 1.45;
}

.mpg-guard-list {
  margin: 0 0 12px;
  padding-left: 20px;
  color: #f0dfbe;
  font-size: 0.9rem;
}

.mpg-guard-actions,
.mpg-delete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.mpg-delete-links-warn {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid rgba(216, 164, 92, 0.55);
  background: rgba(58, 39, 18, 0.55);
  color: #f7dba0;
  font-size: 0.88rem;
}

.mpg-delete-note {
  margin: 6px 0 0;
  font-size: 0.86rem;
}

.mpg-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 10px;
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(164, 137, 94, 0.34);
  background: rgba(18, 15, 20, 0.7);
  font-size: 0.84rem;
}

.mpg-import-summary-grid div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.mpg-import-impact {
  margin: 10px 0;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(206, 150, 92, 0.5);
  background: rgba(52, 32, 20, 0.52);
  color: #f4dcb2;
  font-size: 0.86rem;
  line-height: 1.4;
}

.mpg-import-safety-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.mpg-soul-dialog-status,
.mpg-poss-dialog-status {
  margin: 0 0 8px;
}

@media (max-width: 640px) {
  .v8-sess-filters-row {
    gap: 8px;
  }

  .v8-filter-select,
  .mpg-sess-poss-search {
    width: 100%;
    flex: 1 1 100%;
  }

  .v8-links-head {
    align-items: flex-start;
  }

  .v8-links-toggle-btn {
    width: 100%;
  }

  .v8-link-chip {
    width: 100%;
  }

  .v8-link-nav-btn {
    flex: 1 1 auto;
  }

  .mpg-guard-actions,
  .mpg-delete-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mpg-guard-actions > button,
  .mpg-delete-actions > button {
    width: 100%;
  }
}

@media print {
  #mpg-home-screen,
  #mpg-pg-runes-field,
  #mpg-switch-nav,
  #mpg-turn-nav,
  #mpg-compendium-popover,
  .mpg-dialog,
  #mpg-delete-dialog,
  .mpg-guard-dialog,
  .mpg-delete-dialog,
  .v8-save-status,
  .v8-sess-filters,
  .v8-links-picker,
  .v8-links-toggle-btn,
  .v8-link-rm-btn,
  .soul-open-hint,
  .aly-rt-toolbar {
    display: none !important;
  }

  body:not(.mpg-home-active) > .shell > main::before {
    display: none !important;
  }

  .soul-card-layout {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .soul-card-layout.soul-body-no-portrait {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================================================================
   VERSIONE 8 — AGGIORNAMENTO CUMULATIVO (COLLEGAMENTI, ETICHETTE, CRONOLOGIA,
   CESTINO DEL PG, MODALITÀ LETTURA E STAMPA PULITA)
   ============================================================================ */

/* Nav trash badge */
.v8-nav-trash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 118, 0.55);
  background: rgba(95, 29, 44, 0.85);
  color: #f8e4bd;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Enhanced Links Picker controls & trashed chip */
.v8-links-picker-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.v8-links-type-select {
  flex: 0 1 180px;
  min-width: 140px;
  margin: 0 !important;
  font-size: 13px !important;
  padding: 7px 9px !important;
}

.v8-links-picker-controls .v8-links-search {
  flex: 1 1 180px;
  margin: 0 !important;
}

.v8-link-pick-item.is-selected {
  border-color: rgba(216, 180, 118, 0.72);
  background: linear-gradient(155deg, rgba(66, 36, 44, 0.78), rgba(28, 20, 24, 0.92));
}

.v8-link-pick-item.is-selected .v8-link-pick-add {
  color: #f6d99a;
  font-weight: 700;
}

.v8-link-chip.is-trashed {
  border-style: dashed;
  border-color: rgba(186, 152, 112, 0.45);
  background: rgba(24, 21, 26, 0.78);
  opacity: 0.86;
}

.v8-link-missing-body.is-trashed {
  cursor: default;
  color: #cabca8;
}

/* Custom Tags System */
.v8-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(196, 160, 102, 0.48);
  background: linear-gradient(160deg, rgba(62, 26, 37, 0.85), rgba(30, 19, 25, 0.92));
  color: #f3dfb8;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.v8-soul-tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 6px;
}

.v8-inline-tag-filter {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-inline-tag-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--gold, #d8b476);
}

.v8-inline-tag-filter select {
  width: auto;
  min-width: 165px;
  margin: 0;
  font-size: 13px;
  padding: 6px 9px;
}

.v8-tags-section {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid rgba(138, 113, 79, 0.55);
  border-radius: 9px;
  background: rgba(18, 16, 22, 0.72);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-tags-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-tags-title {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 14.5px;
  color: var(--gold, #d8b476);
}

.v8-tags-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.v8-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(208, 172, 110, 0.58);
  background: linear-gradient(155deg, #43202c, #24161d);
  color: #f8e6c2;
  font-size: 12.5px;
}

.v8-tag-chip-rm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 4px;
  background: transparent !important;
  color: #efc3a0 !important;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.v8-tag-chip-rm:hover,
.v8-tag-chip-rm:focus-visible {
  background: rgba(196, 62, 74, 0.35) !important;
  color: #fff !important;
}

.v8-tags-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  align-items: center;
}

.v8-tags-select {
  margin: 0 !important;
  font-size: 13px !important;
  padding: 7px 9px !important;
}

.v8-tags-new-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.v8-tags-new-input {
  flex: 1 1 130px;
  margin: 0 !important;
  font-size: 13px !important;
  padding: 7px 9px !important;
}

.v8-tags-err {
  margin: 0;
  font-size: 12.5px;
  color: #f3b0a8;
}

.v8-tags-manage-box {
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid rgba(138, 113, 79, 0.45);
  background: rgba(14, 13, 18, 0.85);
}

.v8-tags-manage-box[hidden] {
  display: none !important;
}

.v8-tags-manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 210px;
  overflow-y: auto;
}

.v8-tags-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #3f352c;
  background: #18161d;
}

.v8-tags-manage-name {
  font-size: 13px;
  color: #f4e6cc;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.v8-tags-manage-btns {
  display: flex;
  gap: 6px;
}

.v8-tags-manage-btns button {
  font-size: 12px;
  padding: 4px 9px;
}

/* Quick note completion box & non-blocking floating adventure notice */
.v8-quicknote-done {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-quicknote-done.is-floating-notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 95;
  width: min(390px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(138, 198, 156, 0.62);
  background: linear-gradient(155deg, rgba(24, 42, 32, 0.96) 0%, rgba(16, 22, 20, 0.97) 100%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(196, 236, 208, 0.14);
  color: #eef5ec;
  gap: 9px;
  animation: mpgNoticeEnter 0.2s ease-out;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.v8-quicknote-done.is-floating-notice.is-kind-item {
  border-color: rgba(218, 182, 118, 0.66);
  background: linear-gradient(155deg, rgba(44, 32, 20, 0.96) 0%, rgba(20, 17, 16, 0.97) 100%);
}

.v8-quicknote-done.is-floating-notice.is-kind-soul {
  border-color: rgba(196, 146, 222, 0.66);
  background: linear-gradient(155deg, rgba(42, 25, 48, 0.96) 0%, rgba(20, 16, 24, 0.97) 100%);
}

.v8-quicknote-done.is-floating-notice.is-hiding {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

@keyframes mpgNoticeEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mpg-qn-notice-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mpg-qn-notice-ico {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(126, 198, 148, 0.16);
  color: #9de2b3;
  margin-top: 1px;
}

.v8-quicknote-done.is-kind-item .mpg-qn-notice-ico {
  background: rgba(218, 182, 118, 0.18);
  color: #f0cf8e;
}

.v8-quicknote-done.is-kind-soul .mpg-qn-notice-ico {
  background: rgba(196, 146, 222, 0.18);
  color: #dfaff4;
}

.mpg-qn-notice-ico svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-qn-notice-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.mpg-qn-notice-copy strong {
  font-size: 13.5px;
  line-height: 1.25;
  color: #fff6e4;
}

.mpg-qn-notice-copy span {
  font-size: 12.5px;
  line-height: 1.38;
  color: #d6d0c4;
  overflow-wrap: anywhere;
}

.mpg-qn-notice-close {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #cfc8bc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.mpg-qn-notice-close:hover,
.mpg-qn-notice-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.mpg-qn-notice-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-qn-notice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mpg-qn-notice-actions .ui-btn-primary {
  font-size: 12px;
  padding: 5px 11px;
  min-height: 30px;
}

/* Revisions Modal (Diario & Background) */
.v8-revisions-dialog {
  max-width: 760px;
  width: min(94vw, 760px);
}

.v8-rev-notice {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.42);
  background: rgba(54, 24, 34, 0.45);
  color: #f3e2c2;
  font-size: 13px;
  line-height: 1.45;
}

.v8-rev-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

.v8-rev-item {
  border: 1px solid #5f4e3c;
  border-radius: 8px;
  background: #16141b;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v8-rev-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.v8-rev-title {
  font-family: Georgia, serif;
  font-size: 15px;
  color: var(--gold, #d8b476);
  overflow-wrap: anywhere;
}

.v8-rev-date {
  font-size: 12px;
  color: var(--muted, #b6b0a6);
}

.v8-rev-preview {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #3f352d;
  background: #111015;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
  color: #eae2d7;
}

.v8-rev-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Archivio Dimenticato del PG */
.v8-trash-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(186, 148, 92, 0.44);
  border-radius: 9px;
  background: linear-gradient(155deg, rgba(36, 26, 30, 0.92), rgba(20, 18, 22, 0.96));
}

.v8-trash-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #efe2c8;
  cursor: pointer;
  margin: 0;
}

.v8-trash-select-all input[type="checkbox"],
.v8-trash-card-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #c99d56;
  cursor: pointer;
  margin: 0;
  flex: 0 0 auto;
}

.v8-trash-bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-trash-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-trash-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #6b5842;
  border-radius: 9px;
  background: linear-gradient(155deg, #211b20, #151418);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.v8-trash-card.is-selected {
  border-color: rgba(214, 134, 140, 0.72);
  background: linear-gradient(155deg, rgba(64, 28, 34, 0.62), rgba(22, 16, 20, 0.96));
  box-shadow: 0 0 0 1px rgba(214, 134, 140, 0.25);
}

.v8-trash-card-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.v8-trash-card-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1 1 260px;
}

.v8-trash-card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-trash-card-top strong {
  font-family: Georgia, serif;
  font-size: 16px;
  color: #f6e7cb;
  overflow-wrap: anywhere;
}

.v8-trash-card-meta {
  font-size: 12.5px;
  color: var(--muted, #b6b0a6);
  margin: 0;
}

.v8-trash-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Modalità Lettura (Leggi) */
.v8-read-dialog {
  max-width: 860px;
  width: min(95vw, 860px);
  max-height: 92vh;
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.v8-read-dialog:not([open]) {
  display: none;
}

.v8-read-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #6b5842;
  background: linear-gradient(155deg, #291b22, #17141a);
  flex-shrink: 0;
}

.v8-read-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-read-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.v8-read-article {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 28px 30px;
  background: linear-gradient(180deg, #1b171d, #141217);
  color: #f2ebe1;
}

.v8-read-title {
  margin: 0 0 12px;
  font-family: Georgia, serif;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.25;
  color: var(--gold, #d8b476);
  overflow-wrap: anywhere;
}

.v8-read-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.v8-read-figure {
  margin: 0 0 20px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #6b5842;
  background: rgba(12, 11, 16, 0.72);
  display: flex;
  justify-content: center;
}

.v8-read-figure img {
  display: block;
  max-width: 100%;
  max-height: 440px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.v8-read-figure.is-portrait img {
  width: 200px;
  height: 266px;
  object-fit: cover;
}

.v8-read-prose {
  font-size: 16px;
  line-height: 1.82;
  color: #f1eae0;
  max-width: 72ch;
}

.v8-read-section {
  margin-top: 20px;
}

.v8-read-section h2 {
  font-size: 18px;
  color: var(--gold, #d8b476);
  margin: 0 0 8px;
}

.v8-read-links {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #4c3e30;
}

.v8-read-links h3 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 16px;
  color: var(--gold, #d8b476);
}

/* Print Options Dialog */
.v8-print-dialog {
  max-width: 640px;
  width: min(94vw, 640px);
}

.v8-print-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #5f4e3c;
  background: #15141a;
}

.v8-print-opt-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
  margin: 0 !important;
  cursor: pointer;
  color: #f0e8dd !important;
  font-size: 14px;
}

.v8-print-opt-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--gold, #d8b476);
}

.v8-print-diary-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}

.v8-print-diary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #5f4e3c;
  background: #131218;
}

.v8-print-diary-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  margin: 0 !important;
  border-radius: 6px;
  background: #1a1820;
  cursor: pointer;
  color: #f2ebe1 !important;
}

.v8-print-diary-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--gold, #d8b476);
}

.v8-print-diary-ord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid #79694e;
  background: #241b21;
  color: var(--gold, #d8b476);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.v8-print-diary-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.v8-print-diary-sub {
  font-size: 12px;
  color: var(--muted, #b6b0a6);
  white-space: nowrap;
}

/* Dedicated Print Sheet — hidden on screen, clean paper layout in @media print */
#mpg-print-sheet {
  display: none;
}

@media (max-width: 640px) {
  .v8-read-article {
    padding: 16px 16px 22px;
  }

  .v8-trash-card-actions {
    width: 100%;
  }

  .v8-trash-card-actions > button {
    flex: 1 1 auto;
  }
}

@media print {
  body.mpg-printing-sheet {
    background: #ffffff !important;
    color: #1a1715 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.mpg-printing-sheet > *:not(#mpg-print-sheet) {
    display: none !important;
  }

  body.mpg-printing-sheet #mpg-print-sheet {
    display: block !important;
    background: #ffffff !important;
    color: #1a1715 !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11.5pt;
    line-height: 1.62;
    padding: 0;
    margin: 0;
    max-width: 100%;
  }

  .v8-print-doc-header {
    border-bottom: 1.5pt solid #6b2434;
    padding-bottom: 8pt;
    margin-bottom: 16pt;
    break-after: avoid;
  }

  .v8-print-doc-pg {
    margin: 0 0 2pt;
    font-family: system-ui, sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b2434 !important;
  }

  .v8-print-doc-header h1 {
    margin: 0;
    font-size: 18pt;
    color: #1a1715 !important;
  }

  .v8-print-entry {
    margin-bottom: 20pt;
    padding-bottom: 14pt;
    border-bottom: 0.75pt solid #d2c7b8;
  }

  .v8-print-entry:last-child {
    border-bottom: 0;
  }

  .v8-print-entry-head {
    display: flex;
    gap: 10pt;
    align-items: baseline;
    font-family: system-ui, sans-serif;
    font-size: 9pt;
    color: #5c5146 !important;
    margin-bottom: 4pt;
    break-after: avoid;
  }

  .v8-print-type {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b2434 !important;
  }

  .v8-print-entry-title {
    margin: 0 0 8pt;
    font-size: 15pt;
    color: #1a1715 !important;
    break-after: avoid;
  }

  .v8-print-tags,
  .v8-print-links {
    margin: 6pt 0 10pt;
    font-family: system-ui, sans-serif;
    font-size: 9.5pt;
    color: #3d352e !important;
    break-inside: avoid;
  }

  .v8-print-figure {
    margin: 10pt 0 12pt;
    break-inside: avoid;
    text-align: center;
  }

  .v8-print-figure img {
    max-width: 100%;
    max-height: 280pt;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 0.5pt solid #c9beae;
  }

  .v8-print-prose {
    color: #1a1715 !important;
  }

  .v8-print-prose p,
  .v8-print-prose li {
    color: #1a1715 !important;
    orphans: 3;
    widows: 3;
  }
}

/* =========================================================
   VERSIONE 8 — TOKEN CONDIVISI TIPI CONTENUTO,
   NOTA RAPIDA SESSIONE, RICERCA PG E REGOLE TURNO EDITABILI
   ========================================================= */
:root {
  --v8-type-diary-bg: #2b1a20;
  --v8-type-diary-bg-hover: #352028;
  --v8-type-diary-border: #8c5a52;
  --v8-type-diary-accent: #d8b476;
  --v8-type-diary-ink: #f2e8dc;

  --v8-type-note-bg: #271f33;
  --v8-type-note-bg-hover: #312740;
  --v8-type-note-border: #a78bc4;
  --v8-type-note-accent: #a78bc4;
  --v8-type-note-ink: #eee7f5;

  --v8-type-quest-bg: #192731;
  --v8-type-quest-bg-hover: #203340;
  --v8-type-quest-border: #5b8fa3;
  --v8-type-quest-accent: #7ab5c9;
  --v8-type-quest-ink: #e4eff4;

  --v8-type-bg-bg: #1c2922;
  --v8-type-bg-bg-hover: #23342b;
  --v8-type-bg-border: #5c8a71;
  --v8-type-bg-accent: #8cc2a3;
  --v8-type-bg-ink: #e6f2eb;
}

/* Session Mode: "Strumenti rapidi" card (coherent dark-fantasy palette + climbing vines frame) */
.mpg-session-quicktools-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-color: rgba(186, 148, 92, 0.56);
  background:
    radial-gradient(circle at 12% 16%, rgba(102, 134, 98, 0.14), transparent 46%),
    radial-gradient(circle at 88% 84%, rgba(124, 52, 60, 0.2), transparent 48%),
    linear-gradient(155deg, rgba(35, 25, 29, 0.94), rgba(20, 18, 21, 0.97));
  box-shadow: inset 0 0 0 1px rgba(216, 180, 118, 0.14), 0 8px 24px rgba(0, 0, 0, 0.44);
}

.mpg-qt-vine-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.mpg-qt-vine-corner {
  position: absolute;
  width: 108px;
  height: 62px;
  opacity: 0.52;
}

.mpg-qt-vine-corner svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mpg-qt-vine-corner .qt-vine-stem {
  fill: none;
  stroke: #b59258;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.mpg-qt-vine-corner .qt-vine-leaf {
  fill: rgba(104, 146, 108, 0.55);
  stroke: #8bb58e;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.mpg-qt-vine-corner .qt-vine-leaf-gold {
  fill: rgba(202, 162, 96, 0.32);
  stroke: #d8b476;
  stroke-width: 1.05;
  stroke-linejoin: round;
}

.mpg-qt-vine-corner .qt-vine-bud {
  fill: #e0be80;
  stroke: none;
}

.mpg-qt-vine-corner.is-tl {
  top: 2px;
  left: 2px;
}

.mpg-qt-vine-corner.is-tr {
  top: 2px;
  right: 2px;
  transform: scaleX(-1);
}

.mpg-qt-vine-corner.is-bl {
  bottom: 2px;
  left: 2px;
  transform: scaleY(-1);
}

.mpg-qt-vine-corner.is-br {
  bottom: 2px;
  right: 2px;
  transform: scale(-1, -1);
}

.mpg-qt-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.mpg-qt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.v8-sess-panel-ico.is-quicktools {
  border-color: rgba(216, 180, 118, 0.55);
  background: rgba(84, 38, 44, 0.5);
  color: #ebd09a;
}

.mpg-qt-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.mpg-qt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  margin: 0;
  border-radius: 9px;
  border: 1px solid rgba(186, 148, 92, 0.52);
  background: linear-gradient(155deg, rgba(48, 28, 34, 0.9), rgba(24, 19, 23, 0.94));
  color: #f4e6cc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.25px;
  box-shadow: inset 0 1px 0 rgba(240, 212, 160, 0.14), 0 4px 12px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.mpg-qt-btn:hover,
.mpg-qt-btn:focus-visible {
  border-color: #e4c17f;
  background: linear-gradient(155deg, rgba(84, 37, 46, 0.94), rgba(38, 22, 28, 0.96));
  color: #fff7e8;
  box-shadow: 0 0 0 1px rgba(228, 193, 127, 0.32), 0 6px 16px rgba(0, 0, 0, 0.44);
  transform: translateY(-1px);
}

.mpg-qt-btn:active {
  transform: translateY(0);
}

.mpg-qt-btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.42);
  background: rgba(18, 14, 18, 0.72);
  color: #e6c483;
  flex: 0 0 auto;
}

.mpg-qt-btn.is-note .mpg-qt-btn-ico {
  border-color: rgba(167, 139, 196, 0.6);
  background: rgba(39, 31, 51, 0.85);
  color: #cbb5e3;
}

.mpg-qt-btn.is-item .mpg-qt-btn-ico {
  border-color: rgba(216, 180, 118, 0.58);
  background: rgba(54, 34, 24, 0.85);
  color: #e8c786;
}

.mpg-qt-btn.is-soul .mpg-qt-btn-ico {
  border-color: rgba(114, 168, 134, 0.58);
  background: rgba(26, 44, 35, 0.85);
  color: #9dd4b2;
}

.mpg-qt-btn.is-coins .mpg-qt-btn-ico {
  border-color: rgba(245, 196, 81, 0.62);
  background: rgba(56, 40, 18, 0.88);
  color: #f5c451;
}

.mpg-qt-btn.is-obiettivo .mpg-qt-btn-ico {
  border-color: rgba(122, 181, 201, 0.62);
  background: rgba(20, 36, 46, 0.88);
  color: #8fd0e6;
}

.mpg-qt-btn-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  color: #f5d284;
  flex: 0 0 auto;
}

.mpg-qt-btn-ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-qt-btn-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v8-qt-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.55);
  background: rgba(54, 34, 24, 0.85);
  color: #e8c786;
  flex: 0 0 auto;
}

.v8-qt-modal-icon.is-soul {
  border-color: rgba(114, 168, 134, 0.6);
  background: rgba(26, 44, 35, 0.88);
  color: #9dd4b2;
}

.v8-qt-modal-icon.is-coins {
  border-color: rgba(245, 196, 81, 0.64);
  background: rgba(56, 40, 18, 0.9);
  color: #f5c451;
}

.v8-qt-modal-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-qt-item-row,
.mpg-qt-opt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.mpg-qt-qty-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 6px;
  align-items: center;
}

.mpg-qt-qty-row button {
  height: 38px;
  padding: 0;
  font-weight: 700;
}

.mpg-qt-qty-row input {
  margin: 0;
  height: 38px;
  text-align: center;
}

.mpg-qt-opt-details {
  margin: 8px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(154, 126, 86, 0.36);
  border-radius: 8px;
  background: rgba(16, 14, 18, 0.55);
}

.mpg-qt-opt-details summary {
  cursor: pointer;
  color: #e6c68a;
  font-size: 13.5px;
  font-weight: 600;
}

.mpg-qt-opt-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 600px) {
  .mpg-qt-vine-corner {
    width: 78px;
    height: 45px;
    opacity: 0.42;
  }

  .mpg-qt-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mpg-qt-btn {
    justify-content: flex-start;
    padding: 10px 14px;
  }

  .mpg-qt-item-row,
  .mpg-qt-opt-grid {
    grid-template-columns: 1fr;
  }
}

.v8-quicknote-title,
.v8-quicktools-title,
.v8-modal-title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.v8-quicknote-title > span:last-child,
.v8-quicktools-title > span:last-child,
.v8-modal-title-with-icon > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.v8-note-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--v8-type-note-border);
  background: var(--v8-type-note-bg);
  color: var(--v8-type-note-accent);
  flex: 0 0 auto;
}

.v8-note-type-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* PG Search badges with shared fantasy type icons & colors */
.mpg-search-kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mpg-search-kind-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.mpg-search-kind-ico svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-search-kind.is-type-diary {
  border-color: var(--v8-type-diary-border);
  background: var(--v8-type-diary-bg);
  color: var(--v8-type-diary-accent);
}

.mpg-search-kind.is-type-note {
  border-color: var(--v8-type-note-border);
  background: var(--v8-type-note-bg);
  color: #cbb5e3;
}

.mpg-search-kind.is-type-quest {
  border-color: var(--v8-type-quest-border);
  background: var(--v8-type-quest-bg);
  color: var(--v8-type-quest-accent);
}

.mpg-search-kind.is-type-background {
  border-color: var(--v8-type-bg-border);
  background: var(--v8-type-bg-bg);
  color: var(--v8-type-bg-accent);
}

/* Editable M/A/B/I/R rule details inside Session Mode turn panels */
.mpg-st-more summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mpg-st-custom-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid rgba(216, 180, 118, 0.45);
  background: rgba(216, 180, 118, 0.12);
  color: #f0d7a3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mpg-st-detail-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.mpg-st-detail-text {
  margin: 0 !important;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.48;
  color: #dcd5c9;
}

.mpg-st-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mpg-st-edit-btn {
  padding: 4px 9px !important;
  font-size: 11.5px !important;
  min-height: 28px;
}

.mpg-st-edit-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #dec089;
}

.mpg-st-edit-ta {
  width: 100%;
  min-height: 82px;
  padding: 8px 9px;
  border-radius: 6px;
  border: 1px solid #6b5842;
  background: #121117;
  color: #f2ece2;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
}

.mpg-st-edit-ta:focus {
  outline: 2px solid color-mix(in srgb, var(--turn-accent, #d8b476) 75%, #ffffff);
  outline-offset: 1px;
}

.mpg-st-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mpg-st-edit-actions button {
  padding: 5px 10px !important;
  font-size: 12px !important;
  min-height: 30px;
}

.mpg-st-edit-err {
  margin: 0;
  font-size: 11.5px;
}

/* Ensure uniform clean gaps on mobile for M/A/B/I/R boxes & quick-note header */
@media (max-width: 820px) {
  #mpg-session-turn-panels,
  .mpg-session-turn-panels,
  .mpg-session-turn-row1,
  .mpg-session-turn-row2 {
    gap: 8px;
  }

  .mpg-turn-row {
    gap: 6px;
  }

  .v8-note-type-icon {
    width: 26px;
    height: 26px;
  }

  .v8-note-type-icon svg {
    width: 15px;
    height: 15px;
  }
}

/* =========================================================
   VERSIONE 8 — INTESTAZIONI UNIFORMI RIQUADRI SESSIONE
   (ICONA + NOME) E COERENZA RIQUADRO BORSELLO
   ========================================================= */
.v8-sess-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-family: Georgia, serif;
  color: var(--gold, #d8b476);
  line-height: 1.25;
}

.v8-sess-panel-title > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.v8-sess-panel-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: var(--gold, #d8b476);
}

.v8-sess-panel-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v8-sess-panel-ico.is-note {
  color: #a78bc4;
}

.v8-sess-panel-ico.is-fav svg {
  fill: currentColor;
}

.mpg-session-top-grid .mpg-panel-card > .v8-sess-panel-title {
  margin-bottom: 10px;
}

.mpg-session-turn-head,
.mpg-comp-section-head,
.mpg-session-res-head,
.v8-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.mpg-sess-coins-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mpg-sess-coins-title svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 640px) {
  .v8-sess-panel-title {
    gap: 8px;
    font-size: 1.04rem;
  }

  .v8-sess-panel-ico {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  .v8-sess-panel-ico svg {
    width: 18px;
    height: 18px;
  }
}

/* =========================================================
   VERSIONE 8 — MENU LATERALE FANTASY (CORNICE BORDEAUX & ORO)
   ========================================================= */
body > .shell > nav {
  background: linear-gradient(180deg, #171217 0%, #121014 55%, #161116 100%);
  border-right: 1px solid rgba(176, 138, 82, 0.45);
}

body > .shell > nav > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid rgba(164, 128, 76, 0.46);
  background:
    radial-gradient(circle at 6% 50%, rgba(168, 128, 72, 0.14), transparent 46%),
    linear-gradient(155deg, #25171e 0%, #191217 62%, #131015 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 180, 118, 0.12),
    inset 0 1px 0 rgba(235, 204, 148, 0.16),
    0 2px 7px rgba(0, 0, 0, 0.36);
  color: #ddd1be;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  letter-spacing: 0.015em;
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}

body > .shell > nav > a::before,
body > .shell > nav > a::after {
  content: "";
  position: absolute;
  pointer-events: none;
  width: 11px;
  height: 11px;
  border-color: rgba(216, 180, 118, 0.48);
  border-style: solid;
  transition: border-color 0.16s ease, opacity 0.16s ease;
}

body > .shell > nav > a::before {
  top: 3px;
  left: 3px;
  border-width: 1.5px 0 0 1.5px;
  border-top-left-radius: 5px;
}

body > .shell > nav > a::after {
  right: 3px;
  bottom: 3px;
  border-width: 0 1.5px 1.5px 0;
  border-bottom-right-radius: 5px;
}

body > .shell > nav > a .navicon {
  color: #cfa96b;
  transition: color 0.16s ease, transform 0.16s ease;
}

body > .shell > nav > a:hover {
  color: #fff4dd;
  border-color: rgba(224, 188, 124, 0.85);
  background:
    radial-gradient(circle at 8% 50%, rgba(216, 180, 118, 0.22), transparent 52%),
    linear-gradient(155deg, #4b1d28 0%, #2d141b 65%, #1d1116 100%);
  box-shadow:
    inset 0 0 0 1px rgba(235, 200, 138, 0.24),
    0 4px 12px rgba(0, 0, 0, 0.48);
  transform: translateX(1px);
}

body > .shell > nav > a:hover::before,
body > .shell > nav > a:hover::after {
  border-color: #e6c688;
}

body > .shell > nav > a:hover .navicon {
  color: #f3d59a;
}

body > .shell > nav > a:focus-visible {
  outline: 2px solid #f0c990;
  outline-offset: 2px;
  color: #fff6e2;
  border-color: #e6c688;
}

body > .shell > nav > a.active,
body > .shell > nav > a[aria-current="page"] {
  color: #fff5df;
  font-weight: 700;
  border-color: #dfbc7c;
  background:
    radial-gradient(circle at 12% 50%, rgba(226, 190, 124, 0.28), transparent 56%),
    linear-gradient(155deg, #642131 0%, #3d1520 62%, #241016 100%);
  box-shadow:
    inset 0 0 0 1px rgba(242, 211, 152, 0.36),
    inset 3px 0 0 #e4c17f,
    0 5px 15px rgba(0, 0, 0, 0.54);
}

body > .shell > nav > a.active::before,
body > .shell > nav > a.active::after,
body > .shell > nav > a[aria-current="page"]::before,
body > .shell > nav > a[aria-current="page"]::after {
  border-color: #f0d093;
}

body > .shell > nav > a.active .navicon,
body > .shell > nav > a[aria-current="page"] .navicon {
  color: #f6dca4;
}

@media (max-width: 760px) {
  body > .shell > nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 10px 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(176, 138, 82, 0.35);
  }

  body > .shell > nav > a {
    display: inline-flex;
    flex: 1 1 auto;
    justify-content: flex-start;
    margin-bottom: 0;
    padding: 7px 10px;
    gap: 7px;
    font-size: 0.82rem;
    min-height: 36px;
  }

  body > .shell > nav > a::before,
  body > .shell > nav > a::after {
    width: 8px;
    height: 8px;
  }

  body > .shell > nav > a:hover {
    transform: none;
  }
}

/* =========================================================
   VERSIONE 8 — INTESTAZIONE PAGINE COERENTE COL MENU LATERALE
   (Cornice bordeaux/ossidiana & oro per tutte le 7 pagine)
   ========================================================= */
.v8-page-header-box {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0 0 18px;
  padding: 16px 18px 15px;
  border-radius: 10px;
  border: 1px solid rgba(176, 138, 82, 0.56);
  background:
    radial-gradient(circle at 6% 0%, rgba(196, 152, 86, 0.16), transparent 46%),
    linear-gradient(155deg, #281820 0%, #1a1318 58%, #131015 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 180, 118, 0.14),
    inset 0 1px 0 rgba(235, 204, 148, 0.18),
    0 6px 20px rgba(0, 0, 0, 0.42);
}

.v8-page-header-box::before,
.v8-page-header-box::after {
  content: "";
  position: absolute;
  pointer-events: none;
  width: 14px;
  height: 14px;
  border-color: rgba(216, 180, 118, 0.58);
  border-style: solid;
}

.v8-page-header-box::before {
  top: 4px;
  left: 4px;
  border-width: 1.5px 0 0 1.5px;
  border-top-left-radius: 6px;
}

.v8-page-header-box::after {
  right: 4px;
  bottom: 4px;
  border-width: 0 1.5px 1.5px 0;
  border-bottom-right-radius: 6px;
}

.v8-page-header-box > h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(176, 138, 82, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  color: #f4ddb2;
  letter-spacing: 0.015em;
  line-height: 1.25;
}

.v8-page-header-box > h2 .page-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e4c17f;
  flex-shrink: 0;
}

.v8-page-header-box > h2 .page-title-icon svg {
  width: 22px;
  height: 22px;
}

.v8-page-header-sub {
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #d6cab8;
}

.v8-page-header-box .toolbar {
  margin-top: 0;
  margin-bottom: 10px;
}

.v8-page-header-box .toolbar:last-child,
.v8-page-header-box .filters:last-child,
.v8-page-header-box .v77-filters-row:last-child,
.v8-page-header-box .v77-bg-filters-row:last-child {
  margin-bottom: 0;
}

.v8-page-header-box .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-top: 2px;
  margin-bottom: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.v8-page-header-box .filters > .v8-lib-filter-field,
.v8-page-header-box .filters > .usage-filter-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 210px;
  min-width: 170px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: var(--muted, #b6b0a6);
  font-size: 12.5px;
  line-height: 1.25;
  align-self: flex-end;
  box-sizing: border-box;
}

.v8-page-header-box .filters > .v8-lib-search-field {
  flex: 1.25 1 230px;
}

.v8-page-header-box .filters > .v8-lib-filter-field input,
.v8-page-header-box .filters > .v8-lib-filter-field select,
.v8-page-header-box .filters > .usage-filter-label select {
  width: 100%;
  max-width: 100%;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 7px 11px;
  font-size: 13.5px;
  line-height: 1.25;
  border: 1px solid rgba(195, 158, 98, 0.45);
  border-radius: 7px;
  background: #121015;
  color: #f3ece2;
  box-sizing: border-box;
}

.v8-page-header-box .filters > .v8-lib-filter-field input:focus-visible,
.v8-page-header-box .filters > .v8-lib-filter-field select:focus-visible,
.v8-page-header-box .filters > .usage-filter-label select:focus-visible {
  outline: 2px solid #e6c686;
  outline-offset: 1px;
  border-color: #d8b476;
}

.v8-page-header-box .filters > .v8-lib-conc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  min-width: auto;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(195, 158, 98, 0.4);
  border-radius: 7px;
  background: rgba(18, 16, 21, 0.85);
  color: #efe4cf;
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  align-self: flex-end;
  box-sizing: border-box;
}

.v8-page-header-box .filters > .v8-lib-conc-toggle:hover,
.v8-page-header-box .filters > .v8-lib-conc-toggle:focus-within {
  border-color: #d8b476;
  background: rgba(48, 24, 31, 0.72);
}

.v8-page-header-box .filters > .v8-lib-conc-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: #d8b476;
}

/* Shared framed header layout for Modalità Sessione, Cerca nel PG, and Cestino */
.mpg-special-root > .v8-page-header-box.v8-page-header-special {
  margin-bottom: 0;
}

.v8-page-header-box.v8-page-header-special {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.v8-page-header-box.v8-page-header-special .v8-special-head-copy {
  flex: 1 1 320px;
  min-width: 0;
}

.v8-page-header-box.v8-page-header-special .v8-special-head-copy > h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(176, 138, 82, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  color: #f4ddb2;
  letter-spacing: 0.015em;
  line-height: 1.25;
}

.v8-page-header-box.v8-page-header-special .v8-special-head-copy > h2 .page-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e4c17f;
  flex-shrink: 0;
}

.v8-page-header-box.v8-page-header-special .v8-special-head-copy > h2 .page-title-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v8-page-header-box.v8-page-header-special .v8-page-header-sub {
  margin: 0;
}

.v8-page-header-box.v8-page-header-special .mpg-back-section-btn {
  align-self: center;
}

.v8-page-header-box .v77-header-controls-slot > .v77-journal-count,
.v8-page-header-box .v77-header-controls-slot > .v77-bg-count {
  margin: 10px 0 0;
}

.v8-page-header-box.v710-guide-index-card {
  margin-bottom: 18px;
}

.v8-page-header-box.v710-guide-index-card .v710-guide-index-head {
  margin-top: 2px;
}

.v8-page-header-box.mpg-home-section-hero {
  padding: 24px 56px 20px;
  text-align: center;
}

.v8-page-header-box.mpg-home-section-hero.mpg-campaigns-hero {
  padding: 24px 56px 20px;
}

.v8-page-header-box.mpg-home-section-hero > h1.mpg-home-title,
.v8-page-header-box.mpg-home-section-hero > h2.mpg-home-title {
  justify-content: center;
  font-size: clamp(22px, 3.4vw, 32px);
  letter-spacing: 1.1px;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

@media (max-width: 760px) {
  .v8-page-header-box {
    padding: 13px 12px 12px;
    margin-bottom: 14px;
    border-radius: 9px;
  }

  .v8-page-header-box.mpg-home-section-hero {
    padding: 18px 46px 16px 14px;
  }

  .v8-page-header-box.mpg-home-section-hero.mpg-campaigns-hero {
    padding: 18px 46px 16px 14px;
  }

  .v8-page-header-box::before,
  .v8-page-header-box::after {
    width: 10px;
    height: 10px;
  }

  .v8-page-header-box > h2,
  .v8-page-header-box.v8-page-header-special .v8-special-head-copy > h2 {
    font-size: 1.32rem;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .v8-page-header-box.mpg-home-section-hero > h1.mpg-home-title,
  .v8-page-header-box.mpg-home-section-hero > h2.mpg-home-title {
    font-size: clamp(19px, 5.4vw, 25px);
  }

  .v8-page-header-box .filters > .v8-lib-filter-field,
  .v8-page-header-box .filters > .usage-filter-label,
  .v8-page-header-box .filters > .v8-lib-conc-toggle {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }

  .v8-page-header-box.v8-page-header-special {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .v8-page-header-box.v8-page-header-special .v8-special-head-copy {
    flex: 0 0 auto;
    width: 100%;
  }

  .v8-page-header-box.v8-page-header-special .mpg-back-section-btn {
    align-self: stretch;
    width: 100%;
  }
}

@media print {
  .v8-page-header-box {
    background: #fff !important;
    border: 1px solid #999 !important;
    box-shadow: none !important;
  }

  .v8-page-header-box::before,
  .v8-page-header-box::after {
    display: none !important;
  }
}

/* =========================================================
   7even — Session Mode: "Scrivi sul diario", Moved Quick Buttons,
   Collapsible Single-Row Panels & Shared Write-to-Diary Modal
   ========================================================= */
.mpg-session-conc-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* Single-row Condizioni attive & Concentrazione aligned with + Oggetto / + Anima */
.mpg-session-cond-strip,
.mpg-session-conc-strip {
  padding: 10px 14px;
  border: 1px solid rgba(182, 146, 94, 0.36);
  background: linear-gradient(155deg, rgba(30, 24, 28, 0.92) 0%, rgba(18, 16, 21, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(242, 212, 152, 0.08), 0 4px 12px rgba(0, 0, 0, 0.28);
}

.mpg-sess-strip-title {
  margin: 0 !important;
  font-size: 14px !important;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mpg-sess-strip-title .mpg-sess-heading-ico {
  width: 24px;
  height: 24px;
}

.mpg-sess-strip-title .mpg-sess-heading-ico svg {
  width: 14px;
  height: 14px;
}

.mpg-sess-cond-strip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  min-height: 34px;
}

.mpg-sess-strip-head {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.mpg-sess-cond-strip-mid {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  align-items: center;
}

.mpg-sess-strip-empty {
  font-size: 13px;
  color: #b4aba0;
  font-style: italic;
}

.mpg-sess-cond-err {
  font-size: 12.5px;
  color: #f3b1b5;
}

.mpg-sess-cond-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.mpg-sess-cond-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px 3px 4px;
  border-radius: 8px;
  border: 1px solid rgba(196, 160, 106, 0.3);
  background: rgba(18, 16, 22, 0.78);
  max-width: 100%;
}

.mpg-sess-cond-chip .mpg-sess-cond-badge {
  margin: 0;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.mpg-sess-cond-chip-acts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mpg-sess-cond-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(186, 152, 102, 0.36);
  background: linear-gradient(160deg, rgba(44, 34, 38, 0.9), rgba(26, 21, 26, 0.95));
  color: #eadcc4;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.mpg-sess-cond-mini-btn:hover,
.mpg-sess-cond-mini-btn:focus-visible {
  background: linear-gradient(160deg, rgba(64, 46, 52, 0.95), rgba(38, 28, 34, 0.98));
  border-color: rgba(232, 196, 134, 0.68);
  color: #fff6e4;
}

.mpg-sess-cond-mini-btn.is-open,
.mpg-sess-cond-mini-btn.has-notes {
  border-color: rgba(226, 188, 122, 0.64);
  color: #f6dcb0;
}

.mpg-sess-cond-mini-btn.is-rm {
  padding: 0;
  width: 24px;
  font-size: 15px;
  border-color: rgba(196, 114, 122, 0.42);
  background: rgba(58, 24, 30, 0.78);
  color: #f2bdc2;
}

.mpg-sess-cond-mini-btn.is-rm:hover,
.mpg-sess-cond-mini-btn.is-rm:focus-visible {
  border-color: rgba(234, 140, 148, 0.78);
  background: rgba(88, 32, 40, 0.92);
  color: #ffecef;
}

.mpg-sess-cond-add-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.mpg-sess-cond-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 190px;
  max-width: 230px;
  height: 34px;
  padding: 0 32px 0 11px;
  border-radius: 8px;
  border: 1px solid rgba(192, 158, 102, 0.48);
  background-color: #19161d;
  background-image: linear-gradient(160deg, rgba(40, 32, 36, 0.72), rgba(20, 18, 24, 0.94)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2c184' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 9px center;
  background-size: 100% 100%, 15px 15px;
  color: #f3e6ce;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.mpg-sess-cond-select:hover {
  border-color: rgba(232, 196, 134, 0.72);
}

.mpg-sess-cond-select:focus-visible {
  outline: none;
  border-color: #edd09a;
  box-shadow: 0 0 0 2px rgba(216, 180, 118, 0.25);
}

.mpg-sess-cond-select option {
  background: #1a171f;
  color: #f3e6ce;
}

.mpg-sess-cond-add-btn {
  height: 34px;
  min-height: 34px !important;
  padding: 0 13px !important;
  font-size: 12.5px !important;
  white-space: nowrap;
  border-radius: 8px !important;
}

.mpg-sess-cond-details-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(182, 146, 94, 0.24);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.mpg-sess-cond-detail-panel {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(168, 138, 92, 0.28);
  background: rgba(16, 14, 20, 0.72);
}

.mpg-sess-cond-detail-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #e4cfa8;
}

.mpg-sess-cond-notes {
  width: 100%;
  min-height: 54px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(176, 144, 98, 0.36);
  background: #131117;
  color: #f2e8d6;
  font-size: 12.5px;
  resize: vertical;
}

.mpg-session-conc-row-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.mpg-session-conc-strip {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 11px;
}

.mpg-session-conc-strip.mpg-session-conc-active {
  border-color: rgba(226, 186, 114, 0.62);
  background: linear-gradient(155deg, rgba(50, 30, 36, 0.94) 0%, rgba(24, 17, 22, 0.97) 100%);
}

.mpg-session-conc-strip .mpg-sess-strip-title {
  font-size: 13.5px !important;
  gap: 6px;
}

.mpg-session-conc-strip .mpg-sess-strip-title .mpg-sess-heading-ico {
  width: 22px;
  height: 22px;
}

.mpg-sess-conc-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  width: 100%;
}

.mpg-sess-conc-sep {
  color: rgba(216, 180, 118, 0.55);
  font-weight: 700;
  flex: 0 0 auto;
}

.mpg-sess-conc-val {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff0d1;
}

.mpg-sess-conc-val.is-empty {
  font-weight: 500;
  font-style: italic;
  color: #b4aba0;
}

.mpg-sess-conc-clear-btn {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin-left: auto;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(224, 134, 142, 0.56);
  background: linear-gradient(155deg, rgba(78, 30, 38, 0.9), rgba(44, 19, 25, 0.95));
  color: #f9c6cb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.mpg-sess-conc-clear-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-sess-conc-clear-btn:hover:not(:disabled),
.mpg-sess-conc-clear-btn:focus-visible:not(:disabled) {
  background: linear-gradient(155deg, rgba(108, 38, 48, 0.96), rgba(62, 24, 32, 0.98));
  border-color: #f4a4ac;
  color: #ffffff;
}

.mpg-sess-conc-clear-btn:disabled {
  opacity: 0.34;
  border-color: rgba(170, 162, 152, 0.28);
  background: rgba(32, 28, 34, 0.65);
  color: #9f968b;
  cursor: not-allowed;
}

.mpg-session-conc-quickbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, auto));
  align-items: stretch;
  gap: 8px;
  flex: 0 0 auto;
  width: auto;
}

.mpg-session-conc-quickbar .mpg-qt-btn {
  width: 100%;
  min-width: 56px;
  min-height: 44px;
  padding: 8px 11px;
  font-size: 13.5px;
  gap: 5px;
  justify-content: center;
  white-space: nowrap;
  overflow: visible;
}

.mpg-session-conc-quickbar .mpg-qt-btn-ico {
  width: 24px;
  height: 24px;
}

.mpg-session-conc-quickbar .mpg-qt-btn-ico svg {
  width: 15px;
  height: 15px;
}

.mpg-session-diary-card .mpg-qt-head {
  flex-wrap: wrap;
}

.mpg-session-diary-autosave {
  font-size: 11.5px;
  font-weight: 600;
  color: #a9d6b6;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(114, 178, 134, 0.42);
  background: rgba(20, 42, 28, 0.72);
  white-space: nowrap;
}

.mpg-session-diary-autosave.is-saving {
  color: #f0d192;
  border-color: rgba(216, 180, 118, 0.5);
  background: rgba(52, 38, 18, 0.76);
}

.mpg-session-diary-autosave.is-err {
  color: #f5b3b3;
  border-color: rgba(214, 96, 96, 0.58);
  background: rgba(64, 22, 26, 0.8);
}

.mpg-session-diary-slot {
  margin-top: 2px;
}

.mpg-session-diary-slot .aly-rt-surface {
  min-height: 135px;
  max-height: 380px;
}

.mpg-session-diary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mpg-session-diary-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mpg-session-diary-save-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Collapsible Single-Row Panels in Session Mode */
.mpg-sess-collapsible .mpg-sess-collapse-head {
  cursor: pointer;
  user-select: none;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(154, 126, 86, 0.24);
  transition: border-color 0.14s ease, margin 0.14s ease, padding 0.14s ease;
}

.mpg-sess-collapsible.is-collapsed {
  padding-top: 11px;
  padding-bottom: 11px;
}

.mpg-sess-collapsible.is-collapsed .mpg-sess-collapse-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
}

.mpg-sess-collapsible.is-collapsed .mpg-sess-collapse-body,
.mpg-sess-collapsible.is-collapsed > .mpg-sess-collapsible-body {
  display: none !important;
}

.v8-lib-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-lib-group {
  margin: 0;
}

.v8-lib-group > .mpg-sess-collapse-head {
  align-items: center;
}

.v8-lib-group > .mpg-sess-collapsible-body {
  padding-top: 2px;
}

.mpg-sess-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mpg-sess-collapse-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(186, 148, 92, 0.48);
  background: rgba(20, 17, 23, 0.82);
  color: #e6c687;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.16s ease;
}

.mpg-sess-collapse-btn:hover,
.mpg-sess-collapse-btn:focus-visible {
  border-color: #f0d090;
  background: rgba(96, 37, 47, 0.85);
  color: #fff6e5;
}

.mpg-sess-collapse-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}

.mpg-sess-collapsible:not(.is-collapsed) .mpg-sess-collapse-btn svg {
  transform: rotate(180deg);
}

/* Shared Write-to-Diary Modal */
.mpg-wd-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mpg-wd-img-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(145, 118, 82, 0.38);
  background: rgba(16, 14, 20, 0.72);
  box-sizing: border-box;
  overflow: hidden;
}

.mpg-wd-img-box.is-image-primary {
  border-color: rgba(218, 178, 108, 0.62);
  background: linear-gradient(160deg, rgba(46, 25, 34, 0.72), rgba(16, 14, 20, 0.9));
  padding: 12px 14px;
}

.mpg-wd-img-box.is-image-primary .mpg-wd-img-preview {
  max-height: 290px;
  border-color: rgba(224, 186, 116, 0.56);
}

.mpg-wd-img-box.is-image-primary .mpg-wd-img-preview img {
  max-height: 270px;
}

.mpg-wd-img-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  max-height: 240px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(186, 148, 92, 0.4);
  background: rgba(10, 9, 13, 0.78);
  box-sizing: border-box;
  overflow: hidden;
}

.mpg-wd-img-preview[hidden] {
  display: none;
}

.mpg-wd-img-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .mpg-wd-img-preview {
    max-height: 200px;
    padding: 4px;
  }

  .mpg-wd-img-preview img {
    max-height: 184px;
  }
}

.mpg-wd-img-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mpg-wd-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.mpg-wd-file-btn input[type="file"] {
  display: none;
}

.mpg-wd-links-slot {
  margin-top: 2px;
}

@media (max-width: 640px) {
  .mpg-wd-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   7even — Sidebar Floating Tooltip Portal (non-invasive)
   ========================================================= */
.mpg-nav-tooltip-portal {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.56);
  background: linear-gradient(155deg, rgba(28, 22, 26, 0.97), rgba(15, 14, 18, 0.98));
  color: #f3e6cc;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 12px;
  line-height: 1.38;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.58);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.mpg-nav-tooltip-portal.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.mpg-nav-tooltip-portal.is-below {
  transform: translateY(-4px);
}

.mpg-nav-tooltip-portal.is-below.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none), (max-width: 760px) {
  .mpg-nav-tooltip-portal {
    display: none !important;
  }
}

/* =========================================================
   7even — Guided Aggiungi Voce Wizard (Talenti e Oggetti)
   ========================================================= */
.v8-entry-wizard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v8-entry-wizard [hidden],
.v8-wiz-nav [hidden] {
  display: none !important;
}

.v8-wiz-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.v8-wiz-step-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 7px 10px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid rgba(150, 124, 88, 0.36);
  background: rgba(20, 17, 22, 0.84);
  color: #bfb5a6;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.v8-wiz-step-pill em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 118, 0.44);
  background: rgba(14, 12, 16, 0.82);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.v8-wiz-step-pill span {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: break-word;
}

.v8-wiz-step-pill.is-current {
  border-color: #e6c281;
  background: linear-gradient(155deg, rgba(78, 38, 46, 0.92), rgba(34, 22, 28, 0.96));
  color: #fff5df;
}

.v8-wiz-step-pill.is-current em {
  border-color: #f2d297;
  background: rgba(216, 180, 118, 0.22);
  color: #ffefd0;
}

.v8-wiz-step-pill.is-done {
  border-color: rgba(124, 178, 138, 0.56);
  color: #cde8d4;
}

.v8-wiz-step-pill.is-done em {
  border-color: rgba(124, 178, 138, 0.72);
  background: rgba(30, 68, 46, 0.8);
  color: #d6f5de;
}

.v8-wiz-progress-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid rgba(186, 148, 92, 0.34);
  background: rgba(24, 20, 26, 0.75);
  color: #e4d6bd;
}

.v8-wiz-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v8-wiz-panel[hidden] {
  display: none !important;
}

.v8-wiz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(142, 120, 92, 0.32);
  background: rgba(18, 16, 21, 0.72);
}

.v8-wiz-field > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-weight: 600;
  color: #f3e4c6;
}

.v8-wiz-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.v8-wiz-badge.is-req {
  border: 1px solid rgba(220, 126, 126, 0.62);
  background: rgba(84, 28, 32, 0.72);
  color: #f7c7c7;
}

.v8-wiz-badge.is-opt {
  border: 1px solid rgba(154, 140, 118, 0.42);
  background: rgba(34, 30, 36, 0.72);
  color: #cfc4b3;
}

.v8-wiz-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #bdb3a4;
}

.v8-wiz-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v8-wiz-checks > label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  color: #f1e2c5;
}

.v8-wiz-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(150, 124, 88, 0.3);
}

.v8-wiz-nav #v8-wiz-prev {
  margin-right: auto;
}

/* =========================================================
   7even — Compact Library Rows (Talenti e Oggetti)
   ========================================================= */
.v8-lib-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}

.card.entry.v8-lib-entry-card {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.v8-lib-entry-fold {
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}

.v8-lib-entry-summary {
  list-style: none;
  cursor: pointer;
  padding-right: 10px;
}

.v8-lib-entry-summary::-webkit-details-marker {
  display: none;
}

.v8-lib-entry-summary .v8-lib-entry-row {
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.v8-lib-fold-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: #cbb996;
  transition: transform 0.16s ease, color 0.16s ease;
}

.v8-lib-fold-chev svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v8-lib-entry-fold[open] > .v8-lib-entry-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: rgba(216, 180, 118, 0.56);
}

.v8-lib-entry-fold[open] > .v8-lib-entry-summary .v8-lib-fold-chev {
  transform: rotate(180deg);
  color: #f3d598;
}

.v8-lib-entry-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.92fr) minmax(0, 1.35fr);
  gap: 16px;
  padding: 14px 16px 16px;
  border: 1px solid rgba(216, 180, 118, 0.42);
  border-top: 0;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  background: linear-gradient(160deg, rgba(24, 20, 26, 0.96), rgba(15, 14, 19, 0.98));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
}

.v8-lib-entry-col {
  min-width: 0;
}

.v8-lib-entry-col h3 {
  margin-top: 0;
}

.v8-lib-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

/* =========================================================
   7even — D&D Race Icon Picker (Nuovo PG / Gestisci PG)
   ========================================================= */
.mpg-race-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(154, 128, 92, 0.34);
  background: rgba(18, 15, 20, 0.78);
}

.mpg-race-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mpg-race-picker-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #f2e0be;
}

.mpg-race-picker-cur {
  font-size: 11.5px;
  color: #d6c29d;
}

.mpg-race-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  max-height: 188px;
  overflow-y: auto;
  padding-right: 4px;
}

.mpg-race-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  margin: 0;
  border-radius: 7px;
  border: 1px solid rgba(154, 128, 92, 0.3);
  background: rgba(26, 22, 28, 0.88);
  color: #d4c6b2;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.mpg-race-opt:hover,
.mpg-race-opt:focus-visible {
  border-color: rgba(226, 188, 122, 0.68);
  background: rgba(54, 30, 38, 0.88);
  color: #fff3da;
}

.mpg-race-opt.is-selected {
  border-color: #f0cf8e;
  background: linear-gradient(155deg, rgba(96, 40, 48, 0.94), rgba(44, 24, 30, 0.96));
  color: #fff6e2;
  box-shadow: 0 0 0 1px rgba(240, 207, 142, 0.32);
}

.mpg-race-opt-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.mpg-race-opt-svg svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-race-opt-lbl {
  font-size: 10.5px;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mpg-manage-pg-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mpg-manage-pg-crest {
  width: 34px;
  height: 34px;
}

.mpg-manage-pg-crest svg {
  width: 20px;
  height: 20px;
}

/* =========================================================
   Chronicle Forge — Anime Search & Campaign Filters
   ========================================================= */
.v8-souls-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.v8-souls-count {
  margin: 6px 0 0;
}

.v8-souls-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  flex: 1 1 320px;
}

.v8-souls-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  flex: 1 1 160px;
  min-width: 0;
}

.v8-souls-filter-field span {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c8baa4;
  font-weight: 600;
}

.v8-souls-filter-field input,
.v8-souls-filter-field select {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.soul-summary-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.v8-soul-camp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid rgba(196, 134, 174, 0.48);
  background: rgba(62, 28, 52, 0.72);
  color: #f0cde4;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

/* =========================================================
   Chronicle Forge — Site Confirm Dialog Heading & Anime Add Accent
   ========================================================= */
.mpg-confirm-heading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.mpg-confirm-ico {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  border: 1px solid rgba(216, 180, 118, 0.48);
  background: rgba(64, 28, 36, 0.78);
  color: #f0cf8e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mpg-confirm-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v77-add[data-add-type="anime"] svg {
  color: #d8a6ea;
}

/* =========================================================
   Chronicle Forge — Spell Properties Table & Unified Resources Panel
   ========================================================= */
.v8-wiz-prop-fieldset {
  padding: 12px 12px 10px;
  border-color: rgba(182, 146, 94, 0.42);
  background: rgba(18, 15, 22, 0.62);
}

.v8-wiz-prop-fieldset > legend {
  padding: 0 6px;
  font-weight: 700;
  color: #f0cf8e;
}

.v8-wiz-prop-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid rgba(176, 142, 92, 0.34);
  background: rgba(14, 12, 18, 0.86);
}

.v8-wiz-prop-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.45;
  color: #e6dfd2;
}

.v8-wiz-prop-table thead th {
  padding: 9px 11px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f0cf8e;
  background: linear-gradient(180deg, rgba(64, 28, 36, 0.72), rgba(38, 20, 26, 0.84));
  border-bottom: 1px solid rgba(206, 168, 108, 0.36);
  white-space: nowrap;
}

.v8-wiz-prop-table tbody td {
  padding: 9px 11px;
  vertical-align: top;
  border-bottom: 1px solid rgba(154, 128, 92, 0.18);
}

.v8-wiz-prop-table tbody tr:last-child td {
  border-bottom: 0;
}

.v8-wiz-prop-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.v8-wiz-prop-table tbody tr:hover {
  background: rgba(124, 52, 66, 0.16);
}

.v8-wiz-prop-table .is-col-check {
  width: 62px;
  text-align: center;
  vertical-align: middle;
}

.v8-wiz-prop-table .is-col-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #d8b476;
  cursor: pointer;
}

.v8-wiz-prop-table .is-col-prop {
  width: 148px;
  white-space: nowrap;
}

.v8-wiz-prop-table .is-col-prop label {
  display: inline;
  margin: 0;
  font-weight: 700;
  color: #f8e6c2;
  cursor: pointer;
}

.v8-wiz-prop-table .is-col-on {
  width: 44%;
  color: #ece4d6;
}

.v8-wiz-prop-table .is-col-off {
  color: #b7aea2;
  font-style: italic;
}

/* Unified "Lanci gratuiti e capacità" (Sidebar & Modalità Avventura) */
.mpg-ures-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mpg-ures-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mpg-ures-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(182, 148, 96, 0.28);
  background: rgba(28, 22, 28, 0.72);
}

.mpg-ures-group.is-free-casts .mpg-ures-group-head {
  border-color: rgba(196, 150, 222, 0.36);
  background: linear-gradient(155deg, rgba(46, 28, 56, 0.62), rgba(24, 18, 30, 0.78));
}

.mpg-ures-group.is-features .mpg-ures-group-head {
  border-color: rgba(216, 180, 118, 0.38);
  background: linear-gradient(155deg, rgba(56, 36, 24, 0.62), rgba(26, 20, 18, 0.78));
}

.mpg-ures-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0d7a6;
}

.mpg-ures-group.is-free-casts .mpg-ures-group-title {
  color: #e4bff6;
}

.mpg-ures-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 14, 20, 0.75);
  border: 1px solid rgba(216, 180, 118, 0.36);
  color: #f3dfb8;
}

.mpg-ures-group.is-free-casts .mpg-ures-group-badge {
  border-color: rgba(196, 150, 222, 0.44);
  color: #ecd0fa;
}

.mpg-ures-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mpg-ures-card.resource {
  margin: 0;
  padding: 0;
  border: 1px solid rgba(154, 126, 86, 0.3);
  border-radius: 7px;
  background: rgba(18, 16, 22, 0.82);
  overflow: hidden;
}

.mpg-ures-card.resource.is-free-cast {
  border-left: 3px solid rgba(198, 148, 226, 0.74);
}

.mpg-ures-card.resource.is-feature {
  border-left: 3px solid rgba(218, 178, 108, 0.78);
}

.mpg-ures-card.resource.is-at-will-card {
  border-left: 3px solid rgba(122, 182, 168, 0.7);
}

.mpg-ures-card.resource.is-empty {
  border-color: rgba(156, 112, 118, 0.34);
  opacity: 0.9;
}

.mpg-ures-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  list-style: none;
  cursor: pointer;
  color: #f2e4c9;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.14s ease;
}

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

.mpg-ures-summary::before {
  content: '▸';
  font-size: 11px;
  color: #d8b476;
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}

.mpg-ures-card[open] > .mpg-ures-summary::before {
  transform: rotate(90deg);
}

.mpg-ures-summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mpg-ures-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.mpg-ures-count {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 118, 0.44);
  background: rgba(44, 30, 24, 0.8);
  color: #f7deb0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.mpg-ures-count.is-empty {
  border-color: rgba(204, 120, 128, 0.44);
  background: rgba(58, 22, 28, 0.78);
  color: #f2b7bc;
}

.mpg-ures-body {
  padding: 7px 9px 8px;
  border-top: 1px solid rgba(154, 126, 86, 0.2);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mpg-ures-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mpg-ures-bar .slotdots {
  margin: 0;
}

.mpg-ures-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.mpg-ures-controls button {
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.mpg-ures-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mpg-ures-item.resitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid rgba(138, 116, 86, 0.22);
  border-radius: 6px;
  background: rgba(14, 13, 18, 0.72);
  font-size: 12px;
}

.mpg-ures-item-name {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mpg-ures-item .mpg-ures-use-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.mpg-ures-recovery {
  margin: 0 !important;
  font-size: 11px;
  line-height: 1.38;
  color: #b7afa3;
}

.mpg-ures-atwill-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mpg-ures-atwill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(14, 13, 18, 0.62);
  font-size: 12px;
}

.mpg-ures-atwill-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mpg-ures-atwill-tag {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(164, 174, 192, 0.36);
  background: rgba(34, 38, 48, 0.78);
  color: #cfd8e8;
}

.mpg-ures-atwill-tag.is-spells {
  border-color: rgba(196, 150, 222, 0.42);
  background: rgba(46, 26, 56, 0.74);
  color: #e4bff6;
}

.mpg-ures-atwill-tag.is-abilities {
  border-color: rgba(216, 180, 118, 0.44);
  background: rgba(54, 36, 22, 0.74);
  color: #f3d7a3;
}

.mpg-ures-foot {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: #afa69a;
}

.mpg-ures-empty {
  margin: 0;
  font-size: 12.5px;
}

/* Circular pallini for Slot disponibili & Lanci gratuiti e capacità */
.slotdots {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.slotdots .mpg-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-sizing: border-box;
  flex: 0 0 auto;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.slotdots .mpg-dot.full {
  background: radial-gradient(circle at 35% 35%, #f9e2a4 0%, #d8b476 58%, #9f7738 100%);
  border: 1px solid rgba(246, 220, 158, 0.85);
  box-shadow: 0 0 6px rgba(216, 180, 118, 0.45);
}

.slotdots .mpg-dot.empty {
  background: rgba(14, 12, 18, 0.72);
  border: 1.5px solid rgba(164, 148, 128, 0.56);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.48);
}

.slotdots .mpg-dot-overflow {
  font-size: 11px;
  color: #c8bca8;
  margin-left: 2px;
}

/* Unified "Slot disponibili" (Sidebar & Modalità Avventura) */
.mpg-uslot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mpg-uslot-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid rgba(154, 126, 86, 0.32);
  border-left: 3px solid rgba(216, 180, 118, 0.8);
  border-radius: 7px;
  background: rgba(18, 16, 22, 0.82);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mpg-uslot-card:hover {
  border-color: rgba(206, 168, 108, 0.48);
  background: rgba(24, 20, 28, 0.88);
}

.mpg-uslot-card.is-empty {
  border-color: rgba(156, 112, 118, 0.34);
  border-left-color: rgba(186, 114, 122, 0.62);
  opacity: 0.9;
}

.mpg-uslot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mpg-uslot-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mpg-uslot-lv {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f3dfb8;
  white-space: nowrap;
}

.mpg-uslot-dots-row {
  display: flex;
  align-items: center;
  min-height: 14px;
}

.mpg-uslot-dots-row .slotdots {
  margin: 0;
}

.mpg-uslot-empty {
  margin: 0;
  font-size: 12.5px;
}

/* Session "Slot e risorse rapide" balanced columns & shared Restore buttons */
.mpg-sess-res-col {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid rgba(164, 134, 92, 0.28);
  background: linear-gradient(160deg, rgba(24, 20, 26, 0.78), rgba(15, 13, 19, 0.88));
  min-width: 0;
}

.mpg-sess-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(164, 134, 92, 0.24);
}

.mpg-sess-col-head .mpg-comp-group-title {
  margin: 0;
}

.mpg-sess-col-body {
  flex: 1 1 auto;
  min-width: 0;
}

.mpg-sess-col-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(164, 134, 92, 0.18);
}

.mpg-livebox-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}

.mpg-livebox-actions > button {
  flex: 1 1 auto;
}

.mpg-restore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid rgba(196, 160, 102, 0.44);
  background: linear-gradient(155deg, rgba(42, 33, 38, 0.9), rgba(24, 20, 26, 0.95));
  color: #efe1c6;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.mpg-restore-btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-restore-btn:hover:not(:disabled),
.mpg-restore-btn:focus-visible:not(:disabled) {
  border-color: rgba(236, 198, 132, 0.72);
  background: linear-gradient(155deg, rgba(64, 42, 48, 0.95), rgba(34, 24, 30, 0.98));
  color: #fff6e4;
}

.mpg-restore-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#livepanel .mpg-restore-btn {
  font-size: 11.5px;
  min-height: 30px;
  padding: 5px 9px;
}

@media (max-width: 980px) {
  .mpg-session-conc-row-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .mpg-session-conc-quickbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .mpg-session-conc-quickbar .mpg-qt-btn {
    min-width: 0;
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .v8-lib-entry-body {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .mpg-race-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #livepanel .livebox-resources .mpg-ures-card.resource {
    display: block;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .v8-wiz-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v8-souls-filters {
    width: 100%;
    flex: 1 1 100%;
  }

  .v8-trash-bulk-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .v8-trash-bulk-actions {
    width: 100%;
    justify-content: stretch;
  }

  .v8-trash-bulk-actions > button {
    flex: 1 1 140px;
  }

  .mpg-sess-cond-strip-row {
    align-items: stretch;
  }

  .mpg-sess-cond-strip-mid {
    flex: 1 1 100%;
  }

  .mpg-sess-cond-add-inline {
    width: 100%;
    margin-left: 0;
  }

  .mpg-sess-cond-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .v8-quicknote-done.is-floating-notice {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}

/* =========================================================
   Chronicle Forge — Modale "Livelli, slot e utilizzi"
   ========================================================= */
.v8-slotcfg-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.v8-slotcfg-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid rgba(180, 146, 94, 0.34);
  background: linear-gradient(160deg, rgba(32, 24, 30, 0.84), rgba(18, 15, 22, 0.9));
}

.v8-slotcfg-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #d6cab8;
}

.v8-slotcfg-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
  font-size: 12.5px;
  color: #bfb29e;
  font-variant-numeric: tabular-nums;
}

.v8-slotcfg-summary strong {
  color: #f0cf8e;
  font-weight: 700;
}

.v8-slotcfg-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-slotcfg-sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(176, 142, 92, 0.28);
}

.v8-slotcfg-sec-head h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: #f2dca8;
}

.v8-slotcfg-quick-btn {
  font-size: 12px;
  padding: 5px 10px;
  min-height: 30px;
}

.v8-slotcfg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.v8-slotcfg-card,
.v8-slotcfg-res-card {
  margin: 0;
  padding: 10px 11px 11px;
  border-radius: 9px;
  border: 1px solid rgba(146, 122, 86, 0.34);
  background: linear-gradient(160deg, rgba(25, 22, 28, 0.86), rgba(16, 15, 20, 0.94));
  min-width: 0;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.v8-slotcfg-card.is-active {
  border-color: rgba(216, 176, 108, 0.62);
  background: linear-gradient(155deg, rgba(44, 26, 34, 0.78), rgba(20, 16, 22, 0.94));
}

.v8-slotcfg-card-legend,
.v8-slotcfg-res-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #e6c687;
}

.v8-slotcfg-lv {
  letter-spacing: 0.04em;
}

.v8-slotcfg-res-key {
  color: #f3deb2;
}

.v8-slotcfg-state {
  font-size: 11.5px;
  font-weight: 600;
  color: #b7aa96;
  font-variant-numeric: tabular-nums;
}

.v8-slotcfg-card.is-active .v8-slotcfg-state {
  color: #f5d896;
}

.v8-slotcfg-state.is-warn {
  color: #f28b82 !important;
}

.v8-slotcfg-stepper-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.v8-slotcfg-num-field,
.v8-slotcfg-text-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.v8-slotcfg-num-field > span,
.v8-slotcfg-text-field > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #cbbda6;
}

.v8-slotcfg-stepper {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 4px;
}

.v8-slotcfg-stepper input[type="number"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 5px 4px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
}

.v8-slotcfg-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(184, 148, 94, 0.45);
  background: linear-gradient(155deg, rgba(48, 30, 36, 0.9), rgba(26, 18, 24, 0.96));
  color: #f4dfb6;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.v8-slotcfg-step-btn:hover,
.v8-slotcfg-step-btn:focus-visible {
  border-color: rgba(238, 198, 128, 0.78);
  background: linear-gradient(155deg, rgba(72, 38, 46, 0.96), rgba(38, 22, 28, 0.98));
  color: #fff6e4;
}

.v8-slotcfg-res-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v8-slotcfg-res-nums {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 9px;
}

.v8-slotcfg-res-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v8-slotcfg-text-field input {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.v8-slotcfg-empty {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(154, 132, 98, 0.34);
  font-size: 13px;
}

.v8-slotcfg-err {
  margin: 0;
}

.v8-slotcfg-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(176, 142, 92, 0.28);
}

@media (max-width: 640px) {
  .v8-slotcfg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v8-slotcfg-res-nums,
  .v8-slotcfg-res-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .v8-slotcfg-sec-head {
    flex-direction: column;
    align-items: stretch;
  }

  .v8-slotcfg-quick-btn {
    width: 100%;
  }

  .v8-slotcfg-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .v8-slotcfg-footer > button {
    width: 100%;
  }
}

@media (max-width: 440px) {
  .v8-slotcfg-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   Chronicle Forge — Modale rapida Monete (Borsello)
   ========================================================= */
.v8-coins-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.v8-coins-modal-summary {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(182, 146, 94, 0.4);
  background: linear-gradient(155deg, rgba(32, 24, 29, 0.92), rgba(18, 16, 22, 0.96));
}

.v8-coins-modal-body {
  padding: 12px 0 2px;
  border-top: 1px solid rgba(158, 127, 74, 0.32);
}

.v8-coins-modal-wrap .v710-coin-row {
  align-items: center;
}

.v8-coin-fix-panel {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(158, 127, 74, 0.34);
}

.v8-coin-fix-panel[hidden] {
  display: none !important;
}

.v8-coin-fix-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #e8d5b3;
}

.v8-coin-fix-inp {
  width: 96px !important;
}

.v8-coin-fix-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

@media (max-width: 640px) {
  .mpg-session-conc-quickbar {
    gap: 6px;
  }

  .mpg-session-conc-quickbar .mpg-qt-btn {
    padding: 8px 6px;
    font-size: 13px;
    gap: 4px;
    justify-content: center;
  }

  .v8-coins-modal-wrap .v710-coin-row {
    flex-direction: column;
    align-items: stretch;
  }

  .v8-coins-modal-wrap .v710-coin-info {
    min-width: 0;
  }

  .v8-coins-modal-wrap .v710-coin-controls {
    width: 100%;
  }

  .v8-coins-modal-wrap .v710-coin-controls .v710-coin-amt {
    flex: 0 0 74px;
  }

  .v8-coins-modal-wrap .v710-coin-controls .v710-coin-btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .v8-coin-fix-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .v8-coin-fix-label {
    justify-content: space-between;
  }

  .v8-coin-fix-actions {
    width: 100%;
  }

  .v8-coin-fix-actions > button {
    flex: 1 1 auto;
  }
}

/* =========================================================
   Chronicle Forge — 4 Tasti Rapidi nel Diario, Riquadro Unico
   Condizioni/Concentrazione/Slot e Icone Sidebar Allineate
   ========================================================= */
#livepanel .mpg-sidebar-live-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

#livepanel .mpg-sidebar-head-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--gold, #c6a063);
}

#livepanel .mpg-sidebar-head-ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 4 tasti (+ Oggetto, + Anima, + Monete, + Obiettivo) in basso a destra di Scrivi sul diario */
.mpg-session-diary-card .mpg-session-diary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}

.mpg-session-diary-actions-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mpg-session-diary-quickbar {
  margin-left: auto;
}

.mpg-session-diary-quickbar .mpg-qt-btn {
  min-height: 40px;
  padding: 6px 10px;
}

/* Riquadro unico ottimizzato: Condizioni attive · Concentrazione · Slot e risorse rapide */
.mpg-session-status-hub {
  padding: 0;
  border: 1px solid rgba(176, 138, 82, 0.48);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(30, 23, 28, 0.93) 0%, rgba(16, 15, 20, 0.96) 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.mpg-status-hub-row {
  padding: 12px 15px;
  min-width: 0;
}

.mpg-status-hub-row + .mpg-status-hub-row {
  border-top: 1px solid rgba(176, 138, 82, 0.24);
}

.mpg-status-hub-conc {
  padding-top: 10px;
  padding-bottom: 10px;
  transition: background 0.18s ease;
}

.mpg-status-hub-conc.mpg-session-conc-active {
  border-color: rgba(176, 138, 82, 0.24);
  background: linear-gradient(150deg, rgba(78, 33, 46, 0.72), rgba(34, 20, 26, 0.78));
}

.mpg-status-hub-resources {
  padding-top: 11px;
  padding-bottom: 11px;
}

.mpg-session-resources-card.is-embedded {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mpg-session-resources-card.is-embedded.is-collapsed {
  padding-top: 0;
  padding-bottom: 0;
}

.mpg-session-resources-card.is-embedded .mpg-session-res-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
}

.mpg-session-resources-card.is-embedded:not(.is-collapsed) > .mpg-sess-collapse-head {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(176, 138, 82, 0.2);
}

@media (max-width: 640px) {
  .mpg-session-diary-card .mpg-session-diary-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mpg-session-diary-actions-left {
    width: 100%;
  }

  .mpg-session-diary-quickbar {
    margin-left: 0;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mpg-status-hub-row {
    padding: 10px 12px;
  }
}

/* =========================================================
   MODALITÀ AVVENTURA — AZIONI DEL TURNO COMPATTE & DETTAGLI REGOLA
   ========================================================= */
.mpg-session-turn-card {
  padding: 10px 12px;
  gap: 8px;
}

.mpg-session-turn-card .mpg-session-turn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0;
}

.mpg-session-turn-card .mpg-session-head-reset-btn {
  min-height: 29px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mpg-session-turn-card #mpg-session-turn-panels,
.mpg-session-turn-card .mpg-session-turn-panels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mpg-session-turn-card .mpg-session-turn-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.mpg-session-turn-card .mpg-session-turn-item {
  --turn-accent: #d8b476;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--turn-accent) 72%, #241e26);
  background: linear-gradient(160deg, color-mix(in srgb, var(--turn-accent) 23%, #1c1821), color-mix(in srgb, var(--turn-accent) 8%, #131218));
  box-shadow: inset 0 3px 0 var(--turn-accent), 0 2px 8px color-mix(in srgb, var(--turn-accent) 14%, transparent);
  transition: opacity 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mpg-session-turn-card .mpg-session-turn-item.is-move { --turn-accent: #38bdf8; }
.mpg-session-turn-card .mpg-session-turn-item.is-action { --turn-accent: #22c55e; }
.mpg-session-turn-card .mpg-session-turn-item.is-bonus { --turn-accent: #f97316; }
.mpg-session-turn-card .mpg-session-turn-item.is-interaction { --turn-accent: #eab308; }
.mpg-session-turn-card .mpg-session-turn-item.is-reaction { --turn-accent: #ef4444; }

.mpg-session-turn-card .mpg-session-turn-item.is-rule-open {
  border-color: color-mix(in srgb, var(--turn-accent) 92%, #ffffff);
  box-shadow: inset 0 3px 0 var(--turn-accent), 0 0 0 1px color-mix(in srgb, var(--turn-accent) 45%, transparent);
}

.mpg-session-turn-card .mpg-session-turn-item.is-used {
  border-color: #423e48;
  background: #141318;
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--turn-accent) 32%, #3a3640);
  opacity: 0.76;
}

.mpg-session-turn-card .mpg-st-main-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 9px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.mpg-session-turn-card .mpg-st-main-btn:hover,
.mpg-session-turn-card .mpg-st-main-btn:focus-visible {
  background: color-mix(in srgb, var(--turn-accent) 18%, transparent);
  outline: none;
}

.mpg-session-turn-card .mpg-st-main-btn:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--turn-accent) 82%, #ffffff);
}

.mpg-session-turn-card .mpg-st-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex: 0 0 26px;
  background: color-mix(in srgb, var(--turn-accent) 26%, #111016);
  border: 1px solid color-mix(in srgb, var(--turn-accent) 78%, transparent);
  color: color-mix(in srgb, var(--turn-accent) 88%, #ffffff);
}

.mpg-session-turn-card .mpg-session-turn-item.is-used .mpg-st-icon {
  background: #1a191f;
  border-color: #46424d;
  color: #8a8490;
}

.mpg-session-turn-card .mpg-st-icon svg {
  width: 15px;
  height: 15px;
}

.mpg-session-turn-card .mpg-st-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

.mpg-session-turn-card .mpg-st-name {
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mpg-session-turn-card .mpg-st-sym {
  color: color-mix(in srgb, var(--turn-accent) 88%, #ffffff);
}

.mpg-session-turn-card .mpg-session-turn-item.is-used .mpg-st-sym {
  color: #8f8995;
}

.mpg-session-turn-card .mpg-st-state {
  margin-top: 0;
  font-size: 10.5px;
  line-height: 1.15;
  color: color-mix(in srgb, var(--turn-accent) 84%, #ffffff);
}

.mpg-session-turn-card .mpg-session-turn-item.is-used .mpg-st-state {
  color: #8f8995;
}

.mpg-session-turn-card .mpg-st-rule-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  width: 100%;
  padding: 4px 9px;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--turn-accent) 28%, rgba(125, 103, 72, 0.24));
  background: rgba(11, 10, 15, 0.52);
  color: #dec089;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.mpg-session-turn-card .mpg-st-rule-trigger:hover,
.mpg-session-turn-card .mpg-st-rule-trigger:focus-visible,
.mpg-session-turn-card .mpg-st-rule-trigger.is-open {
  background: color-mix(in srgb, var(--turn-accent) 20%, rgba(16, 14, 21, 0.88));
  color: #f8e7c4;
  outline: none;
}

.mpg-session-turn-card .mpg-st-rule-trigger-lbl {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mpg-session-turn-card .mpg-st-custom-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #f0cf8e;
  box-shadow: 0 0 0 2px rgba(240, 207, 142, 0.2);
  flex: 0 0 auto;
  margin-left: auto;
}

.mpg-session-turn-card .mpg-st-rule-chev {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
  transition: transform 0.16s ease;
}

.mpg-session-turn-card .mpg-st-rule-trigger.is-open .mpg-st-rule-chev {
  transform: rotate(180deg);
}

.mpg-session-turn-card .mpg-st-rule-drawer[hidden] {
  display: none !important;
}

.mpg-session-turn-card .mpg-st-rule-drawer {
  --turn-accent: #d8b476;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--turn-accent) 62%, #3a3038);
  background: linear-gradient(165deg, color-mix(in srgb, var(--turn-accent) 13%, #1c1821), #131218);
  box-shadow: inset 3px 0 0 var(--turn-accent);
}

.mpg-session-turn-card .mpg-st-rule-drawer.is-move { --turn-accent: #38bdf8; }
.mpg-session-turn-card .mpg-st-rule-drawer.is-action { --turn-accent: #22c55e; }
.mpg-session-turn-card .mpg-st-rule-drawer.is-bonus { --turn-accent: #f97316; }
.mpg-session-turn-card .mpg-st-rule-drawer.is-interaction { --turn-accent: #eab308; }
.mpg-session-turn-card .mpg-st-rule-drawer.is-reaction { --turn-accent: #ef4444; }

.mpg-session-turn-card .mpg-st-rule-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mpg-session-turn-card .mpg-st-rule-drawer-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: #f3ece0;
  font-size: 13px;
}

.mpg-session-turn-card .mpg-st-rule-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(125, 103, 72, 0.35);
  background: rgba(20, 18, 24, 0.85);
  color: #d6cbb9;
  cursor: pointer;
  flex: 0 0 auto;
}

.mpg-session-turn-card .mpg-st-rule-close:hover,
.mpg-session-turn-card .mpg-st-rule-close:focus-visible {
  border-color: var(--turn-accent);
  color: #ffffff;
}

.mpg-session-turn-card .mpg-st-rule-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpg-session-turn-card .mpg-st-rule-short {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #c2b8aa;
}

.mpg-session-turn-card .mpg-st-detail-body {
  margin-top: 0;
  gap: 8px;
}

.mpg-session-turn-card .mpg-st-detail-text-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px dashed rgba(176, 138, 82, 0.35);
  background: rgba(11, 10, 15, 0.56);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mpg-session-turn-card .mpg-st-detail-text-btn:hover,
.mpg-session-turn-card .mpg-st-detail-text-btn:focus-visible {
  border-color: color-mix(in srgb, var(--turn-accent) 75%, #f0cf8e);
  background: rgba(18, 16, 24, 0.85);
  outline: none;
}

.mpg-session-turn-card .mpg-st-detail-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #ebe3d6;
}

.mpg-session-turn-card .mpg-st-detail-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: #cfa96a;
  letter-spacing: 0.02em;
}

@media (max-width: 1080px) {
  .mpg-session-turn-card .mpg-session-turn-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .mpg-session-turn-card .mpg-session-turn-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .mpg-session-turn-card .mpg-session-turn-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   MENU LATERALE — UNICO BLOCCO CON CORNICE, DIVISORI HOME
   & SCROLLBAR A SINISTRA ESTERNA NON SOVRAPPOSTA
   ========================================================= */
body:not(.mpg-home-active) > .shell {
  grid-template-columns: 300px minmax(0, 1fr);
}

body:not(.mpg-home-active) > .shell > nav {
  display: block;
  position: sticky;
  top: 0;
  height: 100dvh;
  margin: 0;
  padding: 10px 4px 10px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  direction: rtl;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(186, 148, 92, 0.56) rgba(14, 12, 17, 0.72);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

body:not(.mpg-home-active) > .shell > nav::-webkit-scrollbar {
  width: 7px;
}

body:not(.mpg-home-active) > .shell > nav::-webkit-scrollbar-track {
  background: rgba(14, 12, 17, 0.72);
  border-radius: 999px;
  margin: 10px 0;
}

body:not(.mpg-home-active) > .shell > nav::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(216, 180, 118, 0.65), rgba(154, 118, 66, 0.65));
  border-radius: 999px;
  border: 1px solid rgba(18, 14, 20, 0.8);
}

body:not(.mpg-home-active) > .shell > nav::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(235, 202, 140, 0.86), rgba(186, 148, 92, 0.86));
}

body:not(.mpg-home-active) > .shell > nav > * {
  direction: ltr;
  box-sizing: border-box;
}

body:not(.mpg-home-active) > .shell > nav > #mpg-switch-nav {
  position: relative;
  display: block;
  flex: 0 0 auto;
  height: auto;
  margin: 0;
  padding: 12px 12px 20px;
  border: 1px solid rgba(186, 148, 92, 0.64);
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(124, 52, 60, 0.22), transparent 56%),
    linear-gradient(180deg, #1d151c 0%, #161218 100%);
  box-shadow:
    inset 1px 1px 0 rgba(216, 180, 118, 0.18),
    inset -1px 0 0 rgba(216, 180, 118, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.38);
}

body:not(.mpg-home-active) > .shell > nav > #mpg-switch-nav .mpg-nav-vine-frame .mpg-qt-vine-corner.is-bl,
body:not(.mpg-home-active) > .shell > nav > #mpg-switch-nav .mpg-nav-vine-frame .mpg-qt-vine-corner.is-br {
  opacity: 0.16;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel {
  display: block;
  flex: 0 0 auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(186, 148, 92, 0.64);
  border-right: 1px solid rgba(186, 148, 92, 0.64);
  background: linear-gradient(180deg, #161218 0%, #141217 55%, #171218 100%);
  box-shadow:
    inset 1px 0 0 rgba(216, 180, 118, 0.16),
    inset -1px 0 0 rgba(216, 180, 118, 0.16);
}

body:not(.mpg-home-active) > .shell > nav > #livepanel:last-child {
  border-bottom: 1px solid rgba(186, 148, 92, 0.64);
  border-radius: 0 0 11px 11px;
  box-shadow:
    inset 1px 0 0 rgba(216, 180, 118, 0.16),
    inset -1px -1px 0 rgba(216, 180, 118, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.38);
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > #mpg-turn-nav,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .v710-conditions-sidebar.livebox,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .undoarea {
  position: relative;
  margin: 0;
  padding: 10px 12px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Divisori ornamentali in stile pagina iniziale (linea oro sfumata + stella a 4 punte) */
body:not(.mpg-home-active) > .shell > nav > #mpg-switch-nav::after,
body:not(.mpg-home-active) > .shell > nav > #livepanel > #mpg-turn-nav::after,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox::after,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .v710-conditions-sidebar.livebox::after,
body:not(.mpg-home-active) > .shell > nav > #livepanel > .undoarea::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 14px;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d8b476' stroke-width='1.8'%3E%3Cpath d='m12 2 2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4Z'/%3E%3C/svg%3E"),
    linear-gradient(90deg, transparent 0%, rgba(142, 111, 70, 0.82) 38%, rgba(142, 111, 70, 0.82) 100%),
    linear-gradient(90deg, rgba(142, 111, 70, 0.82) 0%, rgba(142, 111, 70, 0.82) 62%, transparent 100%);
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-size: 13px 13px, calc(50% - 13px) 1px, calc(50% - 13px) 1px;
  background-position: center center, left center, right center;
  opacity: 0.9;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox h3 {
  font-size: 14.5px;
  margin: 0 0 7px;
  line-height: 1.25;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > #mpg-turn-nav .mpg-turn-nav-head {
  margin-bottom: 7px;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox-conc.is-conc-active {
  background: linear-gradient(150deg, rgba(84, 34, 49, 0.84), rgba(44, 22, 32, 0.88) 72%, rgba(28, 18, 24, 0.92));
  box-shadow: inset 3px 0 0 #e4c17f;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox-conc > div {
  margin-bottom: 6px;
}

body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox-resources .mpg-ures-foot {
  display: block;
  margin-top: 6px;
}

body:not(.mpg-home-active) > .shell > nav > .mpg-creator-signature-nav {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 12px 11px;
  border: 1px solid rgba(186, 148, 92, 0.64);
  border-top: 0;
  border-radius: 0 0 11px 11px;
  background: linear-gradient(180deg, #161217 0%, #121015 100%);
  box-shadow:
    inset 1px 0 0 rgba(216, 180, 118, 0.16),
    inset -1px -1px 0 rgba(216, 180, 118, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.42);
}

@media (max-width: 760px) {
  body:not(.mpg-home-active) > .shell {
    display: block;
  }

  body:not(.mpg-home-active) > .shell > nav {
    display: block;
    position: static;
    top: auto;
    height: auto;
    margin: 8px 10px 6px;
    padding: 0;
    direction: ltr;
    scrollbar-gutter: auto;
    border-radius: 10px;
    border: 1px solid rgba(186, 148, 92, 0.64);
    background:
      radial-gradient(circle at 12% 4%, rgba(124, 52, 60, 0.2), transparent 36%),
      linear-gradient(180deg, #1d151c 0%, #141217 48%, #181218 100%);
    box-shadow:
      inset 0 0 0 1px rgba(216, 180, 118, 0.16),
      0 6px 18px rgba(0, 0, 0, 0.42);
    overflow: hidden;
  }

  body:not(.mpg-home-active) > .shell > nav > #mpg-switch-nav {
    padding: 9px 10px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 200px;
    overflow: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(27, 20, 26, 0.98), rgba(18, 17, 21, 0.98));
    border-bottom: 1px solid rgba(186, 148, 92, 0.66);
    box-shadow: inset 0 -1px 0 rgba(216, 180, 118, 0.18), 0 6px 18px rgba(0, 0, 0, 0.54);
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel > #mpg-turn-nav,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .v710-conditions-sidebar.livebox,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .undoarea {
    padding: 7px 9px 15px;
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel > #mpg-turn-nav::after,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox::after,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .v710-conditions-sidebar.livebox::after,
  body:not(.mpg-home-active) > .shell > nav > #livepanel > .undoarea::after {
    left: 8px;
    right: 8px;
    bottom: 1px;
    height: 12px;
    background-size: 11px 11px, calc(50% - 11px) 1px, calc(50% - 11px) 1px;
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox-conc {
    border-right: 1px solid rgba(176, 138, 82, 0.24);
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox:last-child {
    padding-bottom: 8px;
  }

  body:not(.mpg-home-active) > .shell > nav > #livepanel > .livebox:last-child::after {
    display: none;
  }

  body:not(.mpg-home-active) > .shell > nav > .mpg-creator-signature-nav {
    padding: 7px 10px 8px;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: rgba(10, 9, 13, 0.24);
    box-shadow: none;
  }
}






