/* Same palette and typography as the existing viewer. */
#historyToggle[aria-pressed="true"] { background: #e3eeee; color: #185f69; }
#historyMarkers { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.history-marker { position: absolute; width: 32px; height: 32px; transform: translate(-50%, -50%); border: 0; background: transparent; padding: 0; cursor: pointer; pointer-events: auto; touch-action: manipulation; color: white; font: 700 10px/1 Arial, Helvetica, sans-serif; }
.history-marker::before { content: ''; position: absolute; inset: 10px; background: #2c7075; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #162738, 0 1px 4px rgba(22,39,56,.4); z-index: -1; }
.history-marker.is-cluster::before { inset: 5px; background: #162738; }
.history-marker.is-selected::before, .history-marker:hover::before { box-shadow: 0 0 0 3px #d4b15f, 0 1px 5px rgba(22,39,56,.4); }
.history-marker:focus-visible { outline: 2px solid #162738; border-radius: 50%; }
#historyPanel { position: fixed; z-index: 39; left: 20px; bottom: 104px; width: min(340px, calc(100vw - 40px)); max-height: min(62vh, 560px); overflow: auto; overscroll-behavior: contain; padding: 14px 16px; background: var(--paper); border: 1px solid rgba(22,39,56,.17); box-shadow: var(--shadow); color: #344754; font-size: 12px; }
.history-heading { display: flex; align-items: flex-start; gap: 12px; }
#historyTitle { flex: 1; margin: 0; color: var(--navy); font: 19px/1.2 Georgia, 'Times New Roman', serif; }
#historyClose { flex: none; min-width: 36px; min-height: 36px; margin: -6px -8px 0 0; border: 0; background: transparent; color: var(--navy); font-size: 23px; cursor: pointer; }
#historyBody p { margin: 10px 0 0; white-space: pre-line; }
#historyBody h3 { margin: 14px 0 0; color: var(--navy); font: 700 12px/1.3 Arial, Helvetica, sans-serif; }
#historyBody .history-meta { color: var(--muted); font-size: 11px; }
#historyBody a { color: #185f69; overflow-wrap: anywhere; text-underline-offset: 2px; }
#historyBody figure { margin: 12px 0 0; }
#historyBody img { display: block; max-width: 100%; height: auto; }
#historyBody figcaption { margin-top: 5px; color: var(--muted); font-size: 10px; }
.history-choices { display: grid; gap: 5px; margin-top: 10px; }
.history-choices button { min-height: 38px; padding: 8px; border: 1px solid var(--line); background: white; text-align: left; color: var(--navy); cursor: pointer; }
@media (max-width: 700px) {
 #controls #historyToggle { max-width: 82px; padding: 8px 6px; line-height: 1.2; }
 #historyPanel { left: 10px; bottom: 99px; width: calc(100vw - 110px); max-height: 48vh; padding: 12px; }
 #historyTitle { font-size: 17px; }
 .history-marker { width: 36px; height: 36px; }
 .history-marker::before { inset: 12px; }
 .history-marker.is-cluster::before { inset: 7px; }
}
@media (max-height: 460px) {
 #historyPanel { top: 56px; bottom: 98px; max-height: none; }
}
/* Override the existing generic focus rule so keyboard focus cannot shift a pin. */
#historyMarkers .history-marker:focus-visible { position: absolute; }
@media (max-width: 700px) {
 /* Keep the credits toggle reachable alongside the additional history control. */
 #credits { left: 10px; right: auto; bottom: 99px; width: calc(100vw - 110px); max-height: 48vh; overflow: auto; }
}

/* Fill the existing control group; remove the empty strip beside the toggle. */
#controls #historyToggle { flex: 1; width: 100%; }
#historyBody figcaption { white-space: pre-line; }
/* Keep the title and close action available while reading a long card. */
.history-heading { position: sticky; top: -14px; z-index: 3; margin: -14px -16px 0; padding: 14px 16px 8px; background: #fff; }
@media (max-width: 700px) {
 .history-heading { top: -12px; margin: -12px -12px 0; padding: 12px 12px 8px; }
}
