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

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #222240;
  --accent-games: #7c3aed;
  --accent-anime: #ec4899;
  --accent: #7c3aed;
  --text: #e8eaf0;
  --text-dim: #9090b0;
  --border: #2a2a4a;
  --radius: 16px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header__tabs {
  display: flex;
  gap: 0.5rem;
}

.tab {
  padding: 0.6rem 1.4rem;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab[data-tab="anime"].active {
  background: var(--accent-anime);
  border-color: var(--accent-anime);
}

/* ===== CONTENT ===== */
.content {
  display: none;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.content.active {
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.card__img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}

.card__body {
  padding: 1.2rem;
}

.card__tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.card__tag--games {
  background: rgba(124, 58, 237, 0.2);
  color: #a78bfa;
}

.card__tag--anime {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.card__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.card__desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.card__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: #fff;
  background: var(--accent-games);
}

.card__btn--anime {
  background: var(--accent-anime);
}

.card__btn:hover {
  filter: brightness(1.2);
  transform: scale(1.03);
}

.card__btn .msg-count {
  background: rgba(255,255,255,0.25);
  padding: 0.1rem 0.5rem;
  border-radius: 50px;
  font-size: 0.75rem;
}

/* ===== CHAT MODAL ===== */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.chat-overlay.open {
  display: flex;
}

.chat-modal {
  width: 90%;
  max-width: 520px;
  height: 70vh;
  max-height: 600px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.chat-title {
  font-weight: 700;
  font-size: 1rem;
}

.chat-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  transition: background 0.15s;
}

.chat-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.msg {
  max-width: 80%;
  padding: 0.6rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.msg--me {
  align-self: flex-end;
  background: var(--accent-games);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg--me.anime-theme {
  background: var(--accent-anime);
}

.msg--other {
  align-self: flex-start;
  background: var(--surface2);
  border-bottom-left-radius: 4px;
}

.msg__name {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.7;
  margin-bottom: 0.15rem;
}

.msg__time {
  font-size: 0.65rem;
  opacity: 0.5;
  margin-top: 0.2rem;
  text-align: right;
}

.chat-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem 0;
  font-size: 0.9rem;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-form input:focus {
  border-color: var(--accent);
}

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: filter 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send:hover {
  filter: brightness(1.2);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 1rem;
  }
}
