@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css");
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap');

:root {
  --bg-gradient-start: #0f0c29;
  --bg-gradient-mid: #302b63;
  --bg-gradient-end: #24243e;

  --card-bg-color: rgba(30, 30, 40, 0.45);
  --card-blur: 12px;
  --card-border-color: rgba(255, 255, 255, 0.1);

  --primary-text-color: #f0f0f0;
  --secondary-text-color: #a0a0b0;

  --accent-primary: #a855f7;
  --accent-secondary: #00c6ff;

  --red-color: #ef4444;
  --green-color: #22c55e;

  --font-family: 'Inter', sans-serif;
}

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

@keyframes gradientAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

body {
  font-family: var(--font-family);
  background: linear-gradient(-45deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
  background-size: 400% 400%;
  animation: gradientAnimation 15s ease infinite;
  color: var(--primary-text-color);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Dynamic Background System */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
}

.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 120%;
  height: 120%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out, transform 0.1s ease-out;
  transform: translateX(-10%) translateY(-10%);
  filter: blur(1px) brightness(0.4) saturate(1.2);
}

.background-layer.active {
  opacity: 1;
}

.background-layer.parallax {
  will-change: transform;
}

/* Background overlay to maintain readability */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(
    135deg,
    rgba(15, 12, 41, 0.85) 0%,
    rgba(48, 43, 99, 0.75) 35%,
    rgba(36, 36, 62, 0.85) 100%
  );
  backdrop-filter: blur(0.5px);
}

/* Background Controls */
.background-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.bg-control-btn {
  width: 44px;
  height: 44px;
  background: var(--card-bg-color);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border-color);
  border-radius: 50%;
  color: var(--secondary-text-color);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  opacity: 0.8;
}

.bg-control-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-text-color);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.bg-control-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  opacity: 1;
}

.bg-control-btn i {
  font-size: 1rem;
}

/* Background Menu */
.background-menu {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  width: 320px;
  background: var(--card-bg-color);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: 16px;
  border: 1px solid var(--card-border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.background-menu.visible {
  opacity: 1;
  transform: translateX(0);
}

.bg-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--card-border-color);
}

.bg-menu-header h4 {
  color: var(--primary-text-color);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-menu-header .close-btn {
  background: none;
  border: none;
  color: var(--secondary-text-color);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.3s ease;
}

.bg-menu-header .close-btn:hover {
  color: var(--primary-text-color);
}

.bg-menu-content {
  padding: 20px;
}

.bg-menu-section {
  margin-bottom: 24px;
}

.bg-menu-section:last-child {
  margin-bottom: 0;
}

.bg-menu-section h5 {
  color: var(--primary-text-color);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 12px 0;
}

/* Background Mode Selector */
.bg-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bg-mode-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.bg-mode-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.bg-mode-option input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--card-border-color);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
}

.bg-mode-option input[type="radio"]:checked {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
}

.bg-mode-option input[type="radio"]:checked::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.mode-label {
  color: var(--primary-text-color);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Background preview thumbnails */
.background-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bg-thumbnail {
  width: 60px;
  height: 34px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.bg-thumbnail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
}

.bg-thumbnail:hover::before {
  background: rgba(0, 0, 0, 0.1);
}

.bg-thumbnail.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.bg-thumbnail.active::before {
  background: rgba(168, 85, 247, 0.2);
}


.background-layer {
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.1s ease-out;
}

.background-layer.fallback-gradient {
  background: linear-gradient(-45deg, #0f0c29, #24243e, #302b63, #0f0c29);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

.bg-thumbnail.fallback-thumbnail {
  position: relative;
}

.bg-thumbnail.fallback-thumbnail::after {
  content: '⚠';
  position: absolute;
  top: 2px;
  right: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
}

.background-controls {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.background-selector {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}



header {
  text-align: center;
  padding: 60px 20px;
}

.header-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 20px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

header h1 a {
  font-size: 3.5rem;
  font-weight: 900;
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--secondary-text-color);
  font-weight: 400;
  margin-top: 10px;
}

main {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.instructions, .search-container {
  background: var(--card-bg-color);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: 16px;
  border: 1px solid var(--card-border-color);
  padding: 25px;
  margin-bottom: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-container {
  position: sticky;
  top: 20px;
  z-index: 100;
  margin-bottom: 40px;
  transition: all 0.3s ease;
}

.search-container.sticky {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.instructions {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.instruction-box {
  flex: 1;
  min-width: 300px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.instruction-box h3 {
  font-size: 1.2rem;
  color: var(--primary-text-color);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.instruction-box h3 i {
  margin-right: 12px;
}

.instruction-box:first-child h3 i {
  color: var(--green-color);
}

.instruction-box:last-child h3 i {
  color: var(--red-color);
}

.role-red {
  color: var(--red-color);
  font-weight: 600;
}

#search-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.1rem;
  background-color: transparent;
  color: var(--primary-text-color);
  border: none;
  outline: none;
  font-family: var(--font-family);
}

#search-input::placeholder {
  color: var(--secondary-text-color);
}

.role-section {
  margin-bottom: 60px;
}

.role-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--card-border-color);
    position: relative;
    text-align: center;
}
.role-title::after {
    content: '';
    position: absolute;
    bottom: -1px;
    width: 100px;
    height: 2px;
    background-color: var(--role-color, var(--accent-primary));
    left: 50%;
    transform: translateX(-50%);
}

/*.caretaker-grid {*/
/*    display: grid;*/
/*    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));*/
/*    gap: 30px;*/
/*    justify-content: center; !* --- THIS IS THE ONLY CHANGE --- *!*/
/*}*/

.caretaker-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

.card {
      width: 430px;

  background: var(--card-bg-color);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: 16px;
  border: 1px solid var(--card-border-color);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: radial-gradient(
    circle at 50% 0,
    hsla(from var(--role-color) h s l / 0.25), transparent 70%
  );
  opacity: 0.5;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--role-color),
    0 0 30px color-mix(in srgb, var(--role-color) 30%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--role-color) 20%, transparent);
  border-color: color-mix(in srgb, var(--role-color) 30%, transparent);
}

.card:hover::before {
  opacity: 0.8;
}

.card-header {
  text-align: center;
  padding: 25px;
  border-bottom: 1px solid var(--card-border-color);
  z-index: 1;
}

.card-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 20px;
  object-fit: cover;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.card-name {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
}

.description-in-games {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 250px;
  padding: 20px;
  text-align: center;
}

.description-in-games .description-text {
  font-size: 1.1rem;
  color: var(--primary-text-color);
  line-height: 1.6;
  font-style: italic;
  max-width: 280px;
}

.card-body.description-only h4 {
  text-align: center;
}

.card-body {
  padding: 25px;
  flex-grow: 1;
  z-index: 1;
}

.card-body h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--secondary-text-color);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.games-list {
  list-style: none;
  height: 250px;
  overflow-y: auto;
  padding-right: 10px;
}

.games-list::-webkit-scrollbar {
  width: 4px;
}

.games-list::-webkit-scrollbar-track {
  background: transparent;
}

.games-list::-webkit-scrollbar-thumb {
  background: var(--card-border-color);
  border-radius: 4px;
}

.games-list li {
  padding: 8px 0;
  font-size: 1rem;
  color: var(--primary-text-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.3s ease;
}

.games-list li:last-child {
  border-bottom: none;
}

.games-list li:hover {
  color: var(--accent-secondary);
}

.card-footer {
  padding: 25px;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
  z-index: 1;
  height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.support-button {
  display: inline-block;
  background-image: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #fff;
  padding: 14px 35px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.3s ease;
  border: none;
}

.support-button:hover {
  transform: scale(1.05);
}

.support-note {
  font-size: 0.8rem;
  color: var(--secondary-text-color);
  line-height: 1.4;
  margin: 0;
  flex-shrink: 0;
  height: 70px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-sizing: border-box;
}

footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--secondary-text-color);
}

@media (max-width: 768px) {
  header h1 a {
    font-size: 2.5rem;
  }

  .caretaker-grid {
    grid-template-columns: 1fr;
  }

  .instructions {
    flex-direction: column;
  }

  .background-controls {
    top: 10px;
    right: 10px;
  }

  .bg-control-btn {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .background-menu {
    top: 60px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .bg-thumbnail {
    width: 45px;
    height: 25px;
  }
}