:root{
  --bg: #cfcecf;
  --panel: #bfbfbf;
  --tile: #b3b3b3;
  --text: #111;
  --muted: rgba(0,0,0,0.06);
  --shadow: rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --panel: #2d2d2d;
  --tile: #3d3d3d;
  --text: #ffffff;
  --muted: rgba(255,255,255,0.06);
  --shadow: rgba(0,0,0,0.3);
}

*{
  box-sizing: border-box;
  user-select: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html, body{
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  zoom: 1;
  transform: scale(1);
  transform-origin: 0 0;
}

.main-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: auto;
}

.topbar{
  width: 100%;
  background: var(--panel);
  padding: 12px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 0 var(--muted);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.topbar .logo {
  width: 80px;
  height: auto;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 25px;
}

.nav a{
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s ease;
  cursor: pointer;
}

.nav a:hover{
  color: #0a84ff;
}

/* Кнопка переключения темы */
.theme-toggle {
  background: var(--tile);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .icon {
  transform: rotate(180deg);
}

.container{
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 100px 20px 80px;
  min-height: 100vh;
}

/* SEARCH */
.search-section{
  text-align: center;
  margin-top: 20px;
}

.search-section h2{
  margin: 0 0 14px;
  font-weight: 400;
  font-size: 22px;
}

.search-box{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--tile);
  padding: 8px 14px;
  border-radius: 28px;
  width: 420px;
  box-shadow: 0 8px 30px var(--shadow);
  transition: all 0.3s ease;
}

.search-box .gicon{
  width: 22px;
  height: 22px;
  display: block;
  filter: invert(var(--icon-invert, 0));
}

[data-theme="dark"] .search-box .gicon {
  filter: invert(1);
}

.search-box input{
  border: 0;
  outline: 0;
  font-size: 15px;
  flex: 1;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--text);
  opacity: 0.7;
}

/* TILES GRID */
.tiles{
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(5, 130px);
  gap: 28px;
  justify-content: center;
  align-items: center;
}

/* Base tile */
.tile{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 16px;
  padding: 18px 12px;
  background: var(--tile);
  transition: transform .22s ease, box-shadow .22s ease;
  box-shadow: 0 10px 30px var(--muted), 0 0 0 rgba(0,0,0,0);
  backdrop-filter: blur(2px);
  width: 130px;
  height: 110px;
  cursor: pointer;
}

.tile img{
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 10px;
  transition: filter 0.3s ease;
}

[data-theme="dark"] .tile img {
  filter: brightness(0.9) contrast(1.1);
}

.tile p{
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Neon glow for each service */
.tile.youtube    { --glow: rgba(255, 0, 0, 0.25); }
.tile.twitch     { --glow: rgba(133, 96, 255, 0.25); }
.tile.telegram   { --glow: rgba(3, 150, 255, 0.18); }
.tile.whatsapp   { --glow: rgba(37, 211, 102, 0.18); }
.tile.vk         { --glow: rgba(59, 89, 152, 0.12); }
.tile.cybershoke { --glow: rgba(80, 140, 240, 0.12); }
.tile.faceit     { --glow: rgba(0, 0, 0, 0.08); }
.tile.instagram  { --glow: rgba(233, 76, 138, 0.18); }
.tile.chatgpt    { --glow: rgba(28, 184, 137, 0.18); }
.tile.discord    { --glow: rgba(114, 137, 218, 0.18); }
.tile.faceitfinder{ --glow: rgba(255,140,0,0.15); }
.tile.spotify    { --glow: rgba(30,215,96,0.14); }
.tile.steam      { --glow: rgba(0,0,0,0.10); }
.tile.tiktok     { --glow: rgba(56,205,141,0.12); }
.tile.prosettings{ --glow: rgba(80,160,255,0.12); }

[data-theme="dark"] .tile.faceit { --glow: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .tile.steam { --glow: rgba(255, 255, 255, 0.15); }

/* On hover add colored glow */
.tile:hover{
  transform: translateY(-2px);
  box-shadow:
    0 20px 40px var(--shadow),
    0 0 40px var(--glow),
    0 0 80px var(--muted);
}

/* Фиксируем размеры для всех масштабов */
@media screen {
  html {
    zoom: 1;
    transform: scale(1);
  }
}

/* responsive */
@media (max-width: 1100px){
  .tiles{
    grid-template-columns: repeat(4, 130px);
    gap: 20px;
  }
}

@media (max-width: 780px){
  .search-box{
    width: 92%;
    max-width: 420px;
  }
  .tiles{
    grid-template-columns: repeat(3, 130px);
    gap: 16px;
  }
}

@media (max-width: 580px){
  .tiles{
    grid-template-columns: repeat(2, 130px);
    gap: 14px;
  }
  .topbar{
    padding: 10px 20px;
  }
  .container{
    padding: 90px 15px 60px;
  }
  .nav {
    gap: 15px;
  }
}

@media (max-width: 380px){
  .tiles{
    grid-template-columns: repeat(2, 120px);
    gap: 12px;
  }
  .tile{
    width: 120px;
    height: 100px;
  }
  .tile img{
    width: 48px;
    height: 48px;
  }
  .theme-toggle {
    padding: 6px 12px;
    font-size: 14px;
  }
}
/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--panel);
  margin: 10% auto;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: var(--text);
}

.close:hover {
  color: #0a84ff;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--tile);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #0a84ff;
}

.submit-btn {
  background: var(--tile);
  color: var(--text);
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  background: #0a84ff;
  color: white;
  transform: translateY(-2px);
}

/* Кнопка добавления */
.add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 16px;
  padding: 18px 12px;
  background: var(--tile);
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px var(--muted);
  width: 130px;
  height: 110px;
  cursor: pointer;
  border: 2px dashed var(--text);
  opacity: 0.7;
}

.add-tile:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 20px 40px var(--shadow);
  border-color: #0a84ff;
}

.add-icon {
  font-size: 32px;
  color: var(--text);
  margin-bottom: 8px;
}

.add-text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

/* Стили для кастомных тайлов */
.tile.custom {
  --glow: rgba(100, 100, 100, 0.2);
  position: relative;
}

.delete-custom {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile.custom:hover .delete-custom {
  opacity: 1;
}

.delete-custom:hover {
  background: #cc0000;
  transform: scale(1.1);
}