.digital-sheet-body {
  background: linear-gradient(180deg, var(--py-bg-strong) 0%, var(--py-panel-tint) 55%, var(--py-panel-soft) 100%);
}

.digital-sheet-shell {
  position: relative;
}

.digital-sheet-header {
  position: relative;
  width: 100%;
  z-index: 2;
  padding-top: 10px;
  padding-bottom: 10px;
  background: linear-gradient(180deg, var(--py-header-bg-start) 0%, var(--py-header-bg-end) 100%);
  box-shadow: 0 2px 8px var(--py-header-shadow);
}

.digital-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.digital-header-left {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.digital-header-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.digital-character-summary {
  display: grid;
  gap: 2px;
}

.digital-character-name {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.08;
}

.digital-character-meta {
  font-size: 14px;
  color: var(--muted);
}

.digital-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.digital-header-actions .btn {
  padding: 8px 12px;
  min-height: 38px;
}

.digital-header-menu-wrap {
  position: relative;
}

.digital-header-menu-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--py-panel);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.digital-header-menu-button span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.digital-header-menu-button:hover,
.digital-header-menu-button:focus-visible {
  outline: none;
  border-color: var(--accent-strong, var(--accent));
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

.digital-header-menu-panel[hidden] {
  display: none !important;
}

.digital-header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: var(--py-panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.digital-header-menu-panel .btn {
  width: 100%;
  justify-content: center;
}

.digital-overview-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.digital-sheet-container {
  max-width: 1380px;
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.digital-top-ribbon {
  display: grid;
  grid-template-columns: repeat(9, minmax(94px, 1fr)) minmax(346px, 2fr);
  gap: 10px;
  align-items: stretch;
}

.digital-ability-card,
.digital-mini-stat-card,
.digital-hp-card,
.digital-section-card,
.digital-metric-card,
.digital-defense-condition-card,
.digital-feature-shell {
  background: var(--py-panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.digital-ability-card,
.digital-mini-stat-card,
.digital-hp-card,
.digital-metric-card {
  padding: 8px 10px 7px;
}

.digital-ability-card {
  min-height: 122px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  justify-items: center;
  align-items: start;
  gap: 8px;
}

.digital-score-total {
  align-self: end;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 5px;
}

.digital-mini-stat-card {
  min-height: 122px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  justify-items: center;
  gap: 8px;
}

.digital-mini-value,
.digital-metric-value {
  align-self: center;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.digital-mini-footer {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.digital-hp-card {
  min-height: 122px;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: stretch;
}

.digital-hp-side {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.digital-inline-action {
  border: 2px solid var(--accent);
  background: var(--py-panel);
  color: var(--accent);
  border-radius: 12px;
  padding: 7px 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.digital-inline-action.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.digital-hp-adjust-input {
  border: 2px solid var(--line);
  border-radius: 12px;
  display: block;
  width: 100%;
  min-height: 40px;
  background: var(--py-panel-soft-2);
  font: inherit;
  font-weight: 800;
  text-align: center;
  padding: 6px 8px;
}

.digital-hp-adjust-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

.digital-hp-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  column-gap: 8px;
  row-gap: 6px;
}

.digital-hp-separator {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  align-self: center;
  justify-self: center;
  color: var(--text);
  grid-column: 2;
  grid-row: 2;
}

 .digital-hp-head.hp-current { grid-column: 1; grid-row: 1; }
.digital-hp-head.hp-max { grid-column: 3; grid-row: 1; }
.digital-hp-head.hp-temp { grid-column: 4; grid-row: 1; }

.digital-hp-head {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.digital-hp-head.digital-linkish {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.digital-hp-value.hp-current { grid-column: 1; grid-row: 2; }
.digital-hp-value.hp-max { grid-column: 3; grid-row: 2; }
.digital-hp-value.hp-temp { grid-column: 4; grid-row: 2; }

.digital-hp-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.digital-hp-footer {
  grid-column: 1 / -1;
  align-self: end;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

button.digital-hp-footer {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.digital-stat-label,
.digital-row-label,
.card-bottom-button {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.digital-stat-label {
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.15;
}

.digital-row-label {
  text-align: left;
  line-height: 1.2;
}

.digital-row-label.mini {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.digital-row-label:hover,
.digital-stat-label:hover,
.card-bottom-button:hover,
.digital-linkish:hover {
  color: var(--accent);
}

.digital-mod-chip {
  border: 2px solid var(--line);
  background: var(--py-panel-tint);
  color: var(--accent);
  border-radius: 999px;
  min-width: 58px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.digital-mod-chip.small {
  min-width: 52px;
  padding: 6px 10px;
  font-size: 16px;
}

.digital-top-ribbon .digital-ability-card .digital-mod-chip {
  margin-top: 8px;
}

.digital-mod-chip:hover,
.digital-inline-action:hover,
.digital-header-actions .btn:hover {
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

.digital-mod-chip,
.digital-static-action,
.digital-inline-action,
.btn,
.digital-equip-toggle {
  transition: transform .14s ease, box-shadow .18s ease, filter .18s ease;
}

.digital-mod-chip.is-pressed,
.digital-static-action.is-pressed,
.digital-inline-action.is-pressed,
.btn.is-pressed,
.digital-equip-toggle.is-pressed {
  transform: translateY(1px) scale(.955);
  box-shadow: 0 0 0 5px var(--py-success-ring);
  filter: brightness(1.04);
}

.btn.is-confirmed,
.digital-equip-toggle.is-confirmed {
  animation: digitalButtonConfirm .42s ease;
}

@keyframes digitalButtonConfirm {
  0% { box-shadow: 0 0 0 0 rgba(47,133,90,.36); }
  45% { box-shadow: 0 0 0 8px rgba(47,133,90,.2); }
  100% { box-shadow: 0 0 0 0 rgba(47,133,90,0); }
}

.digital-main-grid {
  display: grid;
  grid-template-columns: 255px 320px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.digital-left-column,
.digital-center-column,
.digital-right-column {
  display: grid;
  gap: 12px;
}

.digital-section-card {
  padding: 10px 12px 12px;
}

.digital-card-title {
  font-size: 15px;
  font-weight: 800;
}

.card-bottom-button,
.card-bottom-static {
  width: 100%;
  text-align: center;
  margin-top: 10px;
  font-size: 15px;
}

.digital-saves-grid {
  display: grid;
  gap: 8px;
}

.digital-save-row {
  display: grid;
  grid-template-columns: auto 16px auto auto 16px auto;
  gap: 8px;
  align-items: center;
}


.digital-save-prof-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--py-panel);
  margin: 0 auto;
}

.digital-save-prof-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.digital-senses-card {
  min-height: 180px;
}

.digital-passive-stack {
  display: grid;
  gap: 8px;
}

.digital-passive-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0;
}

.digital-passive-value {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--py-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-right: -10px;
  z-index: 1;
}

.digital-passive-pill {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--py-panel-soft);
  padding: 10px 14px 10px 18px;
  font-size: 12px;
  font-weight: 700;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.digital-sense-lines {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.digital-profs-card {
  min-height: 260px;
}

.digital-prof-section + .digital-prof-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--py-border-faint);
}

.digital-subsection-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.digital-subsection-title-button {
  display: inline-flex;
  align-items: center;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.digital-subsection-title-button:hover,
.digital-subsection-title-button:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.digital-inspection-list-card.clickable {
  cursor: pointer;
}

.digital-inspection-list-card.clickable:hover {
  border-color: var(--accent);
}

.digital-subsection-copy {
  font-size: 13px;
  line-height: 1.45;
}

.digital-skills-card {
  padding: 10px 12px 12px;
}

.digital-skills-head,
.digital-skill-row {
  display: grid;
  grid-template-columns: 34px 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.digital-skills-head {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.digital-skill-row + .digital-skill-row {
  margin-top: 4px;
}

.digital-prof-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--py-panel);
  margin: 0 auto;
}

.digital-prof-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.digital-prof-dot.expertise {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
  margin: 2px auto;
}

.digital-skill-mod-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.digital-right-top-grid {
  display: grid;
  grid-template-columns: 108px 108px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.digital-metric-card.compact-metric {
  min-height: 118px;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-items: center;
  gap: 8px;
}

.digital-defense-condition-card {
  min-height: 118px;
  padding: 8px 10px;
}

.digital-dual-box {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
}

.digital-dual-col {
  display: grid;
  align-content: start;
  gap: 8px;
}

.digital-dual-divider {
  width: 1px;
  background: var(--py-border-faint);
}

.digital-stat-label.dual-heading {
  text-align: left;
}

.digital-plain-list {
  font-size: 13px;
  line-height: 1.4;
}

.digital-plain-list.muted {
  color: var(--muted);
}

.digital-feature-shell {
  min-height: 540px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.digital-tab-row {
  display: flex;
  gap: 6px;
  padding: 10px 10px 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.digital-tab {
  border: 2px solid var(--line);
  background: var(--py-panel-soft-2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.digital-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--py-on-primary);
}

.digital-feature-shell-body {
  margin: 10px;
  border: 2px dashed var(--py-border-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--py-panel-soft) 0%, var(--py-panel-tint) 100%);
  padding: 14px;
  overflow: auto;
}

.digital-placeholder-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
}

.digital-placeholder-copy {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

.digital-placeholder-list {
  display: grid;
  gap: 8px;
}

.digital-placeholder-line {
  padding: 10px 12px;
  background: var(--py-panel);
  border: 1px solid var(--py-border-faint);
  border-radius: 12px;
}

.digital-inspection-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  transform: translateX(104%);
  transition: transform .22s ease;
  z-index: 30;
  pointer-events: none;
}

.digital-inspection-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}

.digital-inspection-feedback {
  position: absolute;
  top: 78px;
  right: 18px;
  z-index: 4;
  padding: 7px 11px;
  border: 2px solid var(--py-success-border);
  border-radius: 999px;
  background: var(--py-success-bg);
  color: var(--py-success-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px rgba(17,63,109,.14);
  opacity: 0;
  transform: translateY(-6px) scale(.96);
  pointer-events: none;
}

.digital-inspection-feedback.show {
  animation: digitalInspectionFeedback .95s ease forwards;
}

@keyframes digitalInspectionFeedback {
  0% { opacity: 0; transform: translateY(-6px) scale(.96); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  78% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) scale(.98); }
}

.digital-inspection-card {
  height: 100%;
  background: var(--py-panel-glass);
  border-left: 2px solid var(--line);
  box-shadow: -12px 0 28px var(--py-shadow-panel);
  display: grid;
  grid-template-rows: auto 1fr;
}

.digital-inspection-header {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 2px solid var(--py-border-faint);
}

.digital-inspection-title {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
}

.digital-inspection-body {
  padding: 18px;
  overflow: auto;
  line-height: 1.6;
  font-size: 15px;
}

.digital-roll-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  background: rgba(18, 58, 99, 0.94);
  color: var(--py-on-primary);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 35;
  pointer-events: none;
}

.digital-roll-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1320px) {
  .digital-top-ribbon {
    grid-template-columns: repeat(5, minmax(88px, 1fr));
  }

  .digital-hp-card {
    grid-column: span 2;
  }

  .digital-main-grid {
    grid-template-columns: 1fr;
  }

  .digital-right-top-grid {
    grid-template-columns: 108px 108px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .digital-top-ribbon {
    grid-template-columns: repeat(3, minmax(88px, 1fr));
  }

  .digital-hp-card {
    grid-column: span 3;
  }

  .digital-right-top-grid {
    grid-template-columns: 1fr;
  }

  .digital-dual-box {
    grid-template-columns: 1fr;
  }

  .digital-dual-divider {
    display: none;
  }
}


/* v24.0.2 layout tightening pass */
.digital-sheet-header {
  padding: 10px 18px;
}

.digital-header-row {
  align-items: center;
  gap: 16px;
}

.digital-header-left {
  gap: 6px;
}

.digital-header-title {
  font-size: 16px;
  line-height: 1.1;
}

.digital-character-name {
  font-size: 26px;
  line-height: 1.05;
}

.digital-character-meta {
  font-size: 13px;
  line-height: 1.15;
}

.digital-header-actions {
  gap: 6px;
}

.digital-header-actions .btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 14px;
}

.digital-header-menu-button {
  width: 40px;
  height: 40px;
}

.digital-header-menu-button span {
  width: 14px;
}

.digital-sheet-container {
  max-width: 1460px;
  width: min(1460px, calc(100vw - 20px));
  gap: 10px;
  padding: 12px 10px 16px;
}

.digital-top-ribbon {
  grid-template-columns: repeat(6, minmax(0, 100px)) repeat(3, minmax(0, 94px)) minmax(0, 300px);
  justify-content: start;
  gap: 6px;
}

.digital-ability-card,
.digital-mini-stat-card,
.digital-hp-card,
.digital-metric-card {
  padding: 6px 8px;
}

.digital-ability-card {
  min-height: 102px;
  gap: 6px;
}

.digital-mini-stat-card {
  min-height: 102px;
  gap: 6px;
}

.digital-hp-card {
  min-height: 102px;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  grid-column: 10;
  min-width: 300px;
}

.digital-stat-label {
  font-size: 9px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.digital-mod-chip {
  min-width: 44px;
  padding: 6px 10px;
  font-size: 15px;
}

.digital-score-total {
  font-size: 20px;
  margin-bottom: 4px;
}

.digital-mini-value,
.digital-metric-value {
  font-size: 18px;
}

#sheet-inspiration-value {
  font-size: 28px;
  line-height: 1;
}

.digital-mini-footer,
.digital-hp-head,
.digital-hp-footer {
  font-size: 10px;
}

.digital-inline-action {
  padding: 6px 6px;
  border-radius: 10px;
  font-size: 13px;
}

.digital-hp-adjust-input {
  min-height: 34px;
  font-size: 13px;
}

.digital-hp-value {
  font-size: 22px;
}

.digital-main-grid {
  grid-template-columns: 250px 370px minmax(0, 1fr);
  gap: 10px;
}

.digital-left-column,
.digital-center-column,
.digital-right-column {
  gap: 10px;
}

.digital-section-card {
  padding: 8px 10px 10px;
}

.card-bottom-button,
.card-bottom-static,
.digital-card-title {
  font-size: 13px;
  margin-top: 8px;
}

.digital-saves-grid {
  gap: 6px;
}

.digital-save-row {
  gap: 6px;
}

.digital-row-label.mini {
  font-size: 13px;
}

.digital-mod-chip.small {
  min-width: 42px;
  padding: 5px 8px;
  font-size: 14px;
}

.digital-senses-card {
  min-height: 170px;
}

.digital-passive-stack {
  gap: 6px;
}

.digital-passive-value {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.digital-passive-pill {
  min-height: 34px;
  padding: 7px 12px 7px 14px;
  font-size: 11px;
}

.digital-sense-lines,
.digital-subsection-copy,
.digital-plain-list {
  font-size: 12px;
}

.digital-profs-card {
  min-height: 215px;
}

.digital-prof-section + .digital-prof-section {
  margin-top: 8px;
  padding-top: 8px;
}

.digital-subsection-title {
  font-size: 11px;
  margin-bottom: 2px;
}

.digital-skills-card {
  padding: 8px 10px 10px;
}

.digital-skills-head,
.digital-skill-row {
  grid-template-columns: 28px 38px minmax(0, 1fr) auto;
  gap: 6px;
}

.digital-skills-head > div:nth-child(1) { margin-right: 4px; }
.digital-skills-head > div:nth-child(2) { margin-left: 2px; }

.digital-skills-head {
  font-size: 10px;
  margin-bottom: 4px;
}

.digital-skill-row + .digital-skill-row {
  margin-top: 2px;
}

.digital-prof-dot {
  width: 12px;
  height: 12px;
}

.digital-skill-mod-tag {
  font-size: 11px;
}

.digital-right-top-grid {
  grid-template-columns: 78px 78px minmax(0, 1fr);
  gap: 8px;
}

.digital-metric-card.compact-metric {
  min-height: 102px;
  gap: 6px;
}

.digital-defense-condition-card {
  min-height: 102px;
  padding: 6px 8px;
}

.digital-dual-box {
  gap: 8px;
}

.digital-feature-shell {
  min-height: 520px;
}

.digital-tab-row {
  gap: 5px;
  padding: 8px 8px 0;
  overflow-x: visible;
}

.digital-tab {
  padding: 7px 10px;
  font-size: 12px;
}

.digital-feature-shell-body {
  margin: 8px;
  padding: 12px;
}

.digital-placeholder-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.digital-placeholder-copy {
  margin-bottom: 10px;
  font-size: 14px;
}

.digital-placeholder-line {
  padding: 8px 10px;
  font-size: 14px;
}

@media (max-width: 1180px) {
  .digital-sheet-container {
    width: min(1180px, calc(100vw - 16px));
  }

  .digital-top-ribbon {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .digital-hp-card {
    grid-column: span 2;
  }

  .digital-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .digital-top-ribbon {
    grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr) minmax(0, 1fr);
  }

  .digital-hp-card {
    grid-column: span 3;
  }

  .digital-right-top-grid {
    grid-template-columns: 1fr;
  }

  .digital-dual-box {
    grid-template-columns: 1fr;
  }

  .digital-dual-divider {
    display: none;
  }
}

/* v24.0.3 manual roller shell */
.digital-dice-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 58px;
  height: 58px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--py-panel-glass-strong);
  box-shadow: 0 10px 22px var(--py-shadow-panel);
  display: grid;
  place-items: center;
  gap: 2px;
  z-index: 36;
  cursor: pointer;
}

.digital-dice-fab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

.digital-dice-fab:hover,
.digital-die-chip:hover,
.digital-dice-adjust:hover,
.digital-roll-history-toggle:hover {
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

.digital-dice-fab.is-pressed,
.digital-die-chip.is-pressed,
.digital-dice-adjust.is-pressed {
  transform: translateY(1px) scale(.985);
}

.digital-dice-tray {
  position: fixed;
  left: 18px;
  bottom: 86px;
  width: min(320px, calc(100vw - 36px));
  background: var(--py-panel-glass);
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(17,63,109,.2);
  padding: 14px;
  display: grid;
  gap: 12px;
  z-index: 36;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.digital-dice-tray.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.digital-dice-tray-header,
.digital-roll-toast-head,
.digital-history-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.digital-dice-tray-title,
.digital-roll-toast-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.digital-dice-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.digital-die-chip,
.digital-dice-adjust,
.digital-roll-history-toggle {
  border: 2px solid var(--line);
  background: var(--py-panel);
  color: var(--text);
  border-radius: 12px;
  min-height: 42px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.digital-dice-formula-block,
.digital-dice-modifier-row {
  display: grid;
  gap: 6px;
}

.digital-dice-formula {
  min-height: 48px;
  border: 2px solid var(--py-border-faint);
  border-radius: 14px;
  background: var(--py-panel);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.digital-dice-modifier-controls {
  display: grid;
  grid-template-columns: 44px minmax(92px, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.digital-dice-modifier-input {
  min-height: 42px;
  border: 2px solid var(--py-border-faint);
  border-radius: 12px;
  background: var(--py-panel);
  padding: 0 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}


.digital-dice-tray-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.digital-dice-tray-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.digital-roll-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  width: min(520px, calc(100vw - 170px));
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  background: rgba(18, 58, 99, 0.96);
  color: var(--py-on-primary);
  padding: 14px;
  border-radius: 18px;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 14px 28px rgba(17,63,109,.22);
  display: grid;
  gap: 8px;
}

.digital-roll-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.digital-roll-toast-total {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.digital-roll-toast-breakdown,
.digital-roll-toast-meta,
.digital-history-formula,
.digital-history-breakdown,
.digital-history-meta {
  font-size: 13px;
  line-height: 1.45;
}

.digital-roll-toast-meta {
  color: rgba(255,255,255,.76);
}

.digital-roll-history-panel {
  position: fixed;
  left: 18px;
  bottom: 86px;
  width: min(360px, calc(100vw - 36px));
  max-height: min(62vh, 520px);
  background: rgba(18, 58, 99, 0.97);
  color: var(--py-on-primary);
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 18px;
  box-shadow: 0 14px 30px var(--py-shadow-panel-strong);
  padding: 14px;
  display: grid;
  gap: 10px;
  z-index: 37;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.digital-roll-history-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.digital-roll-history-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.digital-roll-history-panel-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.digital-roll-history {
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 10px;
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow: auto;
}

.digital-history-meta,
.digital-history-formula {
  color: rgba(255,255,255,.76);
}

.digital-history-entry {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  display: grid;
  gap: 4px;
}

.digital-history-label,
.digital-history-total {
  font-weight: 800;
}

.digital-history-total {
  font-size: 18px;
}

.digital-history-empty {
  font-size: 13px;
  color: var(--py-muted-strong, var(--muted, #5f746b));
}

.digital-roll-history-panel .digital-history-empty {
  color: rgba(255,255,255,.72);
}

@media (max-width: 900px) {
  .digital-roll-toast {
    width: min(520px, calc(100vw - 24px));
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: translateY(16px);
  }

  .digital-roll-toast.show {
    transform: translateY(0);
  }

  .digital-dice-fab {
    left: 12px;
    bottom: 12px;
  }

  .digital-dice-tray {
    left: 12px;
    bottom: 80px;
    width: min(320px, calc(100vw - 24px));
  }

  .digital-roll-history-panel {
    left: 12px;
    bottom: 80px;
    width: min(360px, calc(100vw - 24px));
  }
}


.digital-sheet-splash {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.digital-sheet-splash-card {
  width: min(720px, 100%);
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(22,61,112,0.14);
  border-radius: 24px;
  box-shadow: 0 18px 60px rgba(7,26,58,0.16);
  padding: 28px;
}
.digital-sheet-splash-title {
  margin: 6px 0 10px;
  color: var(--py-text);
  font-size: 1.9rem;
}
.digital-sheet-splash-copy {
  margin: 0;
  color: var(--py-muted);
  line-height: 1.5;
}
.digital-sheet-splash-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.digital-sheet-file-input {
  flex: 1 1 320px;
  min-width: 260px;
}
.digital-sheet-import-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(22,61,112,0.08);
  color: var(--py-text);
  font-weight: 600;
}
.digital-sheet-import-status.error {
  background: rgba(151, 35, 35, 0.1);
  color: #8b1f1f;
}
.digital-sheet-import-status.success {
  background: rgba(27, 109, 62, 0.1);
  color: #1f6d3e;
}
.digital-sheet-import-hint {
  margin-top: 10px;
  color: var(--py-muted);
  font-size: 0.92rem;
}
.digital-save-prof-dot.expertise {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
  margin: 1px auto;
}
.digital-prof-dot.half,
.digital-save-prof-dot.half {
  background: linear-gradient(90deg, var(--py-text) 0 50%, rgba(22,61,112,0.12) 50% 100%);
}


.digital-sheet-import-page .app-shell { min-height: 100vh; }
.digital-sheet-import-card { max-width: 760px; margin: 0 auto; }
.digital-sheet-import-status.error { color: var(--py-danger); }
.digital-sheet-import-status.success { color: var(--py-success-deep); }


/* Import gateway compact fit */
.digital-sheet-import-page .app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.digital-sheet-import-page .topbar {
  padding: 10px 20px;
}

.digital-sheet-import-page .brand {
  font-size: 20px;
  line-height: 1.1;
}

.digital-sheet-import-page .subbrand {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.25;
}

.digital-sheet-import-page .nav-links {
  margin-top: 8px;
}

.digital-sheet-import-page .nav-pill {
  padding: 10px 20px;
}

.digital-sheet-import-page .container {
  max-width: 860px;
  width: 100%;
  padding: 12px 20px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.digital-sheet-import-page .digital-sheet-import-card {
  width: 100%;
  max-width: 760px;
  padding: 16px 20px;
}

.digital-sheet-import-page .digital-overview-label {
  margin-bottom: 6px;
}

.digital-sheet-import-page .section-title {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.15;
}

.digital-sheet-import-page .section-sub {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.35;
}

.digital-sheet-import-page .field {
  gap: 4px;
  margin-bottom: 0;
}

.digital-sheet-import-page .field label {
  margin-bottom: 4px;
}

.digital-sheet-import-page .digital-sheet-file-input {
  min-width: 0;
}

.digital-sheet-import-page .digital-sheet-splash-actions {
  margin-top: 12px !important;
  gap: 10px;
}

.digital-sheet-import-page .btn {
  min-height: 40px;
}

.digital-sheet-import-page .digital-sheet-import-status {
  margin-top: 10px !important;
  padding: 10px 12px;
}

.digital-sheet-import-page .digital-sheet-import-hint {
  margin-top: 8px;
  font-size: 13px;
}

@media (max-height: 820px) {
  .digital-sheet-import-page .topbar {
    padding: 8px 18px;
  }

  .digital-sheet-import-page .brand {
    font-size: 18px;
  }

  .digital-sheet-import-page .subbrand {
    font-size: 13px;
  }

  .digital-sheet-import-page .nav-links {
    margin-top: 6px;
  }

  .digital-sheet-import-page .container {
    padding-top: 10px;
    padding-bottom: 14px;
  }

  .digital-sheet-import-page .digital-sheet-import-card {
    padding: 14px 18px;
  }
}


/* Import gateway further compacted */
.digital-sheet-import-page .topbar { padding: 6px 16px; }
.digital-sheet-import-page .brand { font-size: 17px; line-height: 1.02; }
.digital-sheet-import-page .subbrand { margin-top: 0; font-size: 12px; line-height: 1.15; }
.digital-sheet-import-page .nav-links { margin-top: 4px; }
.digital-sheet-import-page .nav-pill { padding: 7px 16px; }
.digital-sheet-import-page .container { padding: 5px 16px 8px; max-width: 780px; }
.digital-sheet-import-page .digital-sheet-import-card { max-width: 700px; padding: 11px 14px; }
.digital-sheet-import-page .digital-overview-label { margin-bottom: 3px; font-size: 11px; }
.digital-sheet-import-page .section-title { margin: 0 0 3px; font-size: 15px; }
.digital-sheet-import-page .section-sub { margin: 0 0 6px; font-size: 12px; line-height: 1.2; }
.digital-sheet-import-page .field label { margin-bottom: 2px; font-size: 12px; }
.digital-sheet-import-page .digital-sheet-file-input { font-size: 12px; }
.digital-sheet-import-page .digital-sheet-splash-actions { margin-top: 6px !important; gap: 8px; }
.digital-sheet-import-page .btn { min-height: 34px; padding-top: 7px; padding-bottom: 7px; }
.digital-sheet-import-page .digital-sheet-import-status { margin-top: 6px !important; padding: 7px 9px; font-size: 12px; }
.digital-sheet-import-page .digital-sheet-import-hint { margin-top: 4px; font-size: 11px; }
@media (max-height: 820px) {
  .digital-sheet-import-page .topbar { padding: 5px 14px; }
  .digital-sheet-import-page .container { padding: 4px 14px 8px; }
  .digital-sheet-import-page .digital-sheet-import-card { padding: 10px 12px; }
}

.digital-inspection-copy {
  margin: 0 0 12px;
}

.digital-inspection-stack {
  display: grid;
  gap: 10px;
}

.digital-inspection-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.digital-inspection-metric {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--py-panel-soft-2);
  text-align: center;
}

.digital-inspection-metric-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.digital-inspection-metric-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.digital-inspection-action-row,
.digital-inspection-temp-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.digital-inspection-number-input {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--py-panel);
  font: inherit;
  font-weight: 700;
  padding: 6px 10px;
}

.digital-inspection-helper {
  font-size: 13px;
  color: var(--muted);
}

.digital-inspection-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 2px 0 0;
}

.conditions-panel-list {
  display: grid;
  gap: 8px;
}

.condition-row {
  border: 1px solid var(--py-border-faint);
  border-radius: 12px;
  background: var(--py-panel);
  overflow: hidden;
}

.condition-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.condition-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.condition-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.condition-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.condition-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.condition-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--py-border-faint);
  transition: background .16s ease;
}

.condition-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--py-panel);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform .16s ease;
}

.condition-switch input:checked + .condition-slider {
  background: var(--accent);
}

.condition-switch input:checked + .condition-slider::before {
  transform: translateX(20px);
}

.condition-expand {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.condition-expand.open {
  transform: rotate(180deg);
}

.condition-details {
  border-top: 1px solid var(--py-border-faint);
  background: var(--py-panel-soft-2);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.condition-details[hidden] {
  display: none !important;
}

.condition-detail-line {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.exhaustion-selector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.digital-inspection-select {
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--py-panel);
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
}

.exhaustion-table {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  border: 1px solid var(--py-border-faint);
  border-radius: 12px;
  overflow: hidden;
}

.exhaustion-table-head,
.exhaustion-cell {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  background: var(--py-panel);
  border-bottom: 1px solid var(--py-border-faint);
}

.exhaustion-table-head {
  font-weight: 800;
  background: var(--py-panel-tint);
}

.exhaustion-cell.level {
  font-weight: 800;
}

.exhaustion-table > :nth-last-child(-n+2) {
  border-bottom: 0;
}


.condition-detail-line strong {
  font-weight: 800;
}

.condition-inline-meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}


.defense-toggle-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; margin-bottom:10px; }
.defense-toggle-item { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--py-primary-dark); font-weight:700; line-height:1.1; }
.defense-toggle-item input { width:16px; height:16px; }
.defense-row .condition-inline-meta { display:block; font-size:12px; color:var(--py-muted); margin-top:2px; }

.digital-inspection-metric-value.small {
  font-size: 16px;
  line-height: 1.2;
}

.digital-inspection-action-row.compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.digital-inspection-list-grid {
  display: grid;
  gap: 8px;
}

.digital-inspection-list-grid.wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.digital-inspection-list-card {
  border: 1px solid var(--py-border-faint);
  border-radius: 12px;
  background: var(--py-panel);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.digital-inspection-list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.4;
}

.wizard-song-defense-slot-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wizard-song-defense-slot-grid .digital-inspection-list-card {
  padding: 9px 10px;
  background: var(--py-panel-soft);
  border-color: var(--py-border-soft);
}

.wizard-song-defense-slot-grid .digital-inspection-list-row {
  gap: 8px;
  font-size: 12px;
}

.wizard-song-defense-slot-grid .digital-inspection-helper {
  font-size: 12px;
  line-height: 1.25;
}

@media (max-width: 620px) {
  .wizard-song-defense-slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .wizard-song-defense-slot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .digital-inspection-list-grid.wide {
    grid-template-columns: 1fr;
  }
}

.digital-toggle-row{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  color:var(--py-panel-tint);
}
.digital-toggle-row input{
  margin:0;
}
.digital-inline-select{
  min-width:140px;
  border-radius:10px;
  border:1px solid rgba(154,176,227,.28);
  background:var(--py-dark-popover);
  color:var(--py-dark-popover-text);
  padding:8px 10px;
  font:inherit;
}

.digital-inspection-text-input{
  width:100%;
  min-width:0;
  border-radius:10px;
  border:1px solid rgba(154,176,227,.28);
  background:var(--py-dark-popover);
  color:var(--py-dark-popover-text);
  padding:10px 12px;
  font:inherit;
}


.death-track-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.death-icon-button {
  border: 2px solid var(--line);
  background: var(--py-panel);
  border-radius: 14px;
  min-width: 52px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.death-icon-button.success {
  color: #8b1e3f;
}

.death-icon-button.success.active {
  color: var(--py-danger);
  border-color: var(--py-danger);
  box-shadow: 0 0 0 3px rgba(214,40,57,.12);
}

.death-icon-button.failure {
  color: rgba(34,34,34,.35);
}

.death-icon-button.failure.active {
  color: var(--py-text);
  border-color: var(--py-text);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}


.digital-roll-option-menu {
  position: fixed;
  z-index: 1200;
  min-width: 220px;
  padding: 12px;
  border: 2px solid var(--py-primary);
  border-radius: 16px;
  background: var(--py-panel-glass);
  box-shadow: 0 18px 38px rgba(10, 24, 46, 0.24);
}
.digital-roll-option-menu[hidden] {
  display: none;
}
.digital-roll-option-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--py-muted);
}
.digital-roll-option-btn {
  width: 100%;
  display: block;
  border: 2px solid var(--py-border-soft);
  background: var(--py-panel);
  color: var(--py-text);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  text-align: left;
}
.digital-roll-option-btn + .digital-roll-option-btn {
  margin-top: 8px;
}
.digital-roll-option-btn.active,
.digital-roll-option-btn:hover {
  border-color: var(--py-primary);
  background: var(--py-panel-tint);
}


/* Equipment phase 1 */
.digital-equipment-shell { display:flex; flex-direction:column; gap:14px; }
.digital-equipment-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.digital-equipment-head-actions { display:flex; align-items:center; gap:10px; }
.digital-subtab-row { display:flex; flex-wrap:wrap; gap:8px; }
.digital-subtab { border:1px solid var(--py-border-soft); border-radius:999px; background:var(--py-panel-soft); color:var(--py-primary-dark); font:600 13px/1.2 system-ui, sans-serif; padding:8px 14px; cursor:pointer; }
.digital-subtab.active { background:var(--py-primary-dark); color:var(--py-on-primary); border-color:var(--py-primary-dark); }
.digital-equip-section { border:1px solid var(--py-border-faint); border-radius:18px; background:var(--py-panel-soft); padding:14px; display:flex; flex-direction:column; gap:10px; }
.digital-equip-section-head { font:800 15px/1.2 system-ui, sans-serif; color:var(--py-text); text-transform:uppercase; letter-spacing:.03em; }
.digital-equip-section-subhead { font:700 13px/1.2 system-ui, sans-serif; color:var(--py-muted-strong); text-transform:uppercase; letter-spacing:.03em; margin-top:6px; }
.digital-equip-row, .digital-attune-row { display:grid; grid-template-columns: 22px 1fr auto; gap:12px; align-items:start; padding:10px 0; border-top:1px solid var(--py-border-faint); }
.digital-equip-row.no-toggle { grid-template-columns: 1fr auto; }
.digital-equip-row:first-of-type, .digital-attune-row:first-of-type { border-top:none; padding-top:0; }
.digital-equip-toggle { width:20px; height:20px; border:2px solid var(--py-border-strong); background:var(--py-panel); border-radius:4px; cursor:pointer; margin-top:2px; }
.digital-equip-toggle-spacer { width:20px; height:20px; }
.digital-equip-toggle.active { background:var(--py-primary-dark); border-color:var(--py-primary-dark); box-shadow: inset 0 0 0 3px var(--py-panel); }
.digital-equip-main { min-width:0; }
.digital-equip-name { background:none; border:none; padding:0; margin:0; text-align:left; color:var(--py-text); font:700 16px/1.3 system-ui, sans-serif; cursor:pointer; }
.digital-equip-name.inline { font-size:15px; }
.digital-equip-meta, .digital-equip-submeta, .digital-equip-qty { color:var(--py-muted-strong); font:500 13px/1.35 system-ui, sans-serif; }
.digital-equip-submeta { margin-top:3px; }
.digital-attunement-slots { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; }
.digital-attunement-slot { border:1px solid var(--py-border-faint); border-radius:14px; padding:10px; background:var(--py-panel); text-align:left; display:flex; flex-direction:column; gap:6px; cursor:pointer; width:100%; appearance:none; -webkit-appearance:none; color:inherit; font:inherit; }
.digital-attunement-slot:hover, .digital-attunement-slot:focus-visible { border-color:var(--py-border-strong); box-shadow:0 0 0 2px var(--py-hover-ring); outline:none; }
.digital-attunement-slot-open { background:none; border:none; padding:0; text-align:left; cursor:pointer; }
.digital-attunement-slot-label { font:700 12px/1.2 system-ui, sans-serif; color:var(--py-muted-strong); text-transform:uppercase; letter-spacing:.03em; }
.digital-attunement-slot-value { margin-top:4px; color:var(--py-text); font:700 14px/1.3 system-ui, sans-serif; }
.digital-attunement-slot-hint { color:var(--py-muted-strong); font:600 12px/1.25 system-ui, sans-serif; }
.digital-attune-list { display:flex; flex-direction:column; gap:0; }
.digital-equip-row-end { display:flex; align-items:center; gap:10px; }
.digital-item-controls-row { display:grid; gap:10px; }
.digital-item-controls-row.one { grid-template-columns: minmax(0,1fr); }
.digital-item-controls-row.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.digital-item-controls-row.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.digital-inline-field { border:2px solid var(--line); border-radius:14px; background:var(--py-panel-soft-2); padding:8px 10px; display:flex; flex-direction:column; gap:6px; }
.digital-inline-field > span { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.digital-inline-field.readonly { justify-content:center; }
.digital-inline-value { font-size:16px; font-weight:800; line-height:1.2; color:var(--text); }
.digital-inline-field .digital-inspection-number-input { min-height:36px; padding:4px 8px; }
.digital-attuned-diamond { color:#cc3344; font:800 18px/1 system-ui, sans-serif; }
.digital-currency-field { display:flex; flex-direction:column; gap:6px; font:700 13px/1.2 system-ui, sans-serif; color:var(--py-primary-dark); }
.digital-currency-field input { width:100%; }

.digital-inspection-metrics.two-up { grid-template-columns: repeat(2, minmax(0,1fr)); }


.digital-equip-main { min-width: 0; }
.digital-equip-row.no-toggle { grid-template-columns: minmax(0,1fr) auto; }
.digital-equip-row.no-toggle .digital-equip-main { grid-column: 1; }
.digital-equip-row.no-toggle .digital-equip-row-end { grid-column: 2; justify-self: end; }
.digital-inline-field.compact { padding: 8px 10px; }
.digital-inline-field.compact span { font-size: 11px; }
.digital-inline-actions-row { display:flex; gap:10px; margin: 2px 0 8px; }
.digital-inline-actions-row .btn { flex:1; }
.digital-item-controls-row.compact { gap:8px; }
.digital-item-controls-row.two.compact { grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); }
.digital-item-controls-row.three.compact { grid-template-columns: minmax(0,1.1fr) minmax(0,.8fr) minmax(0,.9fr); }
.digital-feature-shell { height: clamp(430px, calc(100vh - 250px), 760px); max-height: clamp(430px, calc(100vh - 250px), 760px); }

.digital-equip-row-end { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.digital-equip-inline-actions { display:flex; gap:8px; }
.btn.mini { padding: 6px 10px; font-size: 12px; min-height: auto; }
.digital-other-filter { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }
.digital-other-filter span { font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.digital-other-filter select { border:1px solid var(--line); border-radius:999px; padding:8px 12px; background:var(--py-panel); color:var(--text); }
.digital-equip-section-head-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; flex-wrap:wrap; }
.digital-feature-shell { height: clamp(600px, calc(100vh - 150px), 940px); max-height: clamp(600px, calc(100vh - 150px), 940px); }


.digital-rich-copy { color:var(--py-text); font:500 14px/1.55 system-ui, sans-serif; }
.digital-rich-copy p { margin:0 0 10px; }
.digital-rich-copy p:last-child { margin-bottom:0; }
.digital-rich-copy ul { margin:0 0 10px 18px; padding:0; }
.digital-rich-copy li { margin:0 0 6px; }
.digital-inline-meta-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.digital-inline-meta-pill { border:1px solid var(--py-border-faint); border-radius:999px; background:var(--py-panel-soft); padding:5px 10px; color:var(--py-muted-strong); font:700 12px/1.2 system-ui, sans-serif; }

.digital-actions-shell { display:flex; flex-direction:column; gap:14px; min-width:0; }
.digital-action-section { border:1px solid var(--py-border-faint); border-radius:18px; background:var(--py-panel-soft); padding:12px; display:flex; flex-direction:column; gap:8px; overflow:hidden; }
.digital-action-header-row { display:grid; grid-template-columns:minmax(150px,1.2fr) 82px 104px 90px 78px; gap:6px 8px; align-items:end; padding:0 0 6px; border-bottom:1px solid var(--py-border-faint); }
.digital-action-header-label { color:var(--py-muted-strong); font:700 11px/1 system-ui, sans-serif; text-transform:uppercase; letter-spacing:.06em; }
.digital-action-row { display:grid; grid-template-columns:minmax(150px,1.2fr) 82px 104px 90px 78px; gap:6px 8px; align-items:center; padding:8px 0; border-top:1px solid var(--py-border-faint); }
.digital-action-row:first-of-type { border-top:none; padding-top:0; }
.digital-action-main { min-width:0; }
.digital-action-name { background:none; border:none; padding:0; margin:0; text-align:left; color:var(--py-text); font:700 14px/1.2 system-ui, sans-serif; cursor:pointer; }
.digital-action-inline-pair { display:flex; align-items:center; gap:6px; min-width:0; white-space:nowrap; }
.digital-action-inline-label { color:var(--py-muted-strong); font:700 10px/1 system-ui, sans-serif; text-transform:uppercase; letter-spacing:.04em; }
.digital-action-inline-value { color:var(--py-text); font:700 13px/1.15 system-ui, sans-serif; white-space:nowrap; }
.digital-action-hit-wrap { display:flex; justify-content:flex-start; }
.digital-action-hit-stack { display:flex; gap:4px; align-items:flex-start; justify-content:flex-start; flex-wrap:nowrap; min-width:0; }
.digital-action-hit-stack.has-secondary { flex-direction:column; align-items:flex-start; }
.digital-action-damage-stack { display:flex; gap:4px; align-items:flex-start; justify-content:flex-start; flex-wrap:nowrap; min-width:0; }
.digital-action-damage-stack.has-secondary { flex-direction:column; align-items:flex-start; }
.digital-action-damage-stack .digital-mod-chip { white-space:nowrap; }
.digital-action-extra-stack { display:flex; gap:4px; align-items:center; justify-content:flex-end; flex-wrap:wrap; min-width:0; }
.digital-action-extra-stack.has-secondary { flex-direction:column; align-items:center; }
.digital-action-extra-stack .digital-mod-chip { white-space:normal; overflow-wrap:anywhere; word-break:break-word; line-height:1.15; max-width:100%; height:auto; text-align:center; }
.digital-action-row .digital-mod-chip { min-width:38px; padding:5px 8px; font-size:13px; }
.digital-action-hit-stack .digital-mod-chip { min-width:86px; text-align:center; }

.digital-tooltip-host { position:relative; }
.digital-tooltip-host[data-tooltip]:hover::after,
.digital-tooltip-host[data-tooltip]:focus-visible::after { content:attr(data-tooltip); position:absolute; left:50%; bottom:calc(100% + 8px); transform:translateX(-50%); background:var(--py-text); color:var(--py-on-primary); border:1px solid var(--py-border-strong); border-radius:10px; padding:6px 10px; font:700 11px/1 system-ui, sans-serif; letter-spacing:.06em; white-space:nowrap; text-transform:uppercase; box-shadow:0 10px 24px rgba(18,58,99,.2); pointer-events:none; z-index:40; }
.digital-tooltip-host[data-tooltip]:hover::before,
.digital-tooltip-host[data-tooltip]:focus-visible::before { content:''; position:absolute; left:50%; bottom:calc(100% + 3px); transform:translateX(-50%) rotate(45deg); width:10px; height:10px; background:var(--py-text); border-right:1px solid var(--py-border-strong); border-bottom:1px solid var(--py-border-strong); pointer-events:none; z-index:39; }
@media (max-width: 1200px) {
  .digital-action-header-row,
  .digital-action-row { grid-template-columns:minmax(142px,1.15fr) 76px 100px 86px 72px; gap:6px 7px; }
  .digital-action-name { font-size:13px; }
}

@media (max-width: 920px) {
  .digital-action-header-row { display:none; }
  .digital-action-row { grid-template-columns:minmax(0,1fr); align-items:start; gap:8px; }
  .digital-action-inline-pair { justify-content:flex-start; }
  .digital-action-hit-stack { justify-content:flex-start; }
  .digital-action-hit-stack.has-secondary { align-items:flex-start; }
  .digital-action-damage-stack { justify-content:flex-start; }
  .digital-action-damage-stack.has-secondary { align-items:flex-start; }
  .digital-action-extra-stack { justify-content:flex-end; }
  .digital-action-extra-stack.has-secondary { align-items:center; }
}


.digital-inspection-charge-block { display:flex; flex-direction:column; gap:8px; }
.digital-inspection-charge-row { display:flex; gap:8px; flex-wrap:wrap; }

.digital-tooltip-host[data-tooltip]:hover::after,
.digital-tooltip-host[data-tooltip]:focus-visible::after { max-width:min(220px, calc(100vw - 32px)); white-space:normal; text-align:center; overflow-wrap:normal; word-break:normal; min-width:max-content; }
.digital-tooltip-right[data-tooltip]:hover::after,
.digital-tooltip-right[data-tooltip]:focus-visible::after { left:auto; right:0; transform:none; }
.digital-tooltip-right[data-tooltip]:hover::before,
.digital-tooltip-right[data-tooltip]:focus-visible::before { left:auto; right:18px; transform:rotate(45deg); }


.digital-toggle-switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}
.digital-toggle-switch input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.digital-toggle-slider{
  width:42px;
  height:24px;
  border-radius:999px;
  background:var(--py-border-faint);
  border:1px solid var(--py-border-strong);
  position:relative;
  transition:background .16s ease, border-color .16s ease;
  box-shadow:inset 0 1px 2px rgba(18,58,99,.14);
}
.digital-toggle-slider::after{
  content:'';
  position:absolute;
  top:2px;
  left:2px;
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--py-panel);
  box-shadow:0 2px 6px rgba(18,58,99,.18);
  transition:transform .16s ease;
}
.digital-toggle-switch input:checked + .digital-toggle-slider{
  background:var(--py-primary-2);
  border-color:var(--py-primary-2);
}
.digital-toggle-switch input:checked + .digital-toggle-slider::after{
  transform:translateX(18px);
}
.digital-toggle-switch-label{
  color:var(--py-muted-strong);
  font:700 12px/1 system-ui, sans-serif;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.digital-action-damage-stack .digital-mod-chip{
  white-space:normal;
  line-height:1.15;
  text-align:left;
}
.digital-action-row.split-damage-with-extra{
  grid-template-columns:minmax(128px,1fr) 74px 70px 116px 104px;
  gap:6px 6px;
}
.digital-action-row.split-damage-with-extra .digital-action-damage-stack,
.digital-action-row.split-damage-with-extra .digital-action-extra-stack{
  width:100%;
  min-width:0;
}
.digital-action-row.split-damage-with-extra .digital-action-extra-stack{ justify-content:flex-start; }
.digital-action-row.split-damage-with-extra .digital-action-damage-stack .digital-mod-chip,
.digital-action-row.split-damage-with-extra .digital-action-extra-stack .digital-mod-chip{
  max-width:100%;
  min-width:0;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
  text-align:center;
}
@media (max-width: 1200px) {
  .digital-action-row.split-damage-with-extra { grid-template-columns:minmax(122px,1fr) 70px 76px 108px 96px; }
}

/* v24.6.23 spell shell / cantrip test rows */
.digital-spells-shell { display: grid; gap: 12px; }
.digital-spell-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
}
.digital-spell-summary-card {
  border: 2px solid var(--line);
  background: var(--py-panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  font: inherit;
  color: var(--text);
}
button.digital-spell-summary-card { cursor: pointer; }
.digital-spell-summary-card.concentration { border-color: var(--py-primary-border-alpha-strong); }
.digital-spell-summary-value { font-size: 20px; font-weight: 900; line-height: 1.05; }
.digital-spell-summary-value.small { font-size: 16px; }
.digital-manage-spells-button { align-self: stretch; min-width: 132px; }
.digital-spell-table { display: grid; gap: 6px; }
.digital-spell-header-row,
.digital-spell-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(54px,.45fr) minmax(78px,.55fr) minmax(78px,.55fr) minmax(82px,.55fr) minmax(110px,.8fr);
  gap: 8px;
  align-items: center;
}
.digital-spell-header-row {
  padding: 0 8px 2px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .04em;
}
.digital-spell-row {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--py-panel);
  box-shadow: 0 1px 3px var(--py-header-shadow);
  padding: 8px;
}
.digital-spell-name-cell { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; align-items: center; }
.digital-spell-name-cell .digital-equip-meta { grid-column: 2; }
.digital-spell-cast-btn {
  border: 2px solid var(--accent);
  background: var(--py-panel);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.digital-spell-name-button {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-align: left;
  padding: 0;
  cursor: pointer;
  min-width: 0;
}
.digital-spell-cell { font-size: 13px; font-weight: 800; color: var(--text); min-width: 0; }
.digital-spell-cell.effect { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.digital-spell-level-pill,
.digital-spell-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--py-primary-border-alpha);
  background: var(--py-primary-glass);
  color: var(--accent);
  font-weight: 900;
}
.digital-spell-level-pill { padding: 4px 8px; font-size: 11px; }
.digital-spell-tag { padding: 1px 5px; font-size: 10px; vertical-align: middle; }
.digital-spell-dash,
.digital-spell-effect-text { color: var(--muted); font-weight: 800; }
.digital-cantrip-action-section { margin-top: 10px; }
@media (max-width: 980px) {
  .digital-spell-summary-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .digital-spell-header-row { display: none; }
  .digital-spell-row { grid-template-columns: 1fr 1fr; }
  .digital-spell-name-cell { grid-column: 1 / -1; }
}

/* v24.6.23a spell shell aesthetic cleanup */
.digital-spells-shell {
  gap: 10px;
  min-width: 0;
  overflow-x: hidden;
}
.digital-spells-shell .digital-equipment-head {
  margin-bottom: 0;
}
.digital-spell-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.digital-spell-summary-card {
  border-width: 1px;
  border-radius: 10px;
  padding: 6px 8px;
  gap: 1px;
  min-width: 0;
  box-shadow: 0 1px 3px rgba(17,63,109,.05);
}
.digital-spell-summary-value {
  font-size: 15px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.digital-spell-summary-value.small { font-size: 14px; }
.digital-manage-spells-button {
  align-self: center;
  min-width: 0;
  padding: 6px 10px;
  min-height: 0;
  line-height: 1.1;
  border-radius: 10px;
  white-space: nowrap;
}
.digital-spell-slot-shell {
  padding: 8px 10px;
}
.digital-spell-slot-empty {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}
.digital-spell-table {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.digital-spell-header-row,
.digital-spell-row {
  grid-template-columns: minmax(118px, 1.4fr) minmax(34px, .38fr) minmax(50px, .52fr) minmax(54px, .55fr) minmax(64px, .58fr) minmax(76px, .85fr);
  gap: 5px;
  min-width: 0;
}
.digital-spell-header-row {
  padding: 0 6px 2px;
  font-size: 9px;
}
.digital-spell-row {
  border-width: 1px;
  border-radius: 10px;
  padding: 6px;
  min-width: 0;
}
.digital-spell-name-cell {
  grid-template-columns: auto minmax(0,1fr);
  gap: 5px;
  align-items: center;
}
.digital-spell-atwill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--py-primary-border-alpha-strong);
  background: var(--py-primary-glass);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 5px;
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
  align-self: center;
}
.digital-spell-name-button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.digital-spell-cell {
  font-size: 11px;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}
.digital-spell-cell.effect {
  justify-content: flex-start;
  gap: 4px;
  flex-wrap: wrap;
  overflow: visible;
}
.digital-spell-level-pill,
.digital-spell-tag {
  border-width: 1px;
}
.digital-spell-level-pill {
  padding: 2px 5px;
  font-size: 9px;
  line-height: 1.05;
  min-height: 18px;
}
.digital-spell-tag {
  padding: 0 4px;
  font-size: 8px;
  line-height: 1.2;
  margin-left: 2px;
}
.digital-spell-other-filter {
  appearance: auto;
  padding: 6px 8px;
  min-height: 0;
  line-height: 1.1;
  max-width: 120px;
}
.digital-spells-shell .digital-mod-chip.small,
.digital-cantrip-action-section .digital-mod-chip.small {
  padding: 3px 5px;
  font-size: 10px;
  min-height: 20px;
  line-height: 1.05;
}
@media (max-width: 1200px) {
  .digital-spell-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .digital-spell-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .digital-spell-row { grid-template-columns: 1fr 1fr; }
  .digital-spell-name-cell { grid-column: 1 / -1; }
  .digital-spell-cell { overflow: visible; }
}

/* v24.6.23b spell shell header/stat polish */
.digital-spells-shell .digital-spells-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.digital-spells-shell .digital-spells-head .digital-manage-spells-button {
  align-self: center;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.05;
  min-width: 0;
  min-height: 0;
  white-space: nowrap;
}
.digital-spells-shell .digital-spell-summary-grid {
  grid-template-columns: repeat(3, minmax(92px, 142px));
  justify-content: center;
  gap: 10px;
}
.digital-spells-shell .digital-spell-summary-card {
  text-align: center;
  justify-items: center;
  align-items: center;
  padding: 7px 10px;
  min-height: 48px;
}
.digital-spells-shell .digital-spell-summary-card .digital-overview-label {
  text-align: center;
  width: 100%;
  font-size: 10px;
  line-height: 1.05;
}
.digital-spells-shell .digital-spell-summary-value {
  text-align: center;
  width: 100%;
  font-size: 18px;
  line-height: 1;
}
.digital-spell-concentration-row {
  border: 1px solid var(--py-primary-border-alpha-soft);
  background: var(--py-panel);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(17,63,109,.05);
  padding: 0;
  overflow: hidden;
}
.digital-spell-concentration-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}
.digital-spell-concentration-button strong {
  color: var(--accent);
}
.digital-spell-concentration-button span {
  font-weight: 800;
}
.digital-spells-shell .digital-tooltip-host[data-tooltip]:hover::after,
.digital-spells-shell .digital-tooltip-host[data-tooltip]:focus-visible::after {
  white-space: pre-line;
  line-height: 1.25;
}
.digital-spells-shell .digital-spell-header-row,
.digital-spells-shell .digital-spell-row,
.digital-cantrip-action-section .digital-spell-header-row,
.digital-cantrip-action-section .digital-spell-row {
  grid-template-columns: minmax(132px, 1.42fr) minmax(38px, .38fr) minmax(56px, .52fr) minmax(60px, .55fr) minmax(70px, .58fr) minmax(86px, .85fr);
  gap: 6px;
}
.digital-spells-shell .digital-spell-header-row,
.digital-cantrip-action-section .digital-spell-header-row {
  font-size: 10px;
}
.digital-spells-shell .digital-spell-row,
.digital-cantrip-action-section .digital-spell-row {
  padding: 7px;
  min-height: 38px;
}
.digital-spells-shell .digital-spell-name-button,
.digital-cantrip-action-section .digital-spell-name-button {
  font-size: 13px;
}
.digital-spells-shell .digital-spell-cell,
.digital-cantrip-action-section .digital-spell-cell {
  font-size: 12px;
  justify-content: center;
  text-align: center;
}
.digital-spells-shell .digital-spell-name-cell,
.digital-cantrip-action-section .digital-spell-name-cell {
  align-items: center;
}
.digital-spells-shell .digital-spell-name-button,
.digital-cantrip-action-section .digital-spell-name-button {
  text-align: left;
}
.digital-spells-shell .digital-spell-atwill-label,
.digital-cantrip-action-section .digital-spell-atwill-label {
  font-size: 9.5px;
  padding: 3px 6px;
}
.digital-spells-shell .digital-spell-level-pill,
.digital-cantrip-action-section .digital-spell-level-pill {
  font-size: 10px;
  min-height: 20px;
  padding: 3px 6px;
}
.digital-spells-shell .digital-mod-chip.small,
.digital-cantrip-action-section .digital-mod-chip.small {
  font-size: 11px;
  min-height: 22px;
  padding: 4px 6px;
  justify-content: center;
  text-align: center;
}
.digital-spells-shell .digital-spell-cell.effect,
.digital-cantrip-action-section .digital-spell-cell.effect {
  justify-content: center;
}
@media (max-width: 1200px) {
  .digital-spells-shell .digital-spell-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .digital-spells-shell .digital-spell-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* v24.6.23c spell shell row polish */
.digital-spells-shell .digital-spell-atwill-label,
.digital-cantrip-action-section .digital-spell-atwill-label {
  cursor: pointer;
  font-family: inherit;
  transition: transform .14s ease, box-shadow .18s ease, filter .18s ease, background .18s ease;
}
.digital-spells-shell .digital-spell-atwill-label:hover,
.digital-cantrip-action-section .digital-spell-atwill-label:hover {
  box-shadow: 0 0 0 3px var(--py-hover-ring);
  filter: brightness(1.03);
}
.digital-spells-shell .digital-spell-atwill-label.is-pressed,
.digital-cantrip-action-section .digital-spell-atwill-label.is-pressed {
  transform: translateY(1px) scale(.955);
  box-shadow: 0 0 0 3px var(--py-hover-ring-strong);
}
.digital-spells-shell .digital-spell-cell .digital-mod-chip.small,
.digital-cantrip-action-section .digital-spell-cell .digital-mod-chip.small {
  border-radius: 999px;
  box-shadow: none;
  overflow: visible;
}
.digital-spells-shell .digital-spell-cell .digital-mod-chip.small:hover,
.digital-spells-shell .digital-spell-cell .digital-mod-chip.small:focus-visible,
.digital-cantrip-action-section .digital-spell-cell .digital-mod-chip.small:hover,
.digital-cantrip-action-section .digital-spell-cell .digital-mod-chip.small:focus-visible {
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

/* v24.6.23d spell row sizing / at-will stack polish */
.digital-spells-shell .digital-spell-header-row,
.digital-spells-shell .digital-spell-row,
.digital-cantrip-action-section .digital-spell-header-row,
.digital-cantrip-action-section .digital-spell-row {
  grid-template-columns: minmax(168px, 1.72fr) minmax(34px, .32fr) minmax(54px, .42fr) minmax(66px, .55fr) minmax(68px, .54fr) minmax(82px, .70fr);
  gap: 4px;
}
.digital-spells-shell .digital-spell-header-row,
.digital-cantrip-action-section .digital-spell-header-row {
  padding: 0 8px 5px;
  font-size: 11px;
}
.digital-spells-shell .digital-spell-row,
.digital-cantrip-action-section .digital-spell-row {
  padding: 9px 10px;
  min-height: 48px;
  border-radius: 13px;
  align-items: center;
}
.digital-spells-shell .digital-spell-name-cell,
.digital-cantrip-action-section .digital-spell-name-cell {
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 7px;
  align-items: center;
}
.digital-spells-shell .digital-spell-atwill-label,
.digital-cantrip-action-section .digital-spell-atwill-label {
  width: 40px;
  min-width: 40px;
  min-height: 32px;
  padding: 2px 3px;
  flex-direction: column;
  gap: 0;
  line-height: 1.02;
  font-size: 10px;
  text-align: center;
}
.digital-spells-shell .digital-spell-name-button,
.digital-cantrip-action-section .digital-spell-name-button {
  font-size: 14px;
  line-height: 1.08;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
}
.digital-spells-shell .digital-spell-cell,
.digital-cantrip-action-section .digital-spell-cell {
  font-size: 13px;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1.08;
}
.digital-spells-shell .digital-spell-level-pill,
.digital-cantrip-action-section .digital-spell-level-pill,
.digital-spells-shell .digital-spell-cell .digital-mod-chip.small,
.digital-cantrip-action-section .digital-spell-cell .digital-mod-chip.small {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.05;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.digital-spells-shell .digital-action-damage-stack.has-secondary,
.digital-cantrip-action-section .digital-action-damage-stack.has-secondary {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* v25.1.2c: keep multi-beam spell rolls readable. */
.digital-roll-toast-total,
.digital-roll-toast-breakdown,
.digital-roll-toast-meta {
  white-space: pre-line;
}

/* v25.1.3l: weapon cantrip conditional row polish. */
.digital-action-extra-stack .weapon-cantrip-dismiss-chip {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: 7px;
  padding-right: 7px;
  font-size: 12px;
}

/* v25.1.3m: weapon cantrip polish for compact spell tooltips and conditional dismiss alignment. */
.digital-spell-cell.effect .digital-weapon-cantrip-damage-tip[data-tooltip]:hover::after,
.digital-spell-cell.effect .digital-weapon-cantrip-damage-tip[data-tooltip]:focus-visible::after {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  max-width: 132px;
  min-width: 0;
  white-space: pre-line;
  line-height: 1.15;
  text-align: center;
}
.digital-spell-cell.effect .digital-weapon-cantrip-damage-tip[data-tooltip]:hover::before,
.digital-spell-cell.effect .digital-weapon-cantrip-damage-tip[data-tooltip]:focus-visible::before {
  left: 50%;
  right: auto;
  transform: translateX(-50%) rotate(45deg);
}
.digital-action-extra-stack:has(.weapon-cantrip-dismiss-chip) {
  justify-self: center;
  justify-content: center;
  width: 100%;
}
.digital-action-extra-stack .weapon-cantrip-dismiss-chip {
  width: 72px;
  max-width: 72px;
  min-width: 72px;
  justify-content: center;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
.digital-action-extra-stack.weapon-cantrip-extra-stack {
  justify-self: center;
  justify-content: center;
  width: 100%;
}

/* v25.1.3o: leveled spell framework / slot header prototype. */
.digital-leveled-spell-section {
  margin-top: 10px;
}
.digital-spell-level-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.digital-spell-level-section-head .digital-equip-section-head {
  margin: 0;
}
.digital-spell-slot-box-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  flex-wrap: nowrap;
}
.digital-spell-slot-box {
  width: 22px;
  height: 22px;
  border: 1px solid var(--py-primary-border-alpha-strong);
  border-radius: 4px;
  box-shadow: inset 0 1px 3px var(--py-shadow-panel), 0 1px 2px rgba(17,63,109,.08);
  cursor: pointer;
  padding: 0;
}
.digital-spell-slot-box.available {
  background: linear-gradient(180deg, var(--py-panel-soft) 0%, var(--py-bg-strong) 100%);
}
.digital-spell-slot-box.spent {
  background: var(--py-panel);
  box-shadow: inset 0 1px 4px rgba(17,63,109,.12);
  opacity: .62;
}
.digital-spell-slot-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  margin-left: 4px;
}
.digital-spell-cast-label {
  border-color: rgba(195, 44, 47, .55) !important;
  background: rgba(195, 44, 47, .10) !important;
  color: var(--py-danger-strong) !important;
}
.digital-spell-level-button {
  cursor: pointer;
  font-family: inherit;
}
.digital-spell-hit-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.digital-spell-level-option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.digital-inspection-select {
  border: 1px solid var(--py-primary-border-alpha);
  background: var(--py-panel);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}
@media (max-width: 760px) {
  .digital-spell-level-section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .digital-spell-slot-box-row {
    justify-content: flex-start;
  }
}

/* v25.1.3p: first-level spell framework UI polish. */
.digital-sheet-corner-notice {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid rgba(47,133,90,.28);
  background: var(--py-success-bg);
  color: var(--py-success-deep);
  font: 900 12px/1.15 system-ui, sans-serif;
  letter-spacing: .02em;
  box-shadow: 0 10px 22px rgba(17,63,109,.16);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
}
.digital-sheet-corner-notice.error {
  border-color: var(--py-danger-border);
  background: var(--py-danger-bg);
  color: var(--py-danger-strong);
}
.digital-sheet-corner-notice.show { animation: digitalSheetCornerNotice 1.15s ease forwards; }
@keyframes digitalSheetCornerNotice {
  0% { opacity: 0; transform: translateY(8px) scale(.96); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(6px) scale(.98); }
}

/* CAST buttons should match the existing AT WILL palette. */
.digital-spells-shell .digital-spell-cast-label,
.digital-cantrip-action-section .digital-spell-cast-label {
  border-color: var(--py-border-strong) !important;
  background: var(--py-panel-tint) !important;
  color: var(--py-primary) !important;
}

/* Spell slot boxes use the same charge-read language as the item charge widgets: empty box + filled inner cube. */
.digital-spell-slot-box {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--py-border-strong);
  border-radius: 4px;
  background: var(--py-panel);
  box-shadow: none;
  cursor: pointer;
  padding: 0;
}
.digital-spell-slot-box.available,
.digital-spell-slot-box.spent {
  background: var(--py-panel);
  box-shadow: none;
  opacity: 1;
}
.digital-spell-slot-box.available::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #c32c2f;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(18,58,99,.16);
}
.digital-spell-slot-box.spent::after { content: none; }
.digital-spell-slot-box:hover,
.digital-spell-slot-box:focus-visible {
  box-shadow: 0 0 0 3px var(--py-hover-ring);
}

/* Native cast-level selector should behave like the cantrip level pill, not open the inspection drawer. */
.digital-spell-level-select {
  appearance: auto;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  text-align-last: center;
  min-width: 54px;
  padding-right: 4px;
}

/* Tighten spell filters and add the 1st-level filter without the large blank select. */
.digital-spell-other-filter {
  width: 92px;
  max-width: 92px;
  padding-left: 9px;
  padding-right: 6px;
}

/* Header alignment: the Level and Effect headers sit visually over their chips. */
.digital-spells-shell .digital-spell-header-row > div:nth-child(5),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(5) {
  transform: translateX(8px);
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(6),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(6) {
  transform: translateX(10px);
}

/* Keep Hit/DC hover feedback pill-shaped and avoid clipped rectangular tooltip shadows. */
.digital-spells-shell .digital-spell-hit-chip,
.digital-cantrip-action-section .digital-spell-hit-chip {
  border-radius: 999px;
  overflow: visible;
  box-shadow: none;
}
.digital-spells-shell .digital-spell-hit-chip:hover,
.digital-spells-shell .digital-spell-hit-chip:focus-visible,
.digital-cantrip-action-section .digital-spell-hit-chip:hover,
.digital-cantrip-action-section .digital-spell-hit-chip:focus-visible {
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--py-hover-ring) !important;
}
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]:hover::after,
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]:focus-visible::after,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]:hover::after,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]:focus-visible::after {
  left: 50%;
  right: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 0;
  max-width: 132px;
  white-space: pre-line;
  line-height: 1.15;
  text-align: center;
}
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]:hover::before,
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]:focus-visible::before,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]:hover::before,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]:focus-visible::before {
  left: 50%;
  right: auto;
  bottom: calc(100% + 3px);
  transform: translateX(-50%) rotate(45deg);
}

/* v25.1.3q: spell export + UI polish follow-up. */
.digital-sheet-corner-notice {
  top: 22px;
  right: 22px;
  bottom: auto;
  transform: translateY(-8px) scale(.96);
}
@keyframes digitalSheetCornerNotice {
  0% { opacity: 0; transform: translateY(-8px) scale(.96); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(.98); }
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(5),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(5) {
  transform: translateX(12px);
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(6),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(6) {
  transform: translateX(15px);
}
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]::before,
.digital-spells-shell .digital-spell-hit-chip[data-tooltip]::after,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]::before,
.digital-cantrip-action-section .digital-spell-hit-chip[data-tooltip]::after {
  content: none !important;
  display: none !important;
  box-shadow: none !important;
}
.digital-spells-shell .digital-spell-hit-chip,
.digital-cantrip-action-section .digital-spell-hit-chip {
  position: relative;
  isolation: isolate;
  border-radius: 999px !important;
  box-shadow: none !important;
}
.digital-spells-shell .digital-spell-hit-chip:hover,
.digital-spells-shell .digital-spell-hit-chip:focus-visible,
.digital-cantrip-action-section .digital-spell-hit-chip:hover,
.digital-cantrip-action-section .digital-spell-hit-chip:focus-visible {
  box-shadow: 0 0 0 3px var(--py-hover-ring) !important;
  outline: none;
}
.digital-spells-shell .digital-subtab-row .digital-subtab,
.digital-cantrip-action-section .digital-subtab-row .digital-subtab {
  min-width: 42px;
  min-height: 34px;
  padding: 5px 11px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="all"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="all"] {
  min-width: 58px;
  padding-left: 13px;
  padding-right: 13px;
}
.digital-spell-other-filter {
  width: 86px;
  max-width: 86px;
}

/* v25.1.3r: spell filter sizing correction after first-level framework polish. */
.digital-spells-shell .digital-subtab-row .digital-subtab,
.digital-cantrip-action-section .digital-subtab-row .digital-subtab {
  min-width: 36px;
  min-height: 34px;
  padding-left: 9px;
  padding-right: 9px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="all"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="all"] {
  min-width: 52px;
  padding-left: 11px;
  padding-right: 11px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  min-width: 40px;
  padding-left: 8px;
  padding-right: 8px;
}
.digital-spell-other-filter {
  width: 106px;
  max-width: 106px;
  padding-left: 11px;
  padding-right: 24px;
}

/* v25.1.3s: spell attack batch expansion + compact filter/header polish. */
.digital-spells-shell .digital-subtab-row .digital-subtab,
.digital-cantrip-action-section .digital-subtab-row .digital-subtab {
  min-width: 30px;
  min-height: 31px;
  padding-left: 6px;
  padding-right: 6px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="all"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="all"] {
  min-width: 42px;
  padding-left: 8px;
  padding-right: 8px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  min-width: 34px;
  padding-left: 6px;
  padding-right: 6px;
}
.digital-spell-other-filter {
  width: 112px;
  max-width: 112px;
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(4),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(4) {
  transform: translateX(5px);
}

/* v25.1.3t: spell save batch polish. Compact non-Other spell filters further. */
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="all"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="all"] {
  min-width: 36px;
  padding-left: 6px;
  padding-right: 6px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  min-width: 29px;
  padding-left: 4px;
  padding-right: 4px;
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(4),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(4) {
  transform: translateX(8px);
}


/* v25.1.3u: cast-time abbreviation + tighter non-Other spell filter/header polish. */
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="all"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="all"] {
  min-width: 30px;
  padding-left: 4px;
  padding-right: 4px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  min-width: 24px;
  padding-left: 3px;
  padding-right: 3px;
}
.digital-spells-shell .digital-spell-header-row > div:nth-child(4),
.digital-cantrip-action-section .digital-spell-header-row > div:nth-child(4) {
  transform: translateX(11px);
}

/* v25.1.3aa: auto-effect pool polish. Keep pool adjusters compact and symmetric. */
.digital-spell-pool-adjust-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}
.digital-spell-pool-adjust-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.digital-spell-pool-adjust-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.digital-spell-pool-adjust-grid .btn {
  min-width: 0;
  min-height: 34px;
  padding: 4px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}
.digital-spell-pool-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(78px, auto) minmax(78px, auto);
  gap: 8px;
  align-items: center;
}

.digital-spell-effect-text.compact-effect-label { font-size: 0.86rem; letter-spacing: -0.03em; }

/* v25.1.3ao: first visible spell row tooltips open downward so multi-line labels do not clip against section headers. */
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::after,
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::after {
  bottom: auto;
  top: calc(100% + 8px);
}
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::before,
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::before {
  bottom: auto;
  top: calc(100% + 3px);
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--py-border-strong);
  border-top: 1px solid var(--py-border-strong);
}

/* v25.1.3ax: compact stacked spell time for mixed casting-time rows. */
.digital-spell-time-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.05;
}


/* v25.1.3bd action-row long damage/tooltip wrapping without splitting words */
.digital-action-damage-stack .digital-mod-chip,
.digital-action-extra-stack .digital-mod-chip {
  max-width: 150px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  line-height: 1.12;
  text-align: center;
}
.digital-action-damage-stack .digital-tooltip-host[data-tooltip]:hover::after,
.digital-action-damage-stack .digital-tooltip-host[data-tooltip]:focus-visible::after,
.digital-action-extra-stack .digital-tooltip-host[data-tooltip]:hover::after,
.digital-action-extra-stack .digital-tooltip-host[data-tooltip]:focus-visible::after {
  max-width: min(320px, calc(100vw - 32px));
  min-width: max-content;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-align: center;
  line-height: 1.18;
}


/* v25.1.3bi: Aura of Purity active-effect card wrapping + compact spell level filters. */
.digital-inspection-list-card {
  min-width: 0;
  overflow: hidden;
}
.digital-inspection-list-row {
  align-items: flex-start;
  flex-wrap: wrap;
  min-width: 0;
}
.digital-inspection-list-row strong {
  min-width: 0;
  flex: 1 1 220px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.digital-inspection-list-row span {
  flex: 0 0 auto;
  white-space: nowrap;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="2"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="3"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="4"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="2"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="3"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="4"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  min-width: 24px;
  width: 36px;
  padding-left: 3px;
  padding-right: 3px;
}

/* v25.1.3bp: full 0-9 spell filter row and compact level/concentration/ritual pills. */
.digital-spells-shell .digital-subtab-row,
.digital-cantrip-action-section .digital-subtab-row {
  gap: 6px;
}
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="2"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="3"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="4"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="5"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="6"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="7"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="8"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="9"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-spells-shell .digital-subtab-row .digital-subtab[data-spell-filter="r"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="0"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="1"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="2"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="3"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="4"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="5"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="6"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="7"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="8"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="9"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="c"],
.digital-cantrip-action-section .digital-subtab-row .digital-subtab[data-spell-filter="r"] {
  width: auto !important;
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 4px 4px !important;
  line-height: 1.1;
}

/* v25.1.3cj: compact Storm of Vengeance round controls in spell inspection panel. */
.digital-storm-round-list {
  display: grid;
  gap: 8px;
}
.digital-storm-round-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.digital-storm-round-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--py-primary-border-alpha);
  background: var(--py-primary-glass);
  color: var(--accent);
  font: 900 12px/1.1 system-ui, sans-serif;
  padding: 6px 10px;
  min-width: 82px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.digital-storm-round-row .digital-mod-chip.small {
  white-space: nowrap;
}

/* v26.0b feature card compaction / side-panel feature descriptions */
.digital-feature-card {
  gap: 8px;
}
.digital-feature-title-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.digital-feature-title-button strong {
  font-size: 15px;
}
.digital-feature-title-button span {
  color: var(--digital-muted, #9fb2c8);
  font-size: 12px;
  white-space: nowrap;
}
.digital-feature-title-button:hover strong,
.digital-feature-title-button:focus-visible strong {
  text-decoration: underline;
}
.digital-feature-card-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.digital-feature-card-controls.in-inspection {
  margin-top: 4px;
}
.feature-charge-block {
  margin: 0;
}
.feature-charge-block .digital-inspection-charge-row {
  margin: 0;
}
.feature-action-chip {
  min-width: auto;
  width: auto;
}
.digital-feature-action-descriptor {
  color: var(--digital-ink, var(--py-text-strong));
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* v26.1b Arcane Archer feature card cleanup */
.arcane-shot-top-controls {
  justify-content: flex-start;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.45rem;
}
.arcane-shot-option-controls {
  display: block;
}
.arcane-shot-choice-stack {
  display: grid;
  gap: 0.35rem;
}
.digital-feature-card-controls.in-inspection .arcane-shot-choice-stack {
  flex: 0 0 100%;
  width: 100%;
  align-self: stretch;
}
.digital-feature-card-controls.in-inspection .arcane-shot-choice-stack + * {
  margin-top: 0;
}
.arcane-shot-choice-row {
  display: grid;
  grid-template-columns: minmax(10.5rem, max-content) auto;
  justify-content: start;
  align-items: center;
  gap: 0.7rem;
}
.arcane-shot-name-button {
  min-width: 10.5rem;
  text-align: left;
}
.digital-link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--py-primary, var(--py-accent-strong, currentColor));
  font: inherit;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 0.55rem;
}
.digital-link-button:hover,
.digital-link-button:focus-visible {
  background: var(--py-primary-glass, var(--py-accent-soft, rgba(127, 127, 127, 0.12)));
  outline: none;
  text-decoration: underline;
}

/* v26.1i Battle Master metric display */
.digital-combat-superiority-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
  margin: 0.25rem 0 0.55rem;
}
.digital-combat-superiority-metric {
  border: 1px solid var(--py-border-strong);
  border-radius: 0.85rem;
  padding: 0.45rem 0.55rem;
  text-align: center;
  background: var(--py-panel);
}
.digital-combat-superiority-value {
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.1;
  color: var(--digital-ink, var(--py-text-strong));
}
.digital-combat-superiority-label {
  margin-top: 0.25rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--py-muted-strong);
}

/* v26.1s: spell tooltip clipping repair.
   Revert the first-row downward tooltip workaround: single-spell/cantrip sections can jitter when the
   tooltip is forced below the button. Let spell/cantrip damage tooltips open upward like weapon
   tooltips, and keep the spell row/table overflow visible so the bubble can clear the card border. */
.digital-spells-shell,
.digital-spells-shell .digital-spell-table,
.digital-spells-shell .digital-spell-row,
.digital-cantrip-action-section,
.digital-cantrip-action-section .digital-spell-table,
.digital-cantrip-action-section .digital-spell-row {
  overflow: visible !important;
}
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::after,
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::after,
.digital-cantrip-action-section .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::after,
.digital-cantrip-action-section .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::after {
  top: auto !important;
  bottom: calc(100% + 8px) !important;
  z-index: 5000 !important;
}
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::before,
.digital-spells-shell .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::before,
.digital-cantrip-action-section .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:hover::before,
.digital-cantrip-action-section .digital-spell-table > .digital-spell-row:first-of-type .digital-tooltip-host[data-tooltip]:focus-visible::before {
  top: auto !important;
  bottom: calc(100% + 3px) !important;
  border-left: 0 !important;
  border-top: 0 !important;
  border-right: 1px solid var(--py-border-strong) !important;
  border-bottom: 1px solid var(--py-border-strong) !important;
  z-index: 4999 !important;
}

/* v26.1v Psi Warrior resource theme */
.digital-equip-toggle.theme-psionic.active::after,
.digital-spell-slot-box.theme-psionic.available::after {
  background: var(--accent, #2f73ba) !important;
}
.psi-warrior-power-controls { flex-direction: column; align-items: stretch; gap: 8px; }
.psi-warrior-power-controls .digital-inspection-action-row { width: 100%; justify-content: space-between; }

/* v26.1w Psi Warrior feature layout repair */
.digital-equip-toggle.theme-psionic.active {
  background: var(--accent, #2f73ba) !important;
  border-color: var(--accent-strong, var(--accent, #2f73ba)) !important;
  box-shadow: inset 0 0 0 3px var(--py-panel), 0 0 0 2px var(--py-hover-ring) !important;
}
.digital-equip-toggle.theme-psionic.active::after,
.digital-spell-slot-box.theme-psionic.available::after {
  background: var(--accent, #2f73ba) !important;
}
.psi-warrior-metric-grid {
  justify-content: center;
  align-items: center;
  width: 100%;
}
.psi-warrior-metric-grid .digital-combat-superiority-metric {
  text-align: center;
  align-items: center;
  justify-content: center;
}
.psi-warrior-charge-row {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.psi-warrior-power-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}
.psi-warrior-power-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
}
.digital-feature-name-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--py-muted-strong);
  text-align: left;
  font: 800 13px/1.2 system-ui, sans-serif;
  letter-spacing: .03em;
  cursor: pointer;
}
.digital-feature-name-link:hover,
.digital-feature-name-link:focus-visible {
  color: var(--py-text);
  text-decoration: underline;
}
.psi-warrior-power-row .digital-feature-action-descriptor {
  justify-self: start;
}
.digital-tooltip-host[data-tooltip]:hover::after,
.digital-tooltip-host[data-tooltip]:focus-visible::after {
  min-width: 0 !important;
  width: max-content;
  max-width: min(260px, calc(100vw - 48px)) !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}

/* v26.1x Psi Warrior polish: centered rows, darker psionic pips, standard DC hover readability. */
.digital-equip-toggle.theme-psionic {
  border-color: var(--accent, #2f73ba) !important;
}
.digital-equip-toggle.theme-psionic.active {
  background: var(--accent-strong, var(--accent, #2f73ba)) !important;
  border-color: var(--accent-strong, var(--accent, #2f73ba)) !important;
  box-shadow: inset 0 0 0 3px var(--py-panel), 0 0 0 2px var(--py-hover-ring) !important;
}
.digital-equip-toggle.theme-psionic.active::after,
.digital-spell-slot-box.theme-psionic.available::after {
  background: var(--accent-strong, var(--accent, #2f73ba)) !important;
}
.psi-warrior-metric-grid {
  grid-template-columns: repeat(2, minmax(150px, 230px)) !important;
  justify-content: center !important;
  justify-items: stretch !important;
}
.psi-warrior-metric-grid .digital-combat-superiority-metric {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}
.psi-warrior-charge-row {
  justify-content: center !important;
}
.psi-warrior-power-row {
  grid-template-columns: minmax(170px, 260px) auto auto !important;
  justify-content: center !important;
  justify-items: start !important;
  column-gap: 10px !important;
}
.psi-warrior-power-row .feature-action-chip,
.psi-warrior-power-row .digital-mod-chip {
  justify-self: center !important;
}
.psi-warrior-inline-charge .feature-charge-block,
.psi-warrior-inline-charge .digital-inspection-charge-block {
  margin: 0 !important;
}
.psi-warrior-inline-charge .digital-inspection-charge-row {
  gap: 4px !important;
}

/* v26.1y Psi Warrior layout/tooltip polish */
.digital-tooltip-host[data-tooltip]:hover::after,
.digital-tooltip-host[data-tooltip]:focus-visible::after {
  white-space: pre-line !important;
  text-align: center !important;
}
.psi-warrior-charge-row {
  justify-content: flex-start !important;
}
.psi-warrior-power-row {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  justify-items: start !important;
  gap: 10px !important;
  width: 100% !important;
}
.psi-warrior-power-row .feature-action-chip,
.psi-warrior-power-row .digital-mod-chip {
  justify-self: start !important;
  margin-left: 0 !important;
}
.psi-warrior-power-row .digital-feature-name-link,
.psi-warrior-power-row .digital-feature-action-descriptor {
  flex: 0 0 auto !important;
}
.psi-warrior-inline-charge {
  display: inline-flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
}
.psi-warrior-inline-charge .feature-charge-block,
.psi-warrior-inline-charge .digital-inspection-charge-block {
  display: inline-flex !important;
  width: auto !important;
  margin: 0 !important;
}
.psi-warrior-inline-charge .digital-inspection-charge-row {
  display: inline-flex !important;
  width: auto !important;
  gap: 4px !important;
}

/* v26.1z Psi Warrior layout cleanup */
.psi-warrior-subcharge-row {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  width: 100% !important;
  margin-top: 2px !important;
}
.psi-warrior-subcharge-row .feature-charge-block,
.psi-warrior-subcharge-row .digital-inspection-charge-block {
  margin: 0 !important;
}
.psi-warrior-power-controls .battle-master-active-toggle-controls {
  margin-top: 2px !important;
}

/* v26.1ab action header / Psi Warrior follow-up polish */
.digital-action-header-row .digital-action-header-label:last-child {
  text-align: right;
  padding-right: 6px;
}
.digital-action-extra-stack {
  justify-content: flex-end !important;
}

/* v26.1ac/v26.1ad: action Extra column micro-alignment.
   Keep the Extra buttons at the accepted position; nudge only the header left. */
.digital-action-header-row > .digital-action-header-label:nth-child(5) { transform: translateX(-24px); }
.digital-action-extra-stack { transform: translateX(-14px); }

/* v26.1ai Rune Knight QA polish */
.rune-knight-power-controls {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.rune-knight-charge-row,
.rune-knight-use-row {
  width: 100%;
}
.rune-knight-use-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.rune-knight-metric-grid {
  justify-content: center;
}

/* v26.1aj Rune Knight Rune Carver rebuild */
.rune-knight-rune-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.rune-knight-rune-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--py-border-soft);
  border-radius: 12px;
  background: var(--py-panel-soft);
  overflow: hidden;
}
.rune-knight-rune-head,
.rune-knight-rune-body {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.rune-knight-rune-head {
  justify-content: space-between;
}
.rune-knight-rune-body {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.rune-knight-rune-name {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.rune-knight-rune-charge-cell {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 100%;
}
.rune-knight-rune-descriptor {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.rune-knight-rune-active-toggle {
  flex: 0 0 auto;
  max-width: 100%;
}

/* v26.1ak Rune Knight rune-card visual polish + tooltip containment fix */
.rune-knight-rune-list {
  overflow: visible !important;
}
.rune-knight-rune-list.single {
  margin-bottom: 2px;
}
.rune-knight-rune-row {
  background: linear-gradient(180deg, var(--py-panel), var(--py-panel-soft)) !important;
  border-color: var(--py-border-strong) !important;
  box-shadow: inset 0 1px 0 var(--py-panel-glass-strong), 0 1px 3px var(--py-shadow-color) !important;
  overflow: visible !important;
}
.rune-knight-rune-body {
  align-items: center !important;
  flex-wrap: nowrap !important;
}
.rune-knight-rune-descriptor {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}
.rune-knight-rune-control-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: max-content;
  margin-left: auto;
  position: relative;
  overflow: visible;
}
.rune-knight-rune-toggle-spacer {
  display: inline-block;
  width: 0;
  height: 1px;
}
.rune-knight-rune-use-button[data-tooltip]:hover::after,
.rune-knight-rune-use-button[data-tooltip]:focus-visible::after {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
  max-width: min(220px, calc(100vw - 56px)) !important;
  z-index: 90 !important;
}
.rune-knight-rune-use-button[data-tooltip]:hover::before,
.rune-knight-rune-use-button[data-tooltip]:focus-visible::before {
  left: auto !important;
  right: 18px !important;
  transform: rotate(45deg) !important;
  z-index: 89 !important;
}
@media (max-width: 700px) {
  .rune-knight-rune-body {
    flex-wrap: wrap !important;
  }
  .rune-knight-rune-control-cluster {
    width: 100%;
    justify-content: flex-end;
  }
}

/* v26.1al Feature workspace scroll containment fix
   The Features & Traits tab can contain long feature blocks, but the workspace
   is supposed to scroll internally instead of growing the full sheet/page. */
.digital-main-grid,
.digital-right-column,
.digital-feature-shell,
.digital-feature-shell-body {
  min-height: 0;
}
.digital-feature-shell {
  overflow: hidden;
  contain: layout paint;
}
.digital-feature-shell-body {
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.digital-feature-shell-body > .digital-equipment-shell {
  min-height: 0;
  max-width: 100%;
}
.digital-features-shell,
.digital-actions-shell,
.digital-spells-shell {
  min-height: 0;
  max-width: 100%;
}

/* v26.2a: quiet placeholder for non-roll standard action reminder cells. */
.digital-action-empty-cell{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  color:#6c849f;
  font-weight:800;
}


/* v26.2c Rogue Sneak Attack metric: single centered dice display */
.rogue-sneak-attack-metric-grid {
  grid-template-columns: minmax(8rem, 14rem);
  justify-content: center;
}

/* v26.2f Assassin Death Strike metric: single centered save display */
.rogue-assassin-metric-grid {
  grid-template-columns: minmax(8rem, 14rem);
  justify-content: center;
}

/* v26.2s Soulknife metric/layout polish */
.rogue-soulknife-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  justify-content: center;
}
.soulknife-veil-controls {
  width: 100%;
}
.soulknife-veil-controls .digital-inspection-action-row {
  width: 100%;
}

/* v26.2u Phantom polish */
.phantom-token-controls {
  justify-content: center;
}
.phantom-token-controls > .digital-feature-action-descriptor,
.phantom-token-controls > .feature-charge-block,
.phantom-token-controls > .digital-inline-meta-pill {
  flex: 0 0 auto;
}
.phantom-token-button-row {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex: 0 0 100%;
}
.digital-feature-front-note,
.digital-feature-front-detail-list {
  color: var(--digital-muted, var(--py-muted));
  font-size: 13px;
  line-height: 1.35;
}
.digital-feature-front-detail-list {
  display: grid;
  gap: 2px;
}
.digital-feature-front-detail strong {
  color: var(--digital-ink, var(--py-text-strong));
}

/* v26.2v/v26.2w Phantom feature workspace containment. */
.digital-feature-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) !important;
  overflow: hidden !important;
  min-height: 0 !important;
  contain: layout paint;
}
.digital-feature-shell-body {
  min-height: 0 !important;
  height: auto;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.digital-feature-shell-body > .digital-equipment-shell,
.digital-feature-shell-body > .digital-equipment-shell.digital-features-shell,
.digital-feature-shell-body > .digital-equipment-shell.digital-actions-shell {
  min-height: 0 !important;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
}
.phantom-ghost-walk-controls {
  width: 100%;
}
.phantom-ghost-walk-controls .digital-inspection-action-row {
  width: 100%;
  min-width: 0;
}

/* v26_2ab: Arcane Trickster Spell Thief selector panel */
.digital-inspection-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
}
.arcane-trickster-spell-thief-panel .digital-spell-pool-adjust-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.arcane-trickster-spell-thief-panel .digital-spell-pool-adjust-grid .btn.spell-thief-level-filter {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 0.34rem 0.58rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.05;
}
.arcane-trickster-spell-thief-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}
.arcane-trickster-spell-thief-search-row .btn {
  min-width: 72px;
  padding-inline: 0.7rem;
}

/* v26_2ad: Spell Thief search/filter usability */
/* v26_2ac: Compact Arcane Trickster Spell Thief selector rows */
.arcane-trickster-spell-thief-panel .arcane-trickster-current-spell-row {
  align-items: center;
}
.arcane-trickster-spell-thief-description {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.72);
  padding: 0.55rem 0.7rem;
}
.arcane-trickster-spell-thief-description > summary {
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--py-primary-dark);
}
.arcane-trickster-spell-choice-list {
  display: grid;
  gap: 0.45rem;
}
.arcane-trickster-spell-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--py-border-soft);
  border-radius: 12px;
  background: var(--py-panel);
  padding: 0.48rem 0.55rem 0.48rem 0.7rem;
}
.arcane-trickster-spell-choice-main {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}
.arcane-trickster-spell-choice-main strong {
  color: var(--py-text-strong);
  font-size: 0.98rem;
  line-height: 1.1;
}
.arcane-trickster-spell-choice-main span {
  color: var(--py-muted-strong);
  font-size: 0.84rem;
  line-height: 1.05;
}
.arcane-trickster-spell-choice-steal {
  min-width: 76px;
  padding: 0.42rem 0.7rem;
}

/* v26_2ae: Manage Spells panel polish */
.arcane-trickster-manage-spells-panel details {
  border: 1px solid var(--py-border-soft);
  border-radius: 12px;
  background: var(--py-panel-soft);
  padding: 0.45rem 0.55rem;
}
.arcane-trickster-manage-spells-panel details > summary {
  cursor: pointer;
  list-style-position: inside;
}
.arcane-trickster-manage-spell-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  border-top: 1px solid var(--py-hover-ring);
  padding: 0.45rem 0.1rem;
}
.arcane-trickster-manage-spell-row:first-of-type {
  border-top: 0;
}
.arcane-trickster-manage-spells-panel .arcane-trickster-spell-choice-main small {
  color: #8b3a3a;
  font-size: 0.75rem;
  line-height: 1.05;
}

/* v26_2af: wider scalable Manage Spells panel */
.digital-inspection-drawer.wide {
  width: min(720px, 96vw);
}
.manage-spells-v2-panel {
  gap: 0.85rem;
}
.manage-spells-v2-panel .digital-inline-meta-list {
  gap: 0.35rem;
}
.manage-spells-v2-panel .manage-spells-section {
  border: 1px solid var(--py-border-soft);
  border-radius: 14px;
  background: var(--py-panel-soft);
  padding: 0.5rem 0.65rem 0.6rem;
}
.manage-spells-v2-panel .manage-spells-section > summary {
  cursor: pointer;
  list-style-position: inside;
  margin-bottom: 0.35rem;
}
.manage-spells-v2-panel .manage-spell-search-row {
  margin: 0.4rem 0;
}
.manage-spells-v2-panel .manage-spell-filter-row {
  margin: 0.25rem 0 0.5rem;
}
.manage-spells-v2-panel .arcane-trickster-spell-level-group {
  border: 1px solid var(--py-border-soft);
  border-radius: 10px;
  background: var(--py-panel-tint);
  padding: 0.25rem 0.45rem;
  margin-top: 0.35rem;
}
.manage-spells-v2-panel .arcane-trickster-spell-level-group > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--py-primary-dark);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  list-style-position: inside;
}
.manage-spells-v2-panel .arcane-trickster-manage-spell-row {
  padding: 0.38rem 0.1rem;
}
.manage-spells-v2-panel .digital-spell-pool-adjust-grid .btn.spell-thief-level-filter {
  min-width: 40px;
  padding: 0.32rem 0.54rem;
}

.manage-spells-show-all-row{
  display:flex;
  align-items:center;
  gap:8px;
  margin:8px 0 6px;
  font-size:0.85rem;
  color:var(--muted-text, #6f5d52);
}
.manage-spells-show-all-row input{
  width:16px;
  height:16px;
  accent-color:#7b3f2a;
}


/* v26.3B: granted spell frontend tag alignment polish.
   Put Item/Feature Granted metadata on a compact full-width second line
   beneath the spell name/cast area instead of leaving the name column oddly gapped. */
.digital-spells-shell .digital-spell-name-cell,
.digital-cantrip-action-section .digital-spell-name-cell {
  row-gap: 0;
}
.digital-spells-shell .digital-spell-name-cell .digital-spell-grant-meta,
.digital-cantrip-action-section .digital-spell-name-cell .digital-spell-grant-meta {
  grid-column: 1 / -1;
  justify-self: start;
  align-self: start;
  margin-top: -1px;
  padding-left: 0;
  color: var(--py-muted-strong);
  font: 700 12px/1.12 system-ui, sans-serif;
  letter-spacing: .01em;
}

/* v26.3L Ring of Spell Storing side-panel polish */
.ring-spell-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.ring-spell-profile-grid .digital-inline-field,
.ring-spell-add-grid .digital-inline-field {
  min-width: 0;
}
.ring-spell-profile-grid .digital-inline-select {
  width: 100%;
  min-height: 36px;
}
.ring-spell-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: end;
}
.ring-spell-add-grid .btn {
  min-height: 44px;
}
.ring-stored-spell-card {
  gap: 10px;
}
.ring-stored-spell-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.ring-stored-spell-actions .btn,
.ring-store-candidate-card .btn {
  width: 100%;
  min-height: 44px;
}
@media (max-width: 700px) {
  .ring-spell-profile-grid,
  .ring-spell-add-grid {
    grid-template-columns: 1fr;
  }
}

/* v26.3M Ring of Spell Storing polish */
.ring-spell-capacity-grid {
  justify-items: center;
}
.ring-spell-capacity-metric {
  text-align: center;
}
.ring-spell-capacity-metric .digital-inspection-metric-value {
  text-align: center;
}
.ring-spell-profile-grid .digital-inline-field {
  overflow: hidden;
}
.ring-spell-profile-grid .digital-inline-select,
.ring-spell-profile-grid .ring-spell-ability-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.ring-store-quantity-field {
  max-width: 180px;
}


/* v26.3AU: compact counter controls for large shared item charge pools. */
.digital-inspection-charge-counter {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--py-panel-soft-2);
}
.digital-counter-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: stretch;
}
.digital-counter-controls .digital-counter-btn {
  min-width: 0;
  width: 100%;
  min-height: 2rem;
  padding: 0.25rem 0.35rem;
  line-height: 1;
  text-align: center;
  justify-content: center;
}

/* v26.3BO-r22: Manage Items inventory side panel */
.digital-manage-items-panel details.manage-spells-section { margin-bottom: 12px; }
.digital-manage-items-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, .35fr) minmax(130px, .3fr) minmax(82px, .18fr); gap: 8px; align-items: end; margin: 8px 0 10px; }
.digital-inventory-manager-list { display: grid; gap: 8px; margin-top: 8px; }
.digital-inventory-manager-row { align-items: center; grid-template-columns: minmax(0, 1fr) auto; }
.digital-inventory-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.digital-inventory-qty { min-width: 28px; text-align: center; font-weight: 700; }
@media (max-width: 760px) { .digital-manage-items-filters { grid-template-columns: 1fr; } .digital-inventory-manager-row { grid-template-columns: 1fr; } .digital-inventory-row-actions { justify-content: flex-start; } }

/* v26.4: Manage Items functional panel polish */
.digital-manage-items-v26-4 { gap: 14px; }
.digital-inventory-manager-section {
  border: 2px solid var(--accent-soft, var(--py-border));
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  padding: 0;
  overflow: hidden;
}
.digital-inventory-manager-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ink, var(--py-text-strong));
}
.digital-inventory-manager-section > summary::-webkit-details-marker { display: none; }
.digital-inventory-manager-collapse {
  border: 2px solid var(--accent, var(--py-primary-mid));
  border-radius: 12px;
  color: var(--accent, var(--py-primary-mid));
  font-size: .92rem;
  font-weight: 800;
  padding: 8px 14px;
  background: var(--py-panel);
}
.digital-inventory-manager-section-body { padding: 0 20px 18px; }
.digital-inventory-manager-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px 14px;
  align-items: end;
  margin: 12px 0 12px;
}
.digital-inventory-manager-field { display: grid; gap: 6px; color: var(--ink, var(--py-text-strong)); font-weight: 800; }
.digital-inventory-manager-field.wide { grid-column: 1 / -1; }
.digital-inventory-manager-select,
.digital-inventory-manager-search,
.digital-inventory-manager-qty-select {
  border: 2px solid var(--accent-soft, var(--py-border));
  border-radius: 12px;
  background: var(--py-panel);
  color: var(--ink, var(--py-text-strong));
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
}
.digital-inventory-manager-list { display: grid; gap: 10px; margin-top: 10px; }
.digital-inventory-manager-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--accent-soft, var(--py-border));
  border-radius: 16px;
  background: rgba(255,255,255,0.88);
  padding: 14px 16px;
}
.digital-inventory-manager-name { font-weight: 900; color: var(--ink, var(--py-text-strong)); font-size: 1.05rem; letter-spacing: .01em; }
.digital-inventory-manager-count { font-weight: 800; color: var(--muted, var(--py-muted)); font-size: .95em; }
.digital-inventory-manager-meta { color: var(--muted, var(--py-muted)); font-weight: 650; margin-top: 4px; }
.digital-inventory-row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .digital-inventory-manager-filters { grid-template-columns: 1fr; }
  .digital-inventory-manager-card { grid-template-columns: 1fr; }
  .digital-inventory-row-actions { justify-content: flex-start; }
}

/* v26.4-r1: Manage Items search/apply and inline item detail polish */
.digital-inventory-manager-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.digital-inventory-manager-qty-select.compact {
  width: 76px;
  min-width: 68px;
  max-width: 86px;
  min-height: 40px;
  padding: 7px 10px;
}
.digital-inventory-manager-card {
  display: block;
}
.digital-inventory-manager-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.digital-inventory-manager-name.as-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  color: var(--ink, var(--py-text-strong));
  font-size: 1.05rem;
  letter-spacing: .01em;
}
.digital-inventory-manager-name.as-button:hover,
.digital-inventory-manager-name.as-button:focus-visible {
  color: var(--accent, var(--py-primary-mid));
  text-decoration: underline;
  outline: none;
}
.digital-inventory-manager-details {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(43,111,179,.25);
}
@media (max-width: 760px) {
  .digital-inventory-manager-search-row,
  .digital-inventory-manager-card-top { grid-template-columns: 1fr; }
}

.beast-tail-swipe-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.beast-tail-swipe-actions .btn {
  white-space: nowrap;
}

/* v26.5a r35: Wild Magic table cleanup */
.wild-magic-controls { overflow: visible; }
.wild-magic-controls .wild-magic-table-row {
  display: grid;
  grid-template-columns: auto 2rem minmax(0, 1fr) minmax(10rem, auto);
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(118, 164, 219, 0.35);
}
.wild-magic-controls .wild-magic-table-row:last-child { border-bottom: 0; }
.wild-magic-use-cell { display: flex; justify-content: flex-start; align-items: center; }
.wild-magic-roll-cell { font-weight: 900; color: var(--py-text); text-align: center; }
.wild-magic-text-cell { min-width: 0; }
.wild-magic-inline-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.4rem; min-width: 0; }
.wild-magic-inline-buttons .digital-inline-select { max-width: 13rem; }
.wild-magic-controls .digital-tooltip-host[data-tooltip]:hover::after,
.wild-magic-controls .digital-tooltip-host[data-tooltip]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
  max-width: min(220px, calc(100vw - 48px));
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.wild-magic-controls .digital-tooltip-host[data-tooltip]:hover::before,
.wild-magic-controls .digital-tooltip-host[data-tooltip]:focus-visible::before {
  left: auto;
  right: 18px;
  transform: rotate(45deg);
}
@media (max-width: 820px) {
  .wild-magic-controls .wild-magic-table-row {
    grid-template-columns: auto 1.5rem minmax(0, 1fr);
  }
  .wild-magic-controls .wild-magic-inline-buttons {
    grid-column: 3 / 4;
    justify-content: flex-start;
  }
}

/* v26.5a r36: Wild Magic table/side-panel polish */
.wild-magic-controls .wild-magic-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.4rem 0 0.7rem;
  border-bottom: 1px solid rgba(118, 164, 219, 0.35);
}
.wild-magic-roll-button {
  min-width: 88px;
  white-space: nowrap;
  justify-self: end;
}
.wild-magic-controls .digital-tooltip-left-edge[data-tooltip]:hover::after,
.wild-magic-controls .digital-tooltip-left-edge[data-tooltip]:focus-visible::after {
  left: 0;
  right: auto;
  transform: none;
}
.wild-magic-controls .digital-tooltip-left-edge[data-tooltip]:hover::before,
.wild-magic-controls .digital-tooltip-left-edge[data-tooltip]:focus-visible::before {
  left: 18px;
  right: auto;
  transform: rotate(45deg);
}
.wild-magic-reference-controls {
  display: block;
}
.wild-magic-reference-intro {
  margin-bottom: 0.5rem;
}
.wild-magic-reference-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(118, 164, 219, 0.35);
}
.wild-magic-reference-row:last-child { border-bottom: 0; }
.wild-magic-reference-roll {
  font-weight: 900;
  color: var(--py-text);
  text-align: center;
}
.wild-magic-reference-text strong {
  color: var(--py-text);
}
.wild-magic-reference-text span {
  display: block;
  margin-top: 0.2rem;
  color: #4b6b91;
  line-height: 1.35;
}
@media (max-width: 820px) {
  .wild-magic-controls .wild-magic-header-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .wild-magic-roll-button {
    min-width: 82px;
  }
}

.short-rest-song-rest-card .digital-toggle-row {
  color: var(--ink);
}

.short-rest-song-rest-card .digital-toggle-row span {
  color: var(--ink);
  font-weight: 700;
}

.manual-ac-boost-toggle span {
  color: var(--text);
  font-weight: 800;
}

/* v26.5b-r58: keep hover bubbles inside the visible app edges when controls sit near card boundaries. */
.digital-feature-card-controls .digital-tooltip-host:first-of-type[data-tooltip]:hover::after,
.digital-feature-card-controls .digital-tooltip-host:first-of-type[data-tooltip]:focus-visible::after,
.warlock-pact-blade-controls .digital-tooltip-host:first-of-type[data-tooltip]:hover::after,
.warlock-pact-blade-controls .digital-tooltip-host:first-of-type[data-tooltip]:focus-visible::after {
  left:0 !important;
  right:auto !important;
  transform:none !important;
}
.digital-feature-card-controls .digital-tooltip-host:first-of-type[data-tooltip]:hover::before,
.digital-feature-card-controls .digital-tooltip-host:first-of-type[data-tooltip]:focus-visible::before,
.warlock-pact-blade-controls .digital-tooltip-host:first-of-type[data-tooltip]:hover::before,
.warlock-pact-blade-controls .digital-tooltip-host:first-of-type[data-tooltip]:focus-visible::before {
  left:18px !important;
  right:auto !important;
  transform:rotate(45deg) !important;
}
.digital-feature-card-controls .digital-tooltip-host:last-of-type[data-tooltip]:hover::after,
.digital-feature-card-controls .digital-tooltip-host:last-of-type[data-tooltip]:focus-visible::after,
.warlock-pact-blade-controls .digital-tooltip-host:last-of-type[data-tooltip]:hover::after,
.warlock-pact-blade-controls .digital-tooltip-host:last-of-type[data-tooltip]:focus-visible::after {
  left:auto !important;
  right:0 !important;
  transform:none !important;
}
.digital-feature-card-controls .digital-tooltip-host:last-of-type[data-tooltip]:hover::before,
.digital-feature-card-controls .digital-tooltip-host:last-of-type[data-tooltip]:focus-visible::before,
.warlock-pact-blade-controls .digital-tooltip-host:last-of-type[data-tooltip]:hover::before,
.warlock-pact-blade-controls .digital-tooltip-host:last-of-type[data-tooltip]:focus-visible::before {
  left:auto !important;
  right:18px !important;
  transform:rotate(45deg) !important;
}

/* v26.5b-r59: system tooltip containment for feature control buttons near side/card edges. */
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:first-of-type:hover::after,
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:first-of-type:focus-visible::after,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:first-of-type:hover::after,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:first-of-type:focus-visible::after {
  left:0 !important;
  right:auto !important;
  transform:none !important;
  max-width:min(260px, calc(100vw - 40px));
  white-space:normal !important;
  overflow-wrap:break-word;
}
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:first-of-type:hover::before,
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:first-of-type:focus-visible::before,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:first-of-type:hover::before,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:first-of-type:focus-visible::before {
  left:18px !important;
  right:auto !important;
  transform:rotate(45deg) !important;
}
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:last-of-type:hover::after,
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:last-of-type:focus-visible::after,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:last-of-type:hover::after,
.warlock-pact-blade-controls button.digital-tooltip-host[data-tooltip]:last-of-type:focus-visible::after {
  left:auto !important;
  right:0 !important;
  transform:none !important;
  max-width:min(260px, calc(100vw - 40px));
  white-space:normal !important;
  overflow-wrap:break-word;
}

/* v26.5b-r64: manage-spells pact choice controls */
.manage-spells-access-rows{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px 18px;
  margin:8px 0 6px;
}
.manage-spells-access-rows .manage-spells-show-all-row{
  margin:0;
}
.digital-inspection-action-row.compact.warlock-ancient-slot-actions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
}
.digital-inspection-action-row.compact.warlock-ancient-slot-actions .btn{
  width:100%;
}

.short-rest-bonus-hp-card {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.short-rest-bonus-hp-card .digital-inline-field { min-width: 110px; }
.short-rest-bonus-hp-card .digital-inspection-number-input { width: 100%; min-width: 70px; }
@media (max-width: 520px) {
  .short-rest-bonus-hp-card { grid-template-columns: 1fr; align-items: stretch; }
}

/* v26.5b r122 Species feature resource counters */
.species-resource-controls {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.digital-feature-resource-section {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.digital-feature-resource-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--digital-ink, var(--py-text-strong));
  font-size: 13px;
}
.digital-feature-resource-label span {
  color: var(--digital-muted, var(--py-muted));
}
.digital-feature-resource-section .feature-charge-block {
  justify-self: end;
}
@media (max-width: 640px) {
  .digital-feature-resource-section {
    grid-template-columns: 1fr;
  }
  .digital-feature-resource-section .feature-charge-block {
    justify-self: start;
  }
}

/* v26.5b-r127: keep feature use-button tooltips compact inside species feature cards. */
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:hover::after,
.digital-feature-card-controls button.digital-tooltip-host[data-tooltip]:focus-visible::after {
  min-width: 0 !important;
  max-width: min(220px, calc(100vw - 48px)) !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  line-height: 1.15 !important;
}
.digital-feature-card-controls .digital-feature-action-descriptor {
  overflow-wrap: anywhere;
}

/* v26.5b-r129: dynamic tooltip edge guards for feature/action buttons near panel edges. */
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:hover::after,
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:focus-visible::after {
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  max-width: min(260px, calc(100vw - 48px)) !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  text-align: center;
}
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:hover::before,
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:focus-visible::before {
  left: 18px !important;
  right: auto !important;
  transform: rotate(45deg) !important;
}
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:hover::after,
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:focus-visible::after {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
  max-width: min(260px, calc(100vw - 48px)) !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  text-align: center;
}
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:hover::before,
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:focus-visible::before {
  left: auto !important;
  right: 18px !important;
  transform: rotate(45deg) !important;
}

/* v26.5b-r131: make feature/action tooltip edge guards respect the containing card/panel. */
.digital-feature-card,
.digital-feature-card-controls,
.feature-charge-block,
.digital-inspection-charge-row {
  overflow: visible;
}
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:hover::after,
.digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:focus-visible::after,
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:hover::after,
.digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:focus-visible::after {
  min-width: 0 !important;
  max-width: min(260px, calc(100vw - 56px)) !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.15 !important;
}
.digital-feature-card-controls .digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:hover::after,
.digital-feature-card-controls .digital-tooltip-host.digital-tooltip-edge-left[data-tooltip]:focus-visible::after {
  left: 0 !important;
  right: auto !important;
  transform: none !important;
}
.digital-feature-card-controls .digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:hover::after,
.digital-feature-card-controls .digital-tooltip-host.digital-tooltip-edge-right[data-tooltip]:focus-visible::after {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}

/* v26.5b-r132: JS-positioned tooltip for feature/inspection buttons so long labels cannot be clipped by card edges. */
.digital-floating-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  display: none;
  z-index: 100000;
  pointer-events: none;
  box-sizing: border-box;
  background: var(--py-text);
  color: var(--py-on-primary);
  border: 1px solid var(--py-border-strong);
  border-radius: 10px;
  padding: 6px 10px;
  font: 700 11px/1.15 system-ui, sans-serif;
  letter-spacing: .06em;
  white-space: pre-line;
  text-transform: uppercase;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: normal;
  box-shadow: 0 10px 24px rgba(18,58,99,.2);
}
.digital-floating-tooltip.visible { display: block; }

[data-py-mode="dark"] .digital-floating-tooltip,
.digital-floating-tooltip[data-py-mode="dark"] {
  background: var(--py-dark-popover) !important;
  color: var(--py-dark-popover-text) !important;
  border-color: var(--py-border-strong) !important;
  box-shadow: 0 12px 26px rgba(0,0,0,.45) !important;
}
.digital-tooltip-host.digital-js-tooltip-active[data-tooltip]:hover::after,
.digital-tooltip-host.digital-js-tooltip-active[data-tooltip]:focus-visible::after,
.digital-tooltip-host.digital-js-tooltip-active[data-tooltip]:hover::before,
.digital-tooltip-host.digital-js-tooltip-active[data-tooltip]:focus-visible::before {
  display: none !important;
}

/* v26.5b-r135: feature/inspection controls use JS floating tooltips only, preventing pseudo-tooltip clipping on card/panel edges. */
.digital-feature-card .digital-tooltip-host[data-tooltip]::before,
.digital-feature-card .digital-tooltip-host[data-tooltip]::after,
.digital-inspection-panel .digital-tooltip-host[data-tooltip]::before,
.digital-inspection-panel .digital-tooltip-host[data-tooltip]::after {
  display: none !important;
  content: none !important;
}
.digital-species-feature-table-wrap {
  border: 1px solid var(--py-border-soft);
  border-radius: 14px;
  overflow: hidden;
  background: var(--py-panel);
}
.digital-species-feature-table {
  width: 100%;
  border-collapse: collapse;
  font: 700 13px/1.35 system-ui, sans-serif;
  color: var(--py-text);
}
.digital-species-feature-table th,
.digital-species-feature-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--py-border-faint);
  vertical-align: top;
  text-align: left;
}
.digital-species-feature-table tr:last-child td { border-bottom: 0; }
.digital-species-feature-table th {
  color: var(--py-muted-strong);
  background: var(--py-panel-tint);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* v26.5b-r136: inspection drawer should be fully opaque so underlying sheet text does not bleed through. */
.digital-inspection-drawer { z-index: 1000; }
.digital-inspection-card,
.digital-inspection-header,
.digital-inspection-body {
  background: #f6fbff !important;
}

/* v26.5b-r136: feature/action controls use the JS floating tooltip only. Suppress all native pseudo-tooltips in those rows. */
.digital-feature-card-controls .digital-tooltip-host[data-tooltip]::before,
.digital-feature-card-controls .digital-tooltip-host[data-tooltip]::after,
.digital-feature-card .feature-action-chip[data-tooltip]::before,
.digital-feature-card .feature-action-chip[data-tooltip]::after,
.digital-inspection-card .feature-action-chip[data-tooltip]::before,
.digital-inspection-card .feature-action-chip[data-tooltip]::after,
.digital-inspection-card .digital-tooltip-host[data-tooltip]::before,
.digital-inspection-card .digital-tooltip-host[data-tooltip]::after {
  display: none !important;
  content: none !important;
}

/* v26.5b-r148: Character profile editable controls should match the sheet's light-blue control language. */
.digital-character-details-shell .digital-inspection-text-input,
.digital-character-details-shell select.digital-inspection-text-input,
.inspection-panel select.digital-inspection-text-input[data-character-profile-input],
.inspection-panel input.digital-inspection-text-input[data-character-profile-input] {
  border: 2px solid var(--blue-soft, var(--py-border));
  border-radius: 14px;
  background: var(--py-panel);
  color: var(--text, var(--py-text-strong));
  min-height: 42px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(43,108,176,.08);
}
.inspection-panel select.digital-inspection-text-input[data-character-profile-input] {
  appearance: auto;
  cursor: pointer;
}
.inspection-panel textarea.digital-inspection-textarea[data-character-profile-input] {
  border: 2px solid var(--blue-soft, var(--py-border));
  border-radius: 14px;
  background: var(--py-panel);
  color: var(--text, var(--py-text-strong));
  font: inherit;
  box-shadow: 0 1px 0 rgba(43,108,176,.08);
}


/* v26.5b-r149: force Character profile selects into the light sheet control style, including native option rows where the browser allows it. */
.digital-character-details-shell select.digital-inspection-text-input,
.inspection-panel select.digital-inspection-text-input[data-character-profile-input] {
  color-scheme: light;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--py-on-primary);
  color: var(--text, var(--py-text-strong));
  border: 2px solid var(--blue-soft, var(--py-border));
  border-radius: 14px;
  padding: 8px 2.35rem 8px 12px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--blue, var(--py-primary)) 50%),
    linear-gradient(135deg, var(--blue, var(--py-primary)) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.digital-character-details-shell select.digital-inspection-text-input option,
.inspection-panel select.digital-inspection-text-input[data-character-profile-input] option {
  background-color: var(--py-on-primary);
  color: var(--text, var(--py-text-strong));
}
.digital-character-details-shell select.digital-inspection-text-input:focus,
.inspection-panel select.digital-inspection-text-input[data-character-profile-input]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 188, 240, .35);
}

/* v27.13 Sorcerer: temporary Font of Magic slots match the base outline, with a darker non-glowing blue fill */
.digital-spell-slot-box.sorcerer-temp-slot.available {
  border-color: var(--line, rgba(28, 75, 125, .24));
  background: transparent;
  box-shadow: none;
}
.digital-spell-slot-box.sorcerer-temp-slot.available::after {
  border-color: var(--line, rgba(28, 75, 125, .24));
  background: #2563eb;
  box-shadow: none;
}
.digital-spell-slot-box.sorcerer-temp-slot.spent {
  border-color: var(--line, rgba(28, 75, 125, .24));
  background: transparent;
  box-shadow: none;
  opacity: .55;
}
.sorcerer-active-metamagic-row .digital-spell-concentration-button {
  border-color: #38bdf8;
  background: #effcff;
}

/* v27.33: Dark-mode polish for later digital-sheet QA pass. */
[data-py-mode="dark"] .digital-inspection-search,
[data-py-mode="dark"] .arcane-trickster-spell-choice,
[data-py-mode="dark"] .arcane-trickster-manage-spells-panel details,
[data-py-mode="dark"] .digital-spell-pool-row,
[data-py-mode="dark"] .digital-spell-card,
[data-py-mode="dark"] .digital-equipment-row {
  background: var(--py-panel-soft) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border-soft) !important;
}

[data-py-mode="dark"] .arcane-trickster-spell-thief-description {
  background: var(--py-panel-tint) !important;
  border-color: var(--py-border-soft) !important;
}

[data-py-mode="dark"] .arcane-trickster-spell-choice-main strong,
[data-py-mode="dark"] .arcane-trickster-spell-choice-main span,
[data-py-mode="dark"] .digital-character-meta,
[data-py-mode="dark"] .digital-overview-label {
  color: var(--py-muted) !important;
}

[data-py-mode="dark"] .digital-character-name,
[data-py-mode="dark"] .digital-header-title,
[data-py-mode="dark"] .digital-section-title,
[data-py-mode="dark"] .digital-card-title {
  color: var(--py-text-strong) !important;
}

/* v27.34 digital sheet theme polish: side panels and settings/menu integration. */
.digital-header-menu-button {
  border-color: color-mix(in srgb, var(--py-border) 58%, var(--py-primary) 42%);
  background: color-mix(in srgb, var(--py-panel) 86%, var(--py-primary) 14%);
  box-shadow: 0 8px 20px var(--py-shadow-color);
}
.digital-header-menu-button span {
  background: var(--py-primary-dark);
}
.digital-header-menu-button:hover,
.digital-header-menu-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--py-hover-ring), 0 8px 20px var(--py-shadow-color);
}
.digital-inspection-card,
.digital-inspection-header,
.digital-inspection-body {
  background: var(--py-panel-glass) !important;
  color: var(--py-text) !important;
}
.digital-inspection-title,
.digital-inspection-metric-value,
.digital-inspection-copy strong,
.digital-inspection-body strong,
.digital-inspection-body h1,
.digital-inspection-body h2,
.digital-inspection-body h3,
.digital-inspection-body h4 {
  color: var(--py-text-strong) !important;
}
.digital-inspection-body,
.digital-inspection-copy,
.digital-inspection-helper,
.digital-inspection-section-title {
  color: var(--py-text) !important;
}
.digital-inspection-section-title,
.digital-inspection-metric-label {
  color: var(--py-muted-strong) !important;
}
.digital-inspection-metric,
.digital-inspection-list-card,
.digital-inspection-action-row,
.digital-inspection-temp-row,
.digital-placeholder-line,
.conditions-panel-list > * {
  background: var(--py-panel-soft-2) !important;
  border-color: var(--py-border) !important;
  color: var(--py-text) !important;
}
.digital-inspection-number-input,
.digital-inspection-select,
.digital-inspection-text-input,
.digital-inspection-search {
  background: var(--py-input-bg) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
.digital-inspection-number-input::placeholder,
.digital-inspection-text-input::placeholder,
.digital-inspection-search::placeholder {
  color: var(--py-muted-strong) !important;
  opacity: .9;
}
[data-py-mode="dark"] .digital-inspection-card,
[data-py-mode="dark"] .digital-inspection-header,
[data-py-mode="dark"] .digital-inspection-body {
  background: var(--py-panel) !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-inspection-card {
  box-shadow: -12px 0 30px rgba(0,0,0,.46);
}
[data-py-mode="dark"] .digital-header-menu-panel {
  background: var(--py-panel-glass-strong);
  border-color: var(--py-border);
}


/* v27.35 sheet theme correction: dark mode owns large surfaces; accent colors stay accents. */
[data-py-mode="dark"] .digital-sheet-body {
  background: linear-gradient(180deg, var(--py-bg-strong) 0%, var(--py-bg) 58%, var(--py-bg-soft) 100%) !important;
}
[data-py-mode="dark"] .digital-feature-shell,
[data-py-mode="dark"] .digital-section-card,
[data-py-mode="dark"] .digital-ability-card,
[data-py-mode="dark"] .digital-mini-stat-card,
[data-py-mode="dark"] .digital-hp-card,
[data-py-mode="dark"] .digital-metric-card,
[data-py-mode="dark"] .digital-defense-condition-card,
[data-py-mode="dark"] .digital-feature-shell-body,
[data-py-mode="dark"] .digital-action-section,
[data-py-mode="dark"] .digital-spell-card,
[data-py-mode="dark"] .digital-equipment-row,
[data-py-mode="dark"] .digital-character-details-shell,
[data-py-mode="dark"] .digital-sheet-import-card {
  background: var(--py-panel) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="dark"] .digital-feature-shell-body {
  background: linear-gradient(180deg, var(--py-panel-soft) 0%, var(--py-panel) 100%) !important;
}
[data-py-mode="dark"] .digital-tab:not(.active),
[data-py-mode="dark"] .digital-filter-chip:not(.active),
[data-py-mode="dark"] .digital-mod-chip,
[data-py-mode="dark"] .digital-pill,
[data-py-mode="dark"] .digital-tag {
  background: var(--py-panel-soft) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="dark"] .digital-tab.active,
[data-py-mode="dark"] .digital-filter-chip.active {
  background: var(--py-primary) !important;
  color: var(--py-on-primary) !important;
  border-color: var(--py-primary) !important;
}
[data-py-mode="dark"] .digital-card-title,
[data-py-mode="dark"] .digital-section-title,
[data-py-mode="dark"] .digital-character-name,
[data-py-mode="dark"] .digital-placeholder-title,
[data-py-mode="dark"] .digital-action-name,
[data-py-mode="dark"] .digital-action-inline-value,
[data-py-mode="dark"] .digital-score-total,
[data-py-mode="dark"] .digital-save-row,
[data-py-mode="dark"] .digital-inspection-title {
  color: var(--py-text-strong) !important;
}
[data-py-mode="dark"] .digital-placeholder-copy,
[data-py-mode="dark"] .digital-character-meta,
[data-py-mode="dark"] .digital-action-inline-label,
[data-py-mode="dark"] .digital-action-header-label,
[data-py-mode="dark"] .digital-overview-label {
  color: var(--py-muted-strong) !important;
}

/* Side panel rows should not paint a full-width accent-tinted band behind one button. */
.digital-inspection-action-row {
  background: transparent !important;
  border-color: transparent !important;
}
.digital-inspection-temp-row {
  background: var(--py-panel-soft-2) !important;
  border-color: var(--py-border) !important;
  border-radius: 12px;
  padding: 8px;
}
[data-py-mode="dark"] .digital-inspection-action-row {
  background: transparent !important;
  border-color: transparent !important;
}
[data-py-mode="dark"] .digital-inspection-metric,
[data-py-mode="dark"] .digital-inspection-list-card,
[data-py-mode="dark"] .digital-inspection-temp-row,
[data-py-mode="dark"] .digital-placeholder-line,
[data-py-mode="dark"] .conditions-panel-list > * {
  background: var(--py-panel-soft) !important;
  border-color: var(--py-border) !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-inspection-action-row .btn,
[data-py-mode="dark"] .digital-inspection-body .btn,
[data-py-mode="dark"] .digital-inspection-card .btn {
  background: var(--py-panel-soft) !important;
  color: var(--py-primary-dark) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="dark"] .digital-inspection-action-row .btn.primary,
[data-py-mode="dark"] .digital-inspection-body .btn.primary,
[data-py-mode="dark"] .digital-inspection-card .btn.primary {
  background: var(--py-primary) !important;
  color: var(--py-on-primary) !important;
  border-color: var(--py-primary) !important;
}

/* Sheet menu theme controls stay inside the hamburger menu and remain readable in dark mode. */
[data-py-mode="dark"] .digital-header-menu-panel .theme-field,
[data-py-mode="dark"] .digital-header-menu-panel .sheet-menu-theme-label {
  color: var(--py-muted-strong) !important;
}
[data-py-mode="dark"] .digital-header-menu-panel select {
  background: var(--py-input-bg) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}


/* v27.36: Digital sheet dark-mode theme cleanup. */
[data-py-mode="dark"] .digital-sheet-body,
[data-py-mode="dark"] .digital-sheet-shell {
  background: linear-gradient(180deg, var(--py-bg-strong) 0%, var(--py-bg) 100%) !important;
}
[data-py-mode="dark"] .digital-section-card,
[data-py-mode="dark"] .digital-feature-shell,
[data-py-mode="dark"] .digital-spells-shell,
[data-py-mode="dark"] .digital-equipment-shell,
[data-py-mode="dark"] .digital-character-shell,
[data-py-mode="dark"] .digital-tab-panel,
[data-py-mode="dark"] .digital-spell-row,
[data-py-mode="dark"] .digital-action-row,
[data-py-mode="dark"] .digital-feature-card,
[data-py-mode="dark"] .digital-inspection-list-card,
[data-py-mode="dark"] .digital-inspection-list-row,
[data-py-mode="dark"] .digital-spell-concentration-row {
  background: var(--py-panel) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="dark"] .digital-inspection-card,
[data-py-mode="dark"] .digital-inspection-header,
[data-py-mode="dark"] .digital-inspection-body,
[data-py-mode="dark"] .inspection-panel {
  background: var(--py-panel) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="light"] .digital-inspection-card,
[data-py-mode="light"] .digital-inspection-header,
[data-py-mode="light"] .digital-inspection-body {
  background: var(--py-panel-soft) !important;
}
[data-py-mode="dark"] .digital-inspection-action-row,
[data-py-mode="dark"] .digital-inspection-temp-row {
  background: transparent !important;
  border-color: var(--py-border-soft) !important;
}
[data-py-mode="light"] .digital-inspection-action-row,
[data-py-mode="light"] .digital-inspection-temp-row {
  background: transparent !important;
}
[data-py-mode="dark"] .digital-spell-atwill-label,
[data-py-mode="dark"] .digital-spell-level-pill,
[data-py-mode="dark"] .digital-spell-tag,
[data-py-mode="dark"] .digital-spells-shell .digital-spell-cell .digital-mod-chip.small,
[data-py-mode="dark"] .digital-cantrip-action-section .digital-spell-cell .digital-mod-chip.small,
[data-py-mode="dark"] .digital-inline-meta-pill,
[data-py-mode="dark"] .digital-passive-pill,
[data-py-mode="dark"] .digital-mod-chip {
  background: var(--py-accent-pill-bg, rgba(255,255,255,.06)) !important;
  border-color: var(--py-accent-pill-border, var(--py-border-strong)) !important;
  color: var(--py-accent-pill-text, var(--py-primary-dark)) !important;
}
[data-py-mode="dark"] .digital-tooltip-host[data-tooltip]:hover::after,
[data-py-mode="dark"] .digital-tooltip-host[data-tooltip]:focus-visible::after,
[data-py-mode="dark"] .digital-spells-shell .digital-tooltip-host[data-tooltip]:hover::after,
[data-py-mode="dark"] .digital-spells-shell .digital-tooltip-host[data-tooltip]:focus-visible::after,
[data-py-mode="dark"] .digital-cantrip-action-section .digital-tooltip-host[data-tooltip]:hover::after,
[data-py-mode="dark"] .digital-cantrip-action-section .digital-tooltip-host[data-tooltip]:focus-visible::after {
  background: var(--py-dark-popover) !important;
  color: var(--py-dark-popover-text) !important;
  border-color: var(--py-border-strong) !important;
  box-shadow: 0 12px 26px rgba(0,0,0,.45) !important;
}
[data-py-mode="dark"] .digital-tooltip-host[data-tooltip]:hover::before,
[data-py-mode="dark"] .digital-tooltip-host[data-tooltip]:focus-visible::before,
[data-py-mode="dark"] .digital-spells-shell .digital-tooltip-host[data-tooltip]:hover::before,
[data-py-mode="dark"] .digital-spells-shell .digital-tooltip-host[data-tooltip]:focus-visible::before,
[data-py-mode="dark"] .digital-cantrip-action-section .digital-tooltip-host[data-tooltip]:hover::before,
[data-py-mode="dark"] .digital-cantrip-action-section .digital-tooltip-host[data-tooltip]:focus-visible::before {
  background: var(--py-dark-popover) !important;
  border-color: var(--py-border-strong) !important;
}
[data-py-mode="dark"] .digital-sheet-import-page .digital-sheet-import-card,
[data-py-mode="dark"] .digital-sheet-import-page .field {
  background: var(--py-panel) !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-sheet-import-page .digital-sheet-file-input {
  background: transparent !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-sheet-import-status {
  background: var(--py-panel-soft) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
}
/* Character/profile inputs should not force the old light-blue control scheme in dark mode. */
[data-py-mode="dark"] .digital-character-details-shell select.digital-inspection-text-input,
[data-py-mode="dark"] .inspection-panel select.digital-inspection-text-input[data-character-profile-input],
[data-py-mode="dark"] .digital-character-details-shell .digital-inspection-text-input,
[data-py-mode="dark"] .inspection-panel input.digital-inspection-text-input[data-character-profile-input],
[data-py-mode="dark"] .inspection-panel textarea.digital-inspection-textarea[data-character-profile-input] {
  color-scheme: dark !important;
  background-color: var(--py-input-bg) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
  box-shadow: none !important;
}


/* v27.38: contain display preferences inside the live-sheet hamburger menu. */
.digital-header-menu-panel .sheet-menu-theme-control {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow: hidden !important;
}
.digital-header-menu-panel .sheet-menu-theme-control {
  background: var(--py-panel-soft) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
  box-shadow: none !important;
}
.digital-header-menu-panel .sheet-menu-theme-control .theme-field select,
.digital-header-menu-panel .sheet-menu-theme-control .theme-field select[data-py-theme-mode] {
  background-color: var(--py-input-bg) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border) !important;
  box-shadow: none !important;
}
.digital-header-menu-panel .sheet-menu-theme-control .theme-fields {
  display: grid !important;
  grid-template-columns: 1fr;
  width: 100% !important;
  min-width: 0 !important;
  gap: 10px;
}
.digital-header-menu-panel .sheet-menu-theme-control .theme-field {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100% !important;
  min-width: 0 !important;
  align-items: stretch;
}
.digital-header-menu-panel .sheet-menu-theme-control .theme-field select,
.digital-header-menu-panel .sheet-menu-theme-control .theme-field select[data-py-theme-mode] {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}


/* v27.44: inspection tables follow theme surfaces in dark mode instead of falling back to washed gray rows. */
[data-py-mode="dark"] .digital-species-feature-table-wrap {
  background: var(--py-panel) !important;
  border-color: var(--py-border) !important;
}
[data-py-mode="dark"] .digital-species-feature-table {
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-species-feature-table th,
[data-py-mode="dark"] .digital-species-feature-table td {
  border-color: var(--py-border-faint) !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .digital-species-feature-table th {
  background: var(--py-panel-soft) !important;
  color: var(--py-text-strong) !important;
}
[data-py-mode="dark"] .digital-species-feature-table tbody tr {
  background: var(--py-panel) !important;
}
[data-py-mode="dark"] .digital-species-feature-table tbody tr:nth-child(even) {
  background: var(--py-table-stripe) !important;
}

/* v27.68 Wizard signature spell display polish */
.manage-spells-v2-panel .wizard-signature-spells-panel {
  margin-top: 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(239, 246, 255, 0.82));
  padding: 0.75rem;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.06);
}
.manage-spells-v2-panel .wizard-signature-spells-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.manage-spells-v2-panel .wizard-signature-spells-head strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.manage-spells-v2-panel .wizard-signature-spells-head span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.manage-spells-v2-panel .wizard-signature-spell-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  padding: 0.6rem 0.7rem;
  margin-top: 0.45rem;
}
.manage-spells-v2-panel .wizard-signature-spell-main {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.manage-spells-v2-panel .wizard-signature-spell-main strong {
  font-size: 1rem;
  line-height: 1.15;
}
.manage-spells-v2-panel .wizard-signature-spell-main span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.manage-spells-v2-panel .wizard-signature-spell-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}
.manage-spells-v2-panel .wizard-signature-spell-badges span {
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.95);
  color: var(--accent);
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}
.manage-spells-v2-panel .wizard-signature-spell-empty {
  color: var(--muted);
  font-weight: 700;
  padding: 0.35rem 0.1rem;
}
[data-py-mode="dark"] .manage-spells-v2-panel .wizard-signature-spells-panel {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(125, 167, 255, 0.24);
}
[data-py-mode="dark"] .manage-spells-v2-panel .wizard-signature-spell-row {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(125, 167, 255, 0.22);
}
[data-py-mode="dark"] .manage-spells-v2-panel .wizard-signature-spell-badges span {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(125, 167, 255, 0.3);
}

/* Wizard: School of Abjuration Arcane Ward compact tracker */
.wizard-arcane-ward-controls .wizard-arcane-ward-stepper {
  display: grid;
  grid-template-columns: 44px minmax(96px, 1fr) 44px;
  gap: 8px;
  align-items: end;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-step-btn {
  min-width: 44px;
  min-height: 38px;
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-number-wrap {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-number {
  min-height: 38px;
  text-align: center;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-dismiss-row {
  grid-template-columns: 1fr;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-dismiss-row .btn {
  width: 100%;
}
@media (max-width: 520px) {
  .wizard-arcane-ward-controls .wizard-arcane-ward-stepper {
    grid-template-columns: 40px minmax(84px, 1fr) 40px;
  }
  .wizard-arcane-ward-controls .wizard-arcane-ward-step-btn {
    min-width: 40px;
  }
}

/* v27.71 Wizard abjuration tracker and spellcasting side-panel polish */
.wizard-arcane-ward-controls .wizard-arcane-ward-stepper {
  grid-template-columns: 44px minmax(86px, 1fr) 44px minmax(90px, auto);
  align-items: end;
}
.wizard-arcane-ward-controls .wizard-arcane-ward-dismiss-btn {
  min-height: 38px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}
.wizard-spellcasting-copy h3 {
  margin: 14px 0 6px;
  color: var(--py-accent-dark, var(--accent));
  font: 900 13px/1.2 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wizard-spellcasting-copy h3:first-child { margin-top: 0; }
.wizard-spellcasting-copy p strong { font-weight: 900; }
@media (max-width: 520px) {
  .wizard-arcane-ward-controls .wizard-arcane-ward-stepper {
    grid-template-columns: 38px minmax(70px, 1fr) 38px minmax(78px, auto);
    gap: 6px;
  }
  .wizard-arcane-ward-controls .wizard-arcane-ward-dismiss-btn { padding-inline: 0.55rem; }
}

/* v27.73 Wizard School of Divination controls */
.wizard-portent-controls .wizard-portent-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}
.wizard-portent-controls .wizard-portent-input-wrap {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wizard-portent-controls .wizard-portent-number {
  min-height: 38px;
  text-align: center;
}

.wizard-portent-controls .wizard-portent-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
.wizard-portent-controls .wizard-portent-actions .btn {
  width: 100%;
  min-width: 0;
}
.wizard-third-eye-controls select {
  width: 100%;
}
@media (max-width: 520px) {
  .wizard-portent-controls .wizard-portent-row {
    grid-template-columns: 1fr auto;
  }
  .wizard-portent-controls .wizard-portent-row .digital-inline-meta-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* v28.13 Paladin core polish */
.feature-charge-block.compact-counter { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.feature-charge-counter, .feature-charge-counter-recharge { white-space:nowrap; }
.digital-inline-number { width:4.75rem; min-width:0; border-radius:10px; border:1px solid var(--py-border-faint); background:var(--py-panel); color:var(--py-text); padding:7px 9px; font:700 14px/1.2 system-ui, sans-serif; }
.digital-inline-field.paladin-lay-on-hands-amount { display:flex; align-items:center; gap:6px; margin:0; color:var(--py-muted-strong); font:700 11px/1 system-ui, sans-serif; text-transform:uppercase; letter-spacing:.04em; }
.paladin-lay-on-hands-controls.compact .digital-feature-action-descriptor,
.paladin-lay-on-hands-controls.in-inspection .digital-feature-action-descriptor { white-space:nowrap; }
.paladin-lay-on-hands-controls.compact { gap:6px; }
.paladin-lay-on-hands-controls.in-inspection { gap:8px; }


/* v28.14 Paladin counter cleanup */
.feature-charge-counter-button { min-width:2.1rem; padding-left:10px; padding-right:10px; }

/* v28.16 Paladin counter cleanup */
.feature-charge-block.compact-counter,
.digital-inspection-charge-counter.compact-counter {
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.feature-charge-counter-control-row {
  display:inline-flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}
.feature-charge-counter-edit {
  display:inline-flex;
  align-items:center;
  gap:4px;
  border:1px solid var(--py-border-faint);
  border-radius:999px;
  background:var(--py-panel);
  padding:2px 8px;
  color:var(--py-text);
  font:700 14px/1.2 system-ui, sans-serif;
}
.feature-charge-current-input {
  width:4rem;
  border:0;
  background:transparent;
  padding:4px 0;
  text-align:center;
  box-shadow:none;
}
.feature-charge-current-input:focus {
  outline:2px solid var(--py-accent-soft);
  outline-offset:2px;
}
.feature-charge-counter-max {
  color:var(--py-muted-strong);
  white-space:nowrap;
}
.paladin-lay-on-hands-controls .digital-inline-number {
  width:4rem;
  text-align:center;
}

/* v29.15 Fighter Battle Master control cleanup */
.combat-superiority-controls {
  align-items: stretch;
  flex-direction: column;
  width: 100%;
}
.combat-superiority-charge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.combat-superiority-maneuver-table {
  width: 100%;
  margin-top: 0.25rem;
}
.combat-superiority-maneuver-table th:last-child,
.combat-superiority-maneuver-table td:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

/* v29.17: collapsible groups inside the Features > All view */
.digital-feature-collapsible-section > .digital-feature-section-summary {
  cursor: pointer;
  list-style: none;
}
.digital-feature-collapsible-section > .digital-feature-section-summary::-webkit-details-marker {
  display: none;
}
.digital-feature-collapsible-section > .digital-feature-section-summary::before {
  content: '▼ ';
}
.digital-feature-collapsible-section:not([open]) > .digital-feature-section-summary::before {
  content: '▶ ';
}


/* v29.19 Psi Warrior clipping/layout repair */
.psi-warrior-power-controls,
.psi-warrior-control,
.psi-warrior-power-list {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}
.psi-warrior-power-list {
  display: grid;
  gap: 0.55rem;
}
.psi-warrior-resource-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}
.psi-warrior-resource-note {
  color: var(--py-muted-strong);
  font-weight: 700;
  font-size: 0.82rem;
}
.psi-warrior-power-row {
  flex-wrap: wrap !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.psi-warrior-power-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
.psi-warrior-power-row .digital-feature-action-descriptor {
  flex: 1 1 14rem !important;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.25;
}
.psi-warrior-power-row .digital-feature-action,
.psi-warrior-power-row .feature-action-chip,
.psi-warrior-power-row .digital-mod-chip {
  flex: 0 0 auto !important;
}
.digital-inspection-panel,
.digital-inspection-drawer,
.digital-inspection-body {
  overflow-x: hidden;
}

/* v29.39: theme Manage Items and spell cast-level selectors instead of hard-coded light surfaces. */
.digital-manage-items-panel .digital-inventory-manager-section {
  background: var(--py-panel-soft-2) !important;
  border-color: var(--py-border) !important;
  color: var(--py-text) !important;
  box-shadow: none;
}
.digital-manage-items-panel .digital-inventory-manager-section > summary {
  background: var(--py-panel-soft-2) !important;
  color: var(--py-text-strong) !important;
}
.digital-manage-items-panel .digital-inventory-manager-section[open] > summary {
  border-bottom: 1px solid var(--py-border-soft, var(--py-border));
}
.digital-manage-items-panel .digital-inventory-manager-collapse {
  background: var(--py-input-bg) !important;
  border-color: var(--py-border-strong, var(--py-border)) !important;
  color: var(--py-primary-dark, var(--accent)) !important;
}
.digital-manage-items-panel .digital-inventory-manager-card {
  background: var(--py-panel) !important;
  border-color: var(--py-border) !important;
  color: var(--py-text) !important;
}
.digital-manage-items-panel .digital-inventory-manager-card.expanded {
  background: var(--py-panel-soft, var(--py-panel)) !important;
}
.digital-manage-items-panel .digital-inventory-manager-name,
.digital-manage-items-panel .digital-inventory-manager-name.as-button {
  color: var(--py-text-strong) !important;
}
.digital-manage-items-panel .digital-inventory-manager-count,
.digital-manage-items-panel .digital-inventory-manager-meta,
.digital-manage-items-panel .digital-inventory-manager-field,
.digital-manage-items-panel .digital-inspection-helper {
  color: var(--py-muted-strong, var(--py-muted)) !important;
}
.digital-manage-items-panel .digital-inventory-manager-select,
.digital-manage-items-panel .digital-inventory-manager-search,
.digital-manage-items-panel .digital-inventory-manager-qty-select {
  color-scheme: light dark;
  background-color: var(--py-input-bg) !important;
  color: var(--py-text) !important;
  border-color: var(--py-border-strong, var(--py-border)) !important;
  box-shadow: none !important;
}
.digital-manage-items-panel .digital-inventory-manager-select option,
.digital-manage-items-panel .digital-inventory-manager-qty-select option {
  background-color: var(--py-input-bg) !important;
  color: var(--py-text) !important;
}
.digital-manage-items-panel .digital-inventory-manager-select option:checked,
.digital-manage-items-panel .digital-inventory-manager-qty-select option:checked {
  background-color: var(--py-primary) !important;
  color: var(--py-on-primary) !important;
}
[data-py-mode="dark"] .digital-manage-items-panel .digital-inventory-manager-select,
[data-py-mode="dark"] .digital-manage-items-panel .digital-inventory-manager-search,
[data-py-mode="dark"] .digital-manage-items-panel .digital-inventory-manager-qty-select,
[data-py-mode="dark"] .digital-spell-level-select {
  color-scheme: dark !important;
}
[data-py-mode="light"] .digital-manage-items-panel .digital-inventory-manager-select,
[data-py-mode="light"] .digital-manage-items-panel .digital-inventory-manager-search,
[data-py-mode="light"] .digital-manage-items-panel .digital-inventory-manager-qty-select,
[data-py-mode="light"] .digital-spell-level-select {
  color-scheme: light !important;
}
.digital-spells-shell .digital-spell-level-select,
.digital-cantrip-action-section .digital-spell-level-select {
  background-color: var(--py-accent-pill-bg, var(--py-primary-glass)) !important;
  border-color: var(--py-accent-pill-border, var(--py-primary-border-alpha)) !important;
  color: var(--py-accent-pill-text, var(--py-primary-dark)) !important;
}
.digital-spells-shell .digital-spell-level-select option,
.digital-cantrip-action-section .digital-spell-level-select option {
  background-color: var(--py-input-bg) !important;
  color: var(--py-text) !important;
}
.digital-spells-shell .digital-spell-level-select option:checked,
.digital-cantrip-action-section .digital-spell-level-select option:checked {
  background-color: var(--py-primary) !important;
  color: var(--py-on-primary) !important;
}

/* savertest v0.2: roll results must sit above inspection drawers and side panels. */
.digital-roll-toast,
.digital-roll-option-menu,
.digital-roll-history-panel {
  z-index: 12000 !important;
}

/* Manual attack modifier drawer */
.manual-attack-modifiers-shell .digital-inspection-copy {
  margin-bottom: 0.25rem;
}
.manual-attack-modifier-list {
  display: grid;
  gap: 0.7rem;
}
.manual-attack-modifier-card {
  border: 1px solid var(--sheet-card-border, rgba(54, 105, 168, 0.22));
  border-radius: 1rem;
  padding: 0.75rem;
  background: var(--sheet-panel-soft, rgba(255,255,255,0.66));
}
.manual-attack-modifier-card.is-disabled {
  opacity: 0.62;
}
.manual-attack-modifier-card-head,
.manual-attack-modifier-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.manual-attack-modifier-card-body {
  margin-top: 0.55rem;
  flex-wrap: wrap;
}
.manual-attack-modifier-name {
  font-weight: 900;
  font-size: 1rem;
}
.manual-attack-modifier-meta {
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.72;
}
.manual-attack-modifier-form {
  display: grid;
  gap: 0.75rem;
}
.manual-attack-modifier-field {
  display: grid;
  gap: 0.3rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.manual-attack-modifier-field input,
.manual-attack-modifier-field select {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95rem;
}
.manual-attack-modifier-scopes {
  border: 1px solid var(--sheet-card-border, rgba(54, 105, 168, 0.22));
  border-radius: 1rem;
  padding: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.manual-attack-modifier-scopes legend {
  padding: 0 0.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.manual-attack-modifier-scopes label,
.digital-toggle-row.compact {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
}
.manual-attack-modifier-actions {
  align-items: center;
}
[data-py-mode="dark"] .manual-attack-modifier-card,
[data-py-mode="dark"] .manual-attack-modifier-scopes {
  background: rgba(15, 23, 42, 0.55);
}
.manual-attack-damage-type-field.is-hidden {
  display: none;
}
.digital-spell-filter-row select.digital-spell-school-filter,
.digital-spell-filter-row select.digital-spell-other-filter {
  min-width: 8.5rem;
}

/* savertest v0.8: rogue subclass action polish. */
.digital-spells-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  align-items: center;
}
.digital-spell-modifiers-button,
.digital-manage-spells-button {
  white-space: nowrap;
}
.manual-attack-modifier-card .digital-toggle-row.compact,
.manual-attack-modifier-card .digital-toggle-row.compact span {
  color: var(--sheet-text, var(--py-ink)) !important;
  opacity: 1 !important;
}
.manual-attack-modifier-card.is-disabled .digital-toggle-row.compact,
.manual-attack-modifier-card.is-disabled .digital-toggle-row.compact span {
  opacity: 0.82 !important;
}
.manual-spell-damage-type-field.is-hidden {
  display: none;
}
.digital-spells-shell .digital-spell-filter-row,
.digital-cantrip-action-section .digital-spell-filter-row {
  align-items: center;
  gap: 6px;
}
.digital-spells-shell .digital-spell-filter-row select.digital-spell-other-filter,
.digital-spells-shell .digital-spell-filter-row select.digital-spell-school-filter,
.digital-cantrip-action-section .digital-spell-filter-row select.digital-spell-other-filter,
.digital-cantrip-action-section .digital-spell-filter-row select.digital-spell-school-filter {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 8rem !important;
  max-width: 9.6rem !important;
  padding: 5px 24px 5px 10px !important;
  min-height: 31px !important;
}
@media (max-width: 720px) {
  .digital-spells-head-actions { justify-content: flex-start; }
  .digital-spells-shell .digital-spell-filter-row select.digital-spell-other-filter,
  .digital-spells-shell .digital-spell-filter-row select.digital-spell-school-filter,
  .digital-cantrip-action-section .digital-spell-filter-row select.digital-spell-other-filter,
  .digital-cantrip-action-section .digital-spell-filter-row select.digital-spell-school-filter {
    max-width: 100% !important;
  }
}


/* v0.15b action-row column hardening: bonuses must wrap inside their own Hit/Damage/Extra columns instead of pushing neighboring columns out of alignment. */
.digital-action-row > * { min-width:0; }
.digital-action-hit-wrap,
.digital-action-hit-stack,
.digital-action-damage-stack,
.digital-action-extra-stack {
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
}
.digital-action-hit-wrap { overflow:hidden; }
.digital-action-hit-stack .digital-mod-chip,
.digital-action-hit-wrap .digital-mod-chip,
.digital-action-damage-stack .digital-mod-chip,
.digital-action-extra-stack .digital-mod-chip {
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.15;
  height:auto;
}
.digital-action-hit-stack .digital-mod-chip,
.digital-action-hit-wrap .digital-mod-chip,
.digital-action-damage-stack .digital-mod-chip { text-align:center; }


/* v0.15c action Extra column hard lock: keep Extra chips inside their own grid column even when attack/damage bonuses wrap. */
.digital-action-header-row > .digital-action-header-label:nth-child(5) {
  transform:none !important;
  text-align:center !important;
  padding-right:0 !important;
}
.digital-action-extra-stack {
  transform:none !important;
  justify-content:flex-start !important;
  overflow:hidden !important;
}
.digital-action-header-row,
.digital-action-row,
.digital-action-row.split-damage-with-extra {
  grid-template-columns:minmax(160px, 1fr) 92px 120px 120px 104px;
}
.digital-action-extra-stack .digital-mod-chip {
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:normal !important;
}
@media (max-width: 920px) {
  .digital-action-row,
  .digital-action-row.split-damage-with-extra { grid-template-columns:minmax(0, 1fr); }
  .digital-action-extra-stack { justify-content:flex-start !important; }
}

/* v0.15d action-table fit repair: keep Hit/Damage/Extra columns inside the card without horizontal scroll.
   Previous fixed-width hardening stopped chip drift but made the fifth column run past the visible sheet on narrower desktop widths. */
.digital-actions-shell,
.digital-action-section {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.digital-action-header-row,
.digital-action-row,
.digital-action-row.split-damage-with-extra {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns:
    minmax(116px, 1.42fr)
    minmax(56px, 0.58fr)
    minmax(60px, 0.64fr)
    minmax(76px, 0.78fr)
    minmax(56px, 0.60fr) !important;
  column-gap: clamp(4px, 0.75vw, 8px) !important;
}
.digital-action-row > *,
.digital-action-header-row > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.digital-action-header-row > .digital-action-header-label:nth-child(n+2) {
  text-align: center !important;
  transform: none !important;
  padding-right: 0 !important;
}
.digital-action-inline-value {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.digital-action-hit-wrap,
.digital-action-hit-stack,
.digital-action-damage-stack,
.digital-action-extra-stack {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
  justify-content: center !important;
  align-items: center !important;
  transform: none !important;
}
.digital-action-hit-stack.has-secondary,
.digital-action-damage-stack.has-secondary,
.digital-action-extra-stack.has-secondary {
  align-items: center !important;
}
.digital-action-row .digital-mod-chip,
.digital-action-hit-stack .digital-mod-chip,
.digital-action-hit-wrap .digital-mod-chip,
.digital-action-damage-stack .digital-mod-chip,
.digital-action-extra-stack .digital-mod-chip {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  text-align: center !important;
  line-height: 1.12 !important;
  height: auto !important;
}
.digital-action-row .digital-mod-chip.small {
  padding-left: 7px;
  padding-right: 7px;
}
@media (max-width: 920px) {
  .digital-action-header-row {
    display: none;
  }
  .digital-action-row,
  .digital-action-row.split-damage-with-extra {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .digital-action-hit-wrap,
  .digital-action-hit-stack,
  .digital-action-damage-stack,
  .digital-action-extra-stack {
    justify-content: flex-start !important;
    align-items: flex-start !important;
  }
}


/* v0.15e action-column rollback/fit repair: restore the earlier readable column sizes while keeping chips locked to their own cells. */
.digital-action-header-row,
.digital-action-row,
.digital-action-row.split-damage-with-extra {
  grid-template-columns: minmax(150px, 1fr) 82px 104px 104px 86px !important;
  column-gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.digital-action-header-row > .digital-action-header-label:nth-child(n+2) {
  text-align: left !important;
}
.digital-action-header-row > .digital-action-header-label:nth-child(5) {
  text-align: center !important;
}
.digital-action-hit-wrap,
.digital-action-hit-stack,
.digital-action-damage-stack,
.digital-action-extra-stack {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  transform: none !important;
}
.digital-action-hit-wrap,
.digital-action-hit-stack {
  justify-content: flex-start !important;
  align-items: center !important;
}
.digital-action-damage-stack {
  justify-content: flex-start !important;
  align-items: center !important;
}
.digital-action-extra-stack {
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
}
.digital-action-hit-stack.has-secondary,
.digital-action-damage-stack.has-secondary,
.digital-action-extra-stack.has-secondary {
  align-items: center !important;
}
.digital-action-row .digital-mod-chip,
.digital-action-damage-stack .digital-mod-chip,
.digital-action-extra-stack .digital-mod-chip {
  min-width: 38px !important;
  max-width: 100% !important;
  padding: 5px 8px !important;
  font-size: 13px !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  box-sizing: border-box !important;
  text-align: center !important;
  height: auto !important;
}
.digital-action-hit-stack .digital-mod-chip,
.digital-action-hit-wrap .digital-mod-chip {
  min-width: 86px !important;
  max-width: 104px !important;
  padding: 5px 8px !important;
  font-size: 13px !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  box-sizing: border-box !important;
  text-align: center !important;
  height: auto !important;
}
.digital-action-row .digital-mod-chip.small {
  padding-left: 8px !important;
  padding-right: 8px !important;
}
@media (max-width: 920px) {
  .digital-action-header-row { display: none !important; }
  .digital-action-row,
  .digital-action-row.split-damage-with-extra { grid-template-columns: minmax(0, 1fr) !important; }
  .digital-action-hit-wrap,
  .digital-action-hit-stack,
  .digital-action-damage-stack,
  .digital-action-extra-stack {
    justify-content: flex-start !important;
    align-items: flex-start !important;
  }
}


/* v0.15f action Extra column re-fit: keep the Extra column visible without shrinking Hit back into unreadable chips. */
.digital-action-header-row,
.digital-action-row,
.digital-action-row.split-damage-with-extra {
  grid-template-columns:
    minmax(140px, 1fr)
    minmax(64px, 76px)
    minmax(104px, 110px)
    minmax(96px, 104px)
    minmax(108px, 116px) !important;
  column-gap: 6px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.digital-action-header-row > .digital-action-header-label:nth-child(n+2) {
  text-align: left !important;
}
.digital-action-extra-stack {
  justify-content: flex-start !important;
  align-items: center !important;
  overflow: visible !important;
  transform: none !important;
}
.digital-action-extra-stack.has-secondary {
  align-items: flex-start !important;
}
.digital-action-extra-stack .digital-mod-chip {
  min-width: 44px !important;
  max-width: 100% !important;
  padding-left: 7px !important;
  padding-right: 7px !important;
}
.digital-action-hit-stack .digital-mod-chip,
.digital-action-hit-wrap .digital-mod-chip {
  min-width: 86px !important;
  max-width: 110px !important;
}
.digital-action-damage-stack .digital-mod-chip {
  min-width: 44px !important;
  max-width: 104px !important;
}
@media (max-width: 920px) {
  .digital-action-header-row { display: none !important; }
  .digital-action-row,
  .digital-action-row.split-damage-with-extra { grid-template-columns: minmax(0, 1fr) !important; }
}

/* v0.15g Extra column chip wrap repair: keep Extra damage buttons inside the cell and wrap long rider text instead of bleeding right. */
.digital-action-extra-stack {
  overflow: hidden !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
.digital-action-extra-stack .digital-mod-chip {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.15 !important;
  text-align: center !important;
}

/* v0.15h Extra column final wrap: keep the fifth Actions column inside the card and force rider-added Extra chips onto stacked formula lines. */
.digital-action-header-row,
.digital-action-row,
.digital-action-row.split-damage-with-extra {
  grid-template-columns:
    minmax(132px, 1fr)
    minmax(60px, 74px)
    minmax(104px, 112px)
    minmax(104px, 118px)
    minmax(96px, 110px) !important;
  column-gap: 5px !important;
}
.digital-action-header-row > .digital-action-header-label:nth-child(5) {
  text-align: left !important;
}
.digital-action-extra-stack {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  justify-content: stretch !important;
  align-items: stretch !important;
}
.digital-action-extra-stack .digital-mod-chip {
  display: flex !important;
  flex: 1 1 0 !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  inline-size: 100% !important;
  width: 100% !important;
  min-inline-size: 0 !important;
  min-width: 0 !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
.digital-action-extra-stack .digital-chip-line {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.12;
  text-align: center;
}
@media (max-width: 920px) {
  .digital-action-header-row { display: none !important; }
  .digital-action-row,
  .digital-action-row.split-damage-with-extra { grid-template-columns: minmax(0, 1fr) !important; }
}

/* v0.15j tool proficiency roll controls */
.digital-tool-roll-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
}
.digital-tool-roll-button{
  border:1px solid var(--py-border);
  background:var(--py-panel);
  color:var(--py-ink);
  border-radius:999px;
  padding:3px 8px;
  font:inherit;
  font-size:12px;
  font-weight:800;
  line-height:1.25;
  cursor:pointer;
}
.digital-tool-roll-button:hover,
.digital-tool-roll-button:focus-visible{
  border-color:var(--accent);
  color:var(--accent-strong);
  outline:none;
  box-shadow:0 0 0 2px var(--accent-soft, var(--py-border-faint));
}
.tool-roll-control-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
@media (max-width: 720px){
  .tool-roll-control-grid{grid-template-columns:1fr;}
}
[data-py-mode="dark"] .digital-tool-roll-button{
  background:var(--py-panel);
  color:var(--py-ink);
  border-color:var(--py-border);
}
[data-py-mode="dark"] .digital-tool-roll-button:hover,
[data-py-mode="dark"] .digital-tool-roll-button:focus-visible{
  color:var(--accent-strong);
  border-color:var(--accent);
}

/* v0.15m workspace collapsibles: Actions Other/Universal sections and Character > All groups */
.digital-workspace-collapse-section {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.digital-workspace-collapse-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.digital-workspace-collapse-summary::-webkit-details-marker {
  display: none;
}
.digital-workspace-collapse-summary::before {
  content: '▼';
  color: var(--py-muted-strong);
  font: 900 12px/1 system-ui, sans-serif;
  transform: translateY(-1px);
}
.digital-workspace-collapse-section:not([open]) > .digital-workspace-collapse-summary::before {
  content: '▶';
}
.digital-workspace-collapse-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.digital-action-collapsible-section > .digital-workspace-collapse-summary {
  margin-bottom: 0;
}
.digital-action-collapsible-section[open] > .digital-workspace-collapse-summary {
  margin-bottom: 2px;
}
.digital-character-collapsible-section > .digital-workspace-collapse-summary {
  margin-bottom: 0;
}
.digital-character-collapsible-section[open] > .digital-workspace-collapse-summary {
  margin-bottom: 2px;
}


/* v0.17a Summons / Companions layout and readability polish */
.digital-summons-shell {
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.digital-summons-shell .digital-equipment-head {
  min-width: 0;
  flex-wrap: wrap;
}
.summon-card-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.summon-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, rgba(33, 91, 69, .24));
  border-radius: 16px;
  background: var(--panel, #fff);
  overflow: hidden;
}
.summon-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
}
.summon-card-summary::-webkit-details-marker { display: none; }
.summon-summary-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.summon-summary-identity strong {
  font-size: 1.02rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summon-summary-identity span,
.manage-summon-current-row span,
.manage-summon-result span {
  color: var(--muted, #60736b);
  font-size: .82rem;
}
.summon-summary-chevron {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border, rgba(33, 91, 69, .22));
  border-radius: 999px;
  color: var(--accent, #2a8c62);
  background: color-mix(in srgb, var(--panel, #fff) 92%, var(--accent, #2a8c62));
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform .16s ease;
}
.summon-card[open] > .summon-card-summary .summon-summary-chevron {
  transform: rotate(0deg);
}
.summon-summary-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.summon-summary-stat {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, rgba(33, 91, 69, .2));
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .82rem;
  white-space: nowrap;
  background: color-mix(in srgb, var(--panel, #fff) 88%, var(--accent, #2a8c62));
}
.summon-summary-speed {
  flex: 0 1 auto;
  width: fit-content;
  max-width: min(420px, 100%);
  white-space: normal;
  overflow-wrap: anywhere;
}
.summon-card-body {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border-top: 1px solid var(--border, rgba(33, 91, 69, .2));
  padding: 12px;
  display: grid;
  gap: 12px;
  overflow: hidden;
}
.summon-card-tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.summon-card-hp-controls,
.summon-inspection-controls,
.manage-summons-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  min-width: 0;
}
.summon-card-hp-controls {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.summon-card-tool-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
}
.summon-card-tool-actions > .btn {
  max-width: 100%;
  white-space: nowrap;
  padding-inline: 14px;
}
.summon-card-hp-controls label,
.summon-hp-editor label {
  display: grid;
  gap: 4px;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .035em;
}
.summon-card-hp-controls input,
.summon-hp-editor input {
  width: 92px;
  border: 1px solid var(--border, rgba(33, 91, 69, .28));
  border-radius: 9px;
  padding: 7px 8px;
  color: inherit;
  background: var(--panel, #fff);
}
.summon-hp-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.summon-hp-editor input {
  width: 100%;
  box-sizing: border-box;
}
.summon-action-list {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.summon-action-list .digital-action-header-row,
.summon-action-list .digital-action-row,
.summon-action-list .digital-action-row.split-damage-with-extra {
  min-width: 0 !important;
  max-width: 100% !important;
}
.summon-empty-state {
  padding: 28px 18px;
  text-align: center;
}
.manage-summons-shell {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}
.manage-summons-current,
.manage-summons-results {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.manage-summons-results {
  max-height: 46vh;
  overflow: auto;
  padding-right: 4px;
}
.manage-summon-current-row,
.manage-summon-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, rgba(33, 91, 69, .22));
  border-radius: 12px;
  padding: 10px 11px;
  background: var(--panel, #fff);
}
.manage-summon-current-row > div:first-child,
.manage-summon-result > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.manage-summon-current-row > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.manage-summons-controls .digital-inline-field:first-child { flex: 1 1 280px; }
.manage-summons-controls input[type="search"] {
  width: 100%;
  box-sizing: border-box;
}
.summon-monster-statblock { margin-bottom: 16px; }

@media (max-width: 700px) {
  .summon-card-tools {
    flex-wrap: wrap;
  }
  .summon-card-tool-actions {
    justify-content: flex-start;
    margin-left: 0;
    flex-wrap: wrap;
  }
  .summon-card-hp-controls {
    flex-wrap: wrap;
  }
  .summon-hp-editor { grid-template-columns: 1fr; }
  .manage-summon-current-row,
  .manage-summon-result {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .manage-summon-current-row > div:last-child {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .summon-summary-stats {
    align-items: stretch;
  }
  .summon-summary-stat {
    flex: 1 1 auto;
  }
  .summon-summary-speed {
    flex-basis: 100%;
  }
}


/* v0.18 Summon creature reference, spell links, description layout, and viewport-safe tooltips */
.summon-reference-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(520px, 46vw);
  height: 100vh;
  transform: translateX(-104%);
  transition: transform .22s ease;
  z-index: 1001;
  pointer-events: none;
}
.summon-reference-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}
.summon-reference-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--py-panel);
  color: var(--py-text);
  border-right: 2px solid var(--py-border-strong, var(--py-border));
  box-shadow: 12px 0 28px var(--py-shadow-panel);
}
.summon-reference-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 2px solid var(--py-border-faint);
  background: var(--py-panel);
}
.summon-reference-title {
  margin-top: 4px;
  color: var(--py-text-strong);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.15;
}
.summon-reference-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.summon-reference-body {
  min-width: 0;
  overflow: auto;
  padding: 18px;
  background: var(--py-panel);
  color: var(--py-text);
}
body.summon-reference-paired #inspection-drawer {
  width: min(720px, 62vw);
}
body.summon-reference-paired #summon-reference-drawer {
  width: min(520px, 38vw);
}
.manage-summon-name-button {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--py-text-strong);
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.manage-summon-name-button:hover,
.manage-summon-name-button:focus-visible {
  color: var(--py-primary-dark, var(--accent));
  text-decoration-thickness: 2px;
}
.summon-monster-spell-link {
  display: inline;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--py-primary-dark, var(--accent));
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}
.summon-monster-spell-link:hover,
.summon-monster-spell-link:focus-visible {
  color: var(--py-text-strong);
  text-decoration-thickness: 2px;
}
.summon-monster-description {
  margin-top: 14px;
  border: 1px solid var(--py-border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--py-panel);
}
.summon-monster-description > .dnd-statblock-section {
  margin: 0;
}
.summon-monster-description-copy {
  display: grid;
  gap: 9px;
  padding: 14px 16px 16px;
  color: var(--py-text);
  line-height: 1.55;
}
.summon-monster-description-copy h3 {
  margin: 10px -2px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--py-border-faint);
  color: var(--py-text-strong);
  font-size: 16px;
  line-height: 1.25;
}
.summon-monster-description-copy h3:first-child { margin-top: 0; }
.summon-monster-description-copy p { margin: 0; }
.summon-spell-roll-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.summon-spell-roll-chip,
.summon-spell-save-chip {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.summon-action-list .digital-tooltip-host[data-tooltip]::before,
.summon-action-list .digital-tooltip-host[data-tooltip]::after {
  display: none !important;
  content: none !important;
}
.digital-floating-tooltip {
  max-height: calc(100vh - 16px);
  overflow: hidden;
}
@media (max-width: 760px) {
  body.summon-reference-paired #inspection-drawer { width: 58vw; }
  body.summon-reference-paired #summon-reference-drawer { width: 42vw; }
  .summon-reference-header { padding: 12px; }
  .summon-reference-body { padding: 12px; }
  .summon-reference-title { font-size: 19px; }
  .summon-reference-header-actions { width: 100%; justify-content: flex-start; }
}

/* v0.19b Sorcerer feature clarity */
.feature-clarity-block p { margin:0 0 12px; }
.feature-clarity-block p:last-child { margin-bottom:0; }


/* Wild Magic Sorcerer reference and active-effect UI. */
.wild-magic-table-scroll{max-width:100%;overflow:auto;}
.wild-magic-surge-table{width:100%;min-width:900px;table-layout:fixed;border-collapse:separate;border-spacing:0;}
.wild-magic-surge-table .wild-magic-roll-col{width:76px;}
.wild-magic-surge-table .wild-magic-effect-col{width:auto;}
.wild-magic-surge-table th,.wild-magic-surge-table td{vertical-align:top;word-break:normal;overflow-wrap:normal;}
.wild-magic-surge-table th:nth-child(1),.wild-magic-surge-table th:nth-child(3),.wild-magic-surge-table td.wild-magic-range{text-align:center;white-space:nowrap;}
.wild-magic-result-button{border:1px solid var(--accent,#2f8b5f);background:var(--surface,#fff);color:inherit;border-radius:999px;padding:5px 8px;font:inherit;font-weight:800;cursor:pointer;}
.wild-magic-result-button:hover{background:var(--surface-soft,#eef7f1);}
.wild-magic-active-list{display:grid;gap:8px;}
.wild-magic-active-effect{border:1px solid var(--line,#cfe0d5);border-radius:12px;padding:10px 12px;background:var(--surface-soft,#f7fbf8);line-height:1.45;}
.wild-magic-surge-controls{flex-wrap:wrap;}
@media (max-width:760px){.wild-magic-surge-table{min-width:760px;}}


/* v0.19e: Wild Magic uses a standard right inspection drawer and a wide left reference drawer. */
.summon-reference-drawer.wild-magic-reference-drawer {
  width: min(840px, 66vw);
}
body.wild-magic-reference-paired #inspection-drawer {
  width: min(420px, 32vw);
}
body.wild-magic-reference-paired #summon-reference-drawer {
  width: min(840px, 66vw);
}
.wild-magic-reference-table-wrap {
  width: 100%;
  max-width: 100%;
  margin-top: 12px;
  overflow: hidden;
}
.wild-magic-reference-table-wrap .wild-magic-surge-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 13px;
}
.wild-magic-reference-table-wrap .wild-magic-surge-table .wild-magic-roll-col { width: 76px; }
.wild-magic-reference-table-wrap .wild-magic-surge-table th,
.wild-magic-reference-table-wrap .wild-magic-surge-table td {
  min-width: 0;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  word-break: normal;
}
.wild-magic-reference-table-wrap .wild-magic-surge-table td.wild-magic-range {
  width: 76px;
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
}
.wild-magic-result-button {
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
@keyframes wildMagicControlFeedback {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(1px) scale(.96); box-shadow: 0 0 0 4px var(--py-hover-ring); }
  100% { transform: translateY(0) scale(1); }
}
.wild-magic-feedback-button.is-pressed,
[data-class-feature-action="wild_magic_surge_use"].is-pressed,
[data-class-feature-action="wild_magic_surge_roll"].is-pressed,
[data-class-feature-action="wild_magic_surge_check"].is-pressed,
[data-open-sorcerer-wild-magic-table].is-pressed,
[data-sorcerer-wild-magic-reference-roll].is-pressed {
  animation: wildMagicControlFeedback .26s ease;
}
@media (max-width: 760px) {
  .summon-reference-drawer.wild-magic-reference-drawer,
  body.wild-magic-reference-paired #summon-reference-drawer { width: 58vw; }
  body.wild-magic-reference-paired #inspection-drawer { width: 42vw; }
  .wild-magic-reference-table-wrap .wild-magic-surge-table { font-size: 11px; }
  .wild-magic-reference-table-wrap .wild-magic-surge-table .wild-magic-roll-col { width: 60px; }
  .wild-magic-reference-table-wrap .wild-magic-surge-table th,
  .wild-magic-reference-table-wrap .wild-magic-surge-table td { padding: 6px; }
}

/* v0.19e: immediate pointer feedback remains visible even when a Wild Magic control refreshes its panel. */
.wild-magic-feedback-button:active,
[data-class-feature-action="wild_magic_surge_use"]:active,
[data-class-feature-action="wild_magic_surge_roll"]:active,
[data-class-feature-action="wild_magic_surge_check"]:active,
[data-open-sorcerer-wild-magic-table]:active,
[data-sorcerer-wild-magic-reference-roll]:active {
  transform: translateY(1px) scale(.97);
  background: color-mix(in srgb, var(--accent) 18%, var(--py-panel));
  box-shadow: 0 0 0 4px var(--py-hover-ring);
}


/* v0.19f: left reference drawers use the same themed surface as right inspection drawers. */
.summon-reference-drawer .summon-reference-card,
.summon-reference-drawer .summon-reference-header,
.summon-reference-drawer .summon-reference-body {
  background: var(--py-panel-glass) !important;
  color: var(--py-text) !important;
}
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-card,
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-header,
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-body {
  background: var(--py-panel) !important;
}
.digital-inspection-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

/* v0.19g: Wild Magic reference rows follow the standard light/dark table striping. */
[data-py-mode="light"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(odd) {
  background: var(--py-panel-soft) !important;
}
[data-py-mode="light"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(even) {
  background: var(--py-table-stripe) !important;
}
[data-py-mode="dark"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(odd) {
  background: var(--py-panel) !important;
}
[data-py-mode="dark"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(even) {
  background: var(--py-table-stripe) !important;
}

/* Persistent reminders are intentionally quieter than End-controlled effects. */
.wild-magic-note-effect {
  border-style: dashed;
  background: var(--py-panel-soft-2, var(--py-panel-soft)) !important;
}

/* Left reference drawers use the exact same themed surface as the right inspection drawer. */
[data-py-mode="light"] .summon-reference-drawer .summon-reference-card,
[data-py-mode="light"] .summon-reference-drawer .summon-reference-header,
[data-py-mode="light"] .summon-reference-drawer .summon-reference-body {
  background: var(--py-panel-soft) !important;
}
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-card,
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-header,
[data-py-mode="dark"] .summon-reference-drawer .summon-reference-body {
  background: var(--py-panel) !important;
}

/* v0.19i: Wild Magic table follows standard themed table/button rules. */
[data-py-mode="light"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(odd) { background: var(--py-panel) !important; }
[data-py-mode="light"] .wild-magic-reference-table-wrap .wild-magic-surge-table tbody tr:nth-child(even) { background: var(--py-table-stripe) !important; }
.wild-magic-result-button {
  border: 2px solid var(--py-border-strong) !important;
  background: var(--py-panel) !important;
  color: var(--py-primary) !important;
  box-shadow: none;
}
.wild-magic-result-button:hover,
.wild-magic-result-button:focus-visible { background: var(--py-panel-tint) !important; box-shadow: 0 0 0 3px var(--py-hover-ring); }
[data-py-mode="dark"] .wild-magic-result-button { background: var(--py-panel-soft) !important; color: var(--py-text-strong) !important; border-color: var(--py-primary-2) !important; }
.wild-magic-active-effect { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.wild-magic-active-effect > span { min-width:0; flex:1; }
.wild-magic-effect-clear { flex:0 0 auto; min-height:34px; padding:6px 10px; }

/* Shared monster-description formatting inside summon stat blocks. */
.summon-monster-description-copy h4 {
  margin: 10px -2px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--py-border-faint);
  color: var(--py-text-strong);
  font-size: 16px;
  line-height: 1.25;
}
.summon-monster-description-copy h4:first-child { margin-top: 0; }
.summon-monster-description-copy blockquote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--py-panel-soft);
  color: var(--py-muted);
  font-style: italic;
}
.summon-monster-description-copy .monster-description-list {
  margin: 0;
  padding-left: 22px;
}
.summon-monster-description-copy .monster-description-list li + li { margin-top: 5px; }
.summon-monster-description-copy .monster-description-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--py-border);
  border-radius: 10px;
}
.summon-monster-description-copy .monster-description-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--py-panel);
  color: var(--py-text);
}
.summon-monster-description-copy .monster-description-table th,
.summon-monster-description-copy .monster-description-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--py-border-faint);
  text-align: left;
  vertical-align: top;
}
.summon-monster-description-copy .monster-description-table th {
  background: var(--py-panel-soft);
  color: var(--py-text-strong);
  font-weight: 800;
}
.summon-monster-description-copy .monster-description-table tr:last-child td { border-bottom: 0; }

/* v0.28 Drakewarden polish: keep inspection metrics and long action chips inside their assigned cells. */
.digital-inspection-metric,
.digital-inspection-metric-value {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.digital-inspection-metric-value.small {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.digital-action-damage-stack .static-chip {
  white-space: pre-line !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  max-width: 100% !important;
}
.drakewarden-breath-controls .digital-inline-select {
  max-width: 11rem;
  min-width: 7.5rem;
}


/* savertest v0.29a: structured spell tables in the digital-sheet inspection drawer. */
.spell-description-rich{display:grid;gap:0;}
.spell-description-rich>.digital-rich-copy{display:contents;}
.spell-reference-table-block{margin:14px 0 16px;min-width:0;}
.spell-reference-table-title{font-size:12px;font-weight:950;color:var(--py-muted-strong,var(--py-muted));text-transform:uppercase;letter-spacing:.08em;margin:0 0 8px;}
.spell-reference-table-wrap{width:100%;max-width:100%;overflow-x:auto;border:1px solid var(--py-border-soft,var(--py-border));border-radius:14px;background:var(--py-panel-soft);overscroll-behavior-inline:contain;}
.spell-reference-table-wrap.large>.spell-reference-table{min-width:680px;}
.spell-reference-table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px;line-height:1.35;color:var(--py-text);}
.spell-reference-table th,.spell-reference-table td{padding:9px 10px;text-align:left;vertical-align:top;border-right:1px solid var(--py-border-faint);border-bottom:1px solid var(--py-border-faint);overflow-wrap:anywhere;}
.spell-reference-table th:last-child,.spell-reference-table td:last-child{border-right:0;}
.spell-reference-table tbody tr:last-child td{border-bottom:0;}
.spell-reference-table thead th{background:var(--py-primary-glass);color:var(--py-text-strong);font-weight:950;position:sticky;top:0;z-index:1;}
.spell-reference-table tbody tr:nth-child(even) td{background:var(--py-panel);}
@media(max-width:820px){.spell-reference-table-wrap.large>.spell-reference-table{min-width:620px;}}

/* savertest v0.29i: class-gated magic-item modernization. */
.digital-item-requirement-card{
  display:grid;
  gap:5px;
  margin:0 0 16px;
  padding:12px 14px;
  border:1px solid var(--py-border-soft);
  border-radius:14px;
  background:var(--py-panel-soft);
  color:var(--py-text);
}
.digital-item-requirement-card.met{
  border-color:var(--py-success-border, var(--py-primary-border-alpha-strong));
  background:var(--py-success-soft, var(--py-primary-glass));
}
.digital-item-requirement-card.unmet{
  border-color:var(--py-danger-border, var(--py-border-strong));
  background:var(--py-danger-soft, var(--py-panel-soft));
}
.digital-item-requirement-heading{
  color:var(--py-text-strong);
  font-size:12px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.digital-item-requirement-copy{
  color:var(--py-muted-strong, var(--py-muted));
  font-size:13px;
  font-weight:750;
  line-height:1.4;
}
.digital-item-description-table-wrap.large > .digital-item-description-table{min-width:680px;}
@media(max-width:820px){.digital-item-description-table-wrap.large > .digital-item-description-table{min-width:620px;}}
.digital-species-feature-table-wrap.large > .digital-species-feature-table{min-width:680px;}
@media(max-width:820px){.digital-species-feature-table-wrap.large > .digital-species-feature-table{min-width:620px;}}


/* v0.29j inventory add confirmation */
.digital-inventory-add-button.added-confirmation,
.digital-summon-add-button.added-confirmation {
  animation: digitalInventoryAddedPulse .95s ease both;
  cursor: default;
  opacity: 1;
}
@keyframes digitalInventoryAddedPulse {
  0% { transform: scale(1); filter: brightness(1); }
  28% { transform: scale(1.08); filter: brightness(1.2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--py-success, var(--py-primary)) 28%, transparent); }
  58% { transform: scale(.98); }
  100% { transform: scale(1); filter: brightness(1); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .digital-inventory-add-button.added-confirmation,
.digital-summon-add-button.added-confirmation { animation: none; }
}

/* v0.29l summon quick-action refinement */
.summon-quick-actions-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.summon-quick-actions-head strong {
  font-size: .92rem;
}
.summon-quick-actions-head span,
.summon-quick-actions-note {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.summon-quick-actions-note {
  margin-top: -4px;
}


/* v0.29l manage-creature consistency and stable collapsed state */
.manage-summon-result .digital-summon-add-button,
[data-py-mode="dark"] .digital-inspection-body .manage-summon-result .digital-summon-add-button {
  background: var(--py-primary, var(--accent));
  color: var(--py-on-primary, #fff);
  border-color: var(--py-primary, var(--accent));
}
.manage-summons-current-section {
  border: 1px solid var(--py-border, var(--border));
  border-radius: 12px;
  background: var(--py-panel, var(--panel));
  overflow: hidden;
}
.manage-summons-current-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--py-text-strong, inherit);
  font-weight: 850;
  list-style: none;
}
.manage-summons-current-section > summary::-webkit-details-marker { display: none; }
.manage-summons-current-section > summary::after {
  content: '▾';
  order: 2;
  color: var(--py-primary, var(--accent));
  transform: rotate(-90deg);
  transition: transform .16s ease;
}
.manage-summons-current-section[open] > summary::after { transform: rotate(0deg); }
.manage-summons-current-count {
  margin-left: auto;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  background: var(--py-panel-tint, var(--py-panel-soft));
  color: var(--py-primary-dark, var(--accent));
  font-size: .78rem;
}
.manage-summons-current-section > .manage-summons-current {
  border-top: 1px solid var(--py-border, var(--border));
  padding: 9px;
}

/* v0.29p Wizard Signature Spells charge tracking */
.wizard-signature-feature-controls {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}
.wizard-signature-feature-controls .wizard-signature-spell-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  border: 1px solid var(--py-border-faint);
  border-radius: 12px;
  background: var(--py-panel);
  padding: 0.55rem 0.7rem;
}
.wizard-signature-feature-controls.compact .wizard-signature-spell-row {
  padding: 0.45rem 0.6rem;
}
.wizard-signature-feature-controls .wizard-signature-spell-main {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.wizard-signature-feature-controls .wizard-signature-spell-main strong {
  color: var(--py-text-strong);
  font-size: 0.95rem;
  line-height: 1.15;
}
.wizard-signature-feature-controls .wizard-signature-spell-main span {
  color: var(--py-muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
}
.wizard-signature-feature-controls .feature-charge-block {
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .wizard-signature-feature-controls .wizard-signature-spell-row {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* v0.29t: fit the complete Wizard progression table inside the wide drawer without horizontal scrolling. */
.digital-species-feature-table-wrap.wizard-spellcasting-progression-table-wrap {
  overflow: hidden;
  padding-right: 0;
  max-width: 100%;
}
.digital-species-feature-table.wizard-spellcasting-progression-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  font-size: 12px;
}
.digital-species-feature-table.wizard-spellcasting-progression-table th,
.digital-species-feature-table.wizard-spellcasting-progression-table td {
  padding: 8px 4px;
  overflow-wrap: normal;
  word-break: normal;
}
.digital-species-feature-table.wizard-spellcasting-progression-table th:nth-child(1),
.digital-species-feature-table.wizard-spellcasting-progression-table td:nth-child(1) { width: 10%; }
.digital-species-feature-table.wizard-spellcasting-progression-table th:nth-child(2),
.digital-species-feature-table.wizard-spellcasting-progression-table td:nth-child(2) { width: 12%; }
.digital-species-feature-table.wizard-spellcasting-progression-table th:nth-child(3),
.digital-species-feature-table.wizard-spellcasting-progression-table td:nth-child(3) { width: 14%; }
.digital-species-feature-table.wizard-spellcasting-progression-table th:nth-child(n+4),
.digital-species-feature-table.wizard-spellcasting-progression-table td:nth-child(n+4) {
  width: 7.1%;
  text-align: center;
}
@media (max-width: 820px) {
  .digital-species-feature-table.wizard-spellcasting-progression-table { font-size: 11px; }
  .digital-species-feature-table.wizard-spellcasting-progression-table th,
  .digital-species-feature-table.wizard-spellcasting-progression-table td { padding: 7px 2px; }
}



/* v0.29v Polymorph / True Polymorph transformation selector */
.polymorph-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5vh 1.5vw;
  background: color-mix(in srgb, var(--ink, #062f25) 46%, transparent);
}
.polymorph-picker-card {
  width: min(1120px, 97vw);
  height: min(920px, 96vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 2px solid var(--accent, #2c8b5c);
  border-radius: 24px;
  background: var(--panel, #f5fbf6);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.polymorph-picker-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent, #2c8b5c) 28%, transparent);
  background: color-mix(in srgb, var(--accent, #2c8b5c) 5%, var(--panel, #f5fbf6));
}
.polymorph-picker-card .digital-inspection-kicker { font-size: .82rem; line-height: 1.1; }
.polymorph-picker-card h2 { margin: 0; font-size: clamp(1.45rem, 2.4vw, 2.1rem); line-height: 1.05; }
.polymorph-picker-card header p { margin: 2px 0 0; color: var(--muted, #527566); font-size: .92rem; font-weight: 750; }
.polymorph-picker-controls { padding: 9px 16px 10px; border-bottom: 1px solid color-mix(in srgb, var(--accent, #2c8b5c) 18%, transparent); }
.polymorph-route-helper { margin-top: 6px; }
.polymorph-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 8px; }
.polymorph-search-row input,
.polymorph-filter-grid select,
.polymorph-filter-grid input,
.polymorph-object-form input,
.polymorph-object-form select {
  width: 100%;
  min-height: 38px;
  border: 1.5px solid color-mix(in srgb, var(--accent, #2c8b5c) 58%, transparent);
  border-radius: 12px;
  padding: 6px 9px;
  background: var(--panel, #fff);
  color: var(--ink, #062f25);
  font: inherit;
}
.polymorph-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.polymorph-route-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 0; }
.polymorph-filter-grid label,
.polymorph-object-form label,
.polymorph-fixed-filter { display: grid; gap: 3px; min-width: 0; font-size: .86rem; font-weight: 850; color: var(--muted, #527566); }
.polymorph-fixed-filter strong { min-height: 38px; display:flex; align-items:center; padding:6px 9px; border-radius:12px; border:1.5px solid color-mix(in srgb, var(--accent, #2c8b5c) 30%, transparent); color:var(--ink,#062f25); background:color-mix(in srgb,var(--accent,#2c8b5c) 4%,transparent); }
.polymorph-sense-filters { display:flex; flex-wrap:wrap; gap:6px 13px; align-items:center; margin-top:8px; font-size:.9rem; font-weight:700; }
.polymorph-sense-filters > span { font-weight:900; color:var(--muted,#527566); }
.polymorph-picker-results { overflow-y: auto; overscroll-behavior: contain; padding: 5px 16px 12px; scrollbar-gutter: stable; }
.polymorph-result { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:8px 4px; border-bottom:1px solid color-mix(in srgb, var(--accent,#2c8b5c) 20%, transparent); }
.polymorph-result > div { display:grid; gap:2px; min-width:0; }
.polymorph-result span { color:var(--muted,#527566); font-size:.9rem; font-weight:650; }
.polymorph-result .btn { flex: 0 0 auto; min-width: 92px; }
.polymorph-object-form { display:grid; grid-template-columns:minmax(0,2fr) minmax(140px,1fr) auto; gap:10px; align-items:end; padding-top:6px; }
.polymorph-object-form .digital-inspection-helper { grid-column:1/-1; }
.polymorph-object-transform { min-height:38px; }
body.polymorph-picker-open #summon-reference-drawer { z-index: 1300; }
.summon-workspace-group + .summon-workspace-group { margin-top: 22px; }
.transformation-damage-row { align-items:end; }
.summon-summary-name-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink, #062f25);
  font: inherit;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.summon-summary-name-button:hover,
.summon-summary-name-button:focus-visible { color: var(--accent, #2c8b5c); }
@media (max-width: 980px) {
  .polymorph-filter-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .polymorph-picker-backdrop { padding: 0; align-items: stretch; }
  .polymorph-picker-card { width:100vw; height:100dvh; max-height:none; border-radius:0; border-width:0; }
  .polymorph-picker-card > header { padding:9px 12px; }
  .polymorph-picker-controls, .polymorph-picker-results { padding-left:12px; padding-right:12px; }
  .polymorph-route-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .polymorph-search-row { grid-template-columns:minmax(0,1fr) auto auto; }
}
@media (max-width: 620px) {
  .polymorph-filter-grid, .polymorph-route-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .polymorph-object-form { grid-template-columns:1fr 1fr; }
  .polymorph-object-transform { grid-column:1/-1; }
}
@media (max-width: 440px) {
  .polymorph-filter-grid, .polymorph-route-grid, .polymorph-object-form { grid-template-columns:1fr; }
  .polymorph-object-form .digital-inspection-helper, .polymorph-object-transform { grid-column:auto; }
  .polymorph-search-row { grid-template-columns:minmax(0,1fr) auto; }
  .polymorph-search-row [data-polymorph-clear] { grid-column:1/-1; }
}

/* v0.29y: proficiency bonus progression and active modifier inspection. */
.proficiency-bonus-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.proficiency-bonus-modifier-card {
  border-color: var(--py-border-strong);
  background: var(--py-panel-tint);
}
.proficiency-progression-table-wrap {
  max-width: 520px;
}
.proficiency-progression-table th:last-child,
.proficiency-progression-table td:last-child {
  width: 42%;
  text-align: center;
}
.proficiency-progression-table tbody tr.current-level td {
  background: var(--py-panel-tint);
  font-weight: 900;
}
.proficiency-progression-table tbody tr.current-level td:first-child {
  box-shadow: inset 4px 0 0 var(--accent);
}
.proficiency-current-level-label {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid var(--py-border-soft);
  border-radius: 999px;
  color: var(--py-muted-strong);
  background: var(--py-panel);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 720px) {
  .proficiency-bonus-summary-grid { grid-template-columns: 1fr; }
  .proficiency-progression-table-wrap { max-width: none; }
}

/* v0.29z: stored spell and spell scroll management. */
.digital-stored-spells-section {
  margin: 0 0 14px;
  border: 2px solid var(--py-border-soft);
  border-radius: 18px;
  background: var(--py-panel);
  overflow: hidden;
}
.digital-stored-spells-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  color: var(--py-muted-strong);
  background: var(--py-panel-tint);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .035em;
  cursor: pointer;
  list-style-position: inside;
}
.digital-stored-spells-section[open] > summary {
  border-bottom: 1px solid var(--py-border-soft);
}
.digital-stored-spells-summary {
  color: var(--py-muted);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  text-align: right;
}
.digital-stored-spells-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.digital-stored-spells-body .digital-spell-table {
  margin: 0;
}
.digital-scroll-manager-filters {
  grid-template-columns: minmax(145px, .7fr) minmax(165px, .8fr) minmax(280px, 2fr);
}
.digital-manage-items-v29aa .digital-inventory-manager-name.as-button {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.digital-spell-cast-label:disabled {
  cursor: not-allowed;
  opacity: .55;
}
@media (max-width: 820px) {
  .digital-scroll-manager-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .digital-scroll-manager-filters .digital-inventory-manager-field.wide { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .digital-stored-spells-section > summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .digital-stored-spells-summary { text-align: left; }
  .digital-scroll-manager-filters { grid-template-columns: 1fr; }
  .digital-scroll-manager-filters .digital-inventory-manager-field.wide { grid-column: auto; }
}

/* v0.29aa: spell-scroll management, stored-spell rows, and compact spell inspection. */
.digital-scroll-manager-filter-row{display:grid;grid-template-columns:repeat(3,minmax(110px,180px));gap:10px;align-items:end;margin-bottom:10px;}
.digital-scroll-manager-filter-row .digital-inventory-manager-field{min-width:0;}
.digital-scroll-manager-filter-row .digital-inventory-manager-select{min-height:40px;padding:7px 10px;}
.digital-scroll-manager-search-field{margin-bottom:10px;}
.digital-scroll-manager-search-field .digital-inventory-manager-search-row{display:grid;grid-template-columns:minmax(180px,1fr) auto auto;gap:8px;align-items:center;}
.digital-scroll-manager-search-field .digital-inventory-manager-search{min-width:0;}
.digital-scroll-results-toolbar,.digital-scroll-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--py-muted);font-size:12px;font-weight:850;margin:8px 0;}
.digital-scroll-pager{justify-content:flex-end;margin-top:12px;}
.digital-scroll-pager>span{min-width:92px;text-align:center;}
.digital-inventory-manager-card .digital-inventory-manager-count{white-space:nowrap;}
.digital-stored-spells-section{margin:0 0 14px;border:0;border-radius:0;background:transparent;overflow:visible;}
.digital-stored-spells-section>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 4px 9px;border-bottom:1px solid var(--py-border-soft);background:transparent;color:var(--py-text-strong);font-size:15px;font-weight:950;text-transform:uppercase;letter-spacing:.04em;cursor:pointer;list-style-position:inside;}
.digital-stored-spells-section[open]>summary{border-bottom:1px solid var(--py-border-soft);}
.digital-stored-spells-summary{font-size:12px;color:var(--py-muted);font-weight:850;text-transform:none;letter-spacing:0;text-align:right;}
.digital-stored-spells-body{display:block;padding:9px 0 0;}
.digital-stored-spells-note{padding:0 4px 8px;color:var(--py-muted);font-size:12px;font-weight:750;line-height:1.35;}
.digital-stored-spells-body .digital-spell-table{margin:0;width:100%;background:transparent;}
.digital-stored-spells-body .digital-spell-row{background:var(--py-panel-soft);}
.digital-scroll-inline-actions{gap:5px;flex-wrap:nowrap;}
.digital-scroll-inline-actions .btn{min-width:34px;}
.digital-scroll-source-card{margin:0 0 8px;padding:10px 12px;border:1px solid var(--py-border-soft);border-radius:14px;background:var(--py-primary-glass);}
.digital-scroll-source-title{margin:0 0 7px;color:var(--py-muted-strong,var(--py-muted));font-size:11px;font-weight:950;letter-spacing:.08em;text-transform:uppercase;}
.digital-scroll-source-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px;}
.digital-scroll-source-grid>div{display:grid;gap:2px;min-width:0;}
.digital-scroll-source-grid span,.scroll-reference-source-grid span{font-size:10px;font-weight:900;letter-spacing:.07em;text-transform:uppercase;color:var(--py-muted);}
.digital-scroll-source-grid strong,.scroll-reference-source-grid strong{font-size:14px;color:var(--py-text-strong);overflow-wrap:anywhere;}
.digital-scroll-source-note,.scroll-reference-fixed-note{margin-top:7px;padding-top:6px;border-top:1px solid var(--py-border-faint);color:var(--py-muted);font-size:12px;font-weight:800;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-header,
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-body,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-header,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-body{background:var(--py-panel)!important;color:var(--py-text)!important;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-header,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-header{padding:13px 16px;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-body,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-body{padding:12px 16px;line-height:1.4;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-stack,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-stack{gap:8px;}
.digital-inspection-drawer.inspection-kind-spell .condition-detail-line,
.digital-inspection-drawer.inspection-kind-spell-scroll .condition-detail-line{margin:0;font-size:14px;line-height:1.35;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-metric-grid,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-metric-grid{gap:8px;margin-bottom:2px;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-metric,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-metric{padding:10px;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-section-title,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-section-title{margin-top:8px;margin-bottom:4px;}
.digital-inspection-drawer.inspection-kind-spell .spell-description-rich,
.digital-inspection-drawer.inspection-kind-spell-scroll .spell-description-rich{font-size:14px;line-height:1.43;}
.summon-reference-drawer.scroll-reference-drawer{width:min(520px,38vw);}
.summon-reference-drawer.scroll-reference-drawer .summon-reference-card,
.summon-reference-drawer.scroll-reference-drawer .summon-reference-header,
.summon-reference-drawer.scroll-reference-drawer .summon-reference-body{background:var(--py-panel)!important;color:var(--py-text)!important;}
.summon-reference-drawer.scroll-reference-drawer .summon-reference-header{padding:13px 15px;}
.summon-reference-drawer.scroll-reference-drawer .summon-reference-body{padding:13px 15px;line-height:1.4;}
.scroll-reference-spell{display:grid;gap:9px;}
.scroll-reference-source-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px;padding:10px 12px;border:1px solid var(--py-border-soft);border-radius:14px;background:var(--py-primary-glass);}
.scroll-reference-source-grid>div{display:grid;gap:2px;min-width:0;}
.scroll-reference-fixed-note{margin:0;padding:7px 2px 0;}
.scroll-reference-flags{display:flex;gap:6px;flex-wrap:wrap;}
.scroll-reference-flags span{display:inline-flex;border:1px solid var(--py-border-soft);border-radius:999px;background:var(--py-panel-soft);padding:4px 8px;color:var(--py-text-strong);font-size:11px;font-weight:900;}
.scroll-reference-detail-list{display:grid;gap:3px;}
.scroll-reference-detail-list p{margin:0;font-size:14px;line-height:1.35;}
.scroll-reference-detail-list strong{color:var(--py-text-strong);}
@media(max-width:820px){
  .digital-scroll-manager-filter-row{grid-template-columns:repeat(3,minmax(0,1fr));}
  .summon-reference-drawer.scroll-reference-drawer{width:44vw;}
  body.summon-reference-paired #inspection-drawer{width:56vw;}
  body.summon-reference-paired #summon-reference-drawer.scroll-reference-drawer{width:44vw;}
}
@media(max-width:600px){
  .digital-scroll-manager-filter-row{grid-template-columns:1fr 1fr;}
  .digital-scroll-manager-search-field .digital-inventory-manager-search-row{grid-template-columns:1fr 1fr;}
  .digital-scroll-manager-search-field .digital-inventory-manager-search{grid-column:1/-1;}
  .digital-stored-spells-section>summary{align-items:flex-start;flex-direction:column;gap:4px;}
  .digital-stored-spells-summary{text-align:left;}
}
.digital-scroll-manager-search-field .btn{white-space:nowrap;min-width:max-content;padding-inline:13px;}
.digital-scroll-manager-filter-row .digital-inventory-manager-field>span,
.digital-scroll-manager-search-field>span:first-child{font-size:11px;letter-spacing:.07em;}
.digital-scroll-manager-filter-row .digital-inventory-manager-select{width:100%;}
.digital-scroll-source-card{order:-1;}
.digital-inspection-drawer.inspection-kind-spell .digital-inspection-title,
.digital-inspection-drawer.inspection-kind-spell-scroll .digital-inspection-title{font-size:22px;margin-top:1px;line-height:1.12;}

@media(max-width:520px){.digital-scroll-source-grid,.scroll-reference-source-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

/* v0.29ab: reusable stored-spell item selector and Arcane Abeyance storage. */
.stored-spell-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5vh 1.5vw;
  background: color-mix(in srgb, var(--ink, #062f25) 46%, transparent);
}
.stored-spell-picker-card {
  width: min(1100px, 97vw);
  height: min(900px, 96vh);
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr);
  overflow: hidden;
  border: 2px solid var(--accent, #2c8b5c);
  border-radius: 24px;
  background: var(--panel, #f5fbf6);
  color: var(--ink, #062f25);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.stored-spell-picker-card > header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:10px 16px;
  border-bottom:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 28%,transparent);
  background:color-mix(in srgb,var(--accent,#2c8b5c) 5%,var(--panel,#f5fbf6));
}
.stored-spell-picker-card h2 { margin:0; font-size:clamp(1.45rem,2.4vw,2.1rem); line-height:1.05; }
.stored-spell-picker-card header p { margin:2px 0 0; color:var(--muted,#527566); font-size:.92rem; font-weight:750; }
.stored-spell-picker-controls { padding:9px 16px 10px; border-bottom:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 18%,transparent); }
.stored-spell-picker-profile { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.stored-spell-picker-profile.with-quantity { grid-template-columns:repeat(6,minmax(0,1fr)); }
.stored-spell-picker-profile label,
.stored-spell-picker-filter-grid label { display:grid; gap:3px; min-width:0; font-size:.84rem; font-weight:850; color:var(--muted,#527566); }
.stored-spell-picker-profile input,
.stored-spell-picker-profile select,
.stored-spell-picker-filter-grid select,
.stored-spell-picker-search-row input,
.stored-spell-picker-result select {
  width:100%;
  min-height:38px;
  border:1.5px solid color-mix(in srgb,var(--accent,#2c8b5c) 58%,transparent);
  border-radius:12px;
  padding:6px 9px;
  background:var(--panel,#fff);
  color:var(--ink,#062f25);
  font:inherit;
}
.stored-spell-picker-search-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:8px; margin-top:8px; }
.stored-spell-picker-filter-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:8px; }
.stored-spell-picker-results { overflow-y:auto; overscroll-behavior:contain; padding:5px 16px 12px; scrollbar-gutter:stable; }
.stored-spell-picker-result { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:8px 4px; border-bottom:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 20%,transparent); }
.stored-spell-picker-result > div:first-child { display:grid; gap:2px; min-width:0; }
.stored-spell-picker-result span { color:var(--muted,#527566); font-size:.9rem; font-weight:650; }
.stored-spell-picker-result-actions { display:grid; grid-template-columns:minmax(105px,135px) auto; gap:8px; align-items:center; flex:0 0 auto; }
.stored-spell-picker-pager { display:flex; align-items:center; justify-content:center; gap:12px; padding:12px 0 4px; font-weight:800; color:var(--muted,#527566); }
body.stored-spell-picker-open #summon-reference-drawer { z-index:1310; }
.arcane-abeyance-profile-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.digital-inspection-link-button { appearance:none; border:0; background:transparent; color:inherit; padding:0; font:inherit; text-align:left; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.digital-inspection-link-button:hover,.digital-inspection-link-button:focus-visible { color:var(--accent,#2c8b5c); }
.ring-stored-spell-card .digital-inspection-list-row > div { display:grid; gap:3px; min-width:0; }
.ring-stored-spell-card .digital-inspection-list-row span { color:var(--muted,#527566); font-size:.88rem; font-weight:650; }
.ring-stored-spell-actions { display:flex; justify-content:flex-end; margin-top:8px; }
@media(max-width:900px){ .stored-spell-picker-profile{grid-template-columns:repeat(3,minmax(0,1fr));} .arcane-abeyance-profile-grid{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media(max-width:820px){ .stored-spell-picker-backdrop{padding:0;align-items:stretch;} .stored-spell-picker-card{width:100vw;height:100dvh;max-height:none;border:0;border-radius:0;} .stored-spell-picker-card>header{padding:9px 12px;} .stored-spell-picker-controls,.stored-spell-picker-results{padding-left:12px;padding-right:12px;} }
@media(max-width:620px){ .stored-spell-picker-profile,.stored-spell-picker-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));} .stored-spell-picker-result{align-items:flex-start;} }
@media(max-width:460px){ .stored-spell-picker-profile,.stored-spell-picker-filter-grid,.arcane-abeyance-profile-grid{grid-template-columns:1fr;} .stored-spell-picker-search-row{grid-template-columns:minmax(0,1fr) auto;} .stored-spell-picker-search-row .secondary{grid-column:1/-1;} .stored-spell-picker-result{display:grid;} .stored-spell-picker-result-actions{grid-template-columns:1fr auto;} }


/* v0.29ac: Arcane Abeyance lifecycle and 2014 exhaustion tracking. */
.exhaustion-level-controls{display:grid;grid-template-columns:auto minmax(90px,120px) auto;gap:7px;align-items:center;justify-content:end;}
.exhaustion-level-controls .btn{min-width:42px;min-height:40px;padding:6px 10px;}
.exhaustion-table .exhaustion-cell.current{background:color-mix(in srgb,var(--accent,#2c8b5c) 13%,var(--py-panel));font-weight:850;}
@media(max-width:560px){.exhaustion-selector-row{grid-template-columns:1fr;}.exhaustion-level-controls{justify-content:stretch;grid-template-columns:auto minmax(0,1fr) auto;}}

/* v0.29ad: keep stored-spell commits responsive while state changes are processed. */
.stored-spell-picker-result-actions .btn[aria-busy="true"]{
  cursor:progress;
  opacity:.82;
}


/* v0.29af: explicit stored-spell disclosure arrow and concentration retention. */
.digital-stored-spells-section>summary::-webkit-details-marker{display:none;}
.digital-stored-spells-section>summary::marker{content:'';}
.digital-stored-spells-heading{display:inline-flex;align-items:center;gap:8px;min-width:0;}
.digital-stored-spells-arrow{width:0;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent;border-left:8px solid currentColor;transform-origin:45% 50%;transition:transform .15s ease;flex:0 0 auto;}
.digital-stored-spells-section[open]>summary .digital-stored-spells-arrow{transform:rotate(90deg);}


/* v0.29ag: Arcane Abeyance slot summary and exhaustion automation polish. */
.stored-spell-picker-slot-summary{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:center;padding:0 0 8px;border-bottom:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 18%,transparent);}
.stored-spell-picker-slot-summary-title{font-size:.84rem;font-weight:900;letter-spacing:.045em;text-transform:uppercase;color:var(--muted,#527566);}
.stored-spell-picker-slot-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;}
.stored-spell-picker-slot{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0;padding:6px 9px;border:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 34%,transparent);border-radius:12px;background:color-mix(in srgb,var(--accent,#2c8b5c) 6%,var(--py-panel,#fff));font-size:.85rem;font-weight:800;}
.stored-spell-picker-slot strong{font-size:.95rem;white-space:nowrap;}
@media(max-width:620px){.stored-spell-picker-slot-summary{grid-template-columns:1fr;}.stored-spell-picker-slot-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}


/* v0.29ah: stored-spell panel fit and readable depleted storage rows. */
.arcane-abeyance-profile-grid > *,
.arcane-abeyance-profile-grid .digital-inline-field {
  min-width:0;
}
.arcane-abeyance-profile-grid .digital-inline-select,
.arcane-abeyance-profile-grid .digital-inspection-number-input,
.arcane-abeyance-profile-grid .digital-inspection-input {
  display:block;
  width:100%;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}
.arcane-abeyance-profile-grid > :last-child {
  grid-column:span 2;
}
.ring-stored-spell-card,
.ring-stored-spell-card .digital-inspection-list-row,
.ring-stored-spell-card .digital-inspection-list-row > div {
  min-width:0;
  max-width:100%;
}
.ring-stored-spell-card .digital-inspection-list-row {
  align-items:start;
  gap:10px;
}
.ring-stored-spell-card .digital-inspection-list-row span {
  display:block;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:normal;
}
.ring-stored-spell-card .digital-inspection-list-row > strong {
  white-space:nowrap;
}
@media(max-width:560px){
  .arcane-abeyance-profile-grid{grid-template-columns:1fr;}
  .arcane-abeyance-profile-grid > :last-child{grid-column:auto;}
}

/* v0.29ak — Order of Scribes modernization */
.wizard-scribes-awakened-sections{
  display:grid;
  gap:12px;
  margin-top:8px;
}
.wizard-scribes-awakened-section{
  display:grid;
  gap:10px;
  padding:14px;
  border:1px solid color-mix(in srgb,var(--accent,#2c8b5c) 34%,transparent);
  border-radius:16px;
  background:color-mix(in srgb,var(--accent,#2c8b5c) 5%,var(--py-panel,#fff));
}
.wizard-scribes-awakened-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.wizard-scribes-awakened-section-head > div{
  display:grid;
  gap:3px;
  min-width:0;
}
.wizard-scribes-awakened-section-head strong{
  font-size:1rem;
}
.wizard-scribes-awakened-section-head span:not(.digital-inline-meta-pill){
  color:var(--muted,#527566);
  font-size:.9rem;
  line-height:1.35;
}
.wizard-scribes-awakened-action-row{
  display:grid;
  grid-template-columns:minmax(170px,250px) minmax(150px,auto);
  align-items:end;
  gap:10px;
}
.wizard-scribes-awakened-action-row > .digital-inspection-helper{
  margin:0;
}
.wizard-scribes-awakened-action-row > button{
  min-height:44px;
  white-space:normal;
}
.manifest-mind-card .summon-summary-stats{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
.manifest-mind-card .summon-card-tools{
  align-items:center;
}
@media(max-width:620px){
  .wizard-scribes-awakened-section-head{
    display:grid;
  }
  .wizard-scribes-awakened-section-head .digital-inline-meta-pill{
    justify-self:start;
  }
  .wizard-scribes-awakened-action-row{
    grid-template-columns:1fr;
    align-items:stretch;
  }
  .manifest-mind-card .summon-summary-stats{
    grid-template-columns:1fr;
  }
}


/* v0.29al — Order of Scribes One with the Word selector */
.wizard-scribes-word-picker-card{display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;}
.wizard-scribes-word-picker-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:12px 18px;border-bottom:1px solid color-mix(in srgb,var(--accent,#2f8a5b) 25%,transparent);}
.wizard-scribes-word-picker-summary>span{display:flex;flex-direction:column;gap:2px;padding:9px 11px;border:1px solid color-mix(in srgb,var(--accent,#2f8a5b) 35%,transparent);border-radius:14px;background:color-mix(in srgb,var(--accent-soft,#eef8f2) 75%,white);font-weight:800;}
.wizard-scribes-word-picker-summary strong{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted,#527566);}
.wizard-scribes-word-search{padding:10px 18px;}
.wizard-scribes-word-spell-list{overflow:auto;min-height:0;padding:0 18px 12px;display:grid;gap:7px;align-content:start;}
.wizard-scribes-word-spell-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px 12px;border:1px solid color-mix(in srgb,var(--accent,#2f8a5b) 34%,transparent);border-radius:14px;background:var(--panel,#fff);cursor:pointer;}
.wizard-scribes-word-spell-row span{display:grid;gap:2px;min-width:0;}
.wizard-scribes-word-spell-row small{color:var(--muted,#527566);font-weight:700;}
.wizard-scribes-word-spell-row b{font-size:1.1rem;}
.wizard-scribes-word-picker-footer{display:flex;justify-content:flex-end;gap:10px;padding:11px 18px;border-top:1px solid color-mix(in srgb,var(--accent,#2f8a5b) 25%,transparent);background:var(--panel,#fff);}
.wizard-scribes-word-status{display:grid;gap:10px;}
@media(max-width:700px){.wizard-scribes-word-picker-summary{grid-template-columns:1fr 1fr}.wizard-scribes-word-picker-summary>span:last-child{grid-column:1/-1}.wizard-scribes-word-search{grid-template-columns:minmax(0,1fr) auto auto}.wizard-scribes-word-picker-footer{position:sticky;bottom:0;}}

/* v0.29an — One with the Word unavailable-spell row polish. */
.digital-spells-shell .digital-spell-name-button,
.digital-cantrip-action-section .digital-spell-name-button {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 6px;
  width: 100%;
  min-width: 0;
}
.digital-spell-name-text {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.digital-spell-name-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}
.digital-spell-name-tags .digital-spell-tag {
  margin-left: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}
.digital-spell-cast-label.is-unavailable:disabled {
  border-color: var(--line) !important;
  background: var(--py-panel-soft) !important;
  color: var(--muted) !important;
  opacity: 1;
  box-shadow: none;
}


/* v0.29aq: Warlock Pact Magic and invocation progression tables stay inside the wide drawer. */
.digital-species-feature-table-wrap.warlock-pact-magic-progression-table-wrap,
.digital-species-feature-table-wrap.warlock-invocation-progression-table-wrap { overflow:hidden; max-width:100%; }
.digital-species-feature-table.warlock-pact-magic-progression-table,
.digital-species-feature-table.warlock-invocation-progression-table { width:100%; min-width:0; max-width:100%; table-layout:fixed; }
.digital-species-feature-table.warlock-pact-magic-progression-table { font-size:11px; }
.digital-species-feature-table.warlock-pact-magic-progression-table th,
.digital-species-feature-table.warlock-pact-magic-progression-table td { padding:7px 3px; text-align:center; white-space:normal; overflow-wrap:break-word; }
.digital-species-feature-table.warlock-pact-magic-progression-table th:first-child,
.digital-species-feature-table.warlock-pact-magic-progression-table td:first-child { width:12%; }
.digital-species-feature-table.warlock-pact-magic-progression-table th:first-child { white-space:nowrap; }
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(2),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(2),
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(3),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(3),
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(4),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(4) { width:13%; }
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(5),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(5),
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(6),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(6) { width:13%; }
.digital-species-feature-table.warlock-pact-magic-progression-table th:nth-child(7),
.digital-species-feature-table.warlock-pact-magic-progression-table td:nth-child(7) { width:22%; }
.digital-species-feature-table.warlock-genie-expanded-spells-table { font-size:11px; table-layout:fixed; width:100%; }
.digital-species-feature-table.warlock-genie-expanded-spells-table th,
.digital-species-feature-table.warlock-genie-expanded-spells-table td { padding:7px 4px; overflow-wrap:anywhere; }

/* v0.29av: Warlock Chain invocation tracking and compact tentacle tools. */
.warlock-invocation-charge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.warlock-invocation-charge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border, rgba(0,0,0,.2));
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .78rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--panel, #fff) 94%, var(--accent, #b53a3a));
}
.warlock-invocation-charge-pip {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent, #b53a3a);
  border-radius: 4px;
  background: transparent;
  box-sizing: border-box;
}
.warlock-invocation-charge.available .warlock-invocation-charge-pip {
  background: var(--accent, #b53a3a);
}
.warlock-invocation-charge.spent {
  opacity: .62;
}
.fathomless-tentacle-card .summon-card-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  justify-content: space-between;
}
.fathomless-tentacle-card .summon-card-hp-controls,
.fathomless-tentacle-card .summon-card-tool-actions {
  flex-wrap: nowrap;
}
@media (max-width: 700px) {
  .fathomless-tentacle-card .summon-card-tools,
  .fathomless-tentacle-card .summon-card-hp-controls,
  .fathomless-tentacle-card .summon-card-tool-actions {
    flex-wrap: wrap;
  }
}


/* v0.29ax: Limited Wish selector and roll reminder readability. */
.digital-roll-toast-meta,
.digital-history-meta { white-space: pre-line; }

/* v0.29ay: Limited Wish standard panel control alignment. */
.digital-inspection-action-row.compact.warlock-limited-wish-action-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.digital-inspection-action-row.compact.warlock-limited-wish-action-row .btn {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  white-space: nowrap;
}
@media (max-width: 430px) {
  .digital-inspection-action-row.compact.warlock-limited-wish-action-row {
    grid-template-columns: 1fr;
  }
}


/* v0.29az: Pact Blade selector and control alignment. */
.warlock-pact-blade-controls {
  display: grid;
  gap: 8px;
}
.warlock-pact-blade-button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.warlock-pact-blade-button-row .feature-action-chip {
  width: 100%;
  min-width: 0;
}
.pact-weapon-picker-card .pact-weapon-result-actions {
  grid-template-columns: minmax(96px, 128px);
}
@media (max-width: 430px) {
  .warlock-pact-blade-button-row { grid-template-columns: 1fr; }
}


/* v0.29cv: roll history and the Game Log inspection follow the current appearance and theme variables. */
.digital-roll-history-panel {
  background: var(--py-panel-glass-strong, var(--py-panel));
  color: var(--py-text);
  border-color: var(--py-border);
}
.digital-roll-history-panel-head,
.digital-roll-history-panel-title,
.digital-roll-history-panel .digital-overview-label,
.digital-roll-history-panel .digital-history-label,
.digital-roll-history-panel .digital-history-total,
.digital-roll-history-panel .digital-history-breakdown,
.digital-inspection-drawer .digital-history-label,
.digital-inspection-drawer .digital-history-total,
.digital-inspection-drawer .digital-history-breakdown {
  color: var(--py-text);
}
.digital-roll-history {
  border-top-color: var(--py-border-soft);
  scrollbar-color: var(--py-border-strong) var(--py-panel-soft);
}
.digital-roll-history-panel .digital-history-meta,
.digital-roll-history-panel .digital-history-formula,
.digital-roll-history-panel .digital-history-empty,
.digital-inspection-drawer .digital-history-meta,
.digital-inspection-drawer .digital-history-formula,
.digital-inspection-drawer .digital-history-empty {
  color: var(--py-muted-strong, var(--py-muted));
}
.digital-roll-history-panel .digital-history-entry,
.digital-inspection-drawer .digital-history-entry {
  border-color: var(--py-border-soft);
  background: var(--py-panel-soft);
  color: var(--py-text);
}
.digital-inspection-drawer .digital-history-list {
  color: var(--py-text);
}

/* v0.29da: compact Barbarian Wild Magic controls and themed left reference workflow. */
.wild-magic-controls .wild-magic-current-result {
  margin-top: .7rem;
  padding: .75rem .85rem;
  border: 1px solid var(--py-border-soft);
  border-radius: 14px;
  background: var(--py-panel-soft-2);
  color: var(--py-text);
  line-height: 1.4;
}
.wild-magic-controls .wild-magic-current-result strong { color: var(--py-text-strong); }
.wild-magic-controls .wild-magic-header-row > .wild-magic-inline-buttons {
  justify-content: flex-end;
}
.wild-magic-controls > .wild-magic-inline-buttons {
  margin-top: .65rem;
  justify-content: flex-start;
}
.wild-magic-reference-intro {
  margin-bottom: .8rem;
  padding: .75rem .85rem;
  border: 1px solid var(--py-border-soft);
  border-radius: 14px;
  background: var(--py-panel-soft-2);
  color: var(--py-text);
}
[data-open-barbarian-wild-magic-table].is-pressed,
[data-barbarian-wild-magic-reference-roll].is-pressed,
[data-barbarian-wild-magic-result].is-pressed {
  animation: wildMagicControlFeedback .26s ease;
}
[data-open-barbarian-wild-magic-table]:active,
[data-barbarian-wild-magic-reference-roll]:active,
[data-barbarian-wild-magic-result]:active {
  transform: translateY(1px) scale(.97);
  background: color-mix(in srgb, var(--accent) 18%, var(--py-panel));
  box-shadow: 0 0 0 4px var(--py-hover-ring);
}
@media (max-width: 820px) {
  .wild-magic-controls .wild-magic-header-row {
    grid-template-columns: 1fr;
  }
  .wild-magic-controls .wild-magic-header-row > .wild-magic-inline-buttons {
    justify-content: flex-start;
  }
}

/* v0.29db: preserve multi-paragraph Wild Surge result text in apply/choice popups. */
.digital-app-choice-card .digital-app-confirm-message {
  white-space: pre-line;
}
