@import url("https://fonts.googleapis.com/css?family=Raleway");

:root {
  --glow-color: hsl(186 100% 69%);
  --border-color: hsla(186, 100%, 69%, 0.35);
  --bg-gradient: linear-gradient(135deg, #161b21 0%, #1a2632 60%, #1e2430 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg-gradient);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  padding: 20px;
  text-align: center;
  display: block;
}

/* Chat Container */
.chat-container {
  max-width: 1500px;
  width: 70%;
  margin: 0 auto;
  padding: 15px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: rgba(10, 20, 28, 0.89);
  box-shadow: 0 1px 14px 0 #0ff2;
  height: 900px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  z-index: 1000;
  scroll-behavior: smooth; /* Smooth scrolling for auto-scroll */
}

/* Chat Message */
.chat-message {
  display: flex;
  margin: 6px 8px;
  max-width: 80%;
  flex-direction: row;
  align-items: flex-start;
}

.chat-message.ai-message.banner .chat-text {
  background: var(--glow-color);
  color: #000;
  font-weight: 600;
  text-align: center;
  width: 100%;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 0 10px var(--glow-color);
}

.user-message {
  align-self: flex-end;
}

.ai-message {
  align-self: flex-start;
}

/* Chat Text */
.chat-text {
  background: rgba(20, 30, 38, 0.8);
  border-radius: 8px;
  padding: 8px 12px;
  position: relative;
  font-size: 10px; /* Reduced from 11px to fit more text */
  line-height: 1.4; /* Slightly tightened for more content */
}

.user-message .chat-text {
  background: #4fff97;
  color: #000;
}

.ai-message .chat-text {
  background: rgba(20, 30, 38, 0.8);
  color: #fff;
}

/* Chat Nickname */
.chat-nickname {
  font-size: 8px; /* Reduced slightly for consistency */
  color: #a8b4c2;
  margin-bottom: 3px;
}

.user-message .chat-nickname {
  color: #000;
}

/* Chat Avatar */
.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
}

.chat-message.ai-message .chat-avatar.initial,
.chat-message.user-message .chat-avatar.initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px; /* Увеличен для эмодзи */
  font-weight: bold;
  border: 1px solid var(--border-color);
}

.chat-message.ai-message .chat-avatar.initial {
  background: #4fff97;
  color: #000;
}

.chat-message.user-message .chat-avatar.initial {
  background: #ffeb3b;
  color: #000;
}

/* Chat Content */
.chat-content {
  font-size: 10px; /* Reduced from 11px to fit more text */
  line-height: 1.4;
}

/* Chat Quote */
.chat-quote {
  border-left: 2px solid #ffeb3b;
  padding-left: 8px;
  margin: 5px 0;
  font-size: 10px; /* Reduced for consistency */
  color: #a8b4c2;
}

.user-message .chat-quote {
  border-left-color: #000;
}

/* Typing Indicator */
#typing-indicator {
  font-size: 10px; /* Reduced for consistency */
  color: #4fff97;
  margin: 8px 10px;
  text-align: left;
  font-weight: 600;
}

/* Chat Input */
.chat-input {
  max-width: 1500px;
  width: 90%;
  margin: 10px auto;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: transparent;
}

.chat-input input {
  flex: 1;
  padding: 8px; /* Increased padding for comfort */
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: rgba(20, 30, 38, 0.8);
  color: #fff;
  font-size: 14px; /* Increased from 10px for better visibility */
}

.chat-input input:focus {
  outline: none;
  border-color: var(--glow-color);
}

.chat-input button {
  padding: 8px 14px; /* Slightly larger for balance */
  background: var(--glow-color);
  border: none;
  border-radius: 6px;
  color: #000;
  font-weight: 600;
  font-size: 12px; /* Increased for consistency */
  cursor: pointer;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: hsl(186, 100%, 80%);
}

/* Yellow Link Style */
.yellow-link {
  color: #ffeb3b;
  font-weight: bold;
  text-decoration: none;
}

.yellow-link:hover {
  text-decoration: underline;
}

/* Rest of your CSS remains unchanged, included for completeness */
.video-container {
  display: flex;
  justify-content: center;
  margin: 40px 0;
}

.video-frame {
  background: rgba(16, 26, 33, 0.98);
  border: 2px solid var(--border-color);
  border-radius: 22px;
  padding: 14px 12px 8px 12px;
  width: 95%;
  max-width: 900px;
  box-shadow: 0 4px 40px 0 #07e7f599, 0 2px 12px #001c22b8;
  transition: box-shadow 0.25s;
}

.video-frame:hover {
  box-shadow: 0 0 80px 0 #0ff8, 0 2px 12px #001c22b8;
}

.video-frame video {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: none;
  background: #0c1015;
}

.image-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.image-container img {
  max-width: 100%;
  height: auto;
  border: 1px solid #fff;
}

.content {
  text-align: center;
  margin: 20px auto;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content:has(.news-item) {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 300px;
  grid-gap: 20px;
}

.news-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(10, 20, 28, 0.89);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px #00ffe888;
  transition: transform 0.2s;
  width: 100%;
  min-width: 200px;
  max-width: 280px;
  min-height: 280px;
  max-height: 300px;
  box-sizing: border-box;
  overflow: hidden;
}

.news-item:hover {
  transform: translateY(-4px);
}

.news-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  max-height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
}

.news-content {
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.news-meta {
  font-size: 10px;
  color: #a8b4c2;
  margin-bottom: 8px;
}

.news-content h2 {
  font-size: 14px;
  margin: 0 0 8px;
  line-height: 1.4;
}

.news-content h2 a {
  color: #4fff97;
  text-decoration: none;
}

.news-content h2 a:hover {
  text-decoration: underline;
}

.news-content p {
  font-size: 12px;
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-content p a {
  color: #ffeb3b;
  text-decoration: none;
  font-weight: bold;
}

.news-content p a:hover {
  text-decoration: underline;
}

.news-footer {
  font-size: 10px;
  color: #a8b4c2;
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  max-width: 100%;
  overflow: hidden;
}

.news-categories,
.news-sentiment {
  flex: 1;
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 50%;
  white-space: normal;
}

.news-sentiment {
  text-align: right;
}

.instruction-item {
  margin: 8px 0;
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
}

h1 {
  font-size: 36px;
  margin-bottom: 20px;
}

h2 {
  font-size: 30px;
  margin-top: 20px;
}

h2 a {
  color: #4fff97;
  text-decoration: none;
}

h2 a:hover {
  text-decoration: underline;
}

p {
  font-size: 18px;
  margin: 10px 0;
}

a {
  color: #ffeb3b;
  font-weight: bold;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style-type: none;
  padding: 0;
  font-size: 18px;
}

ul li {
  margin: 10px 0;
}

ul li a {
  color: #ffeb3b;
  font-weight: bold;
  text-decoration: none;
}

ul li a:hover {
  text-decoration: underline;
}

hr {
  border: 1px solid #444;
  margin: 10px 0;
  width: 100%;
}

.instructions-list {
  list-style: none;
  text-align: left;
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: rgba(10, 20, 28, 0.89);
  box-shadow: 0 1px 14px 0 #0ff2;
  counter-reset: instruction-counter;
}

.instructions-list li {
  margin: 15px 0;
  font-size: 18px;
  position: relative;
  padding-left: 40px;
}

.instructions-list li:before {
  content: counter(instruction-counter);
  counter-increment: instruction-counter;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--glow-color);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background-color: #111;
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 16px;
}

.footer {
  background: rgba(10, 25, 32, 0.8);
  color: #fff;
  padding: 20px 0;
  text-align: center;
  margin-top: 40px;
  border-top: 2px solid var(--border-color);
  box-shadow: 0 -2px 10px #0ff2;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.footer-links a {
  color: #cff;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.footer-links a:hover {
  background: var(--glow-color);
  color: #000;
  text-decoration: none;
}

.partners {
  margin: 10px 0;
}

.partner-logo {
  max-width: 200px;
  height: auto;
  background: transparent;
  border-radius: 7px;
  box-shadow: 0 0 18px #00ffe888;
  border: 1px solid var(--border-color);
  padding: 10px;
  filter: brightness(1.2);
}

.copyright {
  font-size: 14px;
  color: #a8b4c2;
}

.diods {
  position: relative;
  top: -2em;
  display: flex;
  gap: 2em;
  justify-content: center;
}

.diod {
  width: 1em;
  height: 1em;
  background-color: hsl(180 16% 40%);
  border-radius: 99em;
  box-shadow: 
    inset -1px -2px 6px 2px hsl(144 50% 0% / 60%),
    inset -2px -3px 6px 2px hsl(144 50% 0% / 50%),
    inset 1px 2px 4px hsl(144 50% 0% / 60%),
    inset 0px 1px 2px hsl(144 50% 0% / 80%),
    inset 0 1px 2px 1px hsl(144 50% 0% / 40%),
    0 1px 1px 1px hsl(144 50% 80% / 10%),
    0 0 0 1px hsl(144 50% 0% / 50%);
}

.diod__active {
  background-color: hsl(144 100% 65%);
  box-shadow: 
    inset -1px -2px 6px 2px hsl(144 50% 0% / 60%),
    inset -2px -3px 6px 2px hsl(144 50% 0% / 50%),
    inset 1px 2px 4px hsl(144 50% 0% / 60%),
    inset 0px 1px 2px hsl(144 50% 0% / 80%),
    inset 0 1px 2px 1px hsl(144 50% 0% / 40%),
    0 1px 1px 1px hsl(144 50% 80% / 10%),
    0 1px 12px 1px hsl(144 50% 50% / 40%),
    0 0 0 1px hsl(144 50% 0% / 50%);
}

.diod__active + .diod {
  background: linear-gradient(to right, hsl(144 60% 60%), hsl(180 16% 40%) 45%);
}

.glowing-btn {
  position: relative;
  color: var(--glow-color);
  cursor: pointer;
  padding: 0.25em 0.7em;
  border: 0.13em solid var(--glow-color);
  border-radius: 0.45em;
  background: none;
  perspective: 2em;
  font-family: "Raleway", sans-serif;
  font-size: 1.2em;
  font-weight: 900;
  letter-spacing: 0.25em;
  margin: 0 0.3em 0.5em 0;
  transition: color 0.2s, background 0.2s;
  box-shadow: inset 0px 0px 0.5em 0px var(--glow-color), 0px 0px 0.5em 0px var(--glow-color);
  animation: border-flicker 2s linear infinite;
}

.glowing-txt {
  float: left;
  margin-right: -0.35em;
  text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3), 0 0 0.45em var(--glow-color);
  animation: text-flicker 3s linear infinite;
}

.faulty-letter {
  opacity: 0.5;
  animation: faulty-flicker 2s linear infinite;
}

.glowing-btn::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  opacity: 0.7;
  filter: blur(1em);
  transform: translateY(120%) rotateX(95deg) scale(1, 0.35);
  background: var(--glow-color);
  pointer-events: none;
}

.glowing-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  z-index: -1;
  background-color: var(--glow-color);
  box-shadow: 0 0 2em 0.2em var(--glow-color);
  transition: opacity 100ms linear;
}

.glowing-btn:hover {
  color: rgba(0, 0, 0, 0.8);
  text-shadow: none;
  animation: none;
  background: var(--glow-color);
}

.glowing-btn:hover .glowing-txt {
  animation: none;
}

.glowing-btn:hover .faulty-letter {
  animation: none;
  text-shadow: none;
  opacity: 1;
}

.glowing-btn:hover::before {
  filter: blur(1.5em);
  opacity: 1;
}

.glowing-btn:hover::after {
  opacity: 1;
}

@keyframes faulty-flicker {
  0% { opacity: 0.1; }
  2% { opacity: 0.1; }
  4% { opacity: 0.5; }
  19% { opacity: 0.5; }
  21% { opacity: 0.1; }
  23% { opacity: 1; }
  80% { opacity: 0.5; }
  83% { opacity: 0.4; }
  87% { opacity: 1; }
}

@keyframes text-flicker {
  0% { opacity: 0.1; }
  2% { opacity: 1; }
  8% { opacity: 0.1; }
  9% { opacity: 1; }
  12% { opacity: 0.1; }
  20% { opacity: 1; }
  25% { opacity: 0.3; }
  30% { opacity: 1; }
  70% { opacity: 0.7; }
  72% { opacity: 0.2; }
  77% { opacity: 0.9; }
  100% { opacity: 0.9; }
}

@keyframes border-flicker {
  0% { opacity: 0.1; }
  2% { opacity: 1; }
  4% { opacity: 0.1; }
  8% { opacity: 1; }
  70% { opacity: 0.7; }
  100% { opacity: 1; }
}

.btns {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1em 0.5em;
  margin: 20px auto 10px auto;
  border-radius: 2em;
  z-index: 10;
  background: none;
  box-shadow: none;
}

.btns:before {
  display: none;
}

@media only screen and (max-width: 900px) {
  .content:has(.news-item) {
    grid-template-columns: repeat(2, 1fr);
  }
  .chat-container {
    max-width: 95%;
    height: 400px;
  }
}

@media only screen and (max-width: 600px) {
  .content:has(.news-item) {
    grid-template-columns: 1fr;
  }
  .glowing-btn {
    font-size: 1em;
    letter-spacing: 0.1em;
    padding: 0.17em 0.45em;
    margin: 0 0 0.7em 0;
    min-width: 90px;
    max-width: 98vw;
  }
  .btns {
    flex-direction: column;
    gap: 8px;
    padding: 0.5em 0.2em;
  }
  .news-item {
    max-width: 90vw;
    min-width: 0;
  }
  .news-image {
    max-width: 100%;
    max-height: 120px;
  }
  .news-footer {
    flex-direction: column;
    text-align: center;
  }
  .news-categories,
  .news-sentiment {
    text-align: center;
    max-width: 100%;
  }
  .chat-container {
    max-width: 95%;
    height: 400px;
    padding: 10px;
  }
  .chat-message {
    margin: 4px 6px;
    max-width: 85%;
  }
  .chat-text {
    font-size: 9px; /* Further reduced for mobile */
    padding: 6px 10px;
  }
  .chat-nickname {
    font-size: 7px;
  }
  .chat-content {
    font-size: 9px;
  }
  .chat-input input,
  .chat-input button {
    font-size: 12px; /* Slightly smaller for mobile but still readable */
  }
  .instruction-item {
    font-size: 9px;
  }
}

/* Code Container */
.code-container {
  max-width: 1200px;
  margin: 20px auto;
  text-align: left;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 14px;
}

/* Video Poster */
.video-frame video {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: none;
    background: #0c1015;
    object-fit: cover; /* Подгоняет SVG-заставку под размеры видео */
}

/* Убедимся, что контейнер адаптивен */
.video-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.video-frame {
    background: rgba(16, 26, 33, 0.98);
    border: 2px solid var(--border-color);
    border-radius: 22px;
    padding: 14px 12px 8px 12px;
    width: 95%;
    max-width: 900px;
    box-shadow: 0 4px 40px 0 #07e7f599, 0 2px 12px #001c22b8;
    transition: box-shadow 0.25s;
}

.video-frame:hover {
    box-shadow: 0 0 80px 0 #0ff8, 0 2px 12px #001c22b8;
}