.rules-edit-shell {
  width: 100%;
}

.rules-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  margin: 18px auto -20px;
  padding: 6px 8px;

  color: #d7be91;
  background: rgba(29, 23, 20, 0.58);
  border: 1px solid rgba(210, 167, 95, 0.18);
  border-radius: 999px;
  box-shadow: none;
}

.rules-edit-toolbar button {
  min-height: 28px;
  padding: 0 10px;

  color: #d7be91;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(210, 167, 95, 0.2);
  border-radius: 999px;

  font-size: 0.76rem;
  font-weight: 800;
}

.rules-edit-toolbar button:hover {
  color: #f2d9a2;
  background: rgba(210, 167, 95, 0.12);
  border-color: rgba(210, 167, 95, 0.34);
}

.rules-edit-toolbar button.primary {
  color: #21160f;
  background: rgba(224, 179, 105, 0.82);
  border-color: rgba(224, 179, 105, 0.96);
}

.rules-edit-toolbar button.primary:hover {
  background: #e0b369;
}

.rules-edit-toolbar button:disabled {
  opacity: 0.42;
}

.rules-edit-toolbar span {
  color: rgba(239, 229, 209, 0.62);
  font-size: 0.76rem;
  font-weight: 800;
}

.rules-editable-text.editing {
  border-radius: 3px;
  outline: 1px dashed rgba(224, 179, 105, 0.32);
  outline-offset: 2px;
  cursor: text;
}

.rules-editable-text.editing:hover,
.rules-editable-text.editing:focus {
  background: rgba(224, 179, 105, 0.16);
  outline-color: rgba(224, 179, 105, 0.82);
}

.rules-custom-panel {
  gap: 0;
  order: 1000;
}

.rules-custom-panel.editing {
  gap: 14px;
  border-style: dashed;
}

.rules-builtin-card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: -8px 0 14px;
  padding: 10px;

  background: rgba(0, 0, 0, 0.16);
  border: 1px dashed rgba(210, 167, 95, 0.24);
  border-radius: 8px;
}

.rules-builtin-visible-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;

  color: #d7be91;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(210, 167, 95, 0.2);
  border-radius: 999px;

  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rules-builtin-visible-toggle input {
  accent-color: #d5a85f;
}

.rules-builtin-card-hidden {
  opacity: 0.48;
}

.rules-builtin-card-hidden::after {
  content: "Hidden from players";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;

  color: #ffd2ca;
  background: rgba(137, 38, 31, 0.32);
  border: 1px solid rgba(207, 92, 80, 0.42);
  border-radius: 999px;

  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rules-builtin-extra-sections {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.rules-builtin-extra-editor {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;

  border-top: 1px solid rgba(210, 167, 95, 0.16);
}

.rules-custom-panel-compact {
  padding: 16px;
}

.rules-custom-panel-compact h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.rules-custom-panel-top {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.rules-custom-title-field {
  flex: 1 1 240px;
}

.rules-custom-size-field {
  flex: 0 1 150px;
}

.rules-custom-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rules-custom-field + .rules-custom-field {
  margin-top: 12px;
}

.rules-custom-field span,
.rules-custom-rows-title,
.rules-custom-add-section span {
  color: #c8a566;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rules-custom-field input,
.rules-custom-field textarea,
.rules-custom-field select,
.rules-custom-row-editor input,
.rules-custom-row-editor textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  box-sizing: border-box;

  color: #f3e7cf;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(210, 167, 95, 0.26);
  border-radius: 6px;

  font: inherit;
}

.rules-custom-field textarea,
.rules-custom-row-editor textarea {
  resize: vertical;
}

.rules-custom-field textarea {
  min-height: 138px;
}

.rules-custom-field-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rules-custom-formatbar,
.rules-custom-panel-actions,
.rules-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rules-custom-formatbar button,
.rules-icon-button,
.rules-custom-add-row,
.rules-custom-add-section button,
.rules-custom-delete {
  min-height: 30px;
  padding: 0 9px;

  color: #d7be91;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(210, 167, 95, 0.24);
  border-radius: 6px;

  font-size: 0.72rem;
  font-weight: 900;
}

.rules-custom-formatbar button {
  min-width: 30px;
}

.rules-custom-formatbar button:hover,
.rules-icon-button:hover,
.rules-custom-add-row:hover,
.rules-custom-add-section button:hover {
  color: #f2d9a2;
  background: rgba(210, 167, 95, 0.12);
  border-color: rgba(210, 167, 95, 0.42);
}

.rules-icon-button:disabled,
.rules-custom-delete:disabled {
  opacity: 0.42;
}

.rules-icon-button.danger,
.rules-custom-delete {
  color: #ffd2ca;
  background: rgba(137, 38, 31, 0.18);
  border-color: rgba(207, 92, 80, 0.38);
}

.rules-custom-delete {
  white-space: nowrap;
}

.rules-custom-sections {
  display: grid;
  gap: 12px;
}

.rules-section-editor {
  display: grid;
  gap: 10px;
  padding: 12px;

  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(210, 167, 95, 0.18);
  border-radius: 8px;
}

.rules-section-editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.rules-custom-type-field {
  min-width: 165px;
}

.rules-custom-rows {
  display: grid;
  gap: 8px;
}

.rules-custom-row-editor {
  display: grid;
  grid-template-columns: minmax(92px, 0.68fr) minmax(0, 1.32fr) auto;
  gap: 8px;
  align-items: start;
}

.rules-custom-add-row {
  justify-self: start;
}

.rules-custom-add-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 12px;

  border-top: 1px solid rgba(210, 167, 95, 0.16);
}

.rules-add-panel-card {
  display: grid;
  order: 1100;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 190px;
  height: 100%;
  padding: 22px;

  color: rgba(239, 229, 209, 0.72);
  background: rgba(255, 255, 255, 0.018);
  border: 2px dashed rgba(210, 167, 95, 0.32);
  border-radius: 12px;

  text-align: center;
}

.rules-add-panel-card:hover {
  color: #f0d7a6;
  background: rgba(210, 167, 95, 0.08);
  border-color: rgba(210, 167, 95, 0.58);
}

.rules-add-panel-card span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;

  color: #21160f;
  background: rgba(224, 179, 105, 0.88);
  border-radius: 50%;

  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.rules-add-panel-card strong {
  font-size: 0.88rem;
}

.vampire-sheet-app .rules-edit-toolbar {
  color: #bfaea3;
  background: rgba(10, 8, 10, 0.5);
  border-color: rgba(179, 144, 96, 0.2);
}

.vampire-sheet-app .rules-edit-toolbar button,
.vampire-sheet-app .rules-custom-formatbar button,
.vampire-sheet-app .rules-icon-button,
.vampire-sheet-app .rules-custom-add-row,
.vampire-sheet-app .rules-custom-add-section button {
  color: #c9b9aa;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(179, 144, 96, 0.22);
}

.vampire-sheet-app .rules-edit-toolbar button:hover,
.vampire-sheet-app .rules-custom-formatbar button:hover,
.vampire-sheet-app .rules-icon-button:hover,
.vampire-sheet-app .rules-custom-add-row:hover,
.vampire-sheet-app .rules-custom-add-section button:hover {
  color: #f0d7b0;
  background: rgba(193, 154, 98, 0.12);
  border-color: rgba(193, 154, 98, 0.36);
}

.vampire-sheet-app .rules-edit-toolbar button.primary {
  color: #1a1012;
  background: #c19a62;
  border-color: #d9b982;
}

.vampire-sheet-app .rules-edit-toolbar span {
  color: rgba(191, 174, 163, 0.68);
}

.vampire-sheet-app .rules-custom-field span,
.vampire-sheet-app .rules-custom-rows-title,
.vampire-sheet-app .rules-custom-add-section span {
  color: #c19a62;
}

.vampire-sheet-app .rules-builtin-card-controls {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(179, 144, 96, 0.25);
}

.vampire-sheet-app .rules-builtin-visible-toggle {
  color: #c9b9aa;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(179, 144, 96, 0.22);
}

.vampire-sheet-app .rules-builtin-visible-toggle input {
  accent-color: #c19a62;
}

.vampire-sheet-app .rules-custom-field input,
.vampire-sheet-app .rules-custom-field textarea,
.vampire-sheet-app .rules-custom-field select,
.vampire-sheet-app .rules-custom-row-editor input,
.vampire-sheet-app .rules-custom-row-editor textarea {
  color: #f0d7b0;
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(179, 144, 96, 0.28);
}

.vampire-sheet-app .rules-add-panel-card {
  color: rgba(223, 200, 184, 0.72);
  border-color: rgba(179, 144, 96, 0.32);
}

.vampire-sheet-app .rules-add-panel-card:hover {
  color: #f0d7b0;
  background: rgba(193, 154, 98, 0.09);
  border-color: rgba(193, 154, 98, 0.56);
}

.vampire-sheet-app .rules-add-panel-card span {
  color: #1a1012;
  background: #c19a62;
}

@media (max-width: 850px) {
  .rules-edit-toolbar {
    width: calc(100% - 20px);
    margin: 14px auto -10px;
    border-radius: 8px;
  }

  .rules-add-panel-card {
    min-height: 150px;
  }

  .rules-custom-panel-top,
  .rules-section-editor-header,
  .rules-builtin-card-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rules-custom-panel-actions,
  .rules-section-actions {
    justify-content: start;
  }

  .rules-custom-row-editor {
    grid-template-columns: 1fr;
  }

  .rules-custom-add-section button {
    flex: 1 1 132px;
  }
}

@media (max-width: 520px) {
  .rules-edit-toolbar {
    align-items: stretch;
  }

  .rules-edit-toolbar button {
    flex: 1 1 120px;
  }

  .rules-custom-panel.editing {
    padding: 14px;
  }
}
