/**
 * Classic → modern return control ("back to the future").
 * Mirrors modern .tm-toggle pill (global.css) — green #33E06A /
 * Halloween #FF8A2B via html.halloween-mode (same as classic halloween.js).
 */
#tm-banner.tm-return-bar {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 12px;
  box-sizing: border-box;
  width: 100%;
  padding: 6px 10px;
  margin: 0;
  background: rgba(0, 0, 0, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ede6d8;
  text-align: right;
}

.tm-return-bar__label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
  color: rgba(237, 230, 216, 0.48);
  white-space: nowrap;
}

/* Exact mirror of modern .tm-toggle (src/styles/global.css) */
#tm-banner .tm-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  height: 28px;
  min-height: 28px;
  padding: 0 10px 0 8px;
  margin: 0;
  border: 1px solid #20c653;
  border-radius: 999px;
  background: rgba(51, 224, 106, 0.08);
  color: #33e06a;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

#tm-banner .tm-toggle__icon {
  display: block;
  flex-shrink: 0;
  width: 26px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url('/assets/images/tm-v3-f34-16.svg') center / contain no-repeat;
  mask: url('/assets/images/tm-v3-f34-16.svg') center / contain no-repeat;
  transform: translateY(-0.5px);
}

#tm-banner .tm-toggle__label {
  display: inline-block;
}

#tm-banner .tm-toggle:hover {
  background: rgba(51, 224, 106, 0.14);
  border-color: #33e06a;
  color: #33e06a;
}

#tm-banner .tm-toggle:active {
  background: rgba(51, 224, 106, 0.2);
}

#tm-banner .tm-toggle:focus {
  outline: none;
}

#tm-banner .tm-toggle:focus-visible {
  outline: 2px solid #33e06a;
  outline-offset: 2px;
}

/* Keep bar dark in Halloween — do not inherit old pumpkin banner fill */
html.halloween-mode #tm-banner.tm-return-bar,
body.halloween-mode #tm-banner.tm-return-bar {
  background: rgba(0, 0, 0, 0.94);
}

html.halloween-mode #tm-banner .tm-toggle {
  color: #ff8a2b;
  border-color: #ff8a2b;
  background: rgba(255, 138, 43, 0.08);
}

html.halloween-mode #tm-banner .tm-toggle:hover {
  background: rgba(255, 138, 43, 0.14);
  border-color: #ff8a2b;
  color: #ff8a2b;
}

html.halloween-mode #tm-banner .tm-toggle:active {
  background: rgba(255, 138, 43, 0.2);
}

html.halloween-mode #tm-banner .tm-toggle:focus-visible {
  outline-color: #ff8a2b;
}

/* Tight width: label on its own line above the pill */
@media (max-width: 560px) {
  #tm-banner.tm-return-bar {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
  }

  .tm-return-bar__label {
    white-space: normal;
    text-align: right;
    max-width: 100%;
  }
}

/* Very narrow: keep icon + "back to the future", drop the year label */
@media (max-width: 380px) {
  .tm-return-bar__label {
    display: none;
  }

  #tm-banner.tm-return-bar {
    flex-direction: row;
    justify-content: flex-end;
  }
}
