/* Original Youtube-inspired video controls for the Greek colonies map.
   Familiar placement, responsive touch targets, functional map-specific tools. */
#historyStage{
  isolation:isolate;
  color:#fff;
  background:#101010;
  box-shadow:0 6px 26px #0a23302a;
}
#historyStage>svg{
  width:100%;
  height:auto;
  display:block;
  touch-action:pan-y;
}
#historyMapCaption,
#historyStage:fullscreen #historyMapCaption,
#historyStage.history-expanded #historyMapCaption{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:auto;
  z-index:4;
  padding:15px 18px 36px!important;
  margin:0;
  color:white!important;
  background:linear-gradient(to bottom,#0009 0%,#0005 48%,transparent 100%)!important;
  text-align:left;
  font-weight:600;
  font-size:clamp(12px,2.2vw,16px);
  text-shadow:0 1px 2px #000d;
  pointer-events:none;
}
#historyPlayer,
#historyStage:fullscreen #historyPlayer,
#historyStage.history-expanded #historyPlayer{
  position:absolute;
  z-index:8;
  left:0;right:0;bottom:0;
  color:#fff;
  background:linear-gradient(to top,#000d 0%,#000b 26%,transparent 100%);
  padding:29px 12px 7px;
  display:flex;
  flex-direction:column;
  gap:2px;
  box-sizing:border-box;
  transition:opacity .18s ease,transform .18s ease;
}
#historyProgress{height:16px;display:flex;align-items:center;position:relative;cursor:pointer;z-index:9}
#historySeek{
  width:100%;margin:0;cursor:pointer;
  height:4px;min-height:4px;
  border:0;border-radius:0;
  appearance:none;-webkit-appearance:none;
  background:linear-gradient(to right,#ff0033 0%,#ff0033 var(--progress,0%),#ffffff9c var(--progress,0%),#ffffff9c 100%);
  transition:height .12s ease;
}
#historyProgress:hover #historySeek,
#historyProgress:focus-within #historySeek{height:6px;min-height:6px}
#historySeek::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:12px;height:12px;background:#ff0033;border:none;border-radius:50%;
  transform:scale(0);transition:transform .1s ease;
}
#historySeek::-moz-range-thumb{
  width:12px;height:12px;background:#ff0033;border:0;border-radius:50%;
  transform:scale(0);transition:transform .1s ease;
}
#historyProgress:hover #historySeek::-webkit-slider-thumb,
#historyProgress:focus-within #historySeek::-webkit-slider-thumb{transform:scale(1)}
#historyProgress:hover #historySeek::-moz-range-thumb,
#historyProgress:focus-within #historySeek::-moz-range-thumb{transform:scale(1)}
#historyHoverTime{
  position:absolute;bottom:19px;left:50%;transform:translateX(-50%);
  color:white;background:#141414eb;white-space:nowrap;
  padding:6px 8px;border-radius:4px;
  font-variant-numeric:tabular-nums;font-size:12px;
  pointer-events:none;
  opacity:0;transition:opacity .1s ease;
  box-shadow:0 2px 12px #0009;
}
#historyProgress:hover #historyHoverTime:not(.hidden){opacity:1}
#historyControls,
#historyStage:fullscreen #historyControls,
#historyStage.history-expanded #historyControls{
  display:flex!important;
  align-items:center;
  justify-content:space-between!important;
  gap:3px;
  width:100%;
  padding:0!important;
  margin:0!important;
  flex-wrap:nowrap!important;
}
#historyControls .history-left,
#historyControls .history-right{
  display:flex;align-items:center;gap:2px;
  min-width:0;
}
#historyControls .history-right{margin-left:auto;justify-content:flex-end}
#historyControls button,
#historyStage:fullscreen #historyControls button,
#historyStage.history-expanded #historyControls button{
  flex:0 0 auto;
  position:relative;
  display:inline-flex;align-items:center;justify-content:center;
  color:#fff!important;
  background:transparent!important;
  box-shadow:none!important;
  border:0!important;
  border-radius:3px;
  margin:0!important;padding:7px!important;
  min-width:40px!important;min-height:40px!important;
  outline-offset:1px;
  font-size:19px;
}
#historyControls button:focus-visible,
#historyCenterPlay:focus-visible,
#historySeek:focus-visible,
#historySpeedMenu button:focus-visible{outline:2px solid #fff;outline-offset:2px}
#historyControls button:hover{background:#ffffff25!important}
#historyControls button[disabled]{opacity:.35;cursor:default}
#historyControls .hidden{display:none!important}
#historyControls .line-icon{width:23px;height:23px;stroke:#fff!important;stroke-width:2.05}
#historyTime{
  margin-left:5px;margin-right:7px;
  display:inline-block;
  color:#fff;
  font-size:12px!important;
  font-weight:400;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
  letter-spacing:0;
}
#historyNoSound{
  width:32px;min-height:39px;display:inline-flex;align-items:center;justify-content:center;
  opacity:.63;cursor:default;
}
#historyNoSound .line-icon{width:22px;height:22px}
#historyCC[aria-pressed="true"]::after{
  content:"";height:3px;background:#ff0033;
  position:absolute;bottom:3px;left:12px;right:12px;border-radius:2px;
}
#historySpeedMenu{
  display:grid;
  position:absolute;
  right:53px;bottom:67px;
  z-index:11;
  width:208px;max-height:min(64dvh,320px);overflow:auto;
  background:#171717f5;color:#fff;
  box-shadow:0 3px 26px #000b;
  border-radius:9px;padding:8px 0;
}
#historySpeedMenu.hidden{display:none!important}
#historySpeedMenu .history-menu-title{
  padding:7px 14px 9px;
  margin:0;
  font-size:12px;font-weight:650;
  border-bottom:1px solid #ffffff35;
}
#historySpeedMenu button{
  color:#fff;background:transparent;border:0;cursor:pointer;
  text-align:left;padding:10px 18px;font:inherit;font-size:13px;
  min-height:38px;width:100%;display:flex;justify-content:space-between;align-items:center;
}
#historySpeedMenu button:hover,
#historySpeedMenu button[aria-checked="true"]{background:#ffffff29}
#historySubtitles{
  position:absolute;
  bottom:94px;left:8%;right:8%;
  z-index:5;
  margin:0 auto;
  width:max-content;max-width:84%;
  padding:4px 9px;
  background:#080808bf;color:#fff;
  text-align:center;font-size:clamp(13px,2.5vw,19px);line-height:1.38;
  text-shadow:0 1px 2px #000;
  pointer-events:none;
}
#historySubtitles.hidden{display:none!important}
#historyCenterPlay{
  position:absolute;z-index:6;
  left:50%;top:50%;transform:translate(-50%,-50%);
  width:68px;height:68px;border-radius:50%;
  border:0;background:#151515a6;color:#fff;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  transition:opacity .17s ease,background .17s ease;
}
#historyCenterPlay .line-icon{width:31px;height:31px;stroke:#fff;stroke-width:2.1}
#historyCenterPlay:hover{background:#111d}
#historyStage.history-playing #historyCenterPlay{opacity:0;pointer-events:none}
#historyStage.history-playing.history-idle:not(:hover):not(:focus-within) #historyPlayer{
  opacity:0;pointer-events:none;transform:translateY(8px);
}
#historyStage.history-theater:not(:fullscreen):not(.history-expanded){
  width:min(96vw,1250px)!important;
  left:50%;
  transform:translateX(-50%);
  max-width:none;
  border-radius:3px;
}
#historyStage:fullscreen,
#historyStage.history-expanded{
  background:#101010;
  position:fixed;
  inset:0;
  width:100vw;height:100dvh;
  max-width:none;
  border:0;
  margin:0;
  padding:0;
  border-radius:0;
  z-index:9999;
  display:flex;align-items:center;justify-content:center;
}
#historyStage:fullscreen>svg,
#historyStage.history-expanded>svg{
  width:100%;height:100%;max-height:none;
  flex:1 1 100%;min-height:0;
  object-fit:contain;
}
#historyStage:fullscreen #historySubtitles,
#historyStage.history-expanded #historySubtitles{bottom:115px}
#historyStage:fullscreen #historyPlayer,
#historyStage.history-expanded #historyPlayer{padding:40px 24px 10px}
#historyStage:fullscreen #historySpeedMenu,
#historyStage.history-expanded #historySpeedMenu{right:65px;bottom:80px}
@media(max-width:540px){
  #historyControls #historyNextRoute,
  #historyControls #historyNoSound,
  #historyControls #historyTheater{display:none!important}
  #historyControls button{min-width:36px!important;padding:6px!important}
  #historyControls #historyTime{margin-left:3px;margin-right:1px;font-size:11px!important}
  #historyPlayer{padding:20px 6px 5px}
  #historySpeedMenu{right:38px;bottom:60px;width:190px}
  #historyMapCaption{font-size:12px;padding:10px 11px 26px!important}
  #historyCenterPlay{width:56px;height:56px}
}
@media(hover:none){
  #historyStage.history-playing.history-idle #historyPlayer{opacity:1;pointer-events:auto;transform:none}
  #historySeek::-webkit-slider-thumb{transform:scale(1)}
  #historySeek::-moz-range-thumb{transform:scale(1)}
}
@media(prefers-reduced-motion:reduce){
  #historyPlayer,#historyCenterPlay,#historySeek{transition:none!important}
}
