@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg: #0b141b;
  --bg-secondary: #12202c;
  --card: #162533;
  --accent: #b6ff4c;
  --accent-2: #ff7a1a;
  --accent-3: #13c7c1;
  --text: #f2f5f8;
  --muted: #9bb0c6;
  --danger: #ff5454;
  --shadow: 0 20px 40px rgba(5, 10, 14, 0.45);
}

body[data-theme='light'] {
  --bg: #f5f1ea;
  --bg-secondary: #f0ebe2;
  --card: #fbf8f2;
  --accent: #d78a5c;
  --accent-2: #b5654d;
  --accent-3: #6f8f8b;
  --text: #1f2328;
  --muted: #5f6b6b;
  --danger: #c45353;
  --shadow: 0 18px 30px rgba(31, 35, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  background: radial-gradient(circle at top left, #18344a 0%, #0b141b 45%, #0a0f14 100%);
  color: var(--text);
  min-height: 100vh;
}

body[data-theme='light'] {
  background: radial-gradient(circle at top left, #f6f1e6 0%, #efe8de 55%, #e6dfd6 100%);
}

body[data-theme='light'] .panel {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(31, 35, 40, 0.1);
}

body[data-theme='light'] .hero-card {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 241, 233, 0.95) 100%);
  border-color: rgba(31, 35, 40, 0.12);
}

body[data-theme='light'] .card {
  border-color: rgba(31, 35, 40, 0.08);
}

body[data-theme='light'] .card-progress,
body[data-theme='light'] .session-panel {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.08);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

body[data-theme='light'] .bg-grid {
  opacity: 0.25;
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  padding: 3.5rem clamp(1.5rem, 4vw, 5rem) 2.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent-3);
  margin: 0 0 0.75rem;
}

h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 520px;
}

.top-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #08121a;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

body[data-theme='light'] .nav-badge {
  background: var(--accent-2);
  color: #1f150c;
}

.hero-card {
  background: linear-gradient(140deg, rgba(22, 37, 51, 0.95) 0%, rgba(18, 26, 34, 0.95) 100%);
  border: 1px solid rgba(182, 255, 76, 0.2);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1.5rem;
}

.hero-card h3 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
}

.hero-card p {
  margin: 0.4rem 0 0;
  color: var(--accent);
  font-size: 1.1rem;
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2.5rem;
  padding: 0 clamp(1.5rem, 4vw, 5rem) 4rem;
}

.panel {
  background: rgba(16, 26, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 14, 0.65);
  border-radius: 24px;
  display: grid;
  place-items: center;
  z-index: 3;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(182, 255, 76, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

body[data-theme='light'] .spinner {
  border-color: rgba(215, 138, 92, 0.25);
  border-top-color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  letter-spacing: 0.06em;
}

.search-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
}

.search-tabs {
  margin-bottom: 1rem;
}

.search-suggestions {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  z-index: 4;
  box-shadow: 0 10px 20px rgba(6, 10, 14, 0.35);
}

.suggestion-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 0;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

#search-users-section .search-controls {
  margin-bottom: 1rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-row label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 200px;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
}

button {
  background: var(--accent);
  color: #0b141b;
  border: 1px solid rgba(182, 255, 76, 0.35);
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
  background: rgba(182, 255, 76, 0.9);
  border-color: rgba(182, 255, 76, 0.6);
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
}

body[data-theme='light'] button.ghost {
  border-color: rgba(31, 35, 40, 0.2);
}

body[data-theme='light'] button.ghost:hover {
  background: rgba(31, 35, 40, 0.06);
  border-color: rgba(31, 35, 40, 0.3);
}

body[data-theme='light'] button {
  color: #2a1d12;
  border-color: rgba(215, 138, 92, 0.55);
}

body[data-theme='light'] button:hover {
  background: rgba(215, 138, 92, 0.9);
  border-color: rgba(215, 138, 92, 0.8);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

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

.library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(6, 10, 14, 0.35);
}

.result-card {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  border-color: rgba(182, 255, 76, 0.25);
  box-shadow: 0 16px 28px rgba(8, 12, 16, 0.4);
}

body[data-theme='light'] .result-card:hover {
  border-color: rgba(215, 138, 92, 0.4);
  box-shadow: 0 14px 24px rgba(31, 35, 40, 0.18);
}

.cover {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #0d1822;
}

.card-body {
  padding: 1.2rem;
  display: grid;
  gap: 0.6rem;
}

.card-body h3 {
  margin: 0;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta-stack {
  display: grid;
  gap: 0.35rem;
}

.total-time {
  margin-top: 0.35rem;
  color: var(--accent-3);
  font-weight: 600;
}

.game-card {
  padding: 1.5rem;
  background: var(--card);
}

.game-header {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.game-info {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

.game-card .cover {
  height: 205px;
  border-radius: 16px;
}

.clickable {
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.game-card.is-hovered .clickable {
  box-shadow: 0 10px 18px rgba(6, 10, 14, 0.35);
}

.card-progress {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding: 0.9rem 1rem;
  background: rgba(9, 15, 20, 0.6);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.title-row h3 {
  flex: 1;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  display: block;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
}

.fav-btn {
  background: transparent;
  color: var(--accent-2);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.fav-btn.active {
  color: var(--accent);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 0.8rem;
  align-items: center;
  min-width: 0;
}

.status-row label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 0;
  flex: 1;
}

.status-row select {
  width: 100%;
  max-width: 100%;
}

.progress-label {
  font-size: 0.9rem;
  color: var(--accent);
}

.progress-input {
  --progress: 0%;
  width: 100%;
  max-width: 100%;
  display: block;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 999px;
  background-color: rgba(19, 199, 193, 0.2);
  background-image: linear-gradient(90deg, var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: var(--progress) 100%;
  outline: none;
  box-sizing: border-box;
  padding: 0;
}

.progress-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(9, 15, 20, 0.8);
  box-shadow: 0 6px 16px rgba(182, 255, 76, 0.35);
  cursor: pointer;
}

.progress-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(9, 15, 20, 0.8);
  box-shadow: 0 6px 16px rgba(182, 255, 76, 0.35);
  cursor: pointer;
}

.progress-input::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(19, 199, 193, 0.2);
}

body[data-theme='light'] .progress-input {
  background-color: rgba(215, 138, 92, 0.25);
}

body[data-theme='light'] .progress-input::-webkit-slider-thumb {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(215, 138, 92, 0.25);
}

body[data-theme='light'] .progress-input::-moz-range-thumb {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(215, 138, 92, 0.25);
}

body[data-theme='light'] .progress-input::-moz-range-track {
  background: rgba(215, 138, 92, 0.25);
}

.session-panel {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: rgba(10, 18, 25, 0.6);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.session-form {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
}

.session-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.session-grid textarea {
  resize: vertical;
}

.session-grid .notes {
  grid-column: 1 / -1;
}

.session-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.session-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.session-item {
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(18, 28, 38, 0.8);
  display: grid;
  gap: 0.35rem;
}

.session-actions-inline {
  display: flex;
  gap: 0.5rem;
}

.delete-btn {
  margin-top: 1rem;
  color: var(--danger);
  border-color: rgba(255, 84, 84, 0.4);
}

.details-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.details-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 2rem;
}

.details-aside {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.details-cover {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d1822;
}

.details-body {
  display: grid;
  gap: 1.25rem;
}

.details-media h4 {
  margin: 0 0 0.45rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
}

.details-trailer video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d1822;
}

.trailer-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d1822;
}

.trailer-link {
  text-decoration: underline;
  display: inline-block;
  margin-top: 0.4rem;
}

.details-screenshots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.details-media-link {
  margin-top: 0.4rem;
}

.details-screenshots img {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.details-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(19, 199, 193, 0.15);
  color: var(--accent-3);
  font-size: 0.85rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(182, 255, 76, 0.35);
  color: var(--accent);
  font-size: 0.85rem;
  background: rgba(182, 255, 76, 0.12);
}

body[data-theme='light'] .tag {
  border-color: rgba(215, 138, 92, 0.5);
  background: rgba(215, 138, 92, 0.16);
}

body[data-theme='light'] .tag-button:hover {
  background: rgba(215, 138, 92, 0.28);
  border-color: rgba(215, 138, 92, 0.75);
}

.tag-button {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tag-button:hover {
  background: rgba(182, 255, 76, 0.2);
  border-color: rgba(182, 255, 76, 0.6);
}

.details-description {
  color: var(--muted);
  line-height: 1.6;
}

.details-platforms h4 {
  margin: 0 0 0.4rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
}

.details-reviews {
  display: grid;
  gap: 0.75rem;
}

.reviews-list {
  display: grid;
  gap: 0.75rem;
}

.review-card {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: rgba(10, 18, 25, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body[data-theme='light'] .review-card {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.1);
}

.review-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.review-user {
  font-weight: 600;
}

.review-rating {
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.review-body {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.review-form {
  display: grid;
  gap: 0.6rem;
}

.review-actions {
  margin-top: 0.5rem;
}

.review-form label {
  display: grid;
  gap: 0.4rem;
}

.star-rating {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin-top: 0.35rem;
}

.star-rating .star {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
}

.star-rating .star.active {
  color: var(--accent);
  border-color: rgba(182, 255, 76, 0.5);
  background: rgba(182, 255, 76, 0.12);
}

.star-rating .star.hover {
  color: var(--accent);
  border-color: rgba(182, 255, 76, 0.35);
  background: rgba(182, 255, 76, 0.08);
}

body[data-theme='light'] .star-rating .star.active {
  border-color: rgba(215, 138, 92, 0.6);
  background: rgba(215, 138, 92, 0.15);
}

body[data-theme='light'] .star-rating .star.hover {
  border-color: rgba(215, 138, 92, 0.45);
  background: rgba(215, 138, 92, 0.1);
}

.review-submit {
  justify-self: start;
}

.details-similar {
  display: grid;
  gap: 0.75rem;
}

.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.similar-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 18, 25, 0.4);
  cursor: pointer;
}

.similar-card img {
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.similar-card p {
  margin: 0;
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.25;
}

.details-time h4 {
  margin: 0 0 0.4rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
}

.home-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.home-grid h3 {
  margin: 0 0 0.75rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
}

#profile-view h3 {
  margin: 0 0 0.75rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.06em;
}

#profile-view #profile-username,
#public-profile-view #public-username {
  font-family: 'Space Grotesk', sans-serif !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tab-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 600;
}

.tab.active {
  background: var(--accent);
  color: #0b141b;
  border-color: rgba(182, 255, 76, 0.45);
}

body[data-theme='light'] .tab {
  border-color: rgba(31, 35, 40, 0.2);
}

body[data-theme='light'] .tab.active {
  background: var(--accent);
  border-color: rgba(215, 138, 92, 0.6);
  color: #2a1d12;
}

.profile-section {
  display: grid;
  gap: 2rem;
}

.profile-layout {
  display: grid;
  gap: 1.6rem;
  max-width: 1100px;
  margin: 0 auto;
}

.profile-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  background: rgba(10, 18, 25, 0.55);
  padding: 1.1rem 1.25rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body[data-theme='light'] .profile-header {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.1);
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info h3 {
  margin: 0 0 0.35rem;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.profile-stats div {
  display: grid;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.profile-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 2.2fr) minmax(220px, 1fr);
}

.top-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.top-card {
  background: rgba(10, 18, 25, 0.55);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: grid;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body[data-theme='light'] .top-card {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.1);
}

body[data-theme='light'] .top-card:hover {
  border-color: rgba(215, 138, 92, 0.6);
  box-shadow: 0 12px 22px rgba(31, 35, 40, 0.18);
}

.top-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #0d1822;
}

.top-card:hover {
  border-color: rgba(182, 255, 76, 0.35);
  box-shadow: 0 14px 24px rgba(8, 12, 16, 0.35);
}

.top-card .top-card-body {
  padding: 0.75rem;
  display: grid;
  gap: 0.35rem;
}

.top-card .rank {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.profile-edit {
  background: rgba(10, 18, 25, 0.45);
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 0.85rem;
}

body[data-theme='light'] .profile-edit {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.1);
}

.profile-edit form {
  display: grid;
  gap: 0.7rem;
}

.profile-edit form button {
  width: auto;
  justify-self: start;
}

.profile-edit .danger {
  width: fit-content;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

#profile-feedback,
.profile-edit p.muted {
  font-size: 0.82rem;
}

.profile-edit small {
  font-size: 0.78rem;
  display: block;
  margin-top: 0.25rem;
  line-height: 1.3;
}

#profile-feedback {
  font-size: 0.85rem;
}

.profile-edit form.friend-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.profile-edit form.friend-search input {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-edit form.friend-search button {
  width: auto;
}

.top-form-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.compact {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 8px;
  min-height: 0;
  line-height: 1;
}

button.compact {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.friend-search input {
  flex: 1 1 auto;
  min-width: 0;
}

.friend-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.friend-search button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 8px;
}

.top-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(10, 18, 25, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.top-form.hidden {
  display: none;
}

.top-form .compact {
  justify-self: end;
}

body[data-theme='light'] .top-form {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.12);
}

.top-slot {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-slot select {
  width: 100%;
}

.genre-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.genre-pill {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 18, 25, 0.5);
  color: var(--text);
  font-size: 0.85rem;
}

body[data-theme='light'] .genre-pill {
  border-color: rgba(31, 35, 40, 0.12);
  background: rgba(31, 35, 40, 0.04);
}

.friend-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.friend-results {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  background: rgba(10, 18, 25, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-theme='light'] .friend-card {
  background: rgba(31, 35, 40, 0.04);
  border-color: rgba(31, 35, 40, 0.1);
}

.friend-card img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.friend-card .friend-meta {
  flex: 1;
  display: grid;
  gap: 0.2rem;
}

.friend-link {
  cursor: pointer;
  color: var(--accent);
}

.friend-link:hover {
  text-decoration: underline;
}

.danger {
  border-color: rgba(255, 84, 84, 0.6);
  color: var(--danger);
}

.danger:hover {
  background: rgba(255, 84, 84, 0.12);
  border-color: rgba(255, 84, 84, 0.8);
}

.friend-card .friend-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 960px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .top-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
#user-email {
  margin-top: 0.75rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 14, 0.7);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 1.5rem;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.image-modal-card {
  position: relative;
  max-width: min(82vw, 860px);
  max-height: 78vh;
  display: grid;
  place-items: center;
}

.image-modal-card img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.image-modal-card .ghost {
  position: absolute;
  top: -12px;
  right: -12px;
  background: rgba(10, 16, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.confirm-card {
  max-width: 420px;
}

.confirm-card label {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-switch {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
}

.error {
  color: var(--danger);
  margin-top: 0.75rem;
}

.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: grid;
  gap: 0.55rem;
  max-width: min(92vw, 340px);
}

.toast {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 20, 28, 0.96);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(6, 10, 14, 0.35);
  font-size: 0.9rem;
}

.toast.toast-error {
  border-color: rgba(255, 84, 84, 0.7);
}

.toast.toast-success {
  border-color: rgba(182, 255, 76, 0.7);
}

.toast.toast-info {
  border-color: rgba(116, 226, 240, 0.6);
}

body[data-theme='light'] .toast {
  background: rgba(255, 251, 245, 0.98);
  color: #1d2730;
  border-color: rgba(31, 51, 72, 0.18);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.library.compact .game-card {
  padding: 1rem;
}

.library.compact .game-header {
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1rem;
}

.library.compact .game-card .cover {
  height: 150px;
}

.library.compact .session-panel,
.library.compact .card-progress {
  display: none;
}

.library.compact .meta-stack {
  gap: 0.2rem;
}

.library.compact .title-row h3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

#library-search {
  min-width: 220px;
  flex: 1 1 220px;
}

@media (max-width: 780px) {
  .game-header {
    grid-template-columns: 1fr;
  }

  .card-progress {
    margin-top: 0.6rem;
  }

  .title-row h3 {
    white-space: normal;
  }

  .hero-card {
    padding: 1.5rem;
  }

  .details-layout {
    grid-template-columns: 1fr;
  }

  .details-cover {
    height: 260px;
  }
}
