*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: auto;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: url('img/astronaut-on-mars-stockcake.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 80px 20px 20px;
  position: relative;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.541);
  background-blend-mode: overlay;
}

body::before {
  display: none;
}

#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.3;
}

.page-header {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
}

.hamburger {
  display: none; 
  position: fixed;
  top: 15px;
  left: 15px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 20;
  padding: 5px;
}

.hamburger .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #f5e6d3; 
  margin: 5px 0;
  transition: all 0.3s ease;
}

.hamburger.active .bar:nth-child(2) {
  opacity: 0;
}

.hamburger.active .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.active .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.menu {
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  background: #000000; 
  border-right: 2px solid #000000; 
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 15;
  padding: 60px 20px 20px;
  flex-direction: column;
  gap: 10px;
}

.menu.open {
  transform: translateX(0);
}

.useful-links {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 10;
}

.useful-links-mobile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-button {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(45deg, #D95C3A, #F28C5C);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 8px rgba(217, 92, 58, 0.5);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent);
  background-size: 4px 4px;
}

.link-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(217, 92, 58, 0.7), 0 0 12px rgba(217, 92, 58, 0.8);
  background: linear-gradient(45deg, #FFAA80, #FFDAB9);
}

.animated-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #ffffff;
  -webkit-text-stroke: 1px #000000;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: neonPulse 2s ease-in-out infinite;
}

.slogan {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  color: #ffffff;
  -webkit-text-stroke: 0.5px #000000;
  margin-top: 8px;
  opacity: 0;
  animation: fadeIn 1s ease-in forwards 0.5s;
}

@keyframes neonPulse {
  0%, 100% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
  50% { text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.blurred-key {
  filter: blur(4px);
  cursor: pointer;
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  font-size: 12px;
  transition: filter 0.3s ease;
}

.blurred-key.revealed {
  filter: blur(0);
}

.mac-window {
  width: 900px;
  height: 600px;
  background: #f5e6d3;
  border: 2px solid #422800;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mac-window__titlebar {
  height: 40px;
  background: #e6d5c0;
  border-bottom: 1px solid #422800;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.traffic-lights {
  display: flex;
  gap: 8px;
  margin-right: 16px;
}

.traffic-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.traffic-light.red { background-color: #ff5f57; }
.traffic-light.yellow { background-color: #ffbd2e; }
.traffic-light.green { background-color: #28c840; }

.traffic-light:hover {
  transform: scale(1.2);
}

.window-title {
  font-weight: 500;
  font-size: 14px;
  color: #422800;
}

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  background: #f5e6d3;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #f8e8d8;
  border-right: 1px solid #422800;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  border-bottom-left-radius: 16px;
  overflow-y: auto;
}

.sidebar button {
  background-color: #fbeee0;
  border: 2px solid #422800;
  border-radius: 15px;
  box-shadow: #422800 4px 4px 0 0;
  color: #422800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-weight: 600;
  font-size: 12px;
  padding: 0 10px;
  line-height: 36px;
  text-align: left;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.sidebar button:hover {
  background-color: #fff;
}

.sidebar button:active {
  box-shadow: #422800 2px 2px 0 0;
  transform: translate(2px, 2px);
}

.sidebar button .icon {
  font-size: 14px;
  transition: transform 0.2s;
}

.sidebar button:hover .icon {
  transform: scale(1.2);
}

.log-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f5e6d3;
}

.log-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 10px;
  background: #e6d5c0;
  border-bottom: 1px solid #422800;
}

.log-actions button {
  background-color: #fbeee0;
  border: 2px solid #422800;
  border-radius: 15px;
  box-shadow: #422800 4px 4px 0 0;
  color: #422800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  font-weight: 600;
  font-size: 12px;
  padding: 0 12px;
  line-height: 36px;
  text-align: center;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.log-actions button:hover {
  background-color: #fff;
}

.log-actions button:active {
  box-shadow: #422800 2px 2px 0 0;
  transform: translate(2px, 2px);
}

.log-actions button .icon {
  font-size: 14px;
  transition: transform 0.2s;
}

.log-actions button:hover .icon {
  transform: scale(1.2);
}

.content-area {
  padding: 10px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.4;
  color: #422800;
  background: #f5e6d3;
  border-bottom-right-radius: 16px;
}

.content-area a {
  color: #6B7280;
  text-decoration: underline;
  transition: color 0.2s;
}

.content-area a:hover {
  color: #4B5563;
}

.content-area > *:not(button):not(#qrcodeArea) {
  background: #f8e8d8;
  border: 1px solid #422800;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  max-width: 100%;
  overflow: hidden;
}

.content-area h2 {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 600;
  color: #422800;
}

.content-area p {
  margin-bottom: 0;
  color: #422800;
}

#qrcodeArea {
  max-width: 100%;
  overflow: hidden;
}

#qrcodeArea canvas {
  max-width: 100%;
  height: auto;
}

/* Стили для списка инструкций */
.content-area ul {
  padding-left: 20px;
  margin: 10px 0;
}

.content-area li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 10px;
  background: #f8e8d8;
  border: 1px solid #422800;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  max-width: 100%;
  overflow: hidden;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #422800;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #422800;
  border-radius: 4px;
  background: #fff;
  color: #422800;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #6B7280;
  box-shadow: 0 0 5px rgba(107, 114, 128, 0.3);
}

button.btn-action {
  background-color: #fbeee0;
  border: 2px solid #422800;
  border-radius: 15px;
  box-shadow: #422800 4px 4px 0 0;
  color: #422800;
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  font-size: 12px;
  padding: 0 10px;
  line-height: 36px;
  text-align: center;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
  margin-right: 8px;
  margin-bottom: 10px;
}

button.btn-action:hover {
  background-color: #fff;
}

button.btn-action:active {
  box-shadow: #422800 2px 2px 0 0;
  transform: translate(2px, 2px);
}

.log-container {
  flex: 1;
  background: #f8e8d8;
  padding: 10px;
  overflow-y: auto;
  min-height: 0;
  border-bottom-right-radius: 16px;
}

.log-line {
  margin-bottom: 6px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: #422800;
}

.code-like {
  font-family: "Courier New", monospace;
  background: #f1f1f1;
  padding: 2px 4px;
  border-radius: 4px;
  color: #422800;
  display: inline-block;
  line-height: 1.2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.mac-window__footer {
  background: #422800;
  color: #f5e6d3;
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

/* 4K и большие экраны (≥ 2560px) */
@media (min-width: 2560px) {
  body {
    background-position: 20% 80%;
    padding: 120px 40px 40px;
  }
  .animated-title {
    font-size: 60px;
    -webkit-text-stroke: 1.5px #000000;
  }
  .slogan {
    font-size: 24px;
    -webkit-text-stroke: 0.8px #000000;
  }
  .page-header {
    top: 30px;
  }
  .useful-links {
    top: 30px;
    right: 30px;
    gap: 12px;
  }
  .link-button {
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 8px;
  }
  .mac-window {
    width: 1200px;
    height: 800px;
    border-radius: 20px;
  }
  .mac-window__titlebar {
    height: 50px;
    padding: 0 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }
  .traffic-light {
    width: 18px;
    height: 18px;
  }
  .window-title {
    font-size: 18px;
  }
  .sidebar {
    width: 300px;
    padding: 15px;
    gap: 12px;
    border-bottom-left-radius: 20px;
  }
  .sidebar button {
    font-size: 16px;
    padding: 0 14px;
    line-height: 48px;
    border-radius: 18px;
  }
  .sidebar button .icon {
    font-size: 18px;
  }
  .content-area {
    padding: 15px;
    font-size: 18px;
    line-height: 1.5;
    border-bottom-right-radius: 20px;
  }
  .content-area h2 {
    font-size: 20px;
  }
  .content-area p {
    font-size: 16px;
  }
  .form-group {
    padding: 15px;
  }
  .form-group label {
    font-size: 16px;
  }
  .form-group input {
    font-size: 16px;
    padding: 10px 12px;
  }
  button.btn-action {
    font-size: 16px;
    padding: 0 14px;
    line-height: 48px;
    border-radius: 18px;
  }
  .log-actions {
    padding: 15px;
    gap: 12px;
  }
  .log-actions button {
    font-size: 16px;
    padding: 0 16px;
    line-height: 48px;
    border-radius: 18px;
  }
  .log-actions button .icon {
    font-size: 18px;
  }
  .log-container {
    padding: 15px;
    border-bottom-right-radius: 20px;
  }
  .log-line {
    font-size: 16px;
    margin-bottom: 8px;
  }
  .mac-window__footer {
    font-size: 16px;
    padding: 10px 0;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }
}

/* Планшеты (768px - 1280px) */
@media (min-width: 768px) and (max-width: 1280px) {
  body {
    background-position: 30% 70%;
    padding: 100px 30px 30px;
  }
  .animated-title {
    font-size: 36px;
    -webkit-text-stroke: 0.8px #000000;
  }
  .slogan {
    font-size: 16px;
    -webkit-text-stroke: 0.4px #000000;
  }
  .page-header {
    top: 20px;
  }
  .useful-links {
    position: static; 
    margin-bottom: 20px; 
    display: flex;
    justify-content: center; 
    gap: 8px;
    flex-wrap: wrap;
  }
  .link-button {
    font-size: 11px;
    padding: 5px 10px;
  }
  .mac-window {
    width: 100%;
    max-width: 1000px;
    height: 650px;
    border-radius: 14px;
  }
  .mac-window__titlebar {
    height: 45px;
    padding: 0 15px;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
  }
  .traffic-light {
    width: 12px;
    height: 12px;
  }
  .window-title {
    font-size: 13px;
  }
  .sidebar {
    width: 200px;
    padding: 8px;
    gap: 6px;
    border-bottom-left-radius: 14px;
  }
  .sidebar button {
    font-size: 11px;
    padding: 0 8px;
    line-height: 32px;
    border-radius: 12px;
  }
  .sidebar button .icon {
    font-size: 12px;
  }
  .content-area {
    padding: 8px;
    font-size: 13px;
    border-bottom-right-radius: 14px;
  }
  .content-area h2 {
    font-size: 14px;
  }
  .content-area p {
    font-size: 12px;
  }
  .form-group {
    padding: 8px;
  }
  .form-group label {
    font-size: 12px;
  }
  .form-group input {
    font-size: 12px;
    padding: 6px 8px;
  }
  button.btn-action {
    font-size: 11px;
    padding: 0 8px;
    line-height: 32px;
    border-radius: 12px;
  }
  .log-actions {
    padding: 8px;
    gap: 8px;
  }
  .log-actions button {
    font-size: 11px;
    padding: 0 10px;
    line-height: 32px;
    border-radius: 12px;
  }
  .log-actions button .icon {
    font-size: 12px;
  }
  .log-container {
    padding: 8px;
    border-bottom-right-radius: 14px;
  }
  .log-line {
    font-size: 12px;
  }
  .mac-window__footer {
    font-size: 12px;
    padding: 6px 0;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
  }
}

/* Мобильные (< 768px) */
@media (max-width: 767px) {
  body {
    background-position: 40% 60%;
    padding: 60px 10px 10px;
  }
  .animated-title {
    font-size: 28px;
    -webkit-text-stroke: 0.5px #000000;
  }
  .slogan {
    font-size: 14px;
    -webkit-text-stroke: 0.3px #000000;
  }
  .page-header {
    top: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hamburger {
    display: block; 
  }
  .menu {
    display: flex;
    max-width: 300px; 
    height: auto;
    border-radius: 12px;
    max-height: 100vh; 
  }
  .useful-links {
    display: none; 
  }
  .menu .useful-links-mobile {
    display: flex; 
  }
  .link-button {
    font-size: 12px;
    padding: 8px 12px;
    width: 100%;
    text-align: center;
  }
  .mac-window {
    width: 90%;
    max-width: 340px;
    height: calc(100vh - 140px);
    min-height: 480px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: none;
    border: 1px solid #422800;
  }
  .mac-window__titlebar {
    height: 35px;
    padding: 0 10px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
  .traffic-light {
    width: 10px;
    height: 10px;
  }
  .window-title {
    font-size: 12px;
  }
  .content-wrapper {
    flex-direction: column;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 6px;
    border-right: none;
    border-bottom: 1px solid #422800;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 6px;
    border-bottom-left-radius: 0;
  }
  .sidebar button {
    width: auto;
    font-size: 10px;
    padding: 0 6px;
    line-height: 28px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .sidebar button .icon {
    font-size: 10px;
  }
  .content-area {
    font-size: 12px;
    padding: 6px;
    border-bottom-right-radius: 12px;
  }
  .content-area h2 {
    font-size: 14px;
  }
  .content-area p {
    font-size: 11px;
  }
  .content-area > *:not(button):not(#qrcodeArea) {
    padding: 6px;
    margin-bottom: 6px;
  }
  .form-group {
    padding: 6px;
    margin-bottom: 6px;
  }
  .form-group label {
    font-size: 11px;
  }
  .form-group input {
    font-size: 11px;
    padding: 5px 6px;
  }
  button.btn-action {
    font-size: 10px;
    padding: 0 6px;
    line-height: 28px;
    border-radius: 10px;
  }
  .log-actions {
    padding: 6px;
    gap: 6px;
  }
  .log-actions button {
    font-size: 10px;
    padding: 0 8px;
    line-height: 28px;
    border-radius: 10px;
  }
  .log-actions button .icon {
    font-size: 10px;
  }
  .log-container {
    padding: 6px;
    border-bottom-right-radius: 12px;
  }
  .log-line {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .mac-window__footer {
    font-size: 11px;
    padding: 5px 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }
  .blurred-key {
    font-size: 10px;
  }
}

@media (max-width: 400px) {
  body {
    background-position: 50% 50%;
    padding: 50px 5px 5px;
  }
  .animated-title {
    font-size: 24px;
    -webkit-text-stroke: 0.4px #000000;
  }
  .slogan {
    font-size: 12px;
    -webkit-text-stroke: 0.2px #000000;
  }
  .page-header {
    top: 5px;
  }
  .hamburger {
    top: 10px;
    left: 10px;
  }
  .hamburger .bar {
    width: 20px;
    height: 2px;
    margin: 4px 0;
  }
  .menu {
    max-width: 250px;
    padding: 50px 15px 15px;
  }
  .link-button {
    font-size: 11px;
    padding: 6px 10px;
  }
  .mac-window {
    width: 95%;
    max-width: 320px;
    height: calc(100vh - 120px);
    min-height: 450px;
    border-radius: 10px;
  }
  .mac-window__titlebar {
    height: 30px;
    padding: 0 8px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
  .traffic-light {
    width: 8px;
    height: 8px;
  }
  .window-title {
    font-size: 11px;
  }
  .sidebar {
    padding: 4px;
    gap: 4px;
  }
  .sidebar button {
    font-size: 9px;
    padding: 0 5px;
    line-height: 24px;
    border-radius: 8px;
  }
  .sidebar button .icon {
    font-size: 8px;
  }
  .content-area {
    font-size: 11px;
    padding: 5px;
    border-bottom-right-radius: 10px;
  }
  .content-area h2 {
    font-size: 12px;
  }
  .content-area p {
    font-size: 10px;
  }
  .content-area > *:not(button):not(#qrcodeArea) {
    padding: 5px;
    margin-bottom: 5px;
  }
  .form-group {
    padding: 5px;
    margin-bottom: 5px;
  }
  .form-group label {
    font-size: 10px;
  }
  .form-group input {
    font-size: 10px;
    padding: 4px 5px;
  }
  button.btn-action {
    font-size: 9px;
    padding: 0 5px;
    line-height: 24px;
    border-radius: 8px;
  }
  .log-actions {
    padding: 5px;
    gap: 4px;
  }
  .log-actions button {
    font-size: 9px;
    padding: 0 6px;
    line-height: 24px;
    border-radius: 8px;
  }
  .log-actions button .icon {
    font-size: 8px;
  }
  .log-container {
    padding: 5px;
    border-bottom-right-radius: 10px;
  }
  .log-line {
    font-size: 10px;
    margin-bottom: 3px;
  }
  .mac-window__footer {
    font-size: 10px;
    padding: 4px 0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
  }
  .blurred-key {
    font-size: 9px;
  }
}

.loader {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-block;
  border-top: 4px solid #FFF;
  border-right: 4px solid transparent;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}
.loader::after {
  content: '';  
  box-sizing: border-box;
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border-left: 4px solid #FF3D00;
  border-bottom: 4px solid transparent;
  animation: rotation 0.5s linear infinite reverse;
}
@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}