* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}


.nowrap {
  white-space: nowrap;
}

.search-container {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 auto;
}

canvas.webgl-background {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
}


.headline {
  text-align: right;
  margin-bottom: 20px;
  font-size: 1.5rem;
  display: block;
}

/* SEARCH BAR */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 3px solid transparent;
  transition: border-color 0.3s ease;
  width: 100%;
}

.search-bar:has(input:focus) {
  border-color: #000000;
}

.search-bar input {
  flex: 1 1 0%;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 10px 15px;
  color: #000;
  background: transparent;
}

/* CLEAR BUTTON */
.clear-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #000000;
  cursor: pointer;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  visibility: hidden;
}

.search-bar input:not(:placeholder-shown) + .clear-btn {
  visibility: visible;
}

.clear-btn:hover {
  color: #ffffff;
}

.search-btn span {
  font-size: 1.5rem;
  line-height: 1;
}

/* OUTPUT */
#output {
  display: none;
  margin-top: 30px;
  background-color: #000000e3;
  border-left: 4px solid #ffffff;
  padding: 20px;
  border-radius: 10px;
  color: #eeeeee;
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 0 20px rgba(0, 255, 247, 0.05);
}

/* PYTHON / JAVA BLOCKS */
#custom-block,
#python-block,
#java-block,
#javascript-block {
  display: none;
  margin-top: 2em;
  color: #ffffff;
}


.notion-render p {
  margin: 0.5em 0;
  font-size: 1.1em;
  line-height: 1.6;
}

.notion-render h1 {
  font-size: 1.6em;
  margin-top: 1em;
}

.notion-render h2 {
  font-size: 1.3em;
  margin-top: 1em;
}

.notion-render li {
  margin-left: 1.5em;
  list-style-type: disc;
}

#course-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
}

#course-popup.show {
  display: block;
}

#course-popup .popup-inner {
  max-width: 960px;
  margin: 5vh auto;
  background: #fff;
  border-radius: 12px;
  padding: 2em;
  overflow: auto;
  max-height: 90vh;
}

#course-popup-content {
  background: none;
}



/* RESPONSIVE */
@media (max-width: 768px) {
  .headline {
    font-size: 1.2rem;
  }

  .search-container {
    margin-bottom: 20%;
  }

  .search-bar {
    padding: 8px 10px;
  }

  .search-bar input {
    font-size: 1rem;
    padding: 8px 10px;
  }

  .clear-btn {
    font-size: 1rem;
    width: 28px;
    height: 28px;
  }

  .search-btn {
    width: 44px;
    height: 44px;
  }

  .search-btn span {
    font-size: 1.3rem;
  }
}

.circle-arrow {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  visibility: hidden;
}

.search-bar input:not(:placeholder-shown) ~ .circle-arrow {
  visibility: visible;
}


#clear-blocks-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  width: 30px;  /* уменьшено в 2 раза */
  height: 30px;

  font-weight: bold;
  font-size: 0.8rem;
  color: #ffffff; /* текст непрозрачный */

  background-color: rgba(255, 255, 255, 0.1); /* только фон прозрачный */
  border: 0;
  border-radius: 50%;

  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;

  margin: 20px 0 0 auto;
}

#clear-blocks-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  border: 2px solid rgba(255, 0, 0, 0.3);
}

.webgl-background { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }


/* Пока грузится — центрируем и резервируем место под лоадер */
#output.is-loading {
  display: grid !important;
  place-items: center;
  min-height: 120px; /* при желании подправь/убери */
}

/* Контейнер прелоадера */
.preloader {
  display: inline-flex;        /* ряд по умолчанию */
  align-items: center;
  gap: .5rem;
  font: inherit;
  flex-wrap: wrap;             /* NEW: позволяем перенос на новую строку */
  justify-content: center;     /* NEW: центрируем и картинку, и текст */
}

/* Размер SVG управляется переменной */
.preloader__svg {
  width: var(--loader-size, 250px);
  height: auto;                /* NEW: сохраняем пропорции */
  max-width: 80vw;             /* NEW: не вылезаем за экран на мобилках */
  display: block;
}

/* Текст: не рвём слово, можно встать на новую строку ЦЕЛИКОМ */
.preloader__text {
  opacity: .8;
  white-space: nowrap;         /* NEW: запретить разрывы внутри слова */
  word-break: normal;          /* NEW: переопределяем #output { word-break: break-word } */
  overflow-wrap: normal;       /* NEW */
}

/* Если у пользователя отключены анимации — скрываем картинку */
@media (prefers-reduced-motion: reduce) {
  .preloader__svg { display: none; }
}

/* Узкие экраны: жёстко кладём текст ПОД логотип */
@media (max-width: 560px) {
  .preloader {
    flex-direction: column;    /* NEW: всегда снизу */
    gap: 8px;
  }
}
