
:root {
  --border-color: rgba(255, 255, 255, 0.08);
  --background-color: rgba(12, 16, 24, 0.34);
  --background-color-overlay: rgba(12, 16, 24, 0.66);
  --backdrop-filter: saturate(180%) blur(15px);
  --box-shadow-color: 0 8px 24px rgba(0, 0, 0, 0.7);
  --homepage-title-gradient: linear-gradient(90deg, var(--teal-500), var(--pink-500));
}

.header {
  position: sticky;
  top: 0;
  z-index: 9999;
  
}

.header__bar {
  display: grid;
  align-items: center;
  /* Five equal anchors to keep exact center at 50% */
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 5px clamp(16px, 3vw, 35px);
  border-radius: 0 0 30px 30px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--backdrop-filter);
  box-shadow: var(--box-shadow-color);
  position: relative; 
}

.header__left {
  grid-column: 1;
  justify-self: start;
}

.header__left-inner {
  grid-column: 2;
  justify-self: start; /* dodge away from center */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;        /* allow shrinking */
  flex-wrap: wrap;     /* wrap its own content before affecting center */
}

.header__center {
  grid-column: 3;
  justify-self: center; /* keep centered at all times */
  white-space: nowrap;  /* avoid wrapping center content if possible */
  min-width: 0;         /* allow shrinking within the grid cell */
}

.header__right-inner {
  grid-column: 4;
  justify-self: end;    /* dodge away from center */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;        /* allow shrinking */
  flex-wrap: wrap;     /* wrap its own content before affecting center */
}

.header__avatar {
  width: clamp(28px, 3.2vw, 42px);
  height: clamp(28px, 3.2vw, 42px);
  border-radius: 999px;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}


#about-toggle i { margin-left: 5px; }


#about-toggle .btn__label { font-size: 13px; line-height: 1; }

.header__right {
  grid-column: 5;
  justify-self: end;
}

.header__title {
  font-family: var(--font-title);
  font-weight: var(--fw-title);
  font-size: clamp(20px, 2.6vw, 28px);
  background: var(--homepage-title-gradient);
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 720px) {
  .header__title { display: none; }
  /* When title hides, move avatar + About into its left slot */
  .header__left { display: none; }
  .header__left-inner { grid-column: 1; justify-self: start; }
}


.header__bar.timers-layout {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Center icon nav should not wrap globally inside header */
.header__center .buttons { flex-wrap: nowrap; }

/* Keep timers icon nav on one line */
.header__bar.timers-layout .buttons { flex-wrap: nowrap; }

/* Header-scoped responsive sizing for social/home buttons */
.header .buttons { gap: clamp(6px, 1.4vw, 10px); }
.header .buttons .buttons__link {
  width: clamp(28px, 3.2vw, 38px);
  height: clamp(28px, 3.2vw, 38px);
}
.header .buttons .buttons__link i { font-size: clamp(14px, 1.8vw, 18px); }

/* About button scales with width */
#about-toggle.buttons__link.btn {
  padding: clamp(6px, 0.9vw, 8px) clamp(8px, 1.2vw, 12px);
}
#about-toggle .btn__label { font-size: clamp(11px, 1.1vw, 13px); }
#about-toggle i { font-size: clamp(12px, 1.6vw, 16px); }

/* Hide About label a bit earlier to avoid wrapping */
@media (max-width: 700px) {
  #about-toggle .btn__label { display: none; }
  /* Remove extra gap when label is hidden */
  #about-toggle i { margin-left: 0; }
}

/* At <=1366px, keep left/center on first row and wrap right controls below spanning full width */
@media (max-width: 1366px) {
  .header__bar.timers-layout { grid-auto-flow: row; }
  .header__bar.timers-layout .header__left,
  .header__bar.timers-layout .header__left-inner,
  .header__bar.timers-layout .header__center,
  .header__bar.timers-layout .header__right-inner { grid-row: 1; }
  .header__bar.timers-layout .header__right {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
  .header__bar.timers-layout .buttons { gap: 8px; }
}


.timer-controls {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 12px);
  flex-wrap: nowrap; /* keep controls on a single line */
  min-width: 0;
}

.timer-control-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.timer-control-wrapper::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: auto;
}

.timer-control {
  position: relative;
  cursor: pointer;
}


.timer-control-wrapper:hover .timer-control::before,
.timer-control:hover::before {
  opacity: 1;
  animation: socials-gradient-rotate 12s linear infinite;
}

.timer-control-slider {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.timer-control-slider::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: auto;
}

.timer-control-wrapper:hover .timer-dropdown,
.timer-control-slider:hover .slider-container {
  display: block;
}

.slider-container {
  display: none;
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 120px;
  z-index: 10000;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: var(--glass-shadow);
}

.slider-container input[type="range"] {
  width: 100%;
  margin: 4px 0;
}

.slider-container span {
  font-size: 12px;
  color: var(--text-1);
  text-align: center;
  display: block;
}

.timer-dropdown {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px;
  min-width: 160px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10000;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: var(--glass-shadow);
  display: none;
}

.dropdown-option {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-1);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}


.dropdown-option::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 4px;
  background: conic-gradient(
    from var(--border-angle, 225deg),
    var(--teal-500) 0deg,
    var(--pink-500) 180deg,
    var(--teal-500) 360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.dropdown-option:hover::before,
.dropdown-option.active::before {
  opacity: 1;
  animation: dropdown-gradient-rotate 3s linear infinite;
}

@keyframes dropdown-gradient-rotate {
  from { --border-angle: 225deg; }
  to { --border-angle: 585deg; }
}

.dropdown-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-option.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--teal-400);
}

.dropdown-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.dropdown-option.disabled::before {
  display: none;
}

.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

.blacklist-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.blacklist-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.blacklist-option input[type="checkbox"] {
  margin: 0;
}

.blacklist-option label {
  color: var(--text-1);
  cursor: pointer;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .socials__link:hover::before,
  .socials__link:focus-visible::before { animation: none; }
}


.introduction-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.introduction-modal-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-backdrop);
  border-radius: 16px;
  padding: 32px;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.introduction-modal-content h2 {
  color: var(--text-1);
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 28px;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.introduction-modal-content h3 {
  color: var(--text-1);
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 20px;
}

.introduction-modal-content p {
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
}

.introduction-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: var(--text-2);
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.introduction-close:hover,
.introduction-close:focus {
  color: var(--text-1);
}

.introduction-section {
  margin-bottom: 24px;
}

.introduction-controls,
.introduction-table-guide {
  margin-top: 24px;
}

.introduction-control-item,
.introduction-table-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.introduction-table-item {
  flex-direction: column;
  gap: 4px;
}

.introduction-control-item i {
  color: var(--teal-500);
  font-size: 24px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.introduction-control-item strong,
.introduction-table-item strong {
  color: var(--text-1);
  display: block;
  margin-bottom: 4px;
}

.introduction-control-item p,
.introduction-table-item p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

@media (max-width: 1024px) {
  
  .header__bar.timers-layout .header__title {
    display: none;
  }
  
  
  .timer-controls { gap: 6px; }
  /* On timers layout, when title hides earlier, also move avatar + About left */
  .header__bar.timers-layout .header__left { display: none; }
  .header__bar.timers-layout .header__left-inner { grid-column: 1; justify-self: start; }
}

/* Below 1250px, move socials (center) to the right slot visually */
@media (max-width: 1250px) {
  .header__bar .header__center {
    grid-column: 5;         /* occupy the right grid column */
    justify-self: end;      /* align to the right edge */
  }
}

@media (max-width: 768px) {
  
  .timer-controls {
    flex-wrap: nowrap;
    gap: 4px;
  }
  
  .timer-control {
    width: 32px;
    height: 32px;
  }
  
  .timer-control i {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .header__bar { gap: 8px; padding: 8px clamp(10px, 3vw, 18px); }
  .socials { gap: 8px; }
  .socials__link { width: 34px; height: 34px; }
  .socials__link i { font-size: 16px; }
  .socials__link .icon { width: 16px; height: 16px; }
  
  
  .timer-controls { 
    gap: 4px;
    flex-wrap: nowrap; /* prevent wrapping even on very small screens */
  }
  .timer-dropdown { min-width: 140px; }
  
  
  .header__bar.timers-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .header__bar.timers-layout .header__left {
    display: none;
  }
  
  .header__bar.timers-layout .header__center {
    grid-column: 1;
    justify-self: center;
  }
  
  .header__bar.timers-layout .header__right {
    grid-column: 1;
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .introduction-modal-content {
    padding: 20px;
    max-width: 95%;
  }
  
  .introduction-control-item,
  .introduction-table-item {
    flex-direction: column;
    gap: 8px;
  }
}