:root {
  /* Основные цвета */
  --color-primary: #333333;
  --color-secondary: #333333;
  --color-tertiary: #888888;

  /* Цвета фона */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-hover: #f0f0f0;
  --bg-active: #e0e0e0;

  /* Цвета границ */
  --border-primary: #d3d3d3;
  --border-secondary: #666666;
  --border-tertiary: #afafaf;
  --border-input: #666666;

  /* Цвета теней */
  --shadow-color: rgba(0, 0, 0, 0.1);

  /* Добавляем новый цвет для выделенных ячеек */
  --bg-highlight: #f5f5f5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Arial", sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav-container {
  width: 100%;
  display: flex;
  justify-content: center;
  background-color: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  z-index: 1000;
}

.main-nav {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
}

.nav-menu {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
  width: auto;
  gap: 0px;
}

.nav-menu li {
  margin: 0;
  flex: 0 0 auto;
}

.nav-menu li:not(:last-child) {
  margin-right: 30px;
}

.nav-menu li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: block;
}

.nav-menu li a:hover {
  background-color: #e9ecef;
}

.nav-menu li a.active {
  background-color: var(--color-tertiary);
  color: white;
}

.content-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
  margin-top: 4rem;
}

.name-form {
  margin-top: 2rem;
}

.container {
  width: 100%;
  max-width: 600px;
  padding: 20px;
  margin: 0 auto;
}

.name-form {
  background: #ffffff;
  max-width: 400px;
  padding: 40px 30px;
  text-align: center;
}

h1 {
  color: #333333;
  margin-bottom: 10px;
  font-size: 2.5em;
  font-weight: 600;
}

.subtitle {
  color: #333333;
  margin-bottom: 30px;
  font-size: 1.1em;
}

.input-group {
  width: 100%;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--border-input);
  border-radius: 8px;
  font-size: 20px;
  height: 50px;
  box-sizing: border-box;
  outline: none;
  transition: all 0.3s;
  background: transparent;
  color: var(--color-primary);
}

input:focus {
  border-color: #666666;
}

label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #444444;
  transition: all 0.3s;
  pointer-events: none;
}

input:focus + label,
input:not(:placeholder-shown) + label {
  left: 10px;
  font-size: 14px;
  background: #ffffff;
  padding: 0 5px;
  color: #333333;
}

button,
.button {
  background: var(--color-primary);
  color: var(--bg-primary);
  border: 2px solid var(--color-primary);
  padding: 15px 40px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  max-width: 400px;
  width: 100%;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--bg-primary);
  color: var(--color-primary);
}

button:active {
  transform: translateY(1px);
}

.name-table {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.name-table table {
  border-collapse: collapse;
  background: #ffffff;
  margin: 0 auto;
}

.name-table td {
  width: 80px;
  height: 80px;
  border: 1px solid #d3d3d3;
  text-align: center;
  padding: 5px;
  vertical-align: top;
}

.cell-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 2px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3px;
  font-size: 16px;
}

.letter {
  font-weight: bold;
  font-size: 16px;
  margin-right: 3px;
}

.number {
  font-size: 16px;
  color: #333;
}

.parity {
  font-size: 14px;
  color: #666;
  margin-bottom: 2px;
}

.digital-root {
  font-size: 14px;
  color: #666;
}

.name-table tr {
  display: table-row;
}

.letter {
  display: inline-block;
  font-size: 28px;
  margin-right: 10px;
  color: #333333;
}

.number {
  display: inline-block;
  font-size: 28px;
  color: #666666;
}

/* Анимация появления таблицы */
.name-table {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.back-button {
  display: inline-block;
  background: #333333;
  color: white;
  text-decoration: none;
  padding: 15px 40px;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  margin-top: 20px;
  border: 2px solid #333333;
}

.back-button:hover {
  background: #ffffff;
  color: #333333;
  border: 2px solid #333333;
}

.clear-btn {
  width: auto;
  padding: 0 20px;
  font-size: 16px;
  background: #333333;
  color: white;
}

.clear-btn:hover {
  background: #666666;
  color: white;
}

.sum-cell {
  background-color: transparent;
  border: 1px solid #d3d3d3;
}

.sum-cell .cell-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sum-cell .top-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sum-row td {
  background-color: transparent;
  border: 1px solid #d3d3d3;
}

.sum-row .sum-cell {
  background-color: #ebebeb; /* Немного темнее для ячейки с двойной суммой */
}

.name-table td {
  height: 120px;
}

.matrix-container {
  margin: 15px;
  text-align: center;
  padding: 20px;
}

.matrix-container h1 {
  font-size: 20px;
  margin: 8px 0;
  font-weight: normal;
  color: var(--color-primary);
}

.matrix-container h2 {
  font-weight: 600;
  font-size: 16px;
  margin: 8px 0;
  color: var(--color-secondary);
}

.matrix-table {
  border-collapse: collapse;
  margin: 0 auto;
  background: var(--bg-primary);
  box-shadow: 0 2px 4px var(--shadow-color);
}

.matrix-cell {
  width: 75px;
  height: 75px;
  border: 1px solid var(--border-secondary);

  text-align: center;
  padding: 6px;
  vertical-align: middle;
}

.letter-number {
  margin-bottom: 6px;
  white-space: nowrap;
}

.letter-number .letter {
  font-weight: 600;
  font-size: 16px;
  margin-right: 4px;
  color: var(--color-primary);
}

.letter-number .number {
  font-size: 16px;
  color: var(--color-secondary);
}

.parity {
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--color-tertiary);
  white-space: nowrap;
}

.digital-root {
  font-size: 13px;
  color: var(--color-tertiary);
}

h3 {
  color: #333;
  margin-bottom: 15px;
}

h1 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: normal;
}

.matrices-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.matrices-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  flex-direction: row-reverse;
}

.matrix-container {
  margin: 0;
  padding: 15px;
  background: #ffffff;
}

/* Медиа-запрос для мобильных устройств */
@media (max-width: 768px) {
  .matrices-row {
    flex-direction: column;
    align-items: center;
  }

  .matrix-container {
    width: 100%;
    max-width: 350px;
  }

  .nav-menu {
    width: 100%;
    gap: 10px;
  }

  .nav-menu li:not(:last-child) {
    margin-right: 0;
  }

  .nav-menu li a {
    padding: 8px 8px;
    font-size: 14px;
  }
}

/* Медиа-запрос для очень маленьких экранов */
@media (max-width: 380px) {
  .matrix-cell {
    width: 65px;
    height: 65px;
    padding: 4px;
  }

  .letter-number .letter,
  .letter-number .number {
    font-size: 14px;
  }

  .parity,
  .digital-root {
    font-size: 11px;
  }
}

/* Выделение правого столбца (каждая 4-я ячейка в строке) */
.matrix-cell:nth-child(4) {
  background-color: var(--bg-highlight);
}

/* Выделение нижней строки (все ячейки в последней строке) */
.matrix-table tr:last-child .matrix-cell {
  background-color: var(--bg-highlight);
}

/* Более темный оттенок для пересечения (правая нижняя ячейка) */
.matrix-table tr:last-child .matrix-cell:nth-child(4) {
  background-color: #f0f0f0;
}

.gender-switch {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.gender-switch .back-button {
  padding: 10px 20px;
  min-width: 100px;
  text-align: center;
}

/* Медиа-запрос для мобильных устройств */
@media (max-width: 480px) {
  .gender-switch {
    flex-direction: column;
    width: 100%;
  }

  .gender-switch .back-button {
    width: 100%;
    margin: 5px 0;
  }
}

.gender-option {
  display: flex;
  align-items: center;
  gap: 0px;
  color: var(--color-primary);
}

.gender-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.gender-option label {
  color: var(--color-primary);
  cursor: pointer;
  font-size: 16px;
  /* Добавляем эти свойства для гарантии видмости текста */
  display: inline-block;
  position: relative;
  padding-left: 5px;
  line-height: 20px;
  opacity: 1;
  visibility: visible;
  user-select: none;
}

/* Добавляем стили для состояния :checked */
.gender-option input[type="radio"]:checked + label {
  font-weight: bold;
}

.name-list {
  margin: 20px 0;
  padding: 0 20px;
}

.name-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-primary);
  color: var(--color-primary);
  font-size: 16px;
}

.name-item:last-child {
  border-bottom: none;
}

.name-item a {
  text-decoration: none;
  color: var(--color-primary);
  display: block;
  transition: color 0.3s ease;
}

.name-item a:hover {
  color: var(--color-secondary);
}

@font-face {
  font-family: "Bukvica";
  src: url("/fonts/Bukvica_7x7_v2.ttf") format("truetype");
}

.letter-number .letter {
  font-weight: 600;
  font-size: 16px;
  margin-right: 4px;
  color: var(--color-primary);
}
