/* Eryndor shared combat library and private DM stat blocks */

.rf-combat-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(184, 138, 61, 0.28);
  background: rgba(3, 8, 10, 0.4);
}

.rf-combat-mode {
  color: var(--gold-light, #e0bc71);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rf-combat-sync-status {
  color: var(--muted, #9f927c);
  font-size: 0.8rem;
}

.rf-combat-sync-status[data-status-type="success"] { color: #a9c79b; }
.rf-combat-sync-status[data-status-type="loading"] { color: #d5bc7b; }
.rf-combat-sync-status[data-status-type="error"] { color: #d58b82; }

.rf-library {
  margin-bottom: 2rem;
  padding: 1.25rem;
  border: 1px solid rgba(184, 138, 61, 0.3);
  background: rgba(4, 11, 13, 0.66);
}

.rf-library__header,
.rf-library-editor__header,
.rf-stat-block__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.rf-library__header h3,
.rf-library-editor__header h3,
.rf-stat-block__heading h4 {
  margin: 0;
}

.rf-library__header p,
.rf-library-editor__header p,
.rf-stat-block__heading p {
  margin-bottom: 0;
}

.rf-library button,
.rf-library-editor button,
.rf-stat-block button {
  cursor: pointer;
}

.rf-library-quick-add {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 100px auto;
  align-items: end;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.rf-library-quick-add label,
.rf-library-editor label {
  display: grid;
  gap: 0.35rem;
}

.rf-library-quick-add label > span,
.rf-library-editor label > span,
.rf-ability-editor label > span {
  color: var(--muted, #9f927c);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rf-library-quick-add input,
.rf-library-quick-add select,
.rf-library-editor input,
.rf-library-editor select,
.rf-library-editor textarea {
  width: 100%;
  border: 1px solid rgba(184, 138, 61, 0.26);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text, #d6c9b1);
}

.rf-library-quick-add input,
.rf-library-quick-add select,
.rf-library-editor input,
.rf-library-editor select {
  min-height: 42px;
  padding: 0.65rem 0.75rem;
}

.rf-library-editor textarea {
  min-height: 110px;
  padding: 0.75rem;
  resize: vertical;
}

.rf-library-grid {
  display: grid;
  gap: 0.75rem;
}

.rf-library-card {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(184, 138, 61, 0.18);
  background: rgba(0, 0, 0, 0.14);
}

.rf-library-card > div:first-child {
  display: grid;
  gap: 0.2rem;
}

.rf-library-card small {
  color: var(--muted, #9f927c);
}

.rf-library-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.rf-library-card__stat {
  margin-top: 1rem;
}

.rf-library-empty {
  margin: 0;
  color: var(--muted, #9f927c);
  font-style: italic;
}

.rf-library-editor {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid rgba(224, 188, 113, 0.38);
  background: rgba(3, 8, 10, 0.92);
}

.rf-library-editor__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.rf-library-editor__grid--wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rf-ability-editor {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid rgba(184, 138, 61, 0.2);
}

.rf-ability-editor legend {
  padding: 0 0.5rem;
  color: var(--gold-light, #e0bc71);
  font-weight: 700;
}

.rf-library-editor__hint {
  margin: 1.25rem 0 0.75rem;
  color: var(--muted, #9f927c);
}

.rf-library-editor__textareas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.rf-library-editor__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.rf-stat-block {
  grid-column: 1 / -1;
  margin-top: 1rem;
  padding: 1.1rem;
  border: 1px solid rgba(184, 138, 61, 0.34);
  background: rgba(2, 7, 9, 0.95);
}

.rf-stat-block__heading {
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(184, 138, 61, 0.45);
}

.rf-stat-block__basics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 0;
}

.rf-stat-block__basics p,
.rf-stat-block__details p {
  margin: 0.3rem 0;
}

.rf-stat-block__abilities {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(184, 138, 61, 0.25);
  border-bottom: 1px solid rgba(184, 138, 61, 0.25);
}

.rf-stat-block__abilities > div {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
}

.rf-stat-block__abilities strong {
  color: var(--gold-light, #e0bc71);
  font-size: 0.75rem;
}

.rf-stat-block h5 {
  margin: 1rem 0 0.45rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(184, 138, 61, 0.3);
  color: var(--gold-light, #e0bc71);
  font-size: 1rem;
}

.rf-stat-block section p {
  margin: 0.45rem 0;
  line-height: 1.55;
}

.rf-stat-block__notes {
  padding: 0.85rem;
  border-left: 3px solid var(--gold, #b88a3d);
  background: rgba(184, 138, 61, 0.07);
}

.rf-combat.is-player-mode .rf-combat-row input:disabled {
  cursor: default;
  opacity: 1;
  color: inherit;
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(184, 138, 61, 0.14);
}

.rf-combat.is-player-mode .rf-combat-row__buttons {
  display: none;
}

.rf-combat-row__buttons [data-rf-stat-block],
.rf-combat-row__buttons [data-rf-save-template] {
  width: auto;
  min-width: 68px;
  padding-inline: 0.55rem;
  font-size: 0.7rem;
}

@media (max-width: 900px) {
  .rf-library-quick-add,
  .rf-library-editor__grid,
  .rf-library-editor__grid--wide,
  .rf-library-editor__textareas {
    grid-template-columns: 1fr 1fr;
  }

  .rf-ability-editor,
  .rf-stat-block__abilities {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }
}

@media (max-width: 600px) {
  .rf-combat-sync-bar,
  .rf-library__header,
  .rf-library-editor__header,
  .rf-stat-block__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .rf-library-quick-add,
  .rf-library-editor__grid,
  .rf-library-editor__grid--wide,
  .rf-library-editor__textareas {
    grid-template-columns: 1fr;
  }

  .rf-ability-editor,
  .rf-stat-block__abilities {
    grid-template-columns: repeat(2, minmax(70px, 1fr));
  }
}
/* Fix saved-participant dropdown option readability */

.rf-combat select,
.rf-library select,
[data-rf-library-select] {
  color: var(--text, #d6c9b1);
  background-color: #050b0d;
}

.rf-combat select option,
.rf-library select option,
[data-rf-library-select] option {
  color: #111;
  background-color: #f2efe8;
}

.rf-combat select option:checked,
.rf-library select option:checked,
[data-rf-library-select] option:checked {
  color: #fff;
  background-color: #246fd1;
}