/* Account map library and editor windows use the same colours as the game menu. */
.he-library {
  box-sizing: border-box;
  color: var(--menu-text-color, #080c09);
  overflow-y: auto;
  padding: calc(110px + env(safe-area-inset-top)) 20px 40px;
}

.he-library .he-dialog-heading {
  position: static;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.he-library .he-dialog-heading h1 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 32px;
  font-weight: 400;
}

.he-library .he-button.he-library-back {
  position: absolute;
  top: calc(25px + env(safe-area-inset-top));
  left: 20px;
  width: 150px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--menu-button-yellow, #dca34c);
  color: var(--menu-text-color, #080c09);
  font-size: 42px;
  box-shadow: 0 5px 8px #0004;
}

.he-library-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 0;
}

.he-library-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 28px;
}

.he-library-actions select {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: #c1e6b4;
  color: var(--menu-text-color, #080c09);
  padding: 12px 16px;
  font-size: 24px;
}

:is(.he-library, .he-modal) .he-button {
  min-height: 58px;
  padding: 12px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--menu-button-green, #5fa773);
  color: var(--menu-text-color, #080c09);
  font-size: 26px;
  line-height: 1.2;
  box-shadow: 0 4px 7px #0003;
}

.he-library-actions .he-button {
  font-size: 30px;
  overflow-wrap: anywhere;
}

.he-library-actions .he-button:last-child:nth-child(even) {
  grid-column: 1 / -1;
}

.he-map-list {
  gap: 18px;
}

.he-map-row {
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px;
  border: 0;
  border-radius: 18px;
  background: var(--menu-panel-color, #bbd8b5);
  box-shadow: 0 5px 8px #0003;
}

.he-map-info {
  flex: 1 1 260px;
  gap: 8px;
}

.he-map-info strong {
  font-size: 28px;
  color: var(--menu-text-color, #080c09);
}

.he-map-info small {
  font-size: 22px;
  color: #283d2b;
}

.he-map-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.he-map-actions .he-button:first-child {
  flex: 1;
  min-width: 0;
}

.he-map-actions .he-button:not(:first-child) {
  flex: 0 0 58px;
  padding: 8px;
  background: var(--menu-button-olive, #aaa45b);
  font-size: 30px;
}

.he-library .he-note,
.he-library-body > .he-note {
  max-width: none;
  font-size: 22px;
  color: var(--menu-text-color, #080c09);
  line-height: 1.5;
}

.he-modal {
  box-sizing: border-box;
  width: min(680px, 94%);
  max-height: 90dvh;
  border: 0;
  border-radius: 18px;
  background: var(--menu-panel-color, #bbd8b5);
  color: var(--menu-text-color, #080c09);
  font-size: 22px;
  box-shadow: 0 6px 12px #0005;
}

.he-modal::backdrop {
  background: #0006;
}

.he-modal .he-dialog-heading {
  position: sticky;
  top: 0;
  padding: 22px 24px 18px;
  background: var(--menu-panel-color, #bbd8b5);
  border: 0;
  gap: 16px;
}

.he-modal .he-dialog-heading h2 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 30px;
  font-weight: 400;
}

.he-modal .he-close {
  flex: 0 0 52px;
  width: 52px;
  min-height: 52px;
  height: 52px;
  padding: 0;
  background: var(--menu-button-yellow, #dca34c);
  border-radius: 14px;
  font-size: 34px;
}

.he-dialog-content {
  padding: 0 24px 24px;
  gap: 16px;
}

.he-dialog-content > .he-button {
  min-height: 64px;
  font-size: 30px;
}

.he-dialog-content > .he-button:nth-of-type(even) {
  background: var(--menu-button-olive, #aaa45b);
}

.he-modal .he-note,
.he-modal .he-field,
.he-modal .he-check,
.he-modal .he-row,
.he-modal .he-error {
  color: var(--menu-text-color, #080c09);
  font-size: 22px;
  line-height: 1.45;
}

.he-modal .he-error {
  color: #8a2020;
}

.he-modal .he-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.he-modal :is(input, select, textarea) {
  box-sizing: border-box;
  max-width: none;
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: #e6f2df;
  color: var(--menu-text-color, #080c09);
  font-size: 22px;
}

.he-modal .he-row select {
  flex: 1 1 160px;
}

.he-modal .he-code {
  min-height: 160px;
  font-size: 22px;
  line-height: 1.4;
}

.he-modal .he-message-row textarea {
  font-size: 22px;
}

.he-message-row > span {
  min-width: 22px;
}

:is(.he-library, .he-modal) .he-danger,
.he-dialog-content > .he-button.he-danger {
  background: #c57d78;
  color: var(--menu-text-color, #080c09);
}

:is(.he-library, .he-modal) .he-button:hover {
  filter: brightness(1.06);
}

:is(.he-library, .he-modal) :is(button, input, select, textarea):focus-visible,
.he-tabs .he-button:focus-visible {
  outline: 3px solid #182319;
  outline-offset: 3px;
}

/* Keep the canvas tools compact; distinguish section tabs from actions. */
.he-bottom {
  background: #bbd8b5f5;
  border-top: 0;
  color: var(--menu-text-color, #080c09);
  box-shadow: 0 -4px 10px #0003;
}

.he-tabs {
  justify-content: flex-start;
  gap: 22px;
  padding: 5px 18px 8px;
  border-top: 1px solid #18231933;
}

.he-tabs .he-button,
.he-tabs .he-button:hover,
.he-tabs .he-button[aria-pressed=true] {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #182319a6;
  box-shadow: none;
  font-size: 22px;
}

.he-tabs .he-button[aria-pressed=true] {
  border-bottom-color: #182319;
  color: var(--menu-text-color, #080c09);
}

.he-tools .he-button {
  border: 0;
  border-radius: 12px;
  background: var(--menu-button-green, #5fa773);
  color: var(--menu-text-color, #080c09);
  font-size: 22px;
  box-shadow: 0 3px 5px #0002;
}

.he-tools .he-button:hover {
  background: #75b687;
}

.he-tools .he-button[aria-pressed=true] {
  background: var(--menu-button-olive, #aaa45b);
  outline: 2px solid #182319;
  outline-offset: -2px;
  box-shadow: none;
}

.he-tools :is(.he-note, .he-field, .he-check, .he-province-label) {
  color: #182319;
  font-size: 20px;
}

.he-tools :is(input, select) {
  font-size: 22px;
  background: #e6f2df;
  color: var(--menu-text-color, #080c09);
  border: 0;
}

.he-tools .he-object-tool {
  gap: 6px;
  min-width: 90px;
  font-size: 20px;
}

.he-tools .he-swatch {
  border: 2px solid #182319;
  border-radius: 10px;
}

.he-tools .he-swatch[aria-pressed=true] {
  border: 3px solid #fff;
  outline: 2px solid #182319;
  outline-offset: 1px;
}

.he-tools .he-danger {
  background: #c57d78;
}

@media (max-width: 600px) {
  .he-library {
    padding-right: 16px;
    padding-left: 16px;
  }

  .he-library-actions {
    grid-template-columns: 1fr;
  }

  .he-library-actions .he-button {
    grid-column: 1;
  }

  .he-map-row {
    padding: 18px;
  }

  .he-map-actions {
    gap: 8px;
  }

  .he-map-actions .he-button {
    font-size: 22px;
    padding: 10px 8px;
  }

  .he-map-actions .he-button:not(:first-child) {
    flex-basis: 50px;
    font-size: 28px;
  }

  .he-modal .he-dialog-heading {
    padding: 18px 18px 16px;
  }

  .he-dialog-content {
    padding: 0 18px 20px;
  }

  .he-row > .he-button {
    flex: 1 1 130px;
  }

  .he-tabs {
    gap: 20px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .he-tools .he-object-tool {
    flex: 0 0 90px;
  }

  .he-tools .he-object-tool span {
    font-size: 20px;
  }
}
