html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.historical-button {
  position: fixed;
  top: 20px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 110;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.32);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

@media (max-width: 768px) {
  .historical-button {
    top: 14px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .historical-panel {
    right: auto !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) scale(0.96) !important;
  }

  .historical-panel-open {
    transform: translate(-50%, -50%) scale(1) !important;
  }
}

.historical-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
}

.historical-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ecfdf5;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: historical-pulse 1.8s infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes historical-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); opacity: 1; }
  70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); opacity: 0.8; }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); opacity: 1; }
}

.historical-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.48);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.historical-overlay-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.historical-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(92vw, 470px);
  max-height: min(82vh, 760px);
  background: linear-gradient(180deg, #0f172a 0%, #071126 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, visibility 0.25s ease;
  overflow: hidden;
}

.historical-panel-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}

.historical-panel-header {
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.historical-panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.historical-panel-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.historical-close-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 28px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.historical-close-btn:hover {
  background: rgba(148, 163, 184, 0.12);
}

.historical-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  -webkit-overflow-scrolling: touch;
}

.historical-events-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.historical-date-header {
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
  padding: 8px 10px;
  background: rgba(56, 189, 248, 0.12);
  border-left: 3px solid #38bdf8;
  border-radius: 6px;
}

.historical-events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.historical-event-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 14px;
}

.historical-event-year {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #38bdf8;
}

.historical-event-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #f8fafc;
}

.historical-event-description {
  margin: 0;
  color: #dbeafe;
  font-size: 15px;
  line-height: 1.7;
}

.historical-event-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.historical-event-meta {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.historical-event-meta a {
  color: #7dd3fc;
  text-decoration: none;
}

.historical-event-meta a:hover {
  text-decoration: underline;
}

.historical-no-events {
  padding: 28px 18px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.historical-panel-footer {
  padding: 12px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(2, 6, 23, 0.24);
}

.historical-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
}

.historical-sources strong {
  color: #cbd5e1;
}

.historical-sources a {
  color: #7dd3fc;
  text-decoration: none;
}

.historical-sources a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .historical-button {
    top: 18px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 1002;
    max-width: min(220px, calc(100vw - 32px));
  }

  .historical-panel {
    left: 50%;
    right: auto;
    top: 50%;
    width: min(92vw, 440px);
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    visibility: hidden;
  }

  .historical-panel-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 540px) {
  .historical-button { font-size: 11px; padding: 8px 10px; }
  .historical-panel { width: min(94vw, 420px); }
  .historical-event-title { font-size: 15px; }
  .historical-event-description { font-size: 13px; }
}
