:root {
  --myr-radius-sm: 4px;
  --myr-radius-md: 8px;
  --myr-space-1: 0.35rem;
  --myr-space-2: 0.6rem;
  --myr-space-3: 0.85rem;
  --myr-space-4: 1.1rem;
  --myr-font-body: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --myr-font-display: "Goudy Old Style", "Palatino Linotype", Georgia, serif;
}

.myriad-system.theme-dark {
  --myr-bg: #1f1a14;
  --myr-surface: #2b241b;
  --myr-surface-2: #372e23;
  --myr-border: #5a4a33;
  --myr-text: #efe3c7;
  --myr-text-muted: #c8b491;
  --myr-accent: #d6b36a;
  --myr-danger: #b4513e;
}

.myriad-system.theme-light {
  --myr-bg: #ece1c8;
  --myr-surface: #f6ecd6;
  --myr-surface-2: #efe2c5;
  --myr-border: #a6885f;
  --myr-text: #2a2013;
  --myr-text-muted: #6c573c;
  --myr-accent: #7d4f1f;
  --myr-danger: #8d3328;
}

.myriad-system.actor-sheet,
.myriad-system.item-sheet {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: var(--myr-text);
  background:
    radial-gradient(circle at top, rgba(255, 248, 219, 0.08), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--myr-bg) 92%, #000 8%) 0%, var(--myr-bg) 100%);
  border: 1px solid var(--myr-border);
  font-family: var(--myr-font-body);
  position: relative;
}

.myriad-system .sheet-header {
  display: flex;
  gap: var(--myr-space-3);
  align-items: flex-start;
  padding: var(--myr-space-3);
  border-bottom: 2px solid var(--myr-border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 65%, #000 35%) 0%, var(--myr-surface) 100%);
}

.myriad-system .header-cog-button {
  margin-left: auto;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text);
  width: 2rem;
  height: 2rem;
  line-height: 1;
  cursor: pointer;
}

.myriad-system .header-cog-button:hover {
  color: var(--myr-accent);
  border-color: var(--myr-accent);
}

.myriad-system .profile-img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--myr-radius-sm);
  border: 2px solid var(--myr-border);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--myr-accent) 45%, transparent);
}

/* Static type icon replaces the profile image for skill/equipment sheets */
.myriad-system i.item-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--myr-accent);
  background: var(--myr-surface-2);
  flex-shrink: 0;
}

.myriad-system .header-details {
  flex: 1;
}

.myriad-system h1,
.myriad-system h2,
.myriad-system p,
.myriad-system label,
.myriad-system span,
.myriad-system li {
  color: var(--myr-text);
}

.myriad-system .actor-name input,
.myriad-system.item-sheet h1 input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--myr-radius-sm);
  background: transparent;
  color: var(--myr-text);
  font-family: var(--myr-font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.35rem;
}

.myriad-system .actor-name input:hover,
.myriad-system .actor-name input:focus,
.myriad-system.item-sheet h1 input:hover,
.myriad-system.item-sheet h1 input:focus {
  border-color: var(--myr-border);
  outline: none;
}

.myriad-system .header-resources {
  display: flex;
  gap: var(--myr-space-2);
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.myriad-system .xp-panel {
  margin-top: var(--myr-space-2);
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 88%, #fff 12%), var(--myr-surface));
}

.myriad-system .xp-panel.is-overspent {
  border-color: var(--myr-danger);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--myr-danger) 45%, transparent);
}

.myriad-system .xp-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  list-style: none;
  gap: var(--myr-space-2);
}

.myriad-system .xp-summary::-webkit-details-marker {
  display: none;
}

.myriad-system .xp-details {
  padding: 0.1rem 0.6rem 0.45rem;
  border-top: 1px solid var(--myr-border);
}

.myriad-system .xp-meta-row,
.myriad-system .xp-controls {
  display: flex;
  gap: var(--myr-space-2);
  flex-wrap: wrap;
  align-items: center;
}

.myriad-system .xp-label,
.myriad-system .xp-meta,
.myriad-system .xp-controls-label,
.myriad-system .modifiers-section-title {
  color: var(--myr-text-muted);
}

.myriad-system .xp-value {
  font-size: 1rem;
}

.myriad-system .xp-meta-row + .xp-meta-row,
.myriad-system .xp-controls {
  margin-top: 0.35rem;
}

.myriad-system .xp-controls button,
.myriad-system .item-cost {
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface-2);
  color: var(--myr-text);
  padding: 0.15rem 0.45rem;
}

.myriad-system .item-cost {
  font-size: 0.78rem;
}

.myriad-system .resource-group {
  display: flex;
  gap: var(--myr-space-1);
  align-items: center;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 92%, #fff 8%), var(--myr-surface-2));
}

.myriad-system .resource-group label {
  font-size: 0.82rem;
  color: var(--myr-text-muted);
}

.myriad-system .resource-bar {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.myriad-system input,
.myriad-system select,
.myriad-system textarea,
.myriad-system button {
  font-family: inherit;
}

.myriad-system input,
.myriad-system select,
.myriad-system textarea {
  background: color-mix(in srgb, var(--myr-surface) 86%, #fff 14%);
  color: var(--myr-text);
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
}

.myriad-system input:focus,
.myriad-system select:focus,
.myriad-system textarea:focus {
  outline: 1px solid var(--myr-accent);
  outline-offset: 0;
}

.myriad-system .resource-bar input {
  width: 3.25rem;
  text-align: center;
}

.myriad-system .sheet-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.45rem var(--myr-space-3) 0;
  border-bottom: 1px solid var(--myr-border);
  background: color-mix(in srgb, var(--myr-surface) 90%, #000 10%);
}

.myriad-system .sheet-tabs .item {
  display: inline-flex;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--myr-border);
  border-bottom: none;
  border-radius: var(--myr-radius-sm) var(--myr-radius-sm) 0 0;
  color: var(--myr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  background: color-mix(in srgb, var(--myr-surface-2) 88%, #000 12%);
  text-decoration: none;
}

.myriad-system .sheet-tabs .item.active {
  background: var(--myr-bg);
  color: var(--myr-text);
  box-shadow: inset 0 2px 0 0 var(--myr-accent);
}

.myriad-system .sheet-body {
  flex: 1;
  overflow: auto;
  padding: var(--myr-space-3);
  background:
    radial-gradient(circle at top left, rgba(255, 244, 214, 0.06), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--myr-bg) 94%, #000 6%), var(--myr-bg));
}

.myriad-system .sheet-body .tab {
  display: none;
}

.myriad-system .sheet-body .tab.active {
  display: block;
}

.myriad-system .characteristics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--myr-space-2);
}

.myriad-system .characteristic-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--myr-space-2);
  align-items: center;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface) 88%, #fff 12%), var(--myr-surface));
}

.myriad-system .characteristic-label {
  color: var(--myr-text-muted);
}

.myriad-system .characteristic-value {
  width: 3.25rem;
  text-align: center;
}

.myriad-system .secondary-section {
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--myr-border);
  position: relative;
}

.myriad-system .secondary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--myr-space-2);
}

.myriad-system .secondary-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--myr-text-muted);
}

.myriad-system .open-modifiers {
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface-2);
  color: var(--myr-text);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.myriad-system .open-modifiers:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .secondary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--myr-space-2);
}

.myriad-system .secondary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  padding: 0.4rem 0.5rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface) 84%, #fff 16%), var(--myr-surface));
}

.myriad-system .secondary-label {
  color: var(--myr-text-muted);
  font-size: 0.9rem;
}

.myriad-system .secondary-value {
  font-weight: 700;
  color: var(--myr-text);
}

.myriad-system .modifiers-modal.hidden {
  display: none;
}

.myriad-system .modifiers-modal {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--myr-radius-sm);
  z-index: 20;
}

.myriad-system .modifiers-dialog {
  width: min(420px, calc(100% - 1rem));
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-md);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface) 86%, #fff 14%), var(--myr-surface));
  padding: 0.75rem;
}

.myriad-system .modifiers-dialog h4 {
  margin: 0 0 0.6rem;
  color: var(--myr-text);
}

.myriad-system .modifiers-fields {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 0.45rem 0.6rem;
  align-items: center;
}

.myriad-system .modifiers-fields label {
  color: var(--myr-text-muted);
}

.myriad-system .modifiers-fields .modifiers-section-title {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 0.3rem;
}

.myriad-system .modifiers-fields input {
  text-align: center;
}

.myriad-system .modifiers-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.myriad-system .modifiers-actions button {
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface-2);
  color: var(--myr-text);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.myriad-system .modifiers-actions button:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .items-header,
.myriad-system .item-row {
  display: grid;
  align-items: center;
  gap: var(--myr-space-2);
  padding: 0.35rem 0.15rem;
}

.myriad-system .skills-header,
.myriad-system .skill-row {
  grid-template-columns: 24px 1fr 120px 72px 72px 108px;
}

.myriad-system .inventory-header,
.myriad-system .inventory-row {
  grid-template-columns: 24px 1fr 72px 72px 108px;
}

.myriad-system .spell-header,
.myriad-system .spell-row {
  grid-template-columns: 24px 1fr 72px 90px 108px;
}

.myriad-system .path-header,
.myriad-system .path-row {
  grid-template-columns: 24px 1fr 72px 1.35fr 108px;
}

.myriad-system .items-header {
  color: var(--myr-text-muted);
  border-bottom: 1px solid var(--myr-border);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.76rem;
}

.myriad-system .items-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.myriad-system .item-row {
  border-bottom: 1px dashed color-mix(in srgb, var(--myr-border) 70%, transparent);
  border-radius: 3px;
  transition: background 120ms ease;
}

.myriad-system .item-row:hover {
  background: color-mix(in srgb, var(--myr-surface-2) 28%, transparent);
}

.myriad-system .item-row:last-child {
  border-bottom: none;
}

.myriad-system .item-img img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--myr-border);
}

.myriad-system .item-img i {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  border: 1px solid var(--myr-border);
  color: var(--myr-text-muted);
  background: color-mix(in srgb, var(--myr-surface-2) 50%, transparent);
}

.myriad-system .item-name {
  color: var(--myr-text);
  text-align: left;
  cursor: pointer;
}

.myriad-system .item-name:focus {
  outline: 1px solid var(--myr-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.myriad-system .item-name:hover {
  color: var(--myr-accent);
}

.myriad-system .item-main {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.myriad-system .item-subtitle {
  color: var(--myr-text-muted);
  font-size: 0.74rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.myriad-system .skill-row[draggable="true"] {
  cursor: grab;
}

.myriad-system .skill-row[draggable="true"]:active {
  cursor: grabbing;
}

.myriad-system .path-row.drag-over {
  outline: 2px dashed var(--myr-accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--myr-surface-2) 42%, transparent);
}

.myriad-system .item-detail {
  color: var(--myr-text-muted);
}

.myriad-system .item-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
}

.myriad-system .item-inline-input {
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 0.1rem 0.2rem;
  height: 1.8rem;
}

.myriad-system .inventory-summary {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface) 84%, #fff 16%), var(--myr-surface));
  color: var(--myr-text);
  font-size: 0.9rem;
}

.myriad-system .roll-btn,
.myriad-system .add-btn,
.myriad-system .item-edit,
.myriad-system .item-delete {
  border: 1px solid var(--myr-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text);
  border-radius: var(--myr-radius-sm);
  cursor: pointer;
  min-width: 1.7rem;
  height: 1.7rem;
  line-height: 1;
}

.myriad-system .roll-btn:hover,
.myriad-system .add-btn:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .item-edit:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .item-delete:hover {
  border-color: var(--myr-danger);
  color: var(--myr-danger);
}

.myriad-system .items-empty {
  padding: 0.55rem 0.2rem;
  color: var(--myr-text-muted);
}

.myriad-system.item-sheet .item-type {
  color: var(--myr-text-muted);
  margin: 0;
}

.myriad-system .item-fields {
  display: flex;
  flex-direction: column;
  gap: var(--myr-space-2);
  padding: var(--myr-space-3);
  background:
    radial-gradient(circle at right top, rgba(255, 243, 205, 0.06), transparent 36%),
    linear-gradient(180deg, color-mix(in srgb, var(--myr-bg) 94%, #000 6%), var(--myr-bg));
}

.myriad-system .field-row {
  display: flex;
  gap: var(--myr-space-2);
  align-items: center;
}

.myriad-system .item-fieldset {
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface) 88%, #fff 12%), var(--myr-surface));
}

.myriad-system .item-fieldset legend {
  padding: 0 0.35rem;
  color: var(--myr-accent);
  font-family: var(--myr-font-display);
  font-size: 0.85rem;
}

.myriad-system .inline-pair {
  flex: 1;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.myriad-system .inline-pair input {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.myriad-system .checkbox-row input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}

.myriad-system .properties-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.6rem;
}

.myriad-system .properties-grid label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--myr-text-muted);
}

.myriad-system .properties-grid input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}

.myriad-system .field-row label {
  min-width: 120px;
  color: var(--myr-text-muted);
}

.myriad-system .field-row input,
.myriad-system .field-row select,
.myriad-system .field-row textarea {
  flex: 1;
}

.myriad-system .field-row textarea {
  min-height: 86px;
}

.myriad-system .field-path-bundle-head {
  align-items: flex-start;
}

.myriad-system .path-bundle-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.myriad-system .path-bundle-count {
  min-width: 1.5rem;
  text-align: center;
  color: var(--myr-text-muted);
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  padding: 0.1rem 0.35rem;
}

.myriad-system .path-bundled-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 360px;
  overflow: auto;
  width: 100%;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: color-mix(in srgb, var(--myr-surface) 90%, #fff 10%);
  padding: 0.5rem;
}

.myriad-system .path-bundled-item {
  border: 1px solid color-mix(in srgb, var(--myr-border) 80%, transparent);
  border-radius: var(--myr-radius-sm);
  padding: 0.4rem;
  background: color-mix(in srgb, var(--myr-surface-2) 35%, transparent);
}

.myriad-system .path-bundled-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.myriad-system .path-bundled-head strong {
  color: var(--myr-text);
  font-size: 0.82rem;
}

.myriad-system .path-bundled-empty {
  margin: 0;
  color: var(--myr-text-muted);
}

.myriad-system .path-bundled-list label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--myr-text-muted);
}

.myriad-system .path-bundled-list input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}

.myriad-system .path-skills-empty {
  margin: 0;
  color: var(--myr-text-muted);
}

.myriad-system .field-description {
  align-items: flex-start;
}

.myriad-system .sheet-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.myriad-system .save-item {
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.myriad-system .save-item:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

#items .directory-item .myr-dir-item-edit {
  margin-left: 0.35rem;
  color: var(--color-text-light-highlight);
  opacity: 0.75;
  text-decoration: none;
}

#items .directory-item .myr-dir-item-edit:hover {
  opacity: 1;
}

/* Type icons in the items sidebar directory */
#items .myr-type-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text-light-highlight, #c9d3e0);
}

/* ===================================================================
   CHAT ROLL CARD
=================================================================== */
.myriad-roll-card {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  background: linear-gradient(160deg, #2e2720 0%, #1e1a14 100%);
  border: 1px solid #5a4a33;
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.85rem;
  color: #ede0c4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  margin: 2px 0;
  position: relative;
}

.myriad-roll-card.outcome-success { border-top: 3px solid #4d9e65; }
.myriad-roll-card.outcome-failure { border-top: 3px solid #b44a38; }
.myriad-roll-card.outcome-critical-success {
  border-color: #d6b36a;
  border-top: 3px solid #f0d892;
  box-shadow:
    inset 0 0 0 1px rgba(240, 216, 146, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.myriad-roll-card.outcome-critical-failure {
  border-color: #8d5a2f;
  border-top: 3px solid #c0713e;
  box-shadow:
    inset 0 0 0 1px rgba(192, 113, 62, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.myriad-roll-card::before,
.myriad-roll-card::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  pointer-events: none;
}

.myriad-roll-card::before {
  border: 1px solid color-mix(in srgb, #d6b36a 60%, transparent);
  opacity: 0.35;
}

.myriad-roll-card::after {
  background:
    radial-gradient(circle at top left, rgba(214, 179, 106, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at top right, rgba(214, 179, 106, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at bottom left, rgba(214, 179, 106, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at bottom right, rgba(214, 179, 106, 0.32) 0 1px, transparent 2px);
  opacity: 0.75;
}

.myriad-roll-card.outcome-critical-success::before {
  border-color: rgba(240, 216, 146, 0.8);
  opacity: 0.65;
}

.myriad-roll-card.outcome-critical-success::after {
  background:
    radial-gradient(circle at top left, rgba(240, 216, 146, 0.7) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at top right, rgba(240, 216, 146, 0.7) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at bottom left, rgba(240, 216, 146, 0.7) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at bottom right, rgba(240, 216, 146, 0.7) 0 1.5px, transparent 2.5px);
}

.myriad-roll-card.outcome-critical-failure::before {
  border-color: rgba(227, 156, 100, 0.75);
  opacity: 0.65;
}

.myriad-roll-card.outcome-critical-failure::after {
  background:
    radial-gradient(circle at top left, rgba(227, 156, 100, 0.65) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at top right, rgba(227, 156, 100, 0.65) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at bottom left, rgba(227, 156, 100, 0.65) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at bottom right, rgba(227, 156, 100, 0.65) 0 1.5px, transparent 2.5px);
}

/* Header row: actor name + roll type */
.myrcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.65rem;
  background: rgba(0, 0, 0, 0.32);
  border-bottom: 1px solid #5a4a33;
}

.myrcard-actor-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: #d6b36a;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.myrcard-roll-type {
  font-size: 0.72rem;
  color: #896d4a;
  font-style: italic;
}

/* Subject (skill name / characteristic name) */
.myrcard-subject {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem 0.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ede0c4;
}

.myrcard-subject i { font-size: 0.85rem; color: #d6b36a; }

.myrcard-subject-description {
  padding: 0.05rem 0.65rem 0.35rem 1.9rem;
  color: #d2c1a0;
  font-size: 0.77rem;
  line-height: 1.3;
}

.myrcard-subject-description p {
  margin: 0.18rem 0;
}

/* Formula line (skill only: "Power (50) +10 = 60") */
.myrcard-formula {
  padding: 0 0.65rem 0.35rem 1.9rem;
  font-size: 0.75rem;
  color: #967a55;
  font-style: italic;
}

/* Central dice + vs + target row */
.myrcard-dice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem 0.55rem;
  gap: 0.4rem;
}

.myrcard-die-block {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.myrcard-result-block,
.myrcard-target-block {
  text-align: center;
}

/* The two d10 faces */
.myrcard-die-tens,
.myrcard-die-units {
  width: 2.2rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ede0c4;
  background: linear-gradient(180deg, #40352a 0%, #282010 100%);
  border: 1px solid #6a5038;
  border-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.55);
}

.myrcard-vs {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  color: #5a4228;
  letter-spacing: 0.04em;
}

.myrcard-target-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: #d6b36a;
}

.myrcard-target-label {
  font-size: 0.68rem;
  color: #896d4a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.1rem;
}

/* Outcome bar */
.myrcard-outcome-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.32rem 0.65rem;
  border-top: 1px solid #5a4a33;
  gap: 0.5rem;
}

.myrcard-outcome-main {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: wrap;
}

.outcome-success .myrcard-outcome-bar { background: rgba(35, 90, 55, 0.32); }
.outcome-failure .myrcard-outcome-bar { background: rgba(110, 35, 28, 0.32); }

.myrcard-outcome-text {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.outcome-success .myrcard-outcome-text { color: #72d688; }
.outcome-failure .myrcard-outcome-text { color: #e0604e; }

.myrcard-margin-text {
  font-size: 0.9rem;
  color: #8ecfa0;
  font-weight: 700;
}

.myrcard-margin-value {
  font-weight: 800;
}

.myrcard-critical-text {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  line-height: 1.2;
}

.outcome-critical-success .myrcard-critical-text {
  color: #f0d892;
}

.outcome-critical-failure .myrcard-critical-text {
  color: #e39c64;
}

/* ===================================================================
   GRADE ROMAN NUMERAL — display on sheets
=================================================================== */

.myriad-system .grade-roman {
  font-family: var(--myr-font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--myr-accent);
}

/* ===================================================================
   GRADE RADIO SELECTOR — item edit sheet
=================================================================== */

.myriad-system .grade-radio-group {
  display: flex;
  gap: 0.3rem;
  flex: 1;
}

.myriad-system .field-row .grade-radio-option,
.myriad-system .path-bundled-list .grade-radio-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  width: 2.1rem;
  height: 2.1rem;
  cursor: pointer;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%),
    var(--myr-surface-2));
  color: var(--myr-text-muted);
  font-family: var(--myr-font-display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease, box-shadow 120ms ease;
  gap: 0;
  user-select: none;
}

.myriad-system .grade-radio-option input[type="radio"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.myriad-system .grade-radio-option:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .grade-radio-option.is-selected {
  border-color: var(--myr-accent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--myr-accent) 24%, var(--myr-surface-2) 76%),
    color-mix(in srgb, var(--myr-accent) 14%, var(--myr-surface-2) 86%));
  color: var(--myr-accent);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--myr-accent) 38%, transparent),
    0 0 6px color-mix(in srgb, var(--myr-accent) 18%, transparent);
}

/* Effect-related styles */
.myriad-system .effect-row {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.myriad-system .effect-row.is-disabled {
  opacity: 0.6;
}

.myriad-system .effect-mod-count {
  font-size: 0.80rem;
  color: var(--myr-text-muted);
}

.myriad-system .item-toggle-enabled {
  border: 1px solid var(--myr-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text-muted);
  border-radius: var(--myr-radius-sm);
  cursor: pointer;
  min-width: 1.7rem;
  height: 1.7rem;
  line-height: 1;
  padding: 0;
  font-size: 0.8rem;
}

.myriad-system .item-toggle-enabled:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .item-toggle-enabled.is-enabled {
  color: var(--myr-accent);
}

.myriad-system .modifiers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.myriad-system .modifiers-list h4 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--myr-text-muted);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.myriad-system .modifier-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: color-mix(in srgb, var(--myr-surface-2) 35%, transparent);
}

.myriad-system .modifier-target,
.myriad-system .modifier-mode {
  flex: 1;
  min-width: 100px;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface);
  color: var(--myr-text);
  font-size: 0.80rem;
}

.myriad-system .modifier-value {
  width: 60px;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface);
  color: var(--myr-text);
  text-align: center;
  font-size: 0.80rem;
}

.myriad-system .modifier-grade {
  width: 50px;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--myr-border);
  border-radius: var(--myr-radius-sm);
  background: var(--myr-surface);
  color: var(--myr-text);
  text-align: center;
  font-size: 0.80rem;
}

.myriad-system .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-size: 0.80rem;
  color: var(--myr-text-muted);
  cursor: pointer;
}

.myriad-system .checkbox-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.myriad-system .remove-modifier {
  flex: 0 0 auto;
  border: 1px solid var(--myr-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text-muted);
  border-radius: var(--myr-radius-sm);
  cursor: pointer;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1;
  padding: 0;
  font-size: 0.9rem;
}

.myriad-system .remove-modifier:hover {
  border-color: var(--myr-danger);
  color: var(--myr-danger);
}

.myriad-system .add-modifier {
  border: 1px solid var(--myr-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--myr-surface-2) 90%, #fff 10%), var(--myr-surface-2));
  color: var(--myr-text);
  border-radius: var(--myr-radius-sm);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  font-size: 0.80rem;
  width: 100%;
  margin-top: 0.35rem;
}

.myriad-system .add-modifier:hover {
  border-color: var(--myr-accent);
  color: var(--myr-accent);
}

.myriad-system .effects-header {
  display: grid;
  align-items: center;
  gap: var(--myr-space-2);
  padding: 0.35rem 0.15rem;
}

.myriad-system .effects-header span {
  font-weight: 600;
  color: var(--myr-text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
