:root {
  /* Основная цветовая схема */
  --primary: #3f6cb5;
  --primary-hover: #5586d2;
  --primary-light: #ebf2ff;
  --accent: #ff9c00;
  --accent-hover: #ffb53d;
  --text: #333333;
  --text-light: #646464;
  --text-dark: #202020;
  --border: #d0d9e2;
  --border-dark: #a0aebb;
  --white: #ffffff;
  --bg-light: #f9fafb;
  --bg-card: #ffffff;
  --shadow: rgba(0, 0, 0, 0.07);
}

/* Базовые стили */
body {
  max-width: 1200px;
  width: 90%;
  margin: 0 auto;
  background-color: var(--bg-light);
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Oxygen, Ubuntu, sans-serif;
  color: var(--text);
  line-height: 1.5;
}

/* Типографика */
font, th, td, p {
  font-family: inherit;
  font-size: 15px;
}

h1, h2, .maintitle {
  font-weight: 700;
  font-size: 26px;
  font-family: inherit;
  color: var(--text-dark);
  line-height: 1.2;
  margin: 0.8em 0;
}

/* Ссылки */
a {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.2s ease;
}

a:visited {
  color: var(--primary);
}

a:hover, a:active {
  text-decoration: none;
  color: var(--accent);
}

/* Горизонтальная линия */
hr {
  height: 0;
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Изображения */
img {
  border: 0;
  max-width: 100%;
  height: auto;
}

/* Формы */
form {
  display: inline;
}

/* Таблицы */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

table.forumline {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
}

table.forumline:hover {
  box-shadow: 0 6px 16px var(--shadow);
}

/* Строки таблицы */
.row, .row1, .row2 {
  background-color: var(--white);
  transition: background-color 0.2s ease;
}

.row:hover, .row1:hover, .row2:hover {
  background-color: var(--primary-light);
}

.row3 {
  background-color: var(--primary-light);
}

/* Заголовки таблиц */
th, td.th {
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  background-color: var(--primary);
  padding: 12px 16px;
  text-align: left;
  border: none;
}

/* Категории */
td.cat, td.catHead, td.catLeft, td.rowpic, td.catSides, td.catRight, td.catBottom {
  color: var(--text-dark);
  font-size: 15px;
  background-color: var(--bg-light);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

/* Размеры текста */
.gen {
  font-size: 15px;
}

.genmed {
  font-size: 14px;
}

.gensmall {
  font-size: 13px;
}

/* Навигация */
.nav {
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
}

.nav a, .nav a:visited {
  text-decoration: none;
  color: var(--primary);
}

.nav a:hover, .nav a:active {
  color: var(--accent);
}

table.nav {
  background-color: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 15px 0;
  box-shadow: 0 2px 8px var(--shadow);
}

table.nav:hover {
  border-color: var(--primary);
}

/* Ссылки форума */
.forumlink {
  font-weight: 600;
  font-size: 16px;
}

a.forumlink, a.forumlink:visited {
  text-decoration: none;
}

a.forumlink:hover, a.forumlink:active {
  text-decoration: none;
  color: var(--accent);
}

/* Формы ввода */
input, textarea, select {
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
  transition: all 0.2s ease;
}

input.post, textarea.post, select {
  background-color: var(--white);
  border: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}

input.post:focus, textarea.post:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 108, 181, 0.2);
}

textarea.post {
  resize: vertical;
  min-height: 120px;
}

/* Кнопки */
input.button, input.mainoption, input.liteoption, .fakebut {
  background-color: var(--white);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

input.button:hover, input.mainoption:hover, input.liteoption:hover, .fakebut:hover {
  background-color: var(--primary);
  color: var(--white);
}

input.mainoption {
  background-color: var(--primary);
  color: var(--white);
  font-weight: 600;
}

input.mainoption:hover {
  background-color: var(--primary-hover);
}

/* Выпадающий список */
select {
  padding: 8px 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

select optgroup {
  background-color: var(--bg-light);
  color: var(--text-light);
}

select option, select optgroup option {
  background-color: var(--white);
  color: var(--text);
}

/* Код и цитаты */
.code, .quote {
  background-color: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 15px;
  margin: 10px 0;
}

.code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  color: #0050b3;
  white-space: pre-wrap;
}

.quote {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  position: relative;
  padding-left: 20px;
}

.quote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background-color: var(--primary);
  border-radius: 2px;
}

/* Тело сообщения */
.postbody {
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.6;
}

/* Имя и детали сообщения */
.name {
  font-weight: 600;
  font-size: 16px;
}

.postdetails {
  color: var(--text-light);
  font-size: 13px;
}

/* Разделитель строк */
td.spacerow {
  background-color: var(--border);
  height: 1px;
  padding: 0;
}

/* Заголовок категории */
.cattitle {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-dark);
}

a.cattitle {
  text-decoration: none;
}

a.cattitle:hover {
  color: var(--accent);
}

/* Кнопки страниц */
.pgbutt a {
  font-family: inherit;
  padding: 6px 12px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--white);
  margin: 5px 3px 0 0;
  border-radius: 6px;
  color: var(--primary);
  font-weight: 500;
  transition: all 0.2s ease;
}

.pgbutt a:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

/* QR-Code */
#qr img {
  width: 40px;
  height: 40px;
  position: fixed;
  right: 15px;
  top: 15px;
  border: 1px solid var(--border);
  padding: 4px;
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.2s ease;
}

#qr img:hover {
  width: 200px;
  height: 200px;
  z-index: 100;
  padding: 8px;
}

/* Аватар для гостей */
.guestavatar {
  width: 120px;
  height: 120px;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: var(--white);
  font-size: 50px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 4px 10px var(--shadow);
}

/* Меню администратора */
#nav8, #nav8 ul, #nav8 li {
  margin: 0;
  padding: 0;
  border: 0;
}

#nav8, #nav8 ul {
  background: var(--white);
}

#nav8 {
  border-spacing: 0;
  position: relative;
  z-index: 50;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 20px;
}

#nav8 ul {
  position: absolute;
  display: none;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

#nav8 td:hover ul {
  display: block;
}

#nav8 ul li {
  list-style: none;
}

#nav8 .right {
  direction: rtl;
}

#nav8 .right ul {
  right: 0;
}

#nav8 .right li {
  direction: ltr;
}

#nav8 a {
  display: block;
  padding: 12px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  font-weight: 500;
}

#nav8 ul a {
  padding: 10px 15px;
  text-align: left;
}

#nav8 td:hover, #nav8 li:hover {
  background: var(--primary-light);
}

#nav8 td:hover a, #nav8 li:hover a {
  color: var(--primary);
}

#nav8 td {
  text-align: center;
}

/* Прогресс-бар загрузки */
#cssbar-wrapper {
  width: 300px;
  height: 6px;
  position: absolute;
  left: 50%;
}

#cssbar-border {
  height: 100%;
  width: 100%;
  position: relative;
  left: -50%;
  top: -50%;
  background-color: var(--border);
  border-radius: 10px;
  overflow: hidden;
}

#cssbar-whitespace {
  overflow: hidden;
  height: 100%;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

#cssbar-line {
  background-color: var(--primary);
  position: absolute;
  height: 100%;
  width: 40%;
  border-radius: 10px;
  animation: cssbar-slide 1.5s ease-in-out infinite;
  -o-animation: cssbar-slide 1.5s ease-in-out infinite;
  -ms-animation: cssbar-slide 1.5s ease-in-out infinite;
  -webkit-animation: cssbar-slide 1.5s ease-in-out infinite;
  -moz-animation: cssbar-slide 1.5s ease-in-out infinite;
}

@keyframes cssbar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

@-o-keyframes cssbar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

@-ms-keyframes cssbar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

@-webkit-keyframes cssbar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

@-moz-keyframes cssbar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  body {
    width: 95%;
  }
  
  th, td.th, td.cat, td.catHead, td.catLeft, td.rowpic, td.catSides, td.catRight, td.catBottom {
    padding: 10px;
  }
  
  .maintitle, h1, h2 {
    font-size: 22px;
  }
  
  #qr img {
    right: 10px;
    top: 10px;
  }
}