.member-button {
  color: #d8e7ff;
  border-color: rgb(126 169 227 / 24%);
  background: rgb(126 169 227 / 8%);
}

.member-button:hover,
.member-button.is-logged-in {
  color: #eef5ff;
  border-color: rgb(126 169 227 / 42%);
  background: rgb(126 169 227 / 14%);
}

.member-button.is-logged-in svg {
  color: var(--lime);
}

.member-auth-modal {
  width: min(460px, calc(100vw - 24px));
}

.member-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.member-auth-tabs button {
  min-height: 34px;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.member-auth-tabs button.is-active {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.member-auth-note {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.member-auth-modal form {
  display: grid;
  gap: 13px;
}

.member-auth-error {
  margin: 0;
  padding: 9px 11px;
  color: #ffd1c8;
  border: 1px solid rgb(255 107 107 / 34%);
  border-radius: 6px;
  background: rgb(255 107 107 / 9%);
  font-size: 10px;
}

.member-game-actions {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  display: grid;
  gap: 6px;
}

.member-game-action {
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  color: white;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 6px;
  background: rgb(13 15 12 / 72%);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 160ms ease, color 160ms ease, background 160ms ease;
}

.game-cover:hover .member-game-action,
.member-game-action.is-active {
  opacity: 1;
}

.member-game-action.is-like.is-active {
  color: #ffb45e;
  background: rgb(13 15 12 / 90%);
}

.member-game-action.is-favorite.is-active {
  color: var(--coral);
  background: rgb(13 15 12 / 90%);
}

.member-game-action.is-active svg {
  fill: currentColor;
}

.member-rating {
  --rating-fill: 0%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 9px;
}

.member-rating-stars {
  position: relative;
  display: inline-flex;
  gap: 1px;
  width: max-content;
}

.member-rating-star {
  position: relative;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
}

.member-rating-star svg {
  position: absolute;
  inset: 0;
  width: 13px;
  height: 13px;
  margin: auto;
}

.member-rating-star .is-empty {
  color: var(--border-strong);
}

.member-rating-star .is-fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  overflow: hidden;
  width: var(--fill, 0%);
  place-items: center;
  color: var(--lime);
}

.member-rating-star .is-fill svg {
  max-width: none;
  fill: currentColor;
}

.member-rating-input {
  position: absolute;
  inset: -5px 0;
  width: 100%;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.member-rating-value {
  min-width: 32px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.member-rating-label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}

.member-rating-label svg {
  width: 12px;
  height: 12px;
}

.profile-page {
  min-height: 100vh;
}

.profile-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.profile-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin-bottom: 34px;
}

.profile-header-left,
.profile-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgb(217 246 90 / 7%), transparent 44%),
    var(--bg-soft);
}

.profile-avatar {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  color: var(--lime-ink);
  border: 1px solid #e8ff7d;
  border-radius: 8px;
  background: var(--lime);
  font-family: "Space Grotesk", sans-serif;
  font-size: 27px;
  font-weight: 800;
}

.profile-copy h1 {
  margin: 5px 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 32px;
  line-height: 1.05;
}

.profile-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 30px;
}

.profile-stat {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.profile-stat strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 25px;
  line-height: 1.1;
}

.profile-stat span {
  display: block;
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 800;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 20px;
}

.profile-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.profile-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.profile-panel-head h2 {
  margin: 4px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
}

.profile-panel-head span {
  color: var(--text-dim);
  font-size: 9px;
}

.profile-history,
.profile-collection {
  display: grid;
  gap: 8px;
  max-height: 620px;
  padding: 12px;
  overflow-y: auto;
}

.profile-history-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.profile-history-cover {
  width: 48px;
  height: 64px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background:
    linear-gradient(145deg, rgb(217 246 90 / 12%), transparent),
    var(--surface-raised);
}

.profile-history-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-history-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.profile-history-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-history-copy span,
.profile-history-copy time {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-history-copy time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.profile-history-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.profile-history-actions .icon-button {
  width: 30px;
  height: 30px;
}

.profile-history-actions .icon-button.is-active {
  color: var(--coral);
  border-color: rgb(255 118 87 / 30%);
  background: rgb(255 118 87 / 8%);
}

.profile-history-actions .icon-button.is-liked {
  color: #ffb45e;
  border-color: rgb(255 180 94 / 30%);
  background: rgb(255 180 94 / 8%);
}

.profile-collection-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.profile-collection-section {
  display: grid;
  gap: 7px;
}

.profile-collection-section + .profile-collection-section {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.profile-collection-section h3 {
  margin: 2px 3px 5px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
}

.profile-collection-item > svg {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}

.profile-collection-thumb {
  width: 36px;
  height: 48px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-raised);
}

.profile-collection-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-collection-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.profile-collection-copy strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-collection-copy span {
  color: var(--text-dim);
  font-size: 8px;
}

.profile-empty {
  padding: 34px 16px;
  color: var(--text-dim);
  font-size: 10px;
  text-align: center;
}

.profile-guest {
  display: grid;
  max-width: 520px;
  margin: 16vh auto 0;
  padding: 34px;
  place-items: center;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.profile-guest-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--lime-ink);
  border-radius: 50%;
  background: var(--lime);
}

.profile-guest h1 {
  margin: 8px 0 7px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
}

.profile-guest p {
  margin: 0 0 20px;
  color: var(--text-muted);
}

@media (max-width: 840px) {
  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .profile-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 12px;
  }

  .profile-hero {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 16px;
  }

  .profile-hero .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .profile-avatar {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }

  .profile-copy h1 {
    font-size: 24px;
  }

  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-history-item {
    grid-template-columns: 43px minmax(0, 1fr);
  }

  .profile-history-cover {
    width: 43px;
    height: 58px;
  }

  .profile-history-actions {
    grid-column: 2;
  }

  .play-actions .member-button span,
  .topbar-actions .member-button span {
    display: none;
  }

  .member-game-action {
    opacity: 1;
  }
}

:root[data-theme="light"] .member-button {
  color: #2c5e8d;
  border-color: #b8cee5;
  background: #edf5ff;
}
