body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  background: #f9fbff;
  color: #1a2a44;
  scroll-behavior: smooth;
  counter-reset: article-counter;
}

article h3::before {
  counter-increment: article-counter;
  content: counter(article-counter) ". ";
  font-weight: bold;
}

body,
p,
h1,
h2,
h3,
h4,
h5,
h6,
li {
  text-align: justify;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-align: justify;
  text-justify: inter-word;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin: 15px 0;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
}

img:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

#menu {
  display: flex;
  justify-content: center;
  gap: 20px;
  background: #3f8efc;
  padding: 12px 0;
}
#menu .button {
  color: white;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 6px;
  transition: background 0.3s;
}
#menu .button:hover {
  background: rgba(255, 255, 255, 0.2);
}

hr {
  border: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #3f8efc 20%,
    #1f6fe0 50%,
    #3f8efc 80%,
    transparent 100%
  );
  margin: 40px 0;
  border-radius: 2px;
  opacity: 0.7;
  box-shadow: 0 2px 8px rgba(63, 142, 252, 0.2);
  transition: all 0.3s ease;
}

hr:hover {
  opacity: 1;
  transform: scaleX(1.02);
  box-shadow: 0 4px 12px rgba(63, 142, 252, 0.3);
}

.essay-nav,
.scientific-nav,
.ind-nav,
.resume-nav {
  background: #1f6fe0;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 900;
  padding: 10px 0;
}

.essay-nav .menu-toggle,
.scientific-nav .menu-toggle,
.ind-nav .menu-toggle,
.resume-nav .menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  margin-right: 15px;
}

.essay-nav .nav-links,
.scientific-nav .nav-links,
.ind-nav .nav-links,
.resume-nav .nav-links {
  display: flex;
  gap: 15px;
}

.essay-nav .nav-links a,
.scientific-nav .nav-links a,
.ind-nav .nav-links a,
.resume-nav .nav-links a {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.3s;
}

.essay-nav .nav-links a:hover,
.scientific-nav .nav-links a:hover,
.ind-nav .nav-links a:hover,
.resume-nav .nav-links a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.topblock {
  background: #003366;
  color: white;
  text-align: right;
  padding: 8px 15px;
  font-size: 14px;
}

.topblock a {
  color: #fff;
  text-decoration: none;
  margin-left: 12px;
}

#references a,
.toc-container a,
.work-item a,
#past-research a,
#sources a {
  color: #1a2a44;
  text-decoration: none;
  margin-left: 12px;
}

#references a,
.toc-container a,
.work-item a:hover,
#past-research a:hover,
#sources a:hover,
.topblock a:hover {
  text-decoration: none;
}

header {
  background: linear-gradient(135deg, #3f8efc, #1f6fe0);
  color: white;
  padding: 40px 0;
}
header .container {
  display: flex;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

header:not(:has(.container)) {
  display: block;
}

header:not(:has(.container)) h1,
header:not(:has(.container)) .meta {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
  text-align: center;
}

@keyframes salto {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

header .photo img {
  width: 180px;
  height: auto;
  border: 4px solid white;
  margin-right: 25px;
  transition: transform 0.4s ease;
  cursor: pointer;
}
header .photo img:hover {
  transform: scale(1.08) rotate(2deg);
}
header .photo img.salto {
  animation: salto 1s ease-in-out;
}
header .info h1 {
  margin: 0 0 15px 0;
  font-size: 28px;
}
header .info h3,
header .info h4 {
  margin: 6px 0;
  font-weight: normal;
}

h1 {
  margin: 10px 0 5px;
  font-size: 2.2rem;
}
h2 {
  margin: 0;
  font-weight: 400;
  font-size: 1.2rem;
  color: #f0f6ff;
}

#table-of-contents h2,
#own-publications h2,
#supervisor-publications h2,
#translated-works h2,
.page-title {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: 30px 0;
  padding: 10px 20px;
}

#table-of-contents h2,
#own-publications h2,
#supervisor-publications h2,
#translated-works h2,
.page-title h2 {
  font-size: 2em;
  font-weight: bold;
  color: #1a2a44;
  margin: 0;
  font-family: "Arial", sans-serif;
}

section {
  max-width: 800px;
  margin: 60px auto;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s ease;
}
section.show {
  opacity: 1;
  transform: translateY(0);
}

section h3 {
  border-left: 5px solid #3f8efc;
  padding-left: 10px;
  margin-bottom: 15px;
  font-size: 1.4rem;
}

ul {
  list-style: none;
  padding: 0;
}
ul li {
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
  opacity: 0;
  transform: translateX(-20px);
  animation: fadeInLeft 0.6s forwards;
}
ul li:nth-child(1) {
  animation-delay: 0.2s;
}
ul li:nth-child(2) {
  animation-delay: 0.4s;
}
ul li:nth-child(3) {
  animation-delay: 0.6s;
}
ul li:nth-child(4) {
  animation-delay: 0.8s;
}

ul li::before {
  content: «•«;
  color: #3f8efc;
  position: absolute;
  left: 0;
}

@keyframes fadeInLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

footer {
  text-align: center;
  padding: 30px 15px;
  font-size: 0.9rem;
  color: #555;
}

#table-of-contents ul,
#past-research ul,
#sources ul,
#soft ul,
#hobby ul,
#general ul,
#pro ul {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 10px 0 25px;
}

#table-of-contents ul {
  flex-direction: column;
  align-items: flex-start;
}

#table-of-contents ul li,
#past-research ul li,
#sources ul li,
#soft ul li,
#hobby ul li,
#general ul li,
#pro ul li {
  background: #e9f2ff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.95rem;
  color: #1a2a44;
  transition: transform 0.3s, background 0.3s;
}

#table-of-contents ul li:hover,
#past-research ul li:hover,
#sources ul li:hover {
  transform: scale(1.05);
  background: #d3e6ff;
}

#table-of-contents ul li::before,
#past-research ul li::before,
#sources ul li::before,
#soft ul li::before,
#hobby ul li::before,
#pro ul li::before {
  content: none !important;
}

header .info a,
#contact a {
  color: inherit;
  text-decoration: none;
  font-weight: normal;
  cursor: pointer;
}

header .info a:hover,
#contact a:hover {
  text-decoration: underline;
}

#scroll-top,
#scroll-bottom {
  position: fixed;
  right: 20px;
  width: 50px;
  height: 50px;
  font-size: 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3f8efc, #1f6fe0);
  color: #fff;
  cursor: pointer;
  z-index: 1000;
  opacity: 0.85;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  opacity: 0.6;
}

#scroll-top:hover,
#scroll-bottom:hover {
  transform: scale(1.1);
  opacity: 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#scroll-top {
  bottom: 80px;
}

#scroll-bottom {
  bottom: 20px;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: white;
}

.comparison-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  font-size: 0.9em;
  margin: 0;
}

.comparison-table th,
.comparison-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  white-space: nowrap;
}

.comparison-table th {
  background-color: #3f8efc;
  color: white;
  position: sticky;
  left: 0;
}

.comparison-table tbody tr:nth-of-type(even) {
  background-color: #f8fbff;
}

.comparison-table tbody tr:hover {
  background-color: #e9f2ff;
}

.comparison-table td:nth-child(n + 2) {
  white-space: normal;
  min-width: 150px;
}

.algorithm-step {
  background: #f0f7ff;
  border-left: 4px solid #3f8efc;
  padding: 15px;
  margin: 15px 0;
  border-radius: 0 8px 8px 0;
}

.algorithm-step h4 {
  margin-top: 0;
  color: #1f6fe0;
}

.source-link {
  color: #0066cc;
  text-decoration: none;
  font-weight: bold;
  margin: 0 2px;
}
.source-link:hover {
  text-decoration: underline;
}

.image-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  text-align: center;
  flex-wrap: wrap;
  flex-direction: column;
}

#solutions-analysis ul {
  list-style: none;
  padding-left: 0;
}

#solutions-analysis ul li {
  position: relative;
  padding-left: 1.2em;
  margin-bottom: 0.5em;
}

#solutions-analysis ul li::before {
  content: "•";
  color: #3f8efc;
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Стили для нумерованных списков в разделах */
#intro ol,
#actual ol,
#goals ol,
#optimization-methods ol,
#metrics ol,
#criterion ol,
#conclusion ol {
  list-style: none;
  padding: 0;
  margin: 15px 0 20px;
  counter-reset: list-counter;
}

#intro ol li,
#actual ol li,
#goals ol li,
#optimization-methods ol li,
#metrics ol li,
#criterion ol li,
#conclusion ol li {
  counter-increment: list-counter;
  position: relative;
  padding: 12px 0 12px 45px;
  margin-bottom: 15px;
  background: #f0f7ff;
  border-radius: 8px;
  border-left: 4px solid #3f8efc;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateX(-20px);
  animation: fadeInLeft 0.6s forwards;
}

#intro ol li:hover,
#actual ol li:hover,
#goals ol li:hover,
#optimization-methods ol li:hover,
#metrics ol li:hover,
#criterion ol li:hover,
#conclusion ol li:hover {
  background: #e9f2ff;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(63, 142, 252, 0.15);
}

#intro ol li::before,
#actual ol li::before,
#goals ol li::before,
#optimization-methods ol li::before,
#metrics ol li::before,
#criterion ol li::before,
#conclusion ol li::before {
  content: counter(list-counter) ".";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #3f8efc;
  font-weight: bold;
  font-size: 1.1em;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Анимация для списков */
#intro ol li:nth-child(1),
#actual ol li:nth-child(1),
#goals ol li:nth-child(1),
#optimization-methods ol li:nth-child(1),
#metrics ol li:nth-child(1),
#criterion ol li:nth-child(1),
#conclusion ol li:nth-child(1) {
  animation-delay: 0.2s;
}

#intro ol li:nth-child(2),
#actual ol li:nth-child(2),
#goals ol li:nth-child(2),
#optimization-methods ol li:nth-child(2),
#metrics ol li:nth-child(2),
#criterion ol li:nth-child(2),
#conclusion ol li:nth-child(2) {
  animation-delay: 0.4s;
}

#intro ol li:nth-child(3),
#actual ol li:nth-child(3),
#goals ol li:nth-child(3),
#optimization-methods ol li:nth-child(3),
#metrics ol li:nth-child(3),
#criterion ol li:nth-child(3),
#conclusion ol li:nth-child(3) {
  animation-delay: 0.6s;
}

#intro ol li:nth-child(4),
#actual ol li:nth-child(4),
#goals ol li:nth-child(4),
#optimization-methods ol li:nth-child(4),
#metrics ol li:nth-child(4),
#criterion ol li:nth-child(4),
#conclusion ol li:nth-child(4) {
  animation-delay: 0.8s;
}

/* Стили для маркированных списков */
#intro ul,
#actual ul,
#goals ul,
#optimization-methods ul,
#metrics ul,
#criterion ul,
#conclusion ul {
  list-style: none;
  padding: 0;
  margin: 15px 0 20px;
}

#intro ul li,
#actual ul li,
#goals ul li,
#optimization-methods ul li,
#metrics ul li,
#criterion ul li,
#conclusion ul li {
  position: relative;
  padding: 8px 0 8px 35px;
  margin-bottom: 10px;
  opacity: 0;
  transform: translateX(-20px);
  animation: fadeInLeft 0.6s forwards;
}

#intro ul li::before,
#actual ul li::before,
#goals ul li::before,
#optimization-methods ul li::before,
#metrics ul li::before,
#criterion ul li::before,
#conclusion ul li::before {
  content: "•";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #3f8efc;
  font-weight: bold;
  font-size: 1.5em;
  line-height: 1;
}

#intro ul li strong,
#actual ul li strong,
#goals ul li strong,
#optimization-methods ul li strong,
#metrics ul li strong,
#criterion ul li strong,
#conclusion ul li strong {
  color: #1f6fe0;
  font-weight: 600;
}

/* Анимация для маркированных списков */
#intro ul li:nth-child(1),
#actual ul li:nth-child(1),
#goals ul li:nth-child(1),
#optimization-methods ul li:nth-child(1),
#metrics ol li:nth-child(5),
#criterion ol li:nth-child(5),
#conclusion ol li:nth-child(5) {
  animation-delay: 1.0s;
}

#intro ul li:nth-child(2),
#actual ul li:nth-child(2),
#goals ul li:nth-child(2),
#optimization-methods ul li:nth-child(2),
#metrics ol li:nth-child(6),
#criterion ol li:nth-child(6),
#conclusion ol li:nth-child(6) {
  animation-delay: 1.2s;
}

#intro ul li:nth-child(3),
#actual ul li:nth-child(3),
#goals ul li:nth-child(3),
#optimization-methods ul li:nth-child(3) {
  animation-delay: 1.4s;
}

#intro ul li:nth-child(4),
#actual ul li:nth-child(4),
#goals ul li:nth-child(4),
#optimization-methods ul li:nth-child(4) {
  animation-delay: 1.6s;
}

#actual h4,
#goals h4,
#optimization-methods h4,
#metrics h4,
#criterion h4 {
  color: #1f6fe0;
  margin: 25px 0 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e9f2ff;
  font-size: 1.2rem;
}

#criterion ul li div {
  background: #f8fbff;
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px;
  border-left: 4px solid #3f8efc;
  font-family: "Courier New", monospace;
  text-align: center;
  overflow-x: auto;
}

/* Компактные таблицы */
.compact-table-container {
  background: white;
  border-radius: 12px;
  margin: 15px 0 25px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.compact-table-container:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.compact-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #3f8efc, #1f6fe0);
  color: white;
  cursor: pointer;
  user-select: none;
  font-size: 0.95em;
  z-index: 2;
  position: relative;
}

.compact-table-header .table-title {
  font-weight: 600;
}

.compact-table-header .table-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.compact-table-header:hover .table-toggle {
  opacity: 1;
}

.compact-table-header .toggle-icon {
  transition: transform 0.3s ease;
  font-size: 0.9em;
}

.compact-table-container.expanded .toggle-icon {
  transform: rotate(180deg);
}

/* Важное изменение: убираем ограничение высоты в развернутом состоянии */
.compact-table-wrapper {
  max-height: 180px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Полное раскрытие при классе expanded */
.compact-table-container.expanded .compact-table-wrapper {
  max-height: none !important;
  overflow: visible;
}

/* Убираем градиент-индикатор в развернутом состоянии */
.compact-table-container.expanded .compact-table-wrapper::after {
  opacity: 0;
  visibility: hidden;
}

/* Индикатор скролла (только для свернутого состояния) */
.compact-table-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to bottom, transparent, white);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease, visibility 0.3s;
  z-index: 1;
}

/* Убираем градиент при наведении (даже в свернутом состоянии) */
.compact-table-wrapper:hover::after {
  opacity: 0;
}

.compact-table-scroll {
  max-height: inherit;
  overflow-y: auto;
  padding: 0 16px;
}

/* Стили для таблицы остаются без изменений */
.compact-table {
  width: 100%;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
  margin: 10px 0;
  font-size: 0.85em;
}

.compact-table th {
  position: sticky;
  top: 0;
  background-color: #f8fbff;
  color: #1f6fe0;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #e0e0e0;
  z-index: 10;
  font-size: 0.9em;
  white-space: nowrap;
}

.compact-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  line-height: 1.4;
}

.compact-table tbody tr:hover {
  background-color: #f8fbff;
}

.compact-table tbody tr:last-child td {
  border-bottom: none;
}

/* Сжатие для длинных текстов */
.compact-table td:nth-child(2),
.compact-table td[data-label="Краткое описание"],
.compact-table td[data-label="Метод"],
.compact-table td[data-label="Примеры инструментов"] {
  min-width: 120px;
  max-width: 180px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.compact-table td:nth-child(1),
.compact-table td[data-label="Название метрики"],
.compact-table td[data-label="№"] {
  min-width: 50px;
}

.compact-table td[data-label="Автоматизация"],
.compact-table td[data-label="Скорость работы"],
.compact-table td[data-label="Учёт динамики нагрузки"],
.compact-table td[data-label="Многокритериальность"],
.compact-table td[data-label="Сложность внедрения"],
.compact-table td[data-label="Единицы измерения"] {
  min-width: 80px;
  text-align: center;
}

/* Индикатор скролла */
.compact-table-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to bottom, transparent, white);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.compact-table-container.expanded .compact-table-wrapper::after {
  opacity: 0;
}

/* Ссылки в таблицах */
.compact-table a[href^="#ref"] {
  font-size: 0.8em;
  padding: 1px 4px;
  margin: 0 1px;
}

.compact-table a[href^="#ref"]:hover {
  transform: translateY(-1px);
}
section:not(#table-of-contents) a[href^="#ref"] {
    color: #1f6fe0;
    text-decoration: none;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    vertical-align: baseline;
    position: relative;
    display: inline-block;
}

section:not(#table-of-contents) a[href^="#ref"]:hover {
    color: #fff;
    background-color: #3f8efc;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(63, 142, 252, 0.3);
}

section:not(#table-of-contents) a[href^="#ref"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(63, 142, 252, 0.2);
}

section:not(#table-of-contents) a[href^="#ref"]::before {
    content: '[';
    color: #3f8efc;
    margin-right: 1px;
}

section:not(#table-of-contents) a[href^="#ref"]::after {
    content: ']';
    color: #3f8efc;
    margin-left: 1px;
}

section:not(#table-of-contents) a[href^="#ref"]:hover::before,
section:not(#table-of-contents) a[href^="#ref"]:hover::after {
    color: #fff;
}

.compact-table a[href^="#ref"] {
    font-size: 0.85em;
    padding: 1px 4px;
    margin: 0 1px;
}

.compact-table a[href^="#ref"]:hover {
    transform: translateY(-1px);
}

#intro ol li a[href^="#ref"],
#actual ol li a[href^="#ref"],
#goals ol li a[href^="#ref"],
#optimization-methods ol li a[href^="#ref"],
#metrics ol li a[href^="#ref"],
#criterion ol li a[href^="#ref"],
#conclusion ol li a[href^="#ref"] {
    margin: 0 3px;
    position: relative;
    top: -1px;
}

p a[href^="#ref"] {
    position: relative;
    top: -1px;
}

h3 a[href^="#ref"],
h4 a[href^="#ref"] {
    font-size: 0.8em;
    position: relative;
    top: -3px;
}

#references ol li:target {
    background-color: #f0f7ff;
    border-left: 4px solid #3f8efc;
    padding-left: 10px;
    animation: highlight 1.5s ease;
}

@keyframes highlight {
    0% {
        background-color: #f0f7ff;
    }
    50% {
        background-color: #e9f2ff;
    }
    100% {
        background-color: #f0f7ff;
    }
}


@media (max-width: 1024px) {
  header .container {
    flex-direction: column;
    text-align: center;
    padding: 0 15px;
  }

  header .photo img {
    margin-right: 0;
    margin-bottom: 20px;
  }

  section {
    max-width: 90%;
    margin: 40px auto;
    padding: 25px;
  }

  .table-container {
    margin: 15px -10px;
    width: calc(100% + 20px);
    border-radius: 0;
  }

  .comparison-table {
    min-width: 900px;
    font-size: 0.85em;
  }
}

@media (max-width: 768px) {
  nav {
    justify-content: space-between;
    padding: 0 15px;
  }

  nav .menu-toggle {
    display: block;
    margin: 0;
    padding: 10px 15px;
  }

  nav .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #1f6fe0;
    position: absolute;
    top: 100%;
    left: 0;
    padding: 10px 0;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }

  nav .nav-links.show {
    display: flex;
  }

  nav .nav-links a {
    padding: 12px 20px;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .essay-nav .menu-toggle,
  .scientific-nav .menu-toggle,
  .ind-nav .menu-toggle,
  .resume-nav .menu-toggle {
    display: block;
  }

  .essay-nav .nav-links,
  .scientific-nav .nav-links,
  .ind-nav .nav-links,
  .resume-nav .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #1f6fe0;
    position: absolute;
    top: 100%;
    left: 0;
    padding: 10px 0;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }

  .essay-nav .nav-links.show,
  .scientific-nav .nav-links.show,
  .ind-nav .nav-links.show,
  .resume-nav .nav-links.show {
    display: flex;
  }

  .essay-nav .nav-links a,
  .scientific-nav .nav-links a,
  .ind-nav .nav-links a,
  .resume-nav .nav-links a {
    padding: 12px 20px;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  header {
    padding: 80px 15px 30px;
  }

  header .container {
    padding: 0 10px;
  }

  header .photo img {
    width: 100px;
    height: 100px;
  }

  header .info h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  header .info h3,
  header .info h4 {
    font-size: 0.9rem;
    margin: 4px 0;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  section {
    margin: 30px 10px;
    padding: 20px;
    border-radius: 12px;
  }

  section h3 {
    font-size: 1.3rem;
    padding-left: 8px;
    margin-bottom: 12px;
  }

  .table-container {
    margin: 15px -10px;
    border-radius: 0;
  }

  .comparison-table {
    min-width: 800px;
    font-size: 0.8em;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 10px 12px;
  }

  .comparison-table td:nth-child(n + 2) {
    min-width: 120px;
  }

  .algorithm-step {
    padding: 12px;
    margin: 12px 0;
  }

  .algorithm-step h4 {
    font-size: 1.1rem;
  }

  #table-of-contents ul,
  #past-research ul,
  #sources ul {
    gap: 8px;
    margin: 8px 0 20px;
  }

  #table-of-contents ul li,
  #past-research ul li,
  #sources ul li {
    padding: 5px 12px;
    font-size: 0.9rem;
  }

  #scroll-top,
  #scroll-bottom {
    width: 45px;
    height: 45px;
    font-size: 20px;
    right: 15px;
  }

  #scroll-top {
    bottom: 70px;
  }

  #scroll-bottom {
    bottom: 15px;
  }

  .compact-table {
    min-width: 600px;
  }
  
  .compact-table-wrapper {
    max-height: 300px;
  }
  
  .compact-table-container:not(.expanded) .compact-table-wrapper {
    max-height: 150px;
  }
  
  .compact-table-header {
    padding: 12px 15px;
  }
  
  .compact-table-scroll {
    padding: 0 10px;
  }
  
  .compact-table th,
  .compact-table td {
    padding: 10px 12px;
    font-size: 0.9em;
  }

    #intro ol li,
  #actual ol li,
  #goals ol li,
  #optimization-methods ol li,
  #metrics ol li,
  #criterion ol li,
  #conclusion ol li {
    padding: 10px 0 10px 40px;
    margin-bottom: 12px;
  }
  
  #intro ol li::before,
  #actual ol li::before,
  #goals ol li::before,
  #optimization-methods ol li::before,
  #metrics ol li::before,
  #criterion ol li::before,
  #conclusion ol li::before {
    left: 10px;
    width: 25px;
    height: 25px;
    font-size: 0.9em;
  }
  
  #intro ul li,
  #actual ul li,
  #goals ul li,
  #optimization-methods ul li,
  #metrics ul li,
  #criterion ul li,
  #conclusion ul li {
    padding: 6px 0 6px 30px;
    margin-bottom: 8px;
  }
  
  #intro ul li::before,
  #actual ul li::before,
  #goals ul li::before,
  #optimization-methods ul li::before,
  #metrics ul li::before,
  #criterion ul li::before,
  #conclusion ul li::before {
    left: 10px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  #menu {
    gap: 10px;
    padding: 10px 0;
  }

  #menu .button {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  header {
    padding: 60px 10px 20px;
  }

  header .photo img {
    width: 80px;
    height: 80px;
  }

  header .info h1 {
    font-size: 1.3rem;
  }

  header .info h3,
  header .info h4 {
    font-size: 0.8rem;
  }

  section {
    margin: 20px 8px;
    padding: 15px;
    border-radius: 10px;
  }

  section h3 {
    font-size: 1.2rem;
    border-left-width: 4px;
  }

  .table-container {
    margin: 10px -8px;
  }

  .comparison-table {
    min-width: 700px;
    font-size: 0.75em;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px;
  }

  .comparison-table td:nth-child(n + 2) {
    min-width: 100px;
  }

  ul li {
    padding-left: 15px;
    margin-bottom: 6px;
  }

  ul li::before {
    left: 0;
  }

  #table-of-contents ul,
  #past-research ul,
  #sources ul {
    gap: 6px;
  }

  #table-of-contents ul li,
  #past-research ul li,
  #sources ul li {
    padding: 4px 10px;
    font-size: 0.85rem;
  }

  #scroll-top,
  #scroll-bottom {
    width: 40px;
    height: 40px;
    font-size: 18px;
    right: 10px;
    opacity: 0.8;
  }

  #scroll-top {
    bottom: 60px;
  }

  #scroll-bottom {
    bottom: 10px;
  }

  footer {
    padding: 20px 10px;
    font-size: 0.8rem;
  }

   .compact-table {
    min-width: 500px;
    font-size: 0.85em;
  }
  
  .compact-table-header .table-toggle .toggle-text {
    display: none;
  }
  
  .compact-table-header .table-toggle {
    gap: 4px;
  }

    #intro ol li,
  #actual ol li,
  #goals ol li,
  #optimization-methods ol li,
  #metrics ol li,
  #criterion ol li,
  #conclusion ol li {
    padding: 8px 0 8px 35px;
    margin-bottom: 10px;
  }
  
  #intro ol li::before,
  #actual ol li::before,
  #goals ol li::before,
  #optimization-methods ol li::before,
  #metrics ol li::before,
  #criterion ol li::before,
  #conclusion ol li::before {
    left: 8px;
    width: 22px;
    height: 22px;
    font-size: 0.8em;
  }
  
  #intro ul li,
  #actual ul li,
  #goals ul li,
  #optimization-methods ul li,
  #metrics ul li,
  #criterion ul li,
  #conclusion ul li {
    padding: 5px 0 5px 25px;
    margin-bottom: 6px;
  }
  
  #intro ul li::before,
  #actual ul li::before,
  #goals ul li::before,
  #optimization-methods ul li::before,
  #metrics ul li::before,
  #criterion ul li::before,
  #conclusion ul li::before {
    left: 8px;
    font-size: 1.3em;
  }
  
  #actual h4,
  #goals h4,
  #optimization-methods h4,
  #metrics h4,
  #criterion h4 {
    font-size: 1.1rem;
    margin: 20px 0 12px;
  }
}

@media (max-width: 360px) {
  body {
    font-size: 13px;
  }

  section {
    margin: 15px 5px;
    padding: 12px;
  }

  .comparison-table {
    min-width: 650px;
  }

  header .info h1 {
    font-size: 1.2rem;
  }
}

@media (hover: none) {
  img:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }

  #scroll-top:hover,
  #scroll-bottom:hover {
    transform: none;
  }

  #menu .button:hover {
    background: transparent;
  }
    .compact-table {
    display: block;
    min-width: auto;
  }
  
  .compact-table thead {
    display: none;
  }
  
  .compact-table tbody tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: #f8fbff;
  }
  
  .compact-table td {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #e0e0e0;
  }
  
  .compact-table td:last-child {
    border-bottom: none;
  }
  
  .compact-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #1f6fe0;
    margin-right: 10px;
    flex: 0 0 40%;
  }
  
  .compact-table td strong {
    color: #1a2a44;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  header {
    padding: 60px 15px 20px;
  }

  header .container {
    flex-direction: row;
    text-align: left;
  }

  header .photo img {
    margin-right: 15px;
    margin-bottom: 0;
    width: 70px;
    height: 70px;
  }

  header .info h1 {
    font-size: 1.2rem;
  }
}

#video-resume {
  background: white;
  padding: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 60px auto;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s ease;
}

#video-resume.show {
  opacity: 1;
  transform: translateY(0);
}

#video-resume.collapsed {
  max-height: 70px;
  padding: 0;
}

#video-resume.expanded {
  max-height: 600px;
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #3f8efc, #1f6fe0);
  color: white;
  cursor: pointer;
  transition: background 0.3s;
  user-select: none;
}

.video-header:hover {
  background: linear-gradient(135deg, #4a9aff, #2a7be5);
}

.video-header h3 {
  margin: 0;
  font-size: 1.2rem;
  border-left: none;
  padding-left: 0;
  color: white;
}

.video-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: "Segoe UI", sans-serif;
}

.video-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.video-content {
  padding: 20px 0;
  display: none;
  animation: fadeIn 0.5s ease;
}

#video-resume.expanded .video-content {
  display: block;
}

.video-square-container {
  position: relative;
  width: 100%;
  max-width: 500px; 
  height: 500px; 
  margin: 0 auto;
  
  aspect-ratio: 1 / 1; 
  border-radius: 12px;
  overflow: hidden;
  
 
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  background: #000; 
  transition: all 0.3s ease;
}

.video-square-container:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.video-square-container video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: auto;
  height: 100%; 
  max-width: 100%; 
  max-height: 100%;
  
  object-fit: contain; 
  object-position: center;
  background: #000;
  
  cursor: pointer;
}

.video-square-container video.landscape {
  width: 100%;
  height: auto;
}

.video-square-container video.portrait {
  width: auto;
  height: 100%;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, 
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.7) 50%,
    transparent 100%);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.video-square-container:hover .video-controls,
.video-controls:focus-within {
  opacity: 1;
}

.video-play-pause,
.video-mute {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.video-play-pause:hover,
.video-mute:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.video-progress-container {
  flex: 1;
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: height 0.2s;
}

.video-progress-container:hover {
  height: 8px;
}

.video-progress {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  -webkit-appearance: none;
  background: transparent;
}

.video-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3f8efc;
  cursor: pointer;
}

.video-progress::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3f8efc;
  cursor: pointer;
  border: none;
}

.video-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #3f8efc;
  border-radius: 3px;
  transition: width 0.1s linear;
  pointer-events: none;
}

.video-time {
  color: white;
  font-size: 0.9rem;
  font-family: monospace;
  min-width: 120px;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.video-volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.video-volume {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  -webkit-appearance: none;
  cursor: pointer;
  transition: width 0.2s;
}

.video-volume:hover {
  width: 80px;
}

.video-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3f8efc;
  cursor: pointer;
}

.video-volume::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3f8efc;
  cursor: pointer;
  border: none;
}

.video-overlay {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-square-container:hover .video-overlay {
  opacity: 1;
}

.video-fullscreen {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.video-fullscreen:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #3f8efc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 5;
  display: none;
}

.video-square-container.loading .video-loading {
  display: block;
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@media (max-width: 768px) {
  #video-resume {
    max-width: 90%;
    margin: 40px auto;
  }
  
  #video-resume.collapsed {
    max-height: 65px;
  }
  
  #video-resume.expanded {
    max-height: 500px;
  }
  
  .video-header {
    padding: 15px;
  }
  
  .video-header h3 {
    font-size: 1.1rem;
  }
  
  .video-toggle {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  .video-content {
    padding: 15px 0;
  }
  
  .video-square-container {
    max-width: 400px;
    height: 400px;
  }
  
  .video-controls {
    padding: 10px 15px;
    gap: 8px;
  }
  
  .video-play-pause,
  .video-mute {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .video-time {
    font-size: 0.8rem;
    min-width: 100px;
  }
  
  .video-volume {
    width: 50px;
  }
  
  .video-volume:hover {
    width: 60px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .video-square-container {
    max-width: 350px;
    height: 350px;
  }
  
  #video-resume.expanded {
    max-height: 450px;
  }
}

@media (max-width: 600px) {
  .video-square-container {
    max-width: 350px;
    height: 350px;
  }
}

@media (max-width: 480px) {
  #video-resume.collapsed {
    max-height: 60px;
  }
  
  #video-resume.expanded {
    max-height: 450px;
  }
  
  .video-header {
    padding: 12px;
  }
  
  .video-header h3 {
    font-size: 1rem;
  }
  
  .video-toggle {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  
  .video-content {
    padding: 10px 0;
  }
  
  .video-square-container {
    max-width: 300px;
    height: 300px;
  }
  
  .video-controls {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
    background: linear-gradient(to top, 
      rgba(0, 0, 0, 0.95) 0%,
      rgba(0, 0, 0, 0.8) 50%,
      transparent 100%);
  }
  
  .video-progress-container {
    order: 1;
    width: 100%;
    margin-top: 5px;
  }
  
  .video-time {
    order: 2;
    min-width: auto;
    flex: 1;
    text-align: left;
    font-size: 0.75rem;
  }
  
  .video-play-pause {
    order: 3;
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  
  .video-mute {
    order: 4;
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  
  .video-volume-container {
    order: 5;
    display: none;
  }
  
  .video-overlay {
    top: 10px;
    right: 10px;
  }
  
  .video-fullscreen {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .video-loading {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 400px) {
  .video-square-container {
    max-width: 280px;
    height: 280px;
  }
  
  #video-resume.expanded {
    max-height: 400px;
  }
}

@media (max-width: 360px) {
  .video-square-container {
    max-width: 250px;
    height: 250px;
  }
  
  #video-resume.expanded {
    max-height: 350px;
  }
  
  .video-header h3 {
    font-size: 0.9rem;
  }
  
  .video-toggle {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
}
.video-square-container:fullscreen {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-square-container:fullscreen video {
  object-fit: contain; 
}

.video-square-container:fullscreen .video-controls {
  padding: 20px 30px;
  opacity: 1;
}

.video-square-container:fullscreen .video-overlay {
  opacity: 1;
  top: 20px;
  right: 20px;
}

.video-square-container:-webkit-full-screen {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-square-container:-moz-full-screen {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-square-container:-ms-fullscreen {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.video-square-container.video-playing .video-play-pause {
  color: #3f8efc;
}

.video-square-container.video-muted .video-mute {
  color: #ff4757;
}

.video-progress-container:hover::before {
  content: attr(data-time);
  position: absolute;
  top: -30px;
  left: var(--mouse-x, 50%);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 11;
  pointer-events: none;
}

.video-square-container.active {
  box-shadow: 0 0 0 2px #3f8efc, 0 6px 20px rgba(63, 142, 252, 0.3);
}