.history-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 88px;
  background-color: var(--surface-2, rgba(255, 255, 255, 0.06));
  color: var(--text-color, var(--text, #fff));
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  cursor: pointer;
  z-index: 1001;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    background-color 0.2s ease;
}

.history-tab:hover {
  background-color: var(--button-bg-hover, rgba(255, 255, 255, 0.1));
}

.history-tab:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.history-tab i {
  font-size: 20px;
}

.history-tab.history-tab--hidden {
  opacity: 0;
  transform: translateY(-50%) scale(0.8);
  pointer-events: none;
  z-index: -1;
}

@media (prefers-reduced-motion: reduce) {
  .history-tab {
    transition: none;
  }
}

.history-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 360px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-color, var(--bg, #2c3e50));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
  transition: right 0.25s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.history-panel.open {
  right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .history-panel {
    transition: none;
  }
}

.history-panel__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--surface-2, rgba(255, 255, 255, 0.06));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-panel__header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-color, var(--text, #ecf0f1));
}

.history-panel__clear {
  background-color: rgba(239, 83, 80, 0.15) !important;
  color: var(--danger, #ef5350) !important;
  border: 1px solid rgba(239, 83, 80, 0.3) !important;
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.875em;
  height: 32px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.history-panel__clear:hover,
.history-panel__clear:focus {
  background-color: rgba(239, 83, 80, 0.25) !important;
  border-color: var(--danger, #ef5350) !important;
}

.history-panel__clear:focus-visible {
  outline: 2px solid rgba(239, 83, 80, 0.5);
  outline-offset: 2px;
}

.history-panel__items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-color, var(--bg, #2c3e50));
}

.history-panel__items::-webkit-scrollbar {
  width: 8px;
}

.history-panel__items::-webkit-scrollbar-track {
  background: transparent;
}

.history-panel__items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 0;
}

.history-panel__items::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.history-panel__item {
  padding: 14px 16px;
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
  max-height: 180px;
  overflow-y: auto;
}

.history-panel__item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.history-panel__item:focus-visible {
  outline: 2px solid var(--primary, #3896f3);
  outline-offset: 2px;
}

.history-panel__item-text {
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.45;
  color: #f1f1f1;
  text-shadow:
    0 1px 0 #000,
    0 -1px 0 #000,
    1px 0 0 #000,
    -1px 0 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
  letter-spacing: 0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
  margin: 0;
  padding: 0;
}

.history-panel__item-text br {
  display: block;
  line-height: 1.45;
}

.history-panel__item-text .me,
.history-panel__item-text .ame {
  color: #c2a3da;
}

.history-panel__item-text .darkgrey {
  color: #5a5a5b;
}

.history-panel__item-text .grey {
  color: #939799;
}

.history-panel__item-text .lightgrey {
  color: #c6c4c4;
}

.history-panel__item-text .death {
  color: #f00000;
}

.history-panel__item-text .yellow {
  color: #fbf724;
}

.history-panel__item-text .green {
  color: #56d64b;
}

.history-panel__item-text .orange {
  color: #eda841;
}

.history-panel__item-text .blue {
  color: #3896f3;
}

.history-panel__item-text .white {
  color: #f1f1f1;
}

.history-panel__item-text .radioColor {
  color: #ffec8b;
}

.history-panel__item-text .radioColor2 {
  color: #a19558;
}

.history-panel__item-text .depColor {
  color: #ccca15;
}

.history-panel__item-text .vesseltraffic {
  color: #33c1c9;
}

.history-panel__item-text .toyou {
  color: #ff00bc;
}

.history-panel__loading {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg-color, var(--bg, #2c3e50));
  gap: 12px;
}

.history-panel__loading.history-panel__loading--active {
  display: flex;
}

.history-panel__loading .history-panel__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: history-panel-spin 0.8s linear infinite;
}

.history-panel__loading p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

@keyframes history-panel-spin {
  to {
    transform: rotate(360deg);
  }
}

.history-panel__empty {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg-color, var(--bg, #2c3e50));
  text-align: center;
  gap: 8px;
}

.history-panel__empty.history-panel__empty--active {
  display: flex;
}

.history-panel__empty::before {
  content: '📝';
  font-size: 40px;
  opacity: 0.5;
}

.history-panel__empty p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.history-panel__empty p:last-child {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}
