/* TỨ PHỦ — Historical timeline explorer */

.ht-explorer {
  border: 1px solid rgba(98, 68, 60, 0.55);
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(42, 26, 28, 0.92);
}

.ht-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(98, 68, 60, 0.45);
  background: rgba(25, 15, 18, 0.75);
}

.ht-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(53, 35, 38, 0.95);
  color: #f4e6d1;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  text-decoration: none;
  cursor: pointer;
}

.ht-btn:hover,
.ht-btn:focus-visible,
.ht-btn.is-active {
  border-color: #c49a59;
  outline: none;
}

.ht-btn.is-primary {
  background: #742b32;
  border-color: transparent;
}

.ht-layout {
  display: grid;
  gap: 0;
}

@media (min-width: 1100px) {
  .ht-layout {
    grid-template-columns: 250px minmax(0, 1fr) 300px;
    min-height: 560px;
  }
}

.ht-side,
.ht-detail {
  display: none;
  overflow: auto;
  max-height: min(75vh, 780px);
  padding: 0.85rem;
  background: rgba(25, 15, 18, 0.55);
}

@media (min-width: 1100px) {
  .ht-side {
    display: block;
    border-right: 1px solid rgba(98, 68, 60, 0.45);
  }
  .ht-detail {
    display: block;
    border-left: 1px solid rgba(98, 68, 60, 0.45);
  }
}

.ht-canvas-wrap {
  position: relative;
  min-height: 360px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(116, 43, 50, 0.14), transparent 55%),
    #190f12;
  overflow: hidden;
}

@media (min-width: 768px) {
  .ht-canvas-wrap {
    min-height: 460px;
  }
}

.ht-axis {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c49a59 8%, #c49a59 92%, transparent);
  transform: translateY(-50%);
  opacity: 0.85;
}

.ht-period-lane {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 1rem 0;
}

.ht-period-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(196, 154, 89, 0.4);
  background: rgba(53, 35, 38, 0.9);
  color: #e4c58c;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.ht-period-chip.is-active,
.ht-period-chip:hover {
  border-color: #c49a59;
  color: #f4e6d1;
}

.ht-track {
  position: relative;
  height: 280px;
  margin: 1rem 0 2rem;
  touch-action: pan-y;
  cursor: grab;
}

.ht-track.is-panning {
  cursor: grabbing;
}

.ht-world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.ht-event {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #c49a59;
  background: #2a1a1c;
  cursor: pointer;
  z-index: 2;
}

.ht-event.is-range {
  width: auto;
  height: 8px;
  border-radius: 4px;
  min-width: 24px;
}

.ht-event.is-approx {
  border-style: dashed;
}

.ht-event.is-selected,
.ht-event:focus-visible {
  outline: 2px solid #f4e6d1;
  outline-offset: 3px;
  background: #742b32;
}

.ht-event-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  width: 140px;
  text-align: center;
  font-size: 0.68rem;
  color: #d5ba99;
  pointer-events: none;
}

.ht-event.is-above .ht-event-label {
  top: auto;
  bottom: calc(100% + 10px);
}

.ht-mobile-list {
  display: block;
  padding: 0.85rem;
}

@media (min-width: 768px) {
  .ht-mobile-list.is-desktop-hide {
    display: none;
  }
}

.ht-card {
  border-radius: 0.75rem;
  border: 1px solid rgba(98, 68, 60, 0.5);
  background: rgba(42, 26, 28, 0.9);
  padding: 0.85rem;
}

.ht-paper {
  border-radius: 0.75rem;
  background: #f5ebdd;
  color: #33241f;
  padding: 0.9rem;
}

.ht-chip {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(196, 154, 89, 0.4);
  padding: 0.1rem 0.5rem;
  font-size: 0.68rem;
  color: #e4c58c;
}

.ht-stat {
  border-radius: 0.75rem;
  border: 1px solid rgba(98, 68, 60, 0.5);
  background: rgba(42, 26, 28, 0.75);
  padding: 1rem;
  text-align: center;
}

.ht-stat-num {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.75rem;
  color: #e4c58c;
}

.ht-input,
.ht-select {
  width: 100%;
  border-radius: 0.55rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: #2a1a1c;
  color: #f4e6d1;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
}

.ht-input:focus,
.ht-select:focus {
  border-color: #c49a59;
  outline: none;
}

.ht-empty {
  border-radius: 0.75rem;
  border: 1px dashed rgba(98, 68, 60, 0.65);
  padding: 1rem;
  text-align: center;
  color: #d5ba99;
  font-size: 0.85rem;
}

.ht-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ht-table-wrap {
  overflow: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(98, 68, 60, 0.5);
}

.ht-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.ht-table th,
.ht-table td {
  border-bottom: 1px solid rgba(98, 68, 60, 0.35);
  padding: 0.6rem 0.5rem;
  text-align: left;
  font-size: 0.82rem;
  vertical-align: top;
}

.ht-table th { color: #e4c58c; font-weight: 500; }
.ht-table td { color: #d5ba99; }
.ht-table tr.is-active td { background: rgba(116, 43, 50, 0.25); }

.ht-drawer,
.ht-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.ht-drawer.is-open,
.ht-sheet.is-open { display: block; }

.ht-drawer-overlay,
.ht-sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 15, 18, 0.72);
}

.ht-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: min(100%, 320px);
  overflow: auto;
  background: #2a1a1c;
  border-right: 1px solid rgba(98, 68, 60, 0.55);
  padding: 1rem;
}

.ht-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 560px);
  overflow: auto;
  background: #2a1a1c;
  border-top: 1px solid rgba(98, 68, 60, 0.55);
  border-radius: 1rem 1rem 0 0;
  padding: 1rem;
}

.ht-mobile-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(98, 68, 60, 0.45);
}

@media (min-width: 1100px) {
  .ht-mobile-bar { display: none; }
}

.ht-explorer.is-fs-fallback {
  position: fixed;
  inset: 0;
  z-index: 90;
  border-radius: 0;
  max-height: 100vh;
  overflow: auto;
}

.ht-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 95;
  transform: translateX(-50%) translateY(120%);
  border-radius: 0.65rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: #2a1a1c;
  color: #f4e6d1;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.ht-toast.is-open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.ht-compare-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .ht-compare-grid { grid-template-columns: 1fr 1fr; }
}

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

@media print {
  .ht-toolbar, .ht-mobile-bar, .site-header, footer, [data-scroll-top] {
    display: none !important;
  }
}
