/**
  Theme + Tokens
*/
:root{
  --c-green: #2ecc71;
  --c-yellow:#f1c40f;
  --c-red:   #e74c3c;

  --c-green-text: black;
  --c-yellow-text:black;
  --c-red-text:   white;

  --cell-h: 14px;
  --cell-w: 14px;
  --cell-gap: 2px
}

:root[data-theme="cb"]{
  --c-green: #0072B2;
  --c-yellow:#E69F00;
  --c-red:   #CC79A7;

  --c-green-text: white;
  --c-yellow-text:black;
  --c-red-text:   black;
}

/**
  Base
*/
html, body {
  max-width: 100%;
  overflow-x: visible;
}

body {
  font-family: system-ui, sans-serif;
  margin: 20px;
  background: #111;
  color: #eee;
}

header h1 {
  margin-bottom: 4px;
}

.subtitle {
  color: #aaa;
  font-size: 15px;
}

.team-note {
  color: #aaa;
  margin: 5px 0px;
  font-size: 15px;
}

.legend-note{
  color: #aaa;
  margin: 5px 0px;
  font-size: 12px;
}

.legend-item{
  margin: 2px 0px;
}

.github-info,
.github-link {
  color: #777;
}

.github-info {
  font-size: 11px;
}

/**
  Layout
*/
main{
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  align-items: start;
}

.team-view {
  margin: 15px 0;
}

.team-view:first-of-type {
  margin-top: 5px 0;
}

.team-view.gigo{
  grid-column: 1 / -1;
}

.view-grid{
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(clamp(280px, 100%, 520px), 1fr)
  );
  gap: 0px 28px;
  align-items: start;
}

.views-root{
  position: relative;
}

/**
  Bars / Cells
*/
.team-head h3 {
  margin-bottom: 12px;
  line-height: 1.15;
}

.bar {
  display: flex;
  gap: var(--cell-gap);
}

.cell {
  width: var(--cell-w);
  height: var(--cell-h);
  border-radius: 5px;
  position: relative;
  opacity: 0.3;
  cursor: pointer;
  will-change: transform, filter;
  box-sizing: border-box;
}

.cell.green { background: var(--c-green); }
.cell.yellow { background: var(--c-yellow); }
.cell.red { background: var(--c-red); }

.swatch-green { background: var(--c-green); }
.swatch-yellow { background: var(--c-yellow); }
.swatch-red { background: var(--c-red); }    

.swatch-green,
.swatch-yellow,
.swatch-red {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 5px;
  margin-right: 3px;
  vertical-align: middle;
}


.cell .tie {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #000;

  pointer-events: none;
}

.gigo .grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(12px, 1fr));
  gap: 2px;
  max-width: 100%;
}

.team-view.gigo {
  overflow-x: auto;
}


.cell.dim { opacity: 0.18; }
.cell.match { opacity: 1; }
.cell.hover { outline: none; z-index:2; box-shadow: inset 0 0 0 2px #fff;}

.team.winner{
  font-weight: bold;
  text-decoration: underline;
}

.team.loser,
.team.draw,
.team.symbol{
  color:#aaa;
}

#filters .match { margin: 8px 0; }


.match-label { font-size: 12px; color: #aaa; margin-bottom: 6px; }
.match-buttons { display: flex; gap: 6px; }
button.opt {
  background: #222; color: #ddd; border: 1px solid #444;
  padding: 4px 8px; border-radius: 8px; cursor: pointer; line-height: 1.2; width: 40px;
}
button.opt.active {
  border-color: #fff;
  color: #fff;
  font-weight: bold;
  border: 3px solid;
}

.cell.empty { background: transparent; border: 1px dashed #333; opacity: 0.4; }

.rows { display: grid; gap: 5px; }
.row { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 1px; grid-auto-rows: 13px;}
.row-label { color:#aaa; font-weight:700; font-size:12px; text-align:center; }

/**
  GIGO Matrix
*/
.gigo-matrix{
  display: grid;
  grid-template-columns:
    10px
    repeat(3, max-content);
  grid-template-rows:
    10px
    repeat(3, max-content);
  column-gap: 10px;
  row-gap: 10px;
  align-items: center;
}

.corner {
  width: 64px;
  height: 32px;
}

.col-h {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  font-weight: 600;
}

.row-h{
  display: flex;
  align-items: center;    
  justify-content: center; 

  writing-mode: sideways-lr;
  text-orientation: mixed;

  color: #aaa;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 600;

  user-select: none;
}

.gigo-board {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 15px;
  padding: 7px 0px;
}

.gigo-block{
  background: rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 7px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
}

.gigo-block .block-title { font-size: 11px; color: #aaa;}

.grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 16px);
  gap: 2px;
  margin-top: 3px;
  margin-bottom: 3px;
}

/**
  Controls
*/
.lang-switch{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 90px;
  gap:8px;
  margin-top:8px;
}

.lang-btn,
.cb-btn,
.clear-btn{
  background:#222;
  color:#ddd;
  border:1px solid #444;
  padding:4px 10px;
  border-radius:10px;
  cursor:pointer;
  line-height: 1.2;
}

.lang-btn.active{
  border-color:#fff;
  color:#fff;
}

.cb-btn.active{
  background: #f2f2f2;
  color: #111;
  border-color: #f2f2f2;
}

/**
  Tooltip / Callout
*/
.tooltip{
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(0,0,0,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  transform: translate(10px, 10px);
}

/* callout bubble */
.callout{
  position: absolute;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.70);
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  line-height: 1.25;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  z-index: 50;
}

/* triangle arrow */
.callout::after{
  content:"";
  position:absolute;
  width:0;
  height:0;
  border:8px solid transparent;
  border-top-color: rgba(255,255,255,0.25);
  bottom:-16px;
  left: 250px;
}

/* Optional: distinct styles */
#callout-fiveway::after{
  left: 130px;
}

/**
  Easter Eggs
*/
@font-face {
	font-family: "Optimus Princeps";
	src: url('OptimusPrinceps.ttf') format('truetype');
}
dialog.ds-popup{
	/* box */
	position: fixed;
	z-index: 99;
	top: 20%;
	width: 100%;

	/* text */
	text-align: center;
	font-size: 2.5em;
	font-family: 'Optimus Princeps', 'Times New Roman', sans-serif;
	padding: 0;

	/* colors */
	background-color: #000;
	color: red;

	/* effects */
	border: none;
	box-shadow: 
		0 0 .5em 1em #000, 
		0 0 0 1000px rgba(50, 50, 50, 0.5) ;
	text-shadow: 0 0 1.2em orangered;

	/* animation */
	animation-name: ds-popup-anim;
	animation-duration: 10s;
	animation-iteration-count: 1;
}

@keyframes ds-popup-anim {
	from {
		opacity: 0;
		font-size: 1.5em;
		text-shadow: 0 0 .6em orange;
	}

	15%{
		opacity: 1;
		text-shadow: 0 0 1em orangered;
	}

	95%{
		opacity: 1;
	}

	to {
		font-size: 2em;
		opacity: 0;
	}
}

.easter img {
    max-width: 100%;
    height: auto;
    display: block;
}

#easter-title {
    white-space: nowrap;
}

#easter-text {
  	color: white;
    font-size: 0.7em;
    font-weight: normal;
    text-shadow: 0 0 0 white;
}

/**
  Responsive
*/
.status-lights{
  gap: 5px;
  align-items: center;
  flex-wrap: nowrap;            /* keep on one line */
  overflow-x: auto;             /* if too narrow, scroll only this row */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox hide scrollbar */
  padding: 8px 6px;
  margin: 0px 0 0px;
}

.status-lights::-webkit-scrollbar{
  display: none;                /* Chrome/Safari hide scrollbar */
}

/* each team lamp */
.lamp{
  flex: 0 0 auto;
  width: 0.1fr;
  height: 25px;
  line-height: 25px;           
  display: grid;
  place-items: center;
  /* border-radius: 10px; */
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.6px;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(0,0,0,0.80);    
}

/* states */
.lamp.green{
  background: var(--c-green);
  color: var(--c-green-text);
}

.lamp.yellow{
  background: var(--c-yellow);
  color: var(--c-yellow-text);
}

.lamp.red{
  background: var(--c-red);
  color: var(--c-red-text);
}

.lamp.off{
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  border-color: rgba(255,255,255,0.08);
}

@media (min-width: 1500px){
  .view-grid{
    grid-template-columns: repeat(3, minmax(480px, 1fr));
  }
}

@media (max-width: 1200px){
  main{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px){
  .view-grid{
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px){
  #device-note {display: none;}
  #statusLightsDesktop{
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  #statusLights{
    display: none;
  }
}

@media (max-width: 900px){
  #panel-head {display: none;}
  #clearFilters {display: none;}
  #callout-apina{ display:none !important; }
  #callout-fiveway{ display:none !important; }
  #tooltip {display: none;}

  .filters-panel{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(17,17,17,0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .match-filters{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0px 0px;
  }

  body{
    padding-bottom: 250px; 
  }

  #statusLights{
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #statusLightsDesktop{
    display: none;
  }
}

@media (max-width: 420px){
  .lamp{
    width: 48px;
    height: 28px;
    font-size: 11px;
    border-radius: 9px;
  }
}

@media (max-width: 480px){
  .view-grid{
    --cell-w: clamp(9px, 2.4vw, 14px);
    --cell-gap: clamp(1px, 0.6vw, 2px)
  }
}

@supports (padding: env(safe-area-inset-bottom)){
  .status-lights{
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}
