@font-face {
  font-family: "Bad Comic";
  src: url("../assets/fonts/badcomic.ttf") format('truetype');
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0;
  font-family: "Bad Comic", sans-serif;
  background: #fdf5f2;
  color: #435e93;
}

.navbar {
  background: #95b1fa;
  padding: 30px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 18px;
  color: #fdf5f2;
  position: relative;
}

.navbar .logo img {
  width: 250px; 
  height: auto;
  grid-column: 2;
  justify-self: center;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 25px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fdf5f2;
  font-weight: bold;
  font-size: 18px;
  padding: 10px 15px;
  border: 3px dashed #d2eaff;
  border-radius: 25px;
  background-color: rgba(255, 255, 255, 0.185);
  transition: all 0.3s ease;
}

.nav-links a:hover {
  background-color: #fdf5f2;
  color: #6f84b8;
  border-color: #355067;
}

/* Волна */
.wave {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  z-index: 0;
}

.wave svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Модалка + оверлей */

#loginModal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

#loginModal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #95b1fa;
  padding: 30px 40px;
  border-radius: 20px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  text-align: center;
  position: relative;
}

#loginModal.active .modal-content {
  transform: translateY(0);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #fdf5f2;
  line-height: 1;
}

.close-news-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #95b1fa;
  line-height: 1;
  z-index: 2;
}

.close-news-btn:hover {
  color: #355067;
}

.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  gap: 20px;
}

.tab {
  background: none;
  border: none;
  font-size: 18px;
  font-weight: bold;
  font-family: "Bad Comic", sans-serif;
  color: #fdf5f2;
  cursor: pointer;
  padding-bottom: 5px;
  border-bottom: 3px solid transparent;
  transition: border-color 0.3s ease;
}

.tab.active {
  border-color: #355067;
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

label {
  text-align: left;
  font-weight: bold;
  color: #355067;
}

input {
  padding: 10px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid #355067;
  outline: none;
  color: #355067;
}

input::placeholder {
  color: #435e93;
}

button.submit-btn {
  padding: 10px;
  font-size: 16px;
  font-weight: bold;
  font-family: "Bad Comic", sans-serif;
  background: rgba(255, 255, 255, 0.185);
  color: #fdf5f2;
  border: 3px dashed #d2eaff;
  border-radius: 25px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

button.submit-btn:hover {
  background-color: #fdf5f2;
  color: #6f84b8;
  border-color: #355067;
}

/* Выпадающее меню аккаунта */
.account-menu {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #95b1fa;
  border-radius: 20px;
  padding: 10px;
  list-style: none;
  margin: 5px 0 0 0;
  min-width: 150px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 100;
  display: none; 
}

.account-menu.logged-in .dropdown-menu {
  display: block;
}

.account-menu.logged-in:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-menu a {
  display: block;
  padding: 8px 15px;
  color: #fdf5f2;
  text-decoration: none;
  border-radius: 15px;
  transition: background-color 0.3s ease;
}

.dropdown-menu a:hover {
  background-color: #fdf5f2;
}

.admin-menu-item {
  display: none !important;
}

.admin-menu-item.admin-visible {
  display: block !important;
}

.admin-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 32px;
}

.game-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(149,177,250,0.15);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.2s;
  cursor: pointer;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.game-card-img-wrap {
  width: 100%;
  height: 240px;
  background: #eaf1ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card-icon {
  width: 100%;
  max-width: 100%;
  height: 240px;
  object-fit: contain;
  border-radius: 0 0 16px 16px;
  background: #eaf1ff;
}

.game-card-title {
  font-size: 1.3em;
  font-weight: bold;
  margin: 24px 0 0 0;
  color: #435e93;
  text-align: center;
}

.game-card-hover {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(149,177,250,0.97);
  color: #fff;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  transition: opacity 0.2s;
  border-radius: 24px;
  pointer-events: none;
}

.game-card:hover .game-card-hover {
  opacity: 1;
  pointer-events: auto;
}

.game-card-desc {
  font-size: 1.1em;
  margin-bottom: 24px;
  text-align: center;
}

.play-btn {
  background: #4caf50;
  color: #fff;
  font-weight: bold;
  font-size: 1.1em;
  border: none;
  border-radius: 20px;
  padding: 12px 32px;
  text-decoration: none;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(76,175,80,0.12);
}
.play-btn:hover {
  background: #388e3c;
}

/* --- Новости --- */
.news-section {
  margin: 40px 0 0 0;
  padding: 0 20px;
}
.news-section h2 {
  margin-bottom: 16px;
}
.news-carousel {
  display: flex;
  overflow-x: auto;
  gap: 24px;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}
.news-card {
  min-width: 320px;
  max-width: 320px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.news-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.news-card img {
  width: 100%;
  height: 192px;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  background: #eee;
}
.news-card .news-title {
  font-size: 1.1em;
  font-weight: bold;
  margin: 12px 16px 4px 16px;
}
.news-card .news-text {
  margin: 0 16px 16px 16px;
  color: #444;
  font-size: 0.98em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.news-modal {
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}
.news-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.news-modal-content {
  background: #fdf5f2;
  border-radius: 16px;
  max-width: 600px;
  width: 90vw;
  padding: 32px 24px 24px 24px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(-20px);
  transition: transform 0.3s cubic-bezier(.4,1.6,.6,1), opacity 0.3s cubic-bezier(.4,1.6,.6,1);
  opacity: 0;
}
.news-modal.active .news-modal-content {
  transform: translateY(0);
  opacity: 1;
}
.news-modal-image {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 18px;
}
.news-modal-content h3 {
  margin: 0 0 12px 0;
  text-align: center;
}
.news-modal-text {
  width: 100%;
  color: #333;
  font-size: 1.05em;
  margin-bottom: 8px;
}
.profile-menu-item {
  display: none !important;
}
.account-menu.logged-in .profile-menu-item {
  display: block !important;
}

/* --- Профиль пользователя --- */
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.profile-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.profile-modal-content {
  background: #fdf5f2;
  border-radius: 18px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.profile-modal.active .profile-modal-content {
  transform: translateY(0);
}

.close-profile-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #95b1fa;
  z-index: 2;
}

.close-profile-btn:hover {
  color: #355067;
}

.profile-main-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: stretch;
  gap: 32px;
  height: 100%;
}
.profile-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 180px;
  gap: 18px;
  height: 100%;
}

.profile-info-block {
  background: #eaf1ff;
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 160px;
  font-size: 1.08em;
  color: #435e93;
  border: 2px solid #bad7ff;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  height: 100%;
  box-sizing: border-box;
}
.profile-username {
  font-size: 1.18em;
  font-weight: bold;
  margin-bottom: 2px;
  color: #355067;
}
.profile-email {
  font-size: 1em;
  color: #435e93;
  margin-bottom: 2px;
  word-break: break-all;
  font-weight: 400;
}
.profile-subend {
  font-size: 0.98em;
  color: #888;
  background: #f5faff;
  border-radius: 8px;
  padding: 3px 10px;
  margin-top: 2px;
  display: inline-block;
  font-weight: 400;
}

.friend-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.friend-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.profile-friends-achievements {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
}
.profile-section-title {
  font-size: 1.13em;
  font-weight: bold;
  margin-bottom: 8px;
  color: #435e93;
}
.profile-friends-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
  min-height: 36px;
}
.profile-friend {
  background: #bad7ff;
  color: #355067;
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 1em;
  font-weight: 500;
}
.profile-friend-btn {
  background: #95b1fa;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 1em;
  font-family: "Bad Comic", sans-serif;
  cursor: pointer;
  margin-left: 6px;
  margin-right: 2px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(149,177,250,0.10);
  font-weight: 500;
}
.profile-friend-btn:hover {
  background: #355067;
  color: #fff;
}

.profile-friend-empty {
  color: #aaa;
  font-size: 0.98em;
  text-align: center;
  width: 100%;
  padding: 10px 0 6px 0;
  margin: 0;
}

.profile-achievements-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 4px;
  margin-top: 8px;
  align-content: flex-start;
}

.profile-achievement {
  background: linear-gradient(135deg, #ffe6b3 0%, #ffd166 100%);
  color: #a67c00;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95em;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  min-height: 40px;
  word-break: break-word;
  white-space: normal;
  border: 1px solid #ffc107;
}

.profile-achievement:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.profile-achievement::before {
  content: '🏆';
  margin-right: 8px;
  font-size: 1.2em;
}

.profile-achievements-section:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, rgba(234,241,255,0) 0%, rgba(234,241,255,1) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 0 0 16px 16px;
}

.profile-achievements-section.scrollable:after {
  opacity: 1;
}

.profile-achievement-empty {
  color: #aaa;
  font-size: 0.98em;
  text-align: center;
  width: 100%;
  padding: 10px 0;
}

.profile-messages {
  margin-top: 18px;
  background: #f5faff;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.04em;
  color: #355067;
  border: 2px solid #bad7ff;
  min-height: 40px;
}
.profile-message {
  margin: 8px 0;
  padding: 8px 12px;
  background: #eaf1ff;
  border-radius: 8px;
  font-size: 0.98em;
}
.profile-message-reward {
  color: #4caf50;
  font-size: 0.95em;
  margin-top: 4px;
}
.profile-card {
  background: #eaf1ff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(149,177,250,0.10);
  padding: 18px 18px 14px 18px;
  margin-bottom: 12px;
  border: 2px solid #bad7ff;
  display: block;
}

#addFriendFormContainer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-start;
  width: 100%;
}
#addFriendForm {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 1px 4px rgba(149,177,250,0.08);
  border: 1.5px solid #bad7ff;
  width: 100%;
  max-width: 100%;
}
#addFriendForm input[type="number"] {
  width: 90px;
  border: 1.5px solid #bad7ff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 1em;
}
#addFriendForm button {
  background: #95b1fa;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 1em;
  font-family: "Bad Comic", sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}
#addFriendForm button:hover {
  background: #355067;
}
#addFriendStatus {
  min-width: 60px;
  color: #355067;
}

/* Компактный профиль друга */
#friendProfileModal .profile-modal-content {
  max-width: 480px;
  width: 96vw;
  margin: 36px auto;
  padding: 14px 8px 22px 8px;
  border-radius: 16px;
  box-sizing: border-box;
  gap: 10px;
}
#friendProfileModal .profile-main-row {
  gap: 10px;
  grid-template-columns: 1fr;
}
#friendProfileModal .profile-avatar-block {
  min-width: 80px;
  gap: 8px;
}
#friendProfileModal .profile-info-block {  
  min-width: 360px;
  text-align: center;
  padding: 8px 8px;
  font-size: 0.98em;
  border-radius: 9px;
  display: flex;
  gap: 3px;
}

#friendProfileModal .profile-username {
  font-size: 1em;
}
#friendProfileModal .profile-email {
  font-size: 0.93em;
}
#friendProfileModal .remove-friend-btn {
  margin-top: 8px;
  background: #e57373;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.98em;
  font-family: "Bad Comic", sans-serif;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
}

#friendProfileModal .remove-friend-btn:hover {
  background: #c62828;
}

/* --- Кнопки заявок в друзья --- */
.accept-friend-btn {
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.98em;
  font-family: "Bad Comic", sans-serif;
  cursor: pointer;
  margin-left: 8px;
  margin-right: 2px;
  transition: background 0.2s;
  font-weight: 500;
}
.accept-friend-btn:hover {
  background: #388e3c;
}
.reject-friend-btn {
  background: #e57373;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.98em;
  font-family: "Bad Comic", sans-serif;
  cursor: pointer;
  margin-left: 4px;
  transition: background 0.2s;
  font-weight: 500;
}
.reject-friend-btn:hover {
  background: #c62828;
}

.accordion-header {
  cursor: pointer;
  padding: 10px;
  background: #d5e3ff;
  border-radius: 8px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: #bad7ff;
}

.accordion-header.active {
  background: #95b1fa;
  color: white;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-icon {
  transition: transform 0.3s ease;
  font-size: 0.8em;
  margin-left: 10px;
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.profile-achievements-list.accordion-content {
  display: none;
}

.profile-achievements-list.accordion-content.show {
  display: block;
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.profile-achievements-list::-webkit-scrollbar {
  width: 8px;
}

.profile-achievements-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.profile-achievements-list::-webkit-scrollbar-thumb {
  background: #95b1fa;
  border-radius: 4px;
}

.profile-achievements-list::-webkit-scrollbar-thumb:hover {
  background: #7d9ae8;
}


.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
}

.game-modal.hidden {
  display: none;
}

#game-frame {
  width: 100%;
  height: 100%;
  border: none;
  flex-grow: 1;
}

.game-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  z-index: 10000;
}

.control-btn {
  font-size: 24px;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

#twoFAForm {
  display: none;
  padding: 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease-in-out;
  text-align: center;
  font-family: inherit;
}

#twoFAForm input {
  width: 80%;
  padding: 10px;
  font-size: 18px;
  border: 2px solid #ccc;
  border-radius: 12px;
  margin-bottom: 12px;
  outline: none;
  transition: 0.2s border;
}

#twoFAForm input:focus {
  border-color: #69c;
}

#twoFAForm button {
  background-color: #3a87f2;
  color: white;
  padding: 10px 24px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s background;
}

#twoFAForm button:hover {
  background-color: #2c6ed5;
}

#twoFAStatus {
  font-size: 14px;
  margin-top: 6px;
  color: #d33;
}
