/* V55: focused website fixes for the BGM control, toolbar balance and review UI. */

.topbar,
.topbar *,
.topbar *::before,
.topbar *::after {
  box-sizing: border-box;
}

.topbar-bgm-toggle {
  display: grid;
  grid-template-columns: 21px auto 32px auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 136px;
  min-height: 44px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  color: #173e32;
  background: #e3ece7;
  box-shadow: none;
  font: inherit;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.topbar-bgm-toggle svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.topbar-bgm-toggle .bgm-wave {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
  transition: opacity 160ms ease;
}

.topbar-bgm-toggle:not(.is-on) .bgm-wave {
  opacity: .2;
}

.topbar-bgm-track {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #94aa9f;
  transition: background 160ms ease;
}

.topbar-bgm-track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.topbar-bgm-toggle.is-on .topbar-bgm-track {
  background: #2d6b50;
}

.topbar-bgm-toggle.is-on .topbar-bgm-track i {
  transform: translateX(14px);
}

.topbar-bgm-toggle small {
  min-width: 22px;
  color: inherit;
  font-size: .58rem;
  font-weight: 900;
}

.topbar-bgm-toggle:hover,
.topbar-bgm-toggle:focus-visible {
  background: #d9e7df;
  outline: 2px solid rgba(45, 107, 80, .22);
  outline-offset: 2px;
}

body:not(.needs-entry) .support-link,
body:not(.needs-entry) .hungry-notes-link,
body:not(.needs-entry) .canopy-inbox-button {
  border: 0 !important;
  border-radius: 7px !important;
  color: #173e32 !important;
  background: #e3ece7 !important;
  box-shadow: none !important;
}

.hungry-notes-mark .notes-cover {
  fill: #f6edc2;
  stroke: #173e32;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.hungry-notes-mark .notes-page {
  fill: none;
  stroke: #173e32;
  stroke-linecap: round;
  stroke-width: 1.45;
}

.hungry-notes-mark .notes-leaf {
  fill: #5a9b78;
  stroke: #173e32;
  stroke-width: 1.2;
}

body:not(.needs-entry) .topbar-tools,
body:not(.needs-entry) .wallet {
  min-width: 0;
  max-width: 100%;
}

body:not(.needs-entry) .wallet {
  overflow: visible;
}

body:not(.needs-entry) .wallet-help,
body:not(.needs-entry) .wallet-redeem {
  flex: 0 0 auto;
}

body:not(.needs-entry) .wallet-tip {
  width: min(270px, calc(100vw - 24px));
  max-width: min(270px, calc(100vw - 24px));
  white-space: normal !important;
  overflow-wrap: break-word;
}

#explanationDetail {
  white-space: pre-line;
}

.weekly-review-conflict {
  margin: 12px 0 4px;
  padding: 13px 14px;
  border: 0;
  border-radius: 7px;
  color: #173228;
  background: #f4e7ad;
}

.weekly-review-conflict strong,
.weekly-review-conflict p {
  display: block;
  margin: 0;
}

.weekly-review-conflict p {
  margin-top: 5px;
  color: #52665c;
  line-height: 1.45;
}

.weekly-review-conflict-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 11px;
}

.weekly-review-conflict-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: #f8faf6;
  background: #174f3f;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.weekly-review-conflict-actions button:last-child {
  color: #173228;
  background: #fffdf5;
}

@media (min-width: 721px) {
  body:not(.needs-entry) .topbar {
    grid-template-columns: minmax(250px, 1fr) auto minmax(0, 760px) !important;
    gap: 14px;
  }

  body:not(.needs-entry) .topbar-bgm-toggle {
    justify-self: center;
  }

  body:not(.needs-entry) .topbar-tools {
    grid-template-columns: auto auto auto minmax(250px, 292px) !important;
    justify-content: end;
    width: 100%;
  }

  body:not(.needs-entry) .wallet {
    width: 100%;
    min-width: 250px !important;
    padding-inline: 9px 10px;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  body:not(.needs-entry) .topbar {
    grid-template-columns: 48px 124px minmax(0, 1fr) !important;
    gap: 9px;
  }

  body:not(.needs-entry) .topbar-bgm-toggle {
    min-width: 124px;
  }

  body:not(.needs-entry) .topbar-tools {
    grid-template-columns: 44px 52px 52px minmax(210px, 1fr) !important;
  }

  body:not(.needs-entry) .support-link span,
  body:not(.needs-entry) .hungry-notes-link span,
  body:not(.needs-entry) .canopy-inbox-button span {
    display: none;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  body:not(.needs-entry) .topbar {
    grid-template-columns: 34px 80px 48px 48px minmax(0, 1fr) !important;
    grid-template-rows: 48px !important;
    gap: 3px !important;
    padding: 5px 6px !important;
  }

  body:not(.needs-entry) .topbar-bgm-toggle {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 1fr 28px;
    width: 80px;
    min-width: 80px;
    min-height: 40px;
    padding: 5px 6px;
    gap: 5px;
    font-size: .7rem;
  }

  body:not(.needs-entry) .topbar-bgm-toggle svg,
  body:not(.needs-entry) .topbar-bgm-toggle small {
    display: none;
  }

  body:not(.needs-entry) .topbar-bgm-track {
    width: 28px;
    height: 16px;
  }

  body:not(.needs-entry) .topbar-bgm-track i {
    top: 3px;
    width: 10px;
    height: 10px;
  }

  body:not(.needs-entry) .topbar-bgm-toggle.is-on .topbar-bgm-track i {
    transform: translateX(12px);
  }

  body:not(.needs-entry) .topbar-tools {
    display: contents !important;
  }

  body:not(.needs-entry) .support-link {
    display: none !important;
  }

  body:not(.needs-entry) .hungry-notes-link {
    grid-column: 3;
    grid-row: 1;
  }

  body:not(.needs-entry) .canopy-inbox-button {
    grid-column: 4;
    grid-row: 1;
  }

  body:not(.needs-entry) .wallet {
    grid-column: 5;
    grid-row: 1;
    width: 100%;
    min-width: 0 !important;
    padding-inline: 4px !important;
  }

  body:not(.needs-entry) .wallet-tip {
    right: 0;
    max-width: min(250px, calc(100vw - 18px));
  }

  .weekly-review-conflict-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 374px) and (orientation: portrait) {
  body:not(.needs-entry) .topbar {
    grid-template-columns: 32px 72px 42px 42px minmax(0, 1fr) !important;
    gap: 2px !important;
    padding-inline: 4px !important;
  }

  body:not(.needs-entry) .topbar-bgm-toggle {
    width: 72px;
    min-width: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-bgm-track,
  .topbar-bgm-track i {
    transition: none;
  }
}
